diff --git a/war/pom.xml b/war/pom.xml index e438840..1e1cec2 100644 --- a/war/pom.xml +++ b/war/pom.xml @@ -35,13 +35,13 @@ org.bukkit bukkit - 1.0.0-R1-SNAPSHOT + 1.0.1-R1 compile org.bukkit craftbukkit - 1.0.0-SNAPSHOT + 1.0.1-R1 compile diff --git a/war/src/main/java/bukkit/tommytony/war/War.java b/war/src/main/java/bukkit/tommytony/war/War.java index 60df446..479f4aa 100644 --- a/war/src/main/java/bukkit/tommytony/war/War.java +++ b/war/src/main/java/bukkit/tommytony/war/War.java @@ -25,10 +25,17 @@ import org.bukkit.plugin.java.JavaPlugin; import com.nijiko.permissions.PermissionHandler; import com.nijikokun.bukkit.Permissions.Permissions; -import com.tommytony.war.*; +import com.tommytony.war.FlagReturn; +import com.tommytony.war.TeamKind; +import com.tommytony.war.TeamSpawnStyle; +import com.tommytony.war.WarHub; +import com.tommytony.war.Warzone; +import com.tommytony.war.ZoneLobby; import com.tommytony.war.jobs.HelmetProtectionTask; -import com.tommytony.war.mappers.*; -import com.tommytony.war.utils.*; +import com.tommytony.war.mappers.WarMapper; +import com.tommytony.war.mappers.WarzoneMapper; +import com.tommytony.war.utils.ChatFixUtil; +import com.tommytony.war.utils.PlayerState; /** * Main class of War diff --git a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java index 14df564..80af4f2 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java +++ b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java @@ -3,7 +3,6 @@ package bukkit.tommytony.war; import java.util.ArrayList; import java.util.List; import java.util.Random; -import java.util.logging.Level; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -12,7 +11,6 @@ import org.bukkit.block.Block; import org.bukkit.block.ContainerBlock; import org.bukkit.block.NoteBlock; import org.bukkit.block.Sign; -import org.bukkit.craftbukkit.entity.CraftCreeper; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftTNTPrimed; import org.bukkit.entity.Arrow; @@ -20,17 +18,16 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.TNTPrimed; -import org.bukkit.entity.ThrownPotion; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityListener; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.inventory.ItemStack; import com.tommytony.war.Team; diff --git a/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java b/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java index db2d544..c2adf25 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java +++ b/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java @@ -1,9 +1,7 @@ package bukkit.tommytony.war; import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -552,8 +550,6 @@ public class WarPlayerListener extends PlayerListener { } } - - public void purgeLatestPositions() { this.latestLocations.clear(); } diff --git a/war/src/main/java/bukkit/tommytony/war/command/DeleteTeamFlagCommand.java b/war/src/main/java/bukkit/tommytony/war/command/DeleteTeamFlagCommand.java index 72e5e82..a1a9d96 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/DeleteTeamFlagCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/DeleteTeamFlagCommand.java @@ -3,14 +3,13 @@ package bukkit.tommytony.war.command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import com.tommytony.war.Monument; +import bukkit.tommytony.war.WarCommandHandler; + import com.tommytony.war.Team; import com.tommytony.war.Warzone; import com.tommytony.war.ZoneLobby; import com.tommytony.war.mappers.WarzoneMapper; -import bukkit.tommytony.war.WarCommandHandler; - /** * Deletes a monument. * diff --git a/war/src/main/java/com/tommytony/war/Warzone.java b/war/src/main/java/com/tommytony/war/Warzone.java index 80732d1..9e8245e 100644 --- a/war/src/main/java/com/tommytony/war/Warzone.java +++ b/war/src/main/java/com/tommytony/war/Warzone.java @@ -906,6 +906,10 @@ public class Warzone { if (this.hasPlayerState(player.getName())) { this.restorePlayerState(player); } + if (this.getLoadoutSelections().containsKey(player.getName())) { + // clear inventory selection + this.getLoadoutSelections().remove(player.getName()); + } player.setFireTicks(0); player.setRemainingAir(300); diff --git a/war/src/main/java/com/tommytony/war/ZoneSetter.java b/war/src/main/java/com/tommytony/war/ZoneSetter.java index 7883895..21d8ad5 100644 --- a/war/src/main/java/com/tommytony/war/ZoneSetter.java +++ b/war/src/main/java/com/tommytony/war/ZoneSetter.java @@ -4,6 +4,8 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; +import bukkit.tommytony.war.War; + import com.tommytony.war.mappers.WarMapper; import com.tommytony.war.mappers.WarzoneMapper; import com.tommytony.war.volumes.NotNorthwestException; @@ -11,9 +13,6 @@ import com.tommytony.war.volumes.NotSoutheastException; import com.tommytony.war.volumes.TooBigException; import com.tommytony.war.volumes.TooSmallException; -import bukkit.tommytony.war.War; -import bukkit.tommytony.war.command.SetZoneCommand; - public class ZoneSetter { private final Player player; @@ -40,7 +39,7 @@ public class ZoneSetter { War.war.getIncompleteZones().add(warzone); warzone.getVolume().setNorthwest(northwestBlock); War.war.msg(this.player, "Warzone " + warzone.getName() + " created. Northwesternmost point set to x:" + warzone.getVolume().getNorthwestX() + " z:" + warzone.getVolume().getNorthwestZ() + ". "); - } else if (!this.isPlayerAuthorOfZone(warzone)) { + } else if (!this.isPlayerAuthorOfZoneOrAdmin(warzone)) { return; } else { // change existing warzone @@ -67,8 +66,6 @@ public class ZoneSetter { } } - - public void placeSoutheast() { Warzone warzone = War.war.findWarzone(this.zoneName); Block southeastBlock = this.player.getLocation().getWorld().getBlockAt(this.player.getLocation()); @@ -85,7 +82,7 @@ public class ZoneSetter { War.war.getIncompleteZones().add(warzone); warzone.getVolume().setSoutheast(southeastBlock); War.war.msg(this.player, "Warzone " + warzone.getName() + " created. Southeasternmost point set to x:" + warzone.getVolume().getSoutheastX() + " z:" + warzone.getVolume().getSoutheastZ() + ". "); - } else if (!this.isPlayerAuthorOfZone(warzone)) { + } else if (!this.isPlayerAuthorOfZoneOrAdmin(warzone)) { return; } else { // change existing warzone @@ -132,7 +129,7 @@ public class ZoneSetter { War.war.getIncompleteZones().add(warzone); warzone.getVolume().setZoneCornerOne(corner1Block); War.war.msg(this.player, "Warzone " + warzone.getName() + " created. Corner 1 set to x:" + corner1Block.getX() + " y:" + corner1Block.getY() + " z:" + corner1Block.getZ() + ". "); - } else if (!this.isPlayerAuthorOfZone(warzone)) { + } else if (!this.isPlayerAuthorOfZoneOrAdmin(warzone)) { return; } else { // change existing warzone @@ -174,7 +171,7 @@ public class ZoneSetter { War.war.getIncompleteZones().add(warzone); warzone.getVolume().setZoneCornerTwo(corner2Block); War.war.msg(this.player, "Warzone " + warzone.getName() + " created. Corner 2 set to x:" + corner2Block.getX() + " y:" + corner2Block.getY() + " z:" + corner2Block.getZ() + ". "); - } else if (!this.isPlayerAuthorOfZone(warzone)) { + } else if (!this.isPlayerAuthorOfZoneOrAdmin(warzone)) { return; } else { // change existing warzone @@ -196,12 +193,13 @@ public class ZoneSetter { } } - private boolean isPlayerAuthorOfZone(Warzone warzone) { + private boolean isPlayerAuthorOfZoneOrAdmin(Warzone warzone) { boolean isAuthor = warzone.isAuthor(player); - if (!isAuthor) { + boolean isAdmin = !War.war.isWarAdmin(player); + if (!isAuthor && !isAdmin) { War.war.badMsg(player, "You can't do this because you are not an author of the " + warzone.getName() + " warzone." ); } - return isAuthor; + return isAuthor || isAdmin; } private void resetWarzone(Warzone warzone, StringBuilder msgString) { diff --git a/war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java b/war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java index edbcd53..7396a6c 100644 --- a/war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java +++ b/war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java @@ -34,13 +34,6 @@ public class VolumeMapper { return volume; } - // public static ZoneVolume loadZoneVolume(String volumeName, String zoneName, - // War war, World world, Warzone zone) { - // ZoneVolume volume = new ZoneVolume(volumeName, war, world, zone); - // load(volume, zoneName, war, world); - // return volume; - // } - public static void load(Volume volume, String zoneName, World world) { BufferedReader in = null; try { diff --git a/war/src/main/java/com/tommytony/war/mappers/ZoneVolumeMapper.java b/war/src/main/java/com/tommytony/war/mappers/ZoneVolumeMapper.java index b071a8c..c679269 100644 --- a/war/src/main/java/com/tommytony/war/mappers/ZoneVolumeMapper.java +++ b/war/src/main/java/com/tommytony/war/mappers/ZoneVolumeMapper.java @@ -9,7 +9,6 @@ import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; -import java.util.ArrayList; import java.util.List; import java.util.logging.Level; @@ -22,7 +21,6 @@ import org.bukkit.block.Dispenser; import org.bukkit.block.Sign; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import org.bukkit.material.MaterialData; import bukkit.tommytony.war.War;