diff --git a/war/src/main/java/com/tommytony/war/Team.java b/war/src/main/java/com/tommytony/war/Team.java index 50dc4b8..ff5f461 100644 --- a/war/src/main/java/com/tommytony/war/Team.java +++ b/war/src/main/java/com/tommytony/war/Team.java @@ -8,6 +8,7 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.OfflinePlayer; +import org.bukkit.attribute.Attribute; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; @@ -371,6 +372,12 @@ public class Team { player.setScoreboard(this.warzone.getScoreboard()); } warzone.updateScoreboard(); + boolean cooldownEnabled = War.war.getWarConfig().getBoolean(WarConfig.DISABLECOOLDOWN); + if(cooldownEnabled) { + player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(1024.0); + } else { + player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0); + } } public List getPlayers() { @@ -431,6 +438,7 @@ public class Team { } this.warzone.getLoadoutSelections().remove(thePlayer); warzone.updateScoreboard(); + thePlayer.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0); } public int getRemainingLives() { diff --git a/war/src/main/java/com/tommytony/war/event/WarPlayerListener.java b/war/src/main/java/com/tommytony/war/event/WarPlayerListener.java index b95e2b0..be86ea9 100644 --- a/war/src/main/java/com/tommytony/war/event/WarPlayerListener.java +++ b/war/src/main/java/com/tommytony/war/event/WarPlayerListener.java @@ -19,7 +19,6 @@ import com.tommytony.war.utility.LoadoutSelection; import com.tommytony.war.volume.Volume; import org.apache.commons.lang.Validate; import org.bukkit.*; -import org.bukkit.attribute.Attribute; import org.bukkit.block.BlockFace; import org.bukkit.block.Sign; import org.bukkit.entity.Item; @@ -67,17 +66,10 @@ public class WarPlayerListener implements Listener { War.war.removeWandBearer(player); } } - event.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0); } @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerJoin(final PlayerJoinEvent event) { - boolean cooldownDisabled = War.war.getWarConfig().getBoolean(WarConfig.DISABLECOOLDOWN); - if(cooldownDisabled) { - event.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(1024.0); - } else { - event.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0); - } String autojoinName = War.war.getWarConfig().getString(WarConfig.AUTOJOIN); boolean autojoinEnabled = !autojoinName.isEmpty(); if (autojoinEnabled) { // Won't be able to find warzone if unset