Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.UUID;
- import org.bukkit.Bukkit;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Jumping extends JavaPlugin{
- //Strings
- public String noperm = "§cFehler: Du hast keine Rechte!";
- public String prefix = "§4[§6Jumping§4]";
- //HashMaps
- public HashMap<UUID, Location> oldLoc = new HashMap();
- public HashMap<UUID, ItemStack[]> oldItems = new HashMap();
- public HashMap<String, String> arena = new HashMap();
- public HashMap<String, GameMode> gamemode = new HashMap();
- public HashMap<Player, String> jumpnrunPlayers = new HashMap();
- //ArraysLists
- public ArrayList<String> inJump = new ArrayList();
- public void onEnable(){
- System.out.println("[Jumping] v" + getDescription().getVersion() + " | Enable | <Developed by bapf>");
- Config();
- new Listeners(this);
- getCommand("jumping").setExecutor(new Commands(this));
- }
- public void onDisable(){
- System.out.println("[Jumping] v" + getDescription().getVersion() + " | Disable | <Developed by bapf>");
- }
- //Leave Arena
- public void leaveArena(Player p){
- if (this.inJump.contains(p.getName()))
- {
- this.inJump.remove(p.getName());
- p.getInventory().clear();
- ItemStack[] old = (ItemStack[])this.oldItems.get(p.getUniqueId());
- p.getInventory().setContents(old);
- p.updateInventory();
- Location loc = (Location)this.oldLoc.get(p.getUniqueId());
- p.teleport(loc);
- if (this.gamemode.containsKey(p.getName())) {
- p.setGameMode((GameMode)this.gamemode.get(p.getName()));
- FileConfiguration cfg = getConfig();
- if (cfg.getString("notify").equalsIgnoreCase("true")) {
- for (Player all : Bukkit.getOnlinePlayers()) {
- if (all.hasPermission("Jumping.message"))
- {
- all.sendMessage(prefix + "§7" + p.getName() + "§8 < §7" + arena.get(p.getName()));
- }
- }
- }
- }
- p.sendMessage(this.prefix + "§7Du hast das JumpnRun verlassen!");
- this.jumpnrunPlayers.remove(p);
- arena.remove(p.getName());
- inJump.remove(p.getName());
- gamemode.remove(p.getName());
- oldLoc.remove(p.getUniqueId());
- oldItems.remove(p.getUniqueId());
- jumpnrunPlayers.remove(p.getName());
- }
- else {
- p.sendMessage(this.prefix + "§cDu bist in keinem JumpnRun!");
- }
- }
- //Config
- public void Config(){
- FileConfiguration cfg = getConfig();
- cfg.options().copyDefaults(true);
- saveConfig();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement