diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java index bf41c3a9e..cb0932006 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java @@ -534,41 +534,41 @@ public class LootModule extends MiniPlugin String[] metadataSplit = lootItem.getMetadata().split(" "); String key = metadataSplit[0]; String[] values = new String[metadataSplit.length - 1]; - - for (int i = 1; i < metadataSplit.length; i++) - { - values[i - 1] = metadataSplit[i]; - } - + + System.arraycopy(metadataSplit, 1, values, 0, metadataSplit.length - 1); + switch (key) { - case "RANK_UPGRADE": - reward = new LootRankReward(itemStack); - break; - case "SHARD": - reward = new LootShardReward(Integer.parseInt(values[0]) * 1000, itemStack, Integer.parseInt(values[1])); - break; - case "CHEST": - reward = new LootChestReward(Integer.parseInt(values[0]) * 1000, itemStack, values[1], Integer.parseInt(values[2])); - break; - case "GADGET": - String gadget = ""; - - for (int i = 1; i < values.length; i++) - { - gadget += values[i] + " "; - } - - reward = new LootGadgetReward(Integer.parseInt(values[0]) * 1000, itemStack, gadget.trim()); - break; - default: - return; + case "RANK_UPGRADE": + reward = new LootRankReward(itemStack); + break; + case "SHARD": + reward = new LootShardReward(Integer.parseInt(values[0]) * 1000, itemStack, Integer.parseInt(values[1])); + break; + case "CHEST": + reward = new LootChestReward(Integer.parseInt(values[0]) * 1000, itemStack, values[1], Integer.parseInt(values[2])); + break; + case "GADGET": + String gadget = ""; + + for (int i = 1; i < values.length; i++) + { + gadget += values[i] + " "; + } + + reward = new LootGadgetReward(Integer.parseInt(values[0]) * 1000, itemStack, gadget.trim()); + break; + default: + return; } _itemRewards.add(reward); } - reward.collectItem(player); + if (reward != null) + { + reward.collectItem(player); + } } public void addItemReward(LootItemReward reward) diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldListeners.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldListeners.java index b81b81279..f5eb8b845 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldListeners.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldListeners.java @@ -24,11 +24,7 @@ import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.hanging.HangingBreakEvent; -import org.bukkit.event.player.PlayerArmorStandManipulateEvent; -import org.bukkit.event.player.PlayerInteractAtEntityEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.*; import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -52,7 +48,8 @@ public class WorldListeners implements Listener @EventHandler public void deletePlayerData(PlayerQuitEvent event) { - _plugin.getServer().getScheduler().runTaskLater(_plugin, () -> { + _plugin.getServer().getScheduler().runTaskLater(_plugin, () -> + { World world = event.getPlayer().getWorld(); UUID uuid = event.getPlayer().getUniqueId(); String path = world.getWorldFolder().getPath(); @@ -60,7 +57,7 @@ public class WorldListeners implements Listener new File(path + File.separator + "stats" + File.separator + uuid + ".json").delete(); }, 10); } - + @EventHandler public void customDamage(CustomDamageEvent event) { @@ -117,7 +114,7 @@ public class WorldListeners implements Listener { event.setCancelled(true); } - + @EventHandler public void itemFrames(PlayerInteractEntityEvent event) { @@ -134,16 +131,16 @@ public class WorldListeners implements Listener { event.setCancelled(true); } - + Block block = event.getClickedBlock(); - + if (block == null) { return; } - + Material material = block.getType(); - + if (material == Material.BEACON || material == Material.DISPENSER || material == Material.HOPPER || material == Material.BREWING_STAND || material == Material.DROPPER) { event.setCancelled(true); @@ -162,7 +159,7 @@ public class WorldListeners implements Listener { return; } - + event.setCancelled(true); } @@ -173,7 +170,7 @@ public class WorldListeners implements Listener { return; } - + event.setCancelled(true); } @@ -188,7 +185,7 @@ public class WorldListeners implements Listener { event.setCancelled(true); } - + @EventHandler public void leavesDecay(LeavesDecayEvent event) { @@ -203,7 +200,7 @@ public class WorldListeners implements Listener // Some witchcraft from the arcade, seems to make hunger not ridiculous. player.setSaturation(3.8F); } - + @EventHandler(priority = EventPriority.LOWEST) public void weather(WeatherChangeEvent event) { @@ -213,6 +210,12 @@ public class WorldListeners implements Listener } } + @EventHandler + public void bucketEmpty(PlayerBucketEmptyEvent event) + { + event.setCancelled(true); + } + public boolean shouldBlock(Player player) { return player.getGameMode() != GameMode.CREATIVE;