mirror of https://github.com/taoneill/war.git
Only set player attack speed when in warzone
This commit is contained in:
parent
2e6466fab2
commit
3217c0a732
|
@ -8,6 +8,7 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
|
@ -371,6 +372,12 @@ public class Team {
|
||||||
player.setScoreboard(this.warzone.getScoreboard());
|
player.setScoreboard(this.warzone.getScoreboard());
|
||||||
}
|
}
|
||||||
warzone.updateScoreboard();
|
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() {
|
public List<Player> getPlayers() {
|
||||||
|
@ -431,6 +438,7 @@ public class Team {
|
||||||
}
|
}
|
||||||
this.warzone.getLoadoutSelections().remove(thePlayer);
|
this.warzone.getLoadoutSelections().remove(thePlayer);
|
||||||
warzone.updateScoreboard();
|
warzone.updateScoreboard();
|
||||||
|
thePlayer.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRemainingLives() {
|
public int getRemainingLives() {
|
||||||
|
|
|
@ -19,7 +19,6 @@ 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;
|
||||||
|
@ -67,17 +66,10 @@ 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) {
|
||||||
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