diff --git a/pom.xml b/pom.xml index 957504f..e91f015 100644 --- a/pom.xml +++ b/pom.xml @@ -152,6 +152,7 @@ org.bstats bstats-bukkit + 1.2 compile diff --git a/src/main/java/com/faris/kingkits/KingKits.java b/src/main/java/com/faris/kingkits/KingKits.java index ad46e0a..b50ad9c 100644 --- a/src/main/java/com/faris/kingkits/KingKits.java +++ b/src/main/java/com/faris/kingkits/KingKits.java @@ -17,6 +17,7 @@ import com.faris.kingkits.storage.FlatFileStorage; import com.faris.kingkits.updater.BukkitUpdater; import com.faris.kingkits.updater.SpigotUpdater; +import org.bstats.bukkit.Metrics; import org.bukkit.ChatColor; import org.bukkit.configuration.serialization.ConfigurationSerialization; import org.bukkit.entity.Player; diff --git a/src/main/java/com/faris/kingkits/listener/EventListener.java b/src/main/java/com/faris/kingkits/listener/EventListener.java index 96e2336..33a69a5 100644 --- a/src/main/java/com/faris/kingkits/listener/EventListener.java +++ b/src/main/java/com/faris/kingkits/listener/EventListener.java @@ -85,16 +85,20 @@ public void onPlayerLeave(PlayerQuitEvent event) { player.getInventory().setArmorContents(null); } if (inPvPWorld && ConfigController.getInstance().shouldRemovePotionEffectsOnLeave(player.getWorld())) { - for (PotionEffect activePotionEffect : player.getActivePotionEffects()) + for (PotionEffect activePotionEffect : player.getActivePotionEffects()) { player.removePotionEffect(activePotionEffect.getType()); + } } if (kitPlayer != null && kitPlayer.hasKit()) { - if (player.getHealth() > PlayerUtilities.getDefaultMaxHealth()) + if (player.getHealth() > PlayerUtilities.getDefaultMaxHealth()) { player.setHealth(PlayerUtilities.getDefaultMaxHealth()); - if (ConfigController.getInstance().shouldSetMaxHealth()) + } + if (ConfigController.getInstance().shouldSetMaxHealth()) { player.setMaxHealth(PlayerUtilities.getDefaultMaxHealth()); - if (kitPlayer.getKit().getWalkSpeed() != PlayerUtilities.getDefaultWalkSpeed()) + } + if (kitPlayer.getKit().getWalkSpeed() != PlayerUtilities.getDefaultWalkSpeed()) { player.setWalkSpeed(PlayerUtilities.getDefaultWalkSpeed()); + } } } catch (Exception ex) { Bukkit.getServer().getLogger().log(Level.SEVERE, "Failed to reset " + player.getName() + (player.getName().endsWith("s") ? "'" : "'s") + " inventory and/or potion effects.", ex); @@ -328,7 +332,9 @@ public void onPlayerDeath(PlayerDeathEvent event) { player.getInventory().setArmorContents(null); player.updateInventory(); } else { - event.setKeepInventory(true); + if (ConfigController.getInstance().shouldKeepInventory(player.getWorld())) { + event.setKeepInventory(true); + } } kitPlayer.onDeath(); if (killer != null && !player.getUniqueId().equals(killer.getUniqueId())) {