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/War.java b/war/src/main/java/com/tommytony/war/War.java index f8f2b5a..74cf770 100644 --- a/war/src/main/java/com/tommytony/war/War.java +++ b/war/src/main/java/com/tommytony/war/War.java @@ -147,6 +147,7 @@ public class War extends JavaPlugin { warConfig.put(WarConfig.LANGUAGE, Locale.getDefault().toString()); warConfig.put(WarConfig.AUTOJOIN, ""); warConfig.put(WarConfig.TPWARMUP, 0); + warConfig.put(WarConfig.DISABLECOOLDOWN, false); warzoneDefaultConfig.put(WarzoneConfig.AUTOASSIGN, false); warzoneDefaultConfig.put(WarzoneConfig.BLOCKHEADS, true); diff --git a/war/src/main/java/com/tommytony/war/config/WarConfig.java b/war/src/main/java/com/tommytony/war/config/WarConfig.java index 22cbf3a..839ca43 100644 --- a/war/src/main/java/com/tommytony/war/config/WarConfig.java +++ b/war/src/main/java/com/tommytony/war/config/WarConfig.java @@ -13,7 +13,8 @@ public enum WarConfig { MAXSIZE (Integer.class, "Max size", "Maximum volume of a warzone"), LANGUAGE (String.class, "Language", "Preferred server language"), AUTOJOIN (String.class, "Auto-join", "Name of warzone to send players to upon join"), - TPWARMUP(Integer.class, "TP warmup", "Amount of seconds a player must wait after requesting a teleport"); + TPWARMUP(Integer.class, "TP warmup", "Amount of seconds a player must wait after requesting a teleport"), + DISABLECOOLDOWN (Boolean.class, "Disable the 1.9 combat cooldown", "Disables the attack cooldown when swinging a weapon"); private final Class configType; private final String title; 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 6d495ed..be86ea9 100644 --- a/war/src/main/java/com/tommytony/war/event/WarPlayerListener.java +++ b/war/src/main/java/com/tommytony/war/event/WarPlayerListener.java @@ -46,7 +46,7 @@ import java.util.logging.Level; */ public class WarPlayerListener implements Listener { private java.util.Random random = new java.util.Random(); - private HashMap latestLocations = new HashMap(); + private HashMap latestLocations = new HashMap(); /** * Correctly removes quitting players from warzones