mirror of
https://github.com/taoneill/war.git
synced 2025-01-05 07:17:34 +01:00
Add option to disable combat cooldown
This commit is contained in:
parent
20e3e70461
commit
98afe494c1
1
war/.gitignore
vendored
Normal file
1
war/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target/
|
@ -147,6 +147,7 @@ public class War extends JavaPlugin {
|
|||||||
warConfig.put(WarConfig.LANGUAGE, Locale.getDefault().toString());
|
warConfig.put(WarConfig.LANGUAGE, Locale.getDefault().toString());
|
||||||
warConfig.put(WarConfig.AUTOJOIN, "");
|
warConfig.put(WarConfig.AUTOJOIN, "");
|
||||||
warConfig.put(WarConfig.TPWARMUP, 0);
|
warConfig.put(WarConfig.TPWARMUP, 0);
|
||||||
|
warConfig.put(WarConfig.DISABLECOOLDOWN, false);
|
||||||
|
|
||||||
warzoneDefaultConfig.put(WarzoneConfig.AUTOASSIGN, false);
|
warzoneDefaultConfig.put(WarzoneConfig.AUTOASSIGN, false);
|
||||||
warzoneDefaultConfig.put(WarzoneConfig.BLOCKHEADS, true);
|
warzoneDefaultConfig.put(WarzoneConfig.BLOCKHEADS, true);
|
||||||
|
@ -13,7 +13,8 @@ public enum WarConfig {
|
|||||||
MAXSIZE (Integer.class, "Max size", "Maximum volume of a warzone"),
|
MAXSIZE (Integer.class, "Max size", "Maximum volume of a warzone"),
|
||||||
LANGUAGE (String.class, "Language", "Preferred server language"),
|
LANGUAGE (String.class, "Language", "Preferred server language"),
|
||||||
AUTOJOIN (String.class, "Auto-join", "Name of warzone to send players to upon join"),
|
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 Class<?> configType;
|
||||||
private final String title;
|
private final String title;
|
||||||
|
@ -19,6 +19,7 @@ import com.tommytony.war.utility.LoadoutSelection;
|
|||||||
import com.tommytony.war.volume.Volume;
|
import com.tommytony.war.volume.Volume;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
@ -47,6 +48,7 @@ import java.util.logging.Level;
|
|||||||
public class WarPlayerListener implements Listener {
|
public class WarPlayerListener implements Listener {
|
||||||
private java.util.Random random = new java.util.Random();
|
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>();
|
||||||
|
private boolean cooldownDisabled = War.war.getWarConfig().getBoolean(WarConfig.DISABLECOOLDOWN);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Correctly removes quitting players from warzones
|
* Correctly removes quitting players from warzones
|
||||||
@ -70,6 +72,7 @@ public class WarPlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event) {
|
public void onPlayerJoin(final PlayerJoinEvent event) {
|
||||||
|
event.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(cooldownDisabled ? 1024 : 4);
|
||||||
String autojoinName = War.war.getWarConfig().getString(WarConfig.AUTOJOIN);
|
String autojoinName = War.war.getWarConfig().getString(WarConfig.AUTOJOIN);
|
||||||
boolean autojoinEnabled = !autojoinName.isEmpty();
|
boolean autojoinEnabled = !autojoinName.isEmpty();
|
||||||
if (autojoinEnabled) { // Won't be able to find warzone if unset
|
if (autojoinEnabled) { // Won't be able to find warzone if unset
|
||||||
|
Loading…
Reference in New Issue
Block a user