Advertisement
Guest User

Command Klasse

a guest
Aug 26th, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 22.28 KB | None | 0 0
  1. package main;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.util.List;
  6.  
  7. import org.bukkit.Bukkit;
  8. import org.bukkit.GameMode;
  9. import org.bukkit.Location;
  10. import org.bukkit.command.Command;
  11. import org.bukkit.command.CommandExecutor;
  12. import org.bukkit.command.CommandSender;
  13. import org.bukkit.configuration.file.FileConfiguration;
  14. import org.bukkit.configuration.file.YamlConfiguration;
  15. import org.bukkit.entity.Player;
  16. import org.bukkit.inventory.ItemStack;
  17. import org.bukkit.plugin.Plugin;
  18. import org.bukkit.plugin.PluginManager;
  19.  
  20. public class Commands implements CommandExecutor{
  21.  
  22.     private Jumping plugin;
  23.     public Commands(Jumping main){
  24.         this.plugin = main;
  25.     }
  26.     @Override
  27.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
  28.        
  29.         if(sender instanceof Player){
  30.            
  31.             File file = new File("plugins/Jumping", "Arenas.yml");
  32.             FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  33.             FileConfiguration config = this.plugin.getConfig();
  34.             Player p = (Player) sender;
  35.            
  36.             //Args length == 0
  37.             if(args.length == 0){
  38.                 p.sendMessage(plugin.prefix + "§7/jumping help");
  39.             }
  40.            
  41.             //Args length == 1
  42.             if(args.length == 1){
  43.                 //help
  44.                 if(args[0].equalsIgnoreCase("help")){
  45.                     p.sendMessage("§8[]===============( §r§6Jumping Help §8)===============[]");
  46.                     p.sendMessage("§8Version: §9" + this.plugin.getDescription().getVersion());
  47.                     p.sendMessage("§8Developer: §9" + this.plugin.getDescription().getAuthors());
  48.                     p.sendMessage("§8Copyright: §9© by bapf");
  49.                     p.sendMessage("§8<<===========================================>>");
  50.                     p.sendMessage("§8/Jumping help - §9Hilfe seite!");
  51.                     p.sendMessage("§8/Jumping reloadPlugin - §9Reloade das Plugin!");
  52.                     p.sendMessage("§8/Jumping reloadConfig - §9Reloade die Config!");
  53.                     p.sendMessage("§8/Jumping leave - §9Spiel verlassen!");
  54.                     p.sendMessage("§8/Jumping jumpnruns - §9Liste aller JumpnRuns!");
  55.                     p.sendMessage("§8/Jumping list <jumpnrun> - §9Liste aller Spieler in einem JumpnRuns!");
  56.                     p.sendMessage("§8/Jumping join <jumpnrun> - §9Spiel joinen");
  57.                     p.sendMessage("§8/Jumping tp <jumpnrun> - §9Tp dich zu einem JumpnRun Spawn!");
  58.                     p.sendMessage("§8/Jumping create <jumpnrun> - §9JumpnRun Spawn setzen!");
  59.                     p.sendMessage("§8/Jumping delete <jumpnrun> - §9JumpnRun loeschen!");
  60.                     p.sendMessage("§8/Jumping finish <player> - §9Hole einen Spieler aus einem JumpnRun!");
  61.                     p.sendMessage("§8/Jumping find <player> - §9Finde einen Spieler in einer Arena!");
  62.                     p.sendMessage("§8/Jumping send <player> <jumpnrun> - §9Sende einen Spieler in ein JumpnRun!");
  63.                     p.sendMessage("§8<<===========================================>>");
  64.                 }
  65.                
  66.                 //ReloadPlugin
  67.                 if(args[0].equalsIgnoreCase("reloadPlugin")){
  68.                     if(p.hasPermission("Jumping.reloadPlugin")){
  69.                         PluginManager plg = Bukkit.getPluginManager();
  70.                         Plugin jumping = plg.getPlugin("Jumping");
  71.                         if(plg.getPlugin("Jumping") == null){
  72.                             p.sendMessage("§cFehler: Das Plugin gibt es nicht. Schau mal bitte im Plugins Ordner nach ob es das Plugin 'Jumping' gibt.");
  73.                         }else{
  74.                         plg.disablePlugin(jumping);
  75.                         plg.enablePlugin(jumping);
  76.                         }
  77.                         p.sendMessage(plugin.prefix + "§7Plugin erfolgreich neu geladen!");
  78.                     }else{
  79.                         p.sendMessage(plugin.noperm);
  80.                     }
  81.                 }
  82.                
  83.                 //ReloadConfig
  84.                 if(args[0].equalsIgnoreCase("reloadConfig")){
  85.                     if(p.hasPermission("Jumping.reloadConfig")){
  86.                         plugin.reloadConfig();
  87.                        
  88.                         p.sendMessage(plugin.prefix + "§7Config erfolgreich neu geladen!");
  89.                     }else{
  90.                         p.sendMessage(plugin.noperm);
  91.                     }
  92.                 }
  93.                
  94.                
  95.                 //leave
  96.                 if(args[0].equalsIgnoreCase("leave")){
  97.                     if(p.hasPermission("Jumping.leave")){
  98.                         plugin.leaveArena(p);
  99.                     }else{
  100.                         p.sendMessage(plugin.noperm);
  101.                     }
  102.                 }
  103.                
  104.                
  105.                 //list
  106.                 if(args[0].equalsIgnoreCase("list")){
  107.                     if(p.hasPermission("Jumping.list")){
  108.                         p.sendMessage("§cFehler: §c/jumping list <JumpnRun>");
  109.                     }else{
  110.                         p.sendMessage(plugin.noperm);
  111.                     }
  112.                 }
  113.                
  114.                
  115.                 //jumpnruns
  116.                 if(args[0].equalsIgnoreCase("jumpnruns")){
  117.                     if(p.hasPermission("Jumping.jumpnruns")){
  118.                         String arenen = "";
  119.                           List arenas = cfg.getStringList("arenas");
  120.                           for (int i = 0; i < arenas.size(); i++) {
  121.                             arenen = arenen + (String)arenas.get(i) + "§f, §8";
  122.                           }
  123.                           p.sendMessage(this.plugin.prefix + "§7JumpnRuns: §8" + arenen);
  124.                     }else{
  125.                         p.sendMessage(plugin.noperm);
  126.                     }
  127.                 }
  128.                
  129.                
  130.                 //join
  131.                 if(args[0].equalsIgnoreCase("join")){
  132.                     if(p.hasPermission("Jumping.join")){
  133.                         p.sendMessage("§cFehler: §c/jumping join <JumpnRun>");
  134.                     }else{
  135.                         p.sendMessage(plugin.noperm);
  136.                     }
  137.                 }
  138.                
  139.                
  140.                 //tp
  141.                 if(args[0].equalsIgnoreCase("tp")){
  142.                     if(p.hasPermission("Jumping.tp")){
  143.                         p.sendMessage("§cFehler: §c/jumping tp <JumpnRun>");
  144.                     }else{
  145.                         p.sendMessage(plugin.noperm);
  146.                     }
  147.                 }
  148.                
  149.                
  150.                 //create
  151.                 if(args[0].equalsIgnoreCase("create")){
  152.                     if(p.hasPermission("Jumping.create")){
  153.                         p.sendMessage("§cFehler: §c/jumping create <JumpnRun Name> <Leicht:Mittel:Schwer:SSchwer>");
  154.                     }else{
  155.                         p.sendMessage(plugin.noperm);
  156.                     }
  157.                 }
  158.                
  159.                 //delete
  160.                 if(args[0].equalsIgnoreCase("delete")){
  161.                     if(p.hasPermission("Jumping.delete")){
  162.                         p.sendMessage("§cFehler: §c/jumping delete <JumpnRun>");
  163.                     }else{
  164.                         p.sendMessage(plugin.noperm);
  165.                     }
  166.                 }
  167.                
  168.                
  169.                 //finish
  170.                 if(args[0].equalsIgnoreCase("finish")){
  171.                     if(p.hasPermission("Jumping.finish")){
  172.                         p.sendMessage("§cFehler: §c/jumping finish <Player>");
  173.                     }else{
  174.                         p.sendMessage(plugin.noperm);
  175.                     }
  176.                 }
  177.                
  178.                
  179.                 //find
  180.                 if(args[0].equalsIgnoreCase("find")){
  181.                     if(p.hasPermission("Jumping.find")){
  182.                         p.sendMessage("§cFehler: §c/jumping find <Player>");
  183.                     }else{
  184.                         p.sendMessage(plugin.noperm);
  185.                     }
  186.                 }
  187.                
  188.                
  189.                 //send
  190.                 if(args[0].equalsIgnoreCase("send")){
  191.                     if(p.hasPermission("Jumping.send")){
  192.                         p.sendMessage("§cFehler: §c/jumping send <Player> <JumpnRun>");
  193.                     }else{
  194.                         p.sendMessage(plugin.noperm);
  195.                     }
  196.                 }
  197.                
  198.                
  199.             }
  200.            
  201.             //Args length == 2
  202.             if(args.length == 2){
  203.                
  204.                 //jumpnruns
  205.                 if(args[0].equalsIgnoreCase("jumpnruns")){
  206.                     if(p.hasPermission("Jumping.jumpnruns")){
  207.                         if(args[1].equalsIgnoreCase("leicht")){
  208.                             String arenen = "";
  209.                               List arenas = cfg.getStringList("leicht");
  210.                               for (int i = 0; i < arenas.size(); i++) {
  211.                                 arenen = arenen + (String)arenas.get(i) + "§f, §8";
  212.                               }
  213.                               p.sendMessage(this.plugin.prefix + "§7Leichte JumpnRuns: §8" + arenen);
  214.                         }
  215.                         if(args[1].equalsIgnoreCase("Mittel")){
  216.                             String arenen = "";
  217.                               List arenas = cfg.getStringList("mittel");
  218.                               for (int i = 0; i < arenas.size(); i++) {
  219.                                 arenen = arenen + (String)arenas.get(i) + "§f, §8";
  220.                               }
  221.                               p.sendMessage(this.plugin.prefix + "§7Mittlere JumpnRuns: §8" + arenen);
  222.                         }
  223.                         if(args[1].equalsIgnoreCase("Schwer")){
  224.                             String arenen = "";
  225.                               List arenas = cfg.getStringList("schwer");
  226.                               for (int i = 0; i < arenas.size(); i++) {
  227.                                 arenen = arenen + (String)arenas.get(i) + "§f, §8";
  228.                               }
  229.                               p.sendMessage(this.plugin.prefix + "§7Schwere JumpnRuns: §8" + arenen);
  230.                         }
  231.                         if(args[1].equalsIgnoreCase("SSchwer")){
  232.                             String arenen = "";
  233.                               List arenas = cfg.getStringList("sschwer");
  234.                               for (int i = 0; i < arenas.size(); i++) {
  235.                                 arenen = arenen + (String)arenas.get(i) + "§f, §8";
  236.                               }
  237.                               p.sendMessage(this.plugin.prefix + "§7Sehr Schwere JumpnRuns: §8" + arenen);
  238.                         }
  239.                     }
  240.                        
  241.                     }else{
  242.                         p.sendMessage(plugin.noperm);
  243.                     }
  244.                
  245.                
  246.                 //join
  247.                 if(args[0].equalsIgnoreCase("join")){
  248.                     //if(p.hasPermission("Jumping.join")){
  249.                         if(!plugin.inJump.contains(p.getName())){
  250.                            
  251.                                
  252.                                 plugin.inJump.add(p.getName());
  253.                                 plugin.oldItems.put(p.getUniqueId(), p.getInventory().getContents());
  254.                                 plugin.oldLoc.put(p.getUniqueId(), p.getLocation());
  255.                                 p.getInventory().clear();
  256.                                 p.updateInventory();
  257.                                
  258.                                
  259.                                 String world = cfg.getString("JumpnRuns." + args[1] + ".World");
  260.                                 double x = cfg.getDouble("JumpnRuns." + args[1] + ".PosX");
  261.                                 double y = cfg.getDouble("JumpnRuns." + args[1] + ".PosY");
  262.                                 double z = cfg.getDouble("JumpnRuns." + args[1] + ".PosZ");
  263.                                 double yaw = cfg.getDouble("JumpnRuns." + args[1] + ".PosYam");
  264.                                 double pitch = cfg.getDouble("JumpnRuns." + args[1] + ".PosPitch");
  265.                                 Location loc = new Location(Bukkit.getWorld(world), x, y, z);
  266.                                 loc.setPitch((float)pitch);
  267.                                 loc.setYaw((float)yaw);
  268.                                 plugin.arena.put(p.getName(), args[1]);
  269.                                 plugin.gamemode.put(p.getName(), p.getGameMode());
  270.                                 p.setGameMode(GameMode.ADVENTURE);
  271.                                 p.teleport(loc);
  272.                                 p.setHealth(20);
  273.                                 p.setFoodLevel(20);
  274.                                 p.sendMessage(plugin.prefix + "§7" + p.getName() + " §8> §7" + args[1]);
  275.                                 plugin.jumpnrunPlayers.put(p, args[1]);
  276.                                 p.sendMessage(plugin.prefix + "§7Um das JumpnRun zu verlassen: §8/jumping leave");
  277.                                 if(config.getString("notify").equalsIgnoreCase("true")){
  278.                                     for (Player all : Bukkit.getOnlinePlayers()){
  279.                                         if(all.hasPermission("Jumping.notify")){
  280.                                             all.sendMessage(plugin.prefix + "§7" + p.getName() + "§8 > §7" + args[1]);
  281.                                         }
  282.                                     }
  283.                                 }
  284.                         }else{
  285.                             p.sendMessage(plugin.prefix + "§7Fehler: Du bist schon in einem JumpnRun! §8/jumping leave §7um ein JumpnRun zu verlassen!");
  286.                         }
  287.                     //}else{
  288.                         //p.sendMessage(plugin.noperm);
  289.                     //}
  290.                 }
  291.                
  292.                 //delete
  293.                 if(args[0].equalsIgnoreCase("delete")){
  294.                     if(p.hasPermission("Jumping.delete")){
  295.                         cfg.set("JumpnRuns." + args[1], null);
  296.                        
  297.                         File fileC = new File("plugins/Jumping", "Arenas.yml");
  298.                         FileConfiguration cfgC = YamlConfiguration.loadConfiguration(fileC);
  299.                        
  300.                         List arenas = cfg.getStringList("arenas");
  301.                         arenas.remove(args[1]);
  302.                         cfg.set("arenas", arenas);
  303.                         try {
  304.                           cfg.save(fileC);
  305.                         } catch (IOException e) {
  306.                           e.printStackTrace();
  307.                         }
  308.                        
  309.                         try {
  310.                             cfg.save(file);
  311.                         } catch (IOException e) {
  312.                             // TODO Auto-generated catch block
  313.                             e.printStackTrace();
  314.                         }
  315.                        
  316.                         p.sendMessage(plugin.prefix + "§7JumpnRun §8" + args[1] + " §7erfolgreich geloescht!");
  317.                     }else{
  318.                         p.sendMessage(plugin.noperm);
  319.                     }
  320.                 }
  321.                
  322.                
  323.  
  324.                 //list
  325.                   if (args[0].equalsIgnoreCase("list")) {
  326.                     if (p.hasPermission("Jumping.list")) {
  327.                       String players = "";
  328.                       for (Player players_ : this.plugin.jumpnrunPlayers.keySet()) {
  329.                         if (((String)this.plugin.jumpnrunPlayers.get(players_)).equalsIgnoreCase(args[1])) {
  330.                           players = players + players_.getName() + "§f, §8";
  331.                         }
  332.                       }
  333.                       p.sendMessage(this.plugin.prefix + "§7Spieler: §8" + players);
  334.                     } else {
  335.                       p.sendMessage(this.plugin.noperm);
  336.                     }
  337.  
  338.                   }
  339.  
  340.                 //tp
  341.                     if(args[0].equalsIgnoreCase("tp")){
  342.                         if(p.hasPermission("Jumping.tp")){
  343.                             try{
  344.                                 String world = cfg.getString("JumpnRuns." + args[1] + ".World");
  345.                                 double x = cfg.getDouble("JumpnRuns." + args[1] + ".PosX");
  346.                                 double y = cfg.getDouble("JumpnRuns." + args[1] + ".PosY");
  347.                                 double z = cfg.getDouble("JumpnRuns." + args[1] + ".PosZ");
  348.                                 double yaw = cfg.getDouble("JumpnRuns." + args[1] + ".PosYam");
  349.                                 double pitch = cfg.getDouble("JumpnRuns." + args[1] + ".PosPitch");
  350.                                 Location loc = new Location(Bukkit.getWorld(world), x, y, z);
  351.                                 loc.setPitch((float)pitch);
  352.                                 loc.setYaw((float)yaw);
  353.                                
  354.                                 p.teleport(loc);
  355.                                
  356.                                 p.sendMessage(this.plugin.prefix + "§7Du hast dich zum §8" + args[1] + " §7teleportiert!");
  357.                               }catch(Exception e){
  358.                                   p.sendMessage(this.plugin.prefix + "§cFehler: Dieses JumpnRun gibt es nicht!");
  359.                               }
  360.                         }else{
  361.                             p.sendMessage(plugin.noperm);
  362.                         }
  363.                     }
  364.                     //find
  365.                     if(args[0].equalsIgnoreCase("find")){
  366.                         if(p.hasPermission("Jumping.find")){
  367.                             Player target = UUIDManager.getPlayer(args[1]);
  368.                             if(target == null){
  369.                                 p.sendMessage("§cFehler: Dieser Spieler ist nicht Online!");
  370.                             }else{
  371.                                 if(plugin.inJump.contains(target.getName())){
  372.                                     p.sendMessage(plugin.prefix + "§8" + target.getName() + " §7ist im JumpnRun §8" + plugin.arena.get(target.getName()) + " §7!");
  373.                                 }else{
  374.                                     p.sendMessage("§cFehler: Der Spieler ist in keinem JumpnRun!");
  375.                                 }
  376.                             }
  377.                         }else{
  378.                             p.sendMessage(plugin.noperm);
  379.                         }
  380.                     }
  381.                  
  382.                     //finish
  383.                     if(args[0].equalsIgnoreCase("finish")){
  384.                         if(p.hasPermission("Jumping.finish")){
  385.                             Player target = UUIDManager.getPlayer(args[1]);
  386.                             if(plugin.inJump.contains(target.getName())){
  387.                                 target.getInventory().clear();
  388.                                 ItemStack[] old = (ItemStack[])plugin.oldItems.get(target.getUniqueId());
  389.                                 target.getInventory().setContents(old);
  390.                                 target.updateInventory();
  391.                                 target.setGameMode(plugin.gamemode.get(target.getName()));
  392.                                 Location loc = (Location)plugin.oldLoc.get(target.getUniqueId());
  393.                                 target.teleport(loc);
  394.                                 plugin.inJump.remove(target.getName());
  395.                                 plugin.jumpnrunPlayers.remove(target.getName());
  396.                                 plugin.oldItems.remove(target.getName());
  397.                                 plugin.oldLoc.remove(target.getName());
  398.                                 target.sendMessage(plugin.prefix + "§7Du wurdest von §8" + p.getName() + " §7aus dem JumpnRun geholt!");
  399.                                 p.sendMessage(plugin.prefix + "§7Du hast §8" + target.getName() + " §7aus dem JumpnRun geholt!");
  400.                                 if(config.getString("notify").equalsIgnoreCase("true")){
  401.                                     for (Player all : Bukkit.getOnlinePlayers()){
  402.                                           if (all.hasPermission("Jumping.notify"))
  403.                                           {
  404.                                             all.sendMessage(plugin.prefix + "§7" + target.getName() + "§8 < §7" + plugin.arena.get(target.getName()) + " §7(§8" + p.getName() + "§7)");
  405.                                           }
  406.                                     }
  407.                                     }
  408.                                 plugin.arena.remove(target.getName());
  409.                             }else{
  410.                                 p.sendMessage("§cFehler: Der Spieler ist in keinem JumpnRun!");
  411.                             }
  412.                         }else{
  413.                             p.sendMessage(plugin.noperm);
  414.                         }
  415.                     }
  416.                    
  417.                    
  418.                     //ENDE ARGS 2
  419.                 }
  420.            
  421.                
  422.                 //Args length == 3
  423.             if(args.length == 3){
  424.                
  425.                 //create
  426.                 if (args[0].equalsIgnoreCase("create")) {
  427.                    
  428.                       if (p.hasPermission("Jumping.create")) {
  429.                         String world = p.getWorld().getName();
  430.                         double x = p.getLocation().getX();
  431.                         double y = p.getLocation().getY();
  432.                         double z = p.getLocation().getZ();
  433.                         double yaw = p.getLocation().getYaw();
  434.                         double pitch = p.getLocation().getPitch();
  435.  
  436.                         cfg.set("JumpnRuns." + args[1] + ".World", world);
  437.                         cfg.set("JumpnRuns." + args[1] + ".PosX", Double.valueOf(x));
  438.                         cfg.set("JumpnRuns." + args[1] + ".PosY", Double.valueOf(y));
  439.                         cfg.set("JumpnRuns." + args[1] + ".PosZ", Double.valueOf(z));
  440.                         cfg.set("JumpnRuns." + args[1] + ".PosYaw", Double.valueOf(yaw));
  441.                         cfg.set("JumpnRuns." + args[1] + ".PosPitch", Double.valueOf(pitch));
  442.                         try
  443.                         {
  444.                           cfg.save(file);
  445.                         }
  446.                         catch (IOException e1) {
  447.                           e1.printStackTrace();
  448.                         }
  449.  
  450.                        
  451.  
  452.                         File fileC = new File("plugins/Jumping", "Arenas.yml");
  453.                         FileConfiguration cfgC = YamlConfiguration.loadConfiguration(fileC);
  454.  
  455.                         if(args[2].equalsIgnoreCase("leicht")){
  456.                             List leicht = cfg.getStringList("leicht");
  457.                             leicht.add(args[1]);
  458.                             cfg.set("leicht", leicht);
  459.                             p.sendMessage(this.plugin.prefix + "§7Das JumpnRun §8" + args[1] + " §7wurde erfolgreich erstellt! (§8Leicht§7)");
  460.                         }
  461.                         if(args[2].equalsIgnoreCase("mittel")){
  462.                             List mittel = cfg.getStringList("mittel");
  463.                             mittel.add(args[1]);
  464.                             cfg.set("mittel", mittel);
  465.                             p.sendMessage(this.plugin.prefix + "§7Das JumpnRun §8" + args[1] + " §7wurde erfolgreich erstellt! (§8Mittel§7)");
  466.                         }
  467.                         if(args[2].equalsIgnoreCase("schwer")){
  468.                             List schwer = cfg.getStringList("schwer");
  469.                             schwer.add(args[1]);
  470.                             cfg.set("schwer", schwer);
  471.                             p.sendMessage(this.plugin.prefix + "§7Das JumpnRun §8" + args[1] + " §7wurde erfolgreich erstellt! (§8Schwer§7)");
  472.                         }
  473.                         if(args[2].equalsIgnoreCase("sschwer")){
  474.                             List sschwer = cfg.getStringList("sschwer");
  475.                             sschwer.add(args[1]);
  476.                             cfg.set("sschwer", sschwer);
  477.                             p.sendMessage(this.plugin.prefix + "§7Das JumpnRun §8" + args[1] + " §7wurde erfolgreich erstellt! (§8Sehr Schwer§7)");
  478.                         }
  479.                        
  480.                         List arenas = cfg.getStringList("arenas");
  481.                         arenas.add(args[1]);
  482.                         cfg.set("arenas", arenas);
  483.                         try {
  484.                           cfg.save(fileC);
  485.                         } catch (IOException e) {
  486.                           e.printStackTrace();
  487.                         }
  488.                       }
  489.                       else{
  490.                         p.sendMessage(this.plugin.noperm);
  491.                       }
  492.                    
  493.  
  494.                   }
  495.                
  496.                 //send
  497.                 if(args[0].equalsIgnoreCase("send")){
  498.                     if(p.hasPermission("Jumping.send")){
  499.                         Player target = UUIDManager.getPlayer(args[1]);
  500.                         if(plugin.inJump.contains(target.getName())){
  501.                             p.sendMessage("§cFehler: Der Spieler ist schon in einem JumpnRun!");
  502.                         }else{
  503.                             try{
  504.                                 plugin.inJump.add(target.getName());
  505.                                 plugin.oldLoc.put(target.getUniqueId(), target.getLocation());
  506.                                 plugin.oldItems.put(target.getUniqueId(), target.getInventory().getContents());
  507.                                 plugin.arena.put(target.getName(), args[2]);
  508.                                 plugin.gamemode.put(target.getName(), target.getGameMode());
  509.                                 plugin.jumpnrunPlayers.put(target, args[2]);
  510.                                 target.getInventory().clear();
  511.                                 target.updateInventory();
  512.                                
  513.                                 String world = cfg.getString("JumpnRuns." + args[2] + ".World");
  514.                                 double x = cfg.getDouble("JumpnRuns." + args[2] + ".PosX");
  515.                                 double y = cfg.getDouble("JumpnRuns." + args[2] + ".PosY");
  516.                                 double z = cfg.getDouble("JumpnRuns." + args[2] + ".PosZ");
  517.                                 double yaw = cfg.getDouble("JumpnRuns." + args[2] + ".PosYam");
  518.                                 double pitch = cfg.getDouble("JumpnRuns." + args[2] + ".PosPitch");
  519.                                 Location loc = new Location(Bukkit.getWorld(world), x, y, z);
  520.                                 loc.setPitch((float)pitch);
  521.                                 loc.setYaw((float)yaw);
  522.                                 target.setGameMode(GameMode.ADVENTURE);
  523.                                 target.teleport(loc);
  524.                                
  525.                                 target.setHealth(20);
  526.                                 target.setFoodLevel(20);
  527.                                
  528.                                 target.sendMessage(plugin.prefix + "§7Du wurdest von §8" + p.getName() + " §7in das JumpnRun §8" + args[2] + " §7geschickt!");
  529.                                 target.sendMessage(plugin.prefix + "§7Um das JumpnRun zu verlassen: §8/jumping leave");
  530.                                
  531.                                 p.sendMessage(plugin.prefix + "§7Du hast §8" + target.getName() + " §7in das JumpnRun §8" + args[2] + " §7geschickt!");
  532.                                 p.sendMessage(plugin.prefix + "§7Um §8" + target.getName() + " §7wieder aus dem JumpnRun zu holen: §8/jumping finish " + target.getName());
  533.                                 if(config.getString("notify").equalsIgnoreCase("true")){
  534.                                     for(Player all : Bukkit.getOnlinePlayers()){
  535.                                         if(all.hasPermission("Jumping.notify")){
  536.                                             all.sendMessage(plugin.prefix + "§7" + target.getName() + "§8 > §7" + args[2] + " §7(§8" + p.getName() + "§7)");
  537.                                         }
  538.                                     }
  539.                                 }
  540.                                
  541.                             }catch (Exception e){
  542.                                 target.sendMessage(this.plugin.prefix + "§7Du wurdest von §8" + p.getName() + " §7in das JumpnRun §8" + args[2] + " §7gesendet!");
  543.                                 target.sendMessage(this.plugin.prefix + "§cDieses JumpnRun gibt aber es nicht! Du wurdest wieder aus dem JumpnRun geholt!");
  544.                                 this.plugin.leaveArena(target);
  545.                                 p.sendMessage(this.plugin.prefix + "§cDieses JumpnRun gibt es nicht!");
  546.                             }
  547.                         }
  548.                     }else{
  549.                         p.sendMessage(plugin.noperm);
  550.                     }
  551.                 }
  552.                
  553.             }
  554.                
  555.             }else{
  556.                 sender.sendMessage("Du musst ein Spieler sein!");
  557.             }
  558.            
  559.            
  560.    
  561.             return true;
  562.     }
  563.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement