mirror of
https://github.com/taoneill/war.git
synced 2025-01-21 14:51:25 +01:00
Fix NPE and reset attack speed when necessary
This commit is contained in:
parent
98afe494c1
commit
2e6466fab2
1
war/.gitignore
vendored
1
war/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
/target/
|
|
@ -48,7 +48,6 @@ 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
|
||||||
@ -68,11 +67,17 @@ public class WarPlayerListener implements Listener {
|
|||||||
War.war.removeWandBearer(player);
|
War.war.removeWandBearer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
event.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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);
|
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);
|
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