コード例 #1
0
ファイル: Spawn.java プロジェクト: OfficialNate/Engine
 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!");
   }
 }
コード例 #2
0
ファイル: Spawn.java プロジェクト: OfficialNate/Engine
 @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;
 }
コード例 #3
0
ファイル: Spawn.java プロジェクト: OfficialNate/Engine
 @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;
 }
コード例 #4
0
ファイル: Spawn.java プロジェクト: OfficialNate/Engine
 public void setSpawn(Location location) {
   GearzHub.getInstance().getConfig().set("spawn", TPlugin.encodeLocationString(location));
   updateSpawn();
 }