mirror of
https://github.com/taoneill/war.git
synced 2025-02-23 06:41:20 +01:00
Closes gh-425. Block head restoration job shouldn't break anymore. Updated plugin.yml to reflect v1.7.1-PREVIEW version - sorry about confusion.
This commit is contained in:
parent
fc03a0cf74
commit
eea3af9c1c
@ -329,8 +329,10 @@ public class Warzone {
|
||||
player.getInventory().clear();
|
||||
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
// Players are always in survival mode in warzones
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
|
||||
// clear potion effects
|
||||
PotionEffectHelper.clearPotionEffects(player);
|
||||
|
||||
|
@ -80,8 +80,6 @@ public class JoinCommand extends AbstractWarCommand {
|
||||
}
|
||||
|
||||
// join new team
|
||||
|
||||
|
||||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED)) {
|
||||
this.msg("This warzone is disabled.");
|
||||
} else {
|
||||
|
@ -32,12 +32,14 @@ public class HelmetProtectionTask implements Runnable {
|
||||
for (Player player : team.getPlayers()) {
|
||||
PlayerInventory playerInv = player.getInventory();
|
||||
Material teamBlockMaterial;
|
||||
|
||||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.BLOCKHEADS)) {
|
||||
teamBlockMaterial = team.getKind().getMaterial();
|
||||
// 1) Replace missing block head
|
||||
if (playerInv.getHelmet().getType() != teamBlockMaterial) {
|
||||
if (playerInv.getHelmet() == null || playerInv.getHelmet().getType() != teamBlockMaterial) {
|
||||
playerInv.setHelmet(this.createBlockHead(team));
|
||||
}
|
||||
|
||||
// 2) Get rid of extra blocks in inventory: only keep one
|
||||
HashMap<Integer, ? extends ItemStack> blocks = playerInv.all(teamBlockMaterial);
|
||||
if (blocks.size() > 1 || (blocks.size() == 1 && blocks.get(blocks.keySet().iterator().next()).getAmount() > 1)) {
|
||||
@ -62,7 +64,7 @@ public class HelmetProtectionTask implements Runnable {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// enfore helmet (good thing?)
|
||||
// enforce helmet (good thing?)
|
||||
if (team.getKind() == TeamKind.GOLD) {
|
||||
teamBlockMaterial = Material.GOLD_HELMET;
|
||||
} else if (team.getKind() == TeamKind.DIAMOND) {
|
||||
@ -72,9 +74,11 @@ public class HelmetProtectionTask implements Runnable {
|
||||
} else {
|
||||
teamBlockMaterial = Material.LEATHER_HELMET;
|
||||
}
|
||||
if (playerInv.getHelmet() != null && playerInv.getHelmet().getType() != teamBlockMaterial) {
|
||||
|
||||
if (playerInv.getHelmet() == null || playerInv.getHelmet().getType() != teamBlockMaterial) {
|
||||
playerInv.setHelmet(new ItemStack(teamBlockMaterial));
|
||||
}
|
||||
|
||||
HashMap<Integer, ? extends ItemStack> helmets = playerInv.all(teamBlockMaterial);
|
||||
if (helmets.size() > 1 || (helmets.size() == 1 && helmets.get(helmets.keySet().iterator().next()).getAmount() > 1)) {
|
||||
playerInv.remove(teamBlockMaterial);
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: War
|
||||
version: 1.7 (Doolittle)
|
||||
version: 1.7.1-PREVIEW (Doolittle)
|
||||
description: Lets you create TDM and CTF arenas (warzones) for a fast-paced and structured PVP experience.
|
||||
author: tommytony
|
||||
website: http://war.tommytony.com
|
||||
|
Loading…
Reference in New Issue
Block a user