public static void addInventory(Player player) { HPlayer.get(player.getName()).storeInventory("splegg", player.getInventory().getContents()); HPlayer.get(player.getName()) .storeInventory("splegg_armour", player.getInventory().getArmorContents()); player.getInventory().clear(); player.getInventory().setItem(0, new ItemStack(Material.IRON_SPADE)); }
public static void retrieveInventory(Player player) { if (player == null) return; if (HPlayer.get(player.getName()) == null) return; if (HPlayer.get(player.getName()).getInventory("splegg") != null) player.getInventory().setContents(HPlayer.get(player.getName()).getInventory("splegg")); if (HPlayer.get(player.getName()).getInventory("splegg_armour") != null) player .getInventory() .setContents(HPlayer.get(player.getName()).getInventory("splegg_armour")); }
public static void leave(Player player) { if (player == null) return; if (!get().getPlayers().containsKey(player)) return; player.teleport(Games.getSpec()); player.getInventory().setContents(HPlayer.get(player.getName()).getInventory("splegg")); player .getInventory() .setArmorContents(HPlayer.get(player.getName()).getInventory("splegg_armour")); message(ChatColor.YELLOW + player.getName() + ChatColor.WHITE + " left the game"); }
public static void end(StopReason reason) { if (reason == StopReason.INSUFFICIENT_PLAYERS) { for (String players : get().getPlayers().keySet()) { Player player = Bukkit.getPlayer(players); if (player != null) { player.teleport(Games.getSpec()); player.getInventory().clear(); player.getInventory().setContents(HPlayer.get(player.getName()).getInventory("splegg")); player .getInventory() .setArmorContents(HPlayer.get(player.getName()).getInventory("splegg_armour")); M.v( "Game", ChatColor.YELLOW + "Splegg " + ChatColor.WHITE + "cancelled, less than 2 players"); } } get().getPlayers().clear(); } if (reason == StopReason.GAME_FINISH) {} }