Merge pull request #848 from Ultra03/develop

Add an option in config to disable the 1.9 attack cooldown
This commit is contained in:
Connor Monahan 2018-11-30 16:13:45 -06:00 committed by GitHub
commit 7b982c2687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions

View File

@ -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<Player> 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() {

View File

@ -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);

View File

@ -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;

View File

@ -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<String, Location> latestLocations = new HashMap<String, Location>();
private HashMap<String, Location> latestLocations = new HashMap<String, Location>();
/**
* Correctly removes quitting players from warzones