Exemplo n.º 1
0
 private void updateSpawn() {
   try {
     spawn = TPlugin.parseLocationString(GearzHub.getInstance().getConfig().getString("spawn"));
   } catch (NullPointerException ex) {
     spawn = null;
     GearzHub.getInstance().getLogger().severe("No spawn point set!");
   }
 }
Exemplo n.º 2
0
 @TCommand(
     name = "setspawn",
     description = "Sets the spawn",
     usage = "/setspawn",
     permission = "gearz.setspawn",
     senders = {TCommandSender.Player})
 @SuppressWarnings("unused")
 public TCommandStatus setSpawn(
     CommandSender sender, TCommandSender type, TCommand meta, Command command, String[] args) {
   Player player = (Player) sender;
   this.setSpawn(player.getLocation());
   GearzHub.getInstance().saveConfig();
   sender.sendMessage(ChatColor.GREEN + "Set spawn to where you are standing!");
   return TCommandStatus.SUCCESSFUL;
 }
Exemplo n.º 3
0
 @TCommand(
     name = "world",
     description = "Teleports sender to target world",
     usage = "/world <name>",
     permission = "gearz.world",
     senders = {TCommandSender.Player})
 @SuppressWarnings("unused")
 public TCommandStatus world(
     CommandSender sender, TCommandSender type, TCommand meta, Command command, String[] args) {
   if (args.length < 1) {
     String worlds = "";
     for (World w : Bukkit.getWorlds()) {
       if (sender.hasPermission("gearz.world." + w.getName()))
         worlds = worlds + w.getName() + ", ";
     }
     if (worlds.length() == 0) {
       worlds = "None!";
     } else {
       worlds = worlds.substring(0, worlds.length() - 2);
     }
     sender.sendMessage(
         GearzHub.getInstance()
             .getFormat("formats.world-list", true, new String[] {"<worlds>", worlds}));
     return TCommandStatus.SUCCESSFUL;
   }
   if (args.length > 1) return TCommandStatus.MANY_ARGS;
   World w = Bukkit.getWorld(args[0]);
   if (w == null) return TCommandStatus.INVALID_ARGS;
   if (!sender.hasPermission("gearz.world." + w.getName())) return TCommandStatus.PERMISSIONS;
   ((Player) sender).teleport(w.getSpawnLocation());
   TPlayerManager.getInstance().getPlayer((Player) sender).playSound(Sound.ENDERMAN_TELEPORT);
   sender.sendMessage(
       GearzHub.getInstance()
           .getFormat("formats.world-teleport", true, new String[] {"<world>", w.getName()}));
   return TCommandStatus.SUCCESSFUL;
 }
Exemplo n.º 4
0
 public void setSpawn(Location location) {
   GearzHub.getInstance().getConfig().set("spawn", TPlugin.encodeLocationString(location));
   updateSpawn();
 }