Advertisement
Guest User

Hauptklasse

a guest
Aug 26th, 2014
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.76 KB | None | 0 0
  1. package main;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.HashMap;
  5. import java.util.UUID;
  6.  
  7. import org.bukkit.Bukkit;
  8. import org.bukkit.GameMode;
  9. import org.bukkit.Location;
  10. import org.bukkit.configuration.file.FileConfiguration;
  11. import org.bukkit.entity.Player;
  12. import org.bukkit.inventory.ItemStack;
  13. import org.bukkit.plugin.java.JavaPlugin;
  14.  
  15. public class Jumping extends JavaPlugin{
  16.  
  17.     //Strings
  18.     public String noperm = "§cFehler: Du hast keine Rechte!";
  19.     public String prefix = "§4[§6Jumping§4]";
  20.    
  21.     //HashMaps
  22.     public HashMap<UUID, Location> oldLoc = new HashMap();
  23.     public HashMap<UUID, ItemStack[]> oldItems = new HashMap();
  24.     public HashMap<String, String> arena = new HashMap();
  25.     public HashMap<String, GameMode> gamemode = new HashMap();
  26.     public HashMap<Player, String> jumpnrunPlayers = new HashMap();
  27.    
  28.     //ArraysLists
  29.     public ArrayList<String> inJump = new ArrayList();
  30.    
  31.     public void onEnable(){
  32.         System.out.println("[Jumping] v" + getDescription().getVersion() + " | Enable | <Developed by bapf>");
  33.         Config();
  34.         new Listeners(this);
  35.         getCommand("jumping").setExecutor(new Commands(this));
  36.     }
  37.    
  38.     public void onDisable(){
  39.         System.out.println("[Jumping] v" + getDescription().getVersion() + " | Disable | <Developed by bapf>");
  40.     }
  41.    
  42.     //Leave Arena
  43.     public void leaveArena(Player p){
  44.         if (this.inJump.contains(p.getName()))
  45.         {
  46.           this.inJump.remove(p.getName());
  47.           p.getInventory().clear();
  48.           ItemStack[] old = (ItemStack[])this.oldItems.get(p.getUniqueId());
  49.           p.getInventory().setContents(old);
  50.           p.updateInventory();
  51.           Location loc = (Location)this.oldLoc.get(p.getUniqueId());
  52.           p.teleport(loc);
  53.           if (this.gamemode.containsKey(p.getName())) {
  54.             p.setGameMode((GameMode)this.gamemode.get(p.getName()));
  55.             FileConfiguration cfg = getConfig();
  56.             if (cfg.getString("notify").equalsIgnoreCase("true")) {
  57.               for (Player all : Bukkit.getOnlinePlayers()) {
  58.                 if (all.hasPermission("Jumping.message"))
  59.                 {
  60.                   all.sendMessage(prefix + "§7" + p.getName() + "§8 < §7" + arena.get(p.getName()));
  61.                 }
  62.               }
  63.             }
  64.           }
  65.           p.sendMessage(this.prefix + "§7Du hast das JumpnRun verlassen!");
  66.           this.jumpnrunPlayers.remove(p);
  67.           arena.remove(p.getName());
  68.           inJump.remove(p.getName());
  69.           gamemode.remove(p.getName());
  70.           oldLoc.remove(p.getUniqueId());
  71.           oldItems.remove(p.getUniqueId());
  72.           jumpnrunPlayers.remove(p.getName());
  73.         }
  74.         else {
  75.           p.sendMessage(this.prefix + "§cDu bist in keinem JumpnRun!");
  76.         }
  77.     }
  78.    
  79.     //Config
  80.     public void Config(){
  81.         FileConfiguration cfg = getConfig();
  82.         cfg.options().copyDefaults(true);
  83.         saveConfig();
  84.     }
  85.    
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement