mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 20:59:39 +01:00
Resolving conflicts while merging Tim's style cleanup.
This commit is contained in:
commit
3b0518ece0
@ -10,7 +10,6 @@ import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -76,7 +75,9 @@ public class War extends JavaPlugin {
|
||||
private boolean defaultAutoAssignOnly = false;
|
||||
private boolean defaultUnbreakableZoneBlocks = false;
|
||||
private boolean defaultNoCreatures = false;
|
||||
private boolean defaultResetOnEmpty = false, defaultResetOnLoad = false, defaultResetOnUnload = false;
|
||||
private boolean defaultResetOnEmpty = false,
|
||||
defaultResetOnLoad = false,
|
||||
defaultResetOnUnload = false;
|
||||
private String defaultSpawnStyle = TeamSpawnStyles.BIG;
|
||||
private String defaultFlagReturn = "both";
|
||||
private final HashMap<Integer, ItemStack> defaultReward = new HashMap<Integer, ItemStack>();
|
||||
@ -111,8 +112,8 @@ public class War extends JavaPlugin {
|
||||
this.logger = this.getServer().getLogger();
|
||||
this.setupPermissions();
|
||||
|
||||
if(!loadedOnce) {
|
||||
loadedOnce = true; // This prevented multiple hookups of the same listener
|
||||
if (!War.loadedOnce) {
|
||||
War.loadedOnce = true; // This prevented multiple hookups of the same listener
|
||||
|
||||
// Register hooks
|
||||
PluginManager pm = this.getServer().getPluginManager();
|
||||
@ -158,8 +159,6 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
this.warzones.clear();
|
||||
|
||||
PluginManager pm = this.getServer().getPluginManager();
|
||||
|
||||
if (this.warHub != null) {
|
||||
this.warHub.getVolume().resetBlocks();
|
||||
}
|
||||
@ -192,8 +191,10 @@ public class War extends JavaPlugin {
|
||||
/**
|
||||
* Converts the player-inventory to a loadout hashmap
|
||||
*
|
||||
* @param inv inventory to get the items from
|
||||
* @param loadout the hashmap to save to
|
||||
* @param inv
|
||||
* inventory to get the items from
|
||||
* @param loadout
|
||||
* the hashmap to save to
|
||||
*/
|
||||
private void inventoryToLoadout(PlayerInventory inv, HashMap<Integer, ItemStack> loadout) {
|
||||
loadout.clear();
|
||||
@ -219,8 +220,10 @@ public class War extends JavaPlugin {
|
||||
/**
|
||||
* Converts the player-inventory to a loadout hashmap
|
||||
*
|
||||
* @param player player to get the inventory to get the items from
|
||||
* @param loadout the hashmap to save to
|
||||
* @param player
|
||||
* player to get the inventory to get the items from
|
||||
* @param loadout
|
||||
* the hashmap to save to
|
||||
*/
|
||||
private void inventoryToLoadout(Player player, HashMap<Integer, ItemStack> loadout) {
|
||||
this.inventoryToLoadout(player.getInventory(), loadout);
|
||||
@ -434,38 +437,38 @@ public class War extends JavaPlugin {
|
||||
+ "lifepool:" + zone.getLifePool() + " "
|
||||
+ "teamsize:" + zone.getTeamCap() + " "
|
||||
+ "maxscore:" + zone.getScoreCap() + " "
|
||||
+ "ff:" + onOffStr(zone.getFriendlyFire())
|
||||
+ "autoassign:" + onOffStr(zone.getAutoAssignOnly())
|
||||
+ "blockheads:" + onOffStr(zone.isBlockHeads())
|
||||
+ "ff:" + this.onOffStr(zone.getFriendlyFire())
|
||||
+ "autoassign:" + this.onOffStr(zone.getAutoAssignOnly())
|
||||
+ "blockheads:" + this.onOffStr(zone.isBlockHeads())
|
||||
+ "spawnstyle:" + zone.getSpawnStyle() + " "
|
||||
+ "monumentheal:" + zone.getMonumentHeal() + " "
|
||||
+ "unbreakable:" + onOffStr(zone.isUnbreakableZoneBlocks())
|
||||
+ "disabled:" + onOffStr(zone.isDisabled())
|
||||
+ "nocreatures:" + onOffStr(zone.isNoCreatures())
|
||||
+ "resetonempty:" + onOffStr(zone.isResetOnEmpty())
|
||||
+ "resetonload:" + onOffStr(zone.isResetOnLoad())
|
||||
+ "resetonunload:" + onOffStr(zone.isResetOnUnload());
|
||||
+ "unbreakable:" + this.onOffStr(zone.isUnbreakableZoneBlocks())
|
||||
+ "disabled:" + this.onOffStr(zone.isDisabled())
|
||||
+ "nocreatures:" + this.onOffStr(zone.isNoCreatures())
|
||||
+ "resetonempty:" + this.onOffStr(zone.isResetOnEmpty())
|
||||
+ "resetonload:" + this.onOffStr(zone.isResetOnLoad())
|
||||
+ "resetonunload:" + this.onOffStr(zone.isResetOnUnload());
|
||||
}
|
||||
|
||||
public String printConfig() {
|
||||
return "War config - "
|
||||
+ "pvpinzonesonly:" + onOffStr(War.war.isPvpInZonesOnly())
|
||||
+ "disablepvpmessage:" + onOffStr(War.war.isDisablePvpMessage())
|
||||
+ "buildinzonesonly:" + onOffStr(War.war.isBuildInZonesOnly())
|
||||
+ "pvpinzonesonly:" + this.onOffStr(War.war.isPvpInZonesOnly())
|
||||
+ "disablepvpmessage:" + this.onOffStr(War.war.isDisablePvpMessage())
|
||||
+ "buildinzonesonly:" + this.onOffStr(War.war.isBuildInZonesOnly())
|
||||
+ "- Warzone defaults - "
|
||||
+ "lifepool:" + War.war.getDefaultLifepool() + " "
|
||||
+ "teamsize:" + War.war.getDefaultTeamCap() + " "
|
||||
+ "maxscore:" + War.war.getDefaultScoreCap() + " "
|
||||
+ "ff:" + onOffStr(War.war.isDefaultFriendlyFire())
|
||||
+ "autoassign:" + onOffStr(War.war.isDefaultAutoAssignOnly())
|
||||
+ "blockheads:" + onOffStr(War.war.isDefaultBlockHeads())
|
||||
+ "ff:" + this.onOffStr(War.war.isDefaultFriendlyFire())
|
||||
+ "autoassign:" + this.onOffStr(War.war.isDefaultAutoAssignOnly())
|
||||
+ "blockheads:" + this.onOffStr(War.war.isDefaultBlockHeads())
|
||||
+ "spawnstyle:" + War.war.getDefaultSpawnStyle() + " "
|
||||
+ "monumentheal:" + War.war.getDefaultMonumentHeal() + " "
|
||||
+ "unbreakable:" + onOffStr(War.war.isDefaultUnbreakableZoneBlocks())
|
||||
+ "nocreatures:" + onOffStr(War.war.isDefaultNoCreatures())
|
||||
+ "resetonempty:" + onOffStr(War.war.isDefaultResetOnEmpty())
|
||||
+ "resetonload:" + onOffStr(War.war.isDefaultResetOnLoad())
|
||||
+ "resetonunload:" + onOffStr(War.war.isDefaultResetOnUnload());
|
||||
+ "unbreakable:" + this.onOffStr(War.war.isDefaultUnbreakableZoneBlocks())
|
||||
+ "nocreatures:" + this.onOffStr(War.war.isDefaultNoCreatures())
|
||||
+ "resetonempty:" + this.onOffStr(War.war.isDefaultResetOnEmpty())
|
||||
+ "resetonload:" + this.onOffStr(War.war.isDefaultResetOnLoad())
|
||||
+ "resetonunload:" + this.onOffStr(War.war.isDefaultResetOnUnload());
|
||||
}
|
||||
|
||||
private String onOffStr(boolean makeThisAString) {
|
||||
@ -487,27 +490,6 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean inAnyWarzone(Location location) {
|
||||
Block locBlock = location.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
Warzone currentZone = Warzone.getZoneByLocation(location);
|
||||
if (currentZone == null) {
|
||||
return false;
|
||||
} else if (currentZone.getVolume().isWallBlock(locBlock)) {
|
||||
return false; // wall block doesnt count. this lets people in at the lobby side wall because wall gates overlap with the zone.
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean inWarzone(String warzoneName, Location location) {
|
||||
Warzone currentZone = Warzone.getZoneByLocation(location);
|
||||
if (currentZone == null) {
|
||||
return false;
|
||||
} else if (warzoneName.toLowerCase().equals(currentZone.getName().toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addWarzone(Warzone zone) {
|
||||
this.warzones.add(zone);
|
||||
}
|
||||
@ -536,10 +518,19 @@ public class War extends JavaPlugin {
|
||||
|
||||
/**
|
||||
* Colors the teams and examples in messages
|
||||
<<<<<<< HEAD
|
||||
*
|
||||
* @param str message-string
|
||||
* @param msgColor current message-color
|
||||
* @return Message with colored teams
|
||||
=======
|
||||
*
|
||||
* @param String
|
||||
* str message-string
|
||||
* @param String
|
||||
* msgColor current message-color
|
||||
* @return String Message with colored teams
|
||||
>>>>>>> 174126209b48a201d04de613eaae26503605fa94
|
||||
*/
|
||||
private String colorKnownTokens(String str, ChatColor msgColor) {
|
||||
for (TeamKind kind : TeamKinds.getTeamkinds()) {
|
||||
@ -551,9 +542,17 @@ public class War extends JavaPlugin {
|
||||
|
||||
/**
|
||||
* Logs a specified message with a specified level
|
||||
<<<<<<< HEAD
|
||||
*
|
||||
* @param str message to log
|
||||
* @param lvl level to use
|
||||
=======
|
||||
*
|
||||
* @param String
|
||||
* str message to log
|
||||
* @param Level
|
||||
* lvl level to use
|
||||
>>>>>>> 174126209b48a201d04de613eaae26503605fa94
|
||||
*/
|
||||
public void log(String str, Level lvl) {
|
||||
this.getLogger().log(lvl, "War> " + str);
|
||||
@ -773,7 +772,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isLoaded() {
|
||||
return loaded;
|
||||
return this.loaded;
|
||||
}
|
||||
|
||||
public void setLoaded(boolean loaded) {
|
||||
@ -781,7 +780,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isPvpInZonesOnly() {
|
||||
return pvpInZonesOnly;
|
||||
return this.pvpInZonesOnly;
|
||||
}
|
||||
|
||||
public void setPvpInZonesOnly(boolean pvpInZonesOnly) {
|
||||
@ -789,7 +788,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDisablePvpMessage() {
|
||||
return disablePvpMessage;
|
||||
return this.disablePvpMessage;
|
||||
}
|
||||
|
||||
public void setDisablePvpMessage(boolean disablePvpMessage) {
|
||||
@ -797,7 +796,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isBuildInZonesOnly() {
|
||||
return buildInZonesOnly;
|
||||
return this.buildInZonesOnly;
|
||||
}
|
||||
|
||||
public void setBuildInZonesOnly(boolean buildInZonesOnly) {
|
||||
@ -805,7 +804,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public int getDefaultLifepool() {
|
||||
return defaultLifepool;
|
||||
return this.defaultLifepool;
|
||||
}
|
||||
|
||||
public void setDefaultLifepool(int defaultLifepool) {
|
||||
@ -813,7 +812,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public int getDefaultTeamCap() {
|
||||
return defaultTeamCap;
|
||||
return this.defaultTeamCap;
|
||||
}
|
||||
|
||||
public void setDefaultTeamCap(int defaultTeamCap) {
|
||||
@ -821,7 +820,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public int getDefaultScoreCap() {
|
||||
return defaultScoreCap;
|
||||
return this.defaultScoreCap;
|
||||
}
|
||||
|
||||
public void setDefaultScoreCap(int defaultScoreCap) {
|
||||
@ -829,7 +828,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public int getDefaultMonumentHeal() {
|
||||
return defaultMonumentHeal;
|
||||
return this.defaultMonumentHeal;
|
||||
}
|
||||
|
||||
public void setDefaultMonumentHeal(int defaultMonumentHeal) {
|
||||
@ -837,7 +836,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDefaultBlockHeads() {
|
||||
return defaultBlockHeads;
|
||||
return this.defaultBlockHeads;
|
||||
}
|
||||
|
||||
public void setDefaultBlockHeads(boolean defaultBlockHeads) {
|
||||
@ -845,7 +844,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDefaultFriendlyFire() {
|
||||
return defaultFriendlyFire;
|
||||
return this.defaultFriendlyFire;
|
||||
}
|
||||
|
||||
public void setDefaultFriendlyFire(boolean defaultFriendlyFire) {
|
||||
@ -853,7 +852,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDefaultAutoAssignOnly() {
|
||||
return defaultAutoAssignOnly;
|
||||
return this.defaultAutoAssignOnly;
|
||||
}
|
||||
|
||||
public void setDefaultAutoAssignOnly(boolean defaultAutoAssignOnly) {
|
||||
@ -861,7 +860,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDefaultUnbreakableZoneBlocks() {
|
||||
return defaultUnbreakableZoneBlocks;
|
||||
return this.defaultUnbreakableZoneBlocks;
|
||||
}
|
||||
|
||||
public void setDefaultUnbreakableZoneBlocks(boolean defaultUnbreakableZoneBlocks) {
|
||||
@ -869,7 +868,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDefaultNoCreatures() {
|
||||
return defaultNoCreatures;
|
||||
return this.defaultNoCreatures;
|
||||
}
|
||||
|
||||
public void setDefaultNoCreatures(boolean defaultNoCreatures) {
|
||||
@ -877,7 +876,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDefaultResetOnEmpty() {
|
||||
return defaultResetOnEmpty;
|
||||
return this.defaultResetOnEmpty;
|
||||
}
|
||||
|
||||
public void setDefaultResetOnEmpty(boolean defaultResetOnEmpty) {
|
||||
@ -885,7 +884,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDefaultResetOnLoad() {
|
||||
return defaultResetOnLoad;
|
||||
return this.defaultResetOnLoad;
|
||||
}
|
||||
|
||||
public void setDefaultResetOnLoad(boolean defaultResetOnLoad) {
|
||||
@ -893,7 +892,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDefaultResetOnUnload() {
|
||||
return defaultResetOnUnload;
|
||||
return this.defaultResetOnUnload;
|
||||
}
|
||||
|
||||
public void setDefaultResetOnUnload(boolean defaultResetOnUnload) {
|
||||
@ -901,7 +900,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public String getDefaultSpawnStyle() {
|
||||
return defaultSpawnStyle;
|
||||
return this.defaultSpawnStyle;
|
||||
}
|
||||
|
||||
public void setDefaultSpawnStyle(String defaultSpawnStyle) {
|
||||
|
@ -29,11 +29,15 @@ public class WarBlockListener extends BlockListener {
|
||||
*/
|
||||
@Override
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if (!War.war.isLoaded()) return;
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
if (player == null || block == null) return;
|
||||
if (player == null || block == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
Warzone zone = Warzone.getZoneByLocation(player);
|
||||
@ -114,7 +118,9 @@ public class WarBlockListener extends BlockListener {
|
||||
*/
|
||||
@Override
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if (!War.war.isLoaded()) return;
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
if (player != null && block != null) {
|
||||
|
@ -18,10 +18,13 @@ public class WarCommandHandler {
|
||||
/**
|
||||
* Handles a command
|
||||
*
|
||||
* @param sender The sender of the command
|
||||
* @param cmd The command
|
||||
* @param args The arguments
|
||||
* @see War.onCommand()
|
||||
* @param sender
|
||||
* The sender of the command
|
||||
* @param cmd
|
||||
* The command
|
||||
* @param args
|
||||
* The arguments
|
||||
* @return Success
|
||||
*/
|
||||
public boolean handle(CommandSender sender, Command cmd, String[] args) {
|
||||
String command = cmd.getName();
|
||||
@ -102,13 +105,9 @@ public class WarCommandHandler {
|
||||
commandObj = new ZoneMakerCommand(this, sender, arguments);
|
||||
}
|
||||
// we are not responsible for any other command
|
||||
}
|
||||
catch (NotZoneMakerException e) {
|
||||
// user is no zonemaker -> flame him :D
|
||||
} catch (NotZoneMakerException e) {
|
||||
War.war.badMsg(sender, "You can't do this if you are not a warzone maker.");
|
||||
}
|
||||
catch (Exception e) {
|
||||
// generally catch exceptions and log them
|
||||
} catch (Exception e) {
|
||||
War.war.log("An error occured while handling command " + cmd.getName() + ". Exception:" + e.getClass().toString() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ public class WarEntityListener extends EntityListener {
|
||||
/**
|
||||
* Handles PVP-Damage
|
||||
*
|
||||
* @param event fired event
|
||||
* @param event
|
||||
* fired event
|
||||
*/
|
||||
private void handlerAttackDefend(EntityDamageByEntityEvent event) {
|
||||
Entity attacker = event.getDamager();
|
||||
@ -137,8 +138,9 @@ public class WarEntityListener extends EntityListener {
|
||||
*/
|
||||
@Override
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (!War.war.isLoaded()) return;
|
||||
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
// protect zones elements, lobbies and warhub from creepers
|
||||
List<Block> explodedBlocks = event.blockList();
|
||||
for (Block block : explodedBlocks) {
|
||||
@ -169,7 +171,9 @@ public class WarEntityListener extends EntityListener {
|
||||
*/
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
if (!War.war.isLoaded()) return;
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
if (!(entity instanceof Player)) {
|
||||
@ -202,7 +206,9 @@ public class WarEntityListener extends EntityListener {
|
||||
|
||||
@Override
|
||||
public void onEntityCombust(EntityCombustEvent event) {
|
||||
if (!War.war.isLoaded()) return;
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
Entity entity = event.getEntity();
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
@ -226,7 +232,9 @@ public class WarEntityListener extends EntityListener {
|
||||
*/
|
||||
@Override
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
if (!War.war.isLoaded()) return;
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Location location = event.getLocation();
|
||||
Warzone zone = Warzone.getZoneByLocation(location);
|
||||
@ -243,12 +251,14 @@ public class WarEntityListener extends EntityListener {
|
||||
*/
|
||||
@Override
|
||||
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
||||
if (!War.war.isLoaded()) return;
|
||||
if (!War.war.isLoaded() || event.getRegainReason() != RegainReason.REGEN) {
|
||||
return;
|
||||
}
|
||||
|
||||
// break if reason was not regen
|
||||
if (event.getRegainReason() != RegainReason.REGEN) return;
|
||||
Entity entity = event.getEntity();
|
||||
if (!(entity instanceof Player)) return;
|
||||
if (!(entity instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) entity;
|
||||
Warzone zone = Warzone.getZoneByLocation(player);
|
||||
|
@ -179,8 +179,8 @@ public class WarPlayerListener extends PlayerListener {
|
||||
Player player = event.getPlayer();
|
||||
String reason = event.getReason();
|
||||
if (reason.contains("moved") || reason.contains("too quickly") || reason.contains("Hacking")) {
|
||||
boolean inWarzone = War.war.inAnyWarzone(player.getLocation());
|
||||
boolean inLobby = War.war.inAnyWarzone(player.getLocation());
|
||||
boolean inWarzone = Warzone.getZoneByLocation(player) != null;
|
||||
boolean inLobby = ZoneLobby.getLobbyByLocation(player) != null;
|
||||
boolean inWarhub = false;
|
||||
if (War.war.getWarHub() != null && War.war.getWarHub().getVolume().contains(player.getLocation())) {
|
||||
inWarhub = true;
|
||||
@ -215,7 +215,9 @@ public class WarPlayerListener extends PlayerListener {
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
if (!War.war.isLoaded()) return;
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
Location playerLoc = event.getFrom(); // same as player.getLoc. Don't call again we need same result.
|
||||
Warzone locZone = Warzone.getZoneByLocation(playerLoc);
|
||||
|
@ -52,7 +52,7 @@ public abstract class AbstractWarCommand {
|
||||
* @param message message to send
|
||||
*/
|
||||
public void msg(String message) {
|
||||
War.war.msg(getSender(), message);
|
||||
War.war.msg(this.getSender(), message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ public abstract class AbstractWarCommand {
|
||||
* @param message message to send
|
||||
*/
|
||||
public void badMsg(String message) {
|
||||
War.war.badMsg(getSender(), message);
|
||||
War.war.badMsg(this.getSender(), message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,9 +22,7 @@ public abstract class AbstractZoneMakerCommand extends AbstractWarCommand {
|
||||
if (!War.war.isZoneMaker((Player) sender)) {
|
||||
throw new NotZoneMakerException();
|
||||
}
|
||||
}
|
||||
else if (!(sender instanceof ConsoleCommandSender)) {
|
||||
// otherwise only the console is a legimate sender
|
||||
} else if (!(sender instanceof ConsoleCommandSender)) {
|
||||
throw new NotZoneMakerException();
|
||||
}
|
||||
}
|
||||
|
@ -6,5 +6,9 @@ package bukkit.tommytony.war.command;
|
||||
* @author Tim Düsterhus
|
||||
*/
|
||||
public class NotZoneMakerException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5412011034665080340L;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
|
||||
// More than one param: the arguments need to be shifted
|
||||
String[] newargs = new String[this.args.length - 1];
|
||||
for (int i = 1; i < this.args.length; i++) {
|
||||
newargs[i-1] = args[i];
|
||||
newargs[i - 1] = this.args[i];
|
||||
}
|
||||
this.args = newargs;
|
||||
}
|
||||
@ -64,7 +64,7 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
|
||||
int savedBlocks = zone.saveState(true);
|
||||
|
||||
// changed settings: must reinitialize with new settings
|
||||
War.war.updateZoneFromNamedParams(zone, commandSender, args);
|
||||
War.war.updateZoneFromNamedParams(zone, commandSender, this.args);
|
||||
WarzoneMapper.save(zone, true);
|
||||
if (this.args.length > 0) {
|
||||
// the config may have changed, requiring a reset for spawn styles etc.
|
||||
@ -80,7 +80,6 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
|
||||
War.war.getWarHub().initialize();
|
||||
}
|
||||
|
||||
|
||||
this.msg("Warzone " + zone.getName() + " initial state changed. Saved " + savedBlocks + " blocks.");
|
||||
|
||||
return true;
|
||||
|
@ -64,7 +64,7 @@ public class SetZoneConfigCommand extends AbstractZoneMakerCommand {
|
||||
// More than one param: the arguments need to be shifted
|
||||
String[] newargs = new String[this.args.length - 1];
|
||||
for (int i = 1; i < this.args.length; i++) {
|
||||
newargs[i-1] = args[i];
|
||||
newargs[i - 1] = this.args[i];
|
||||
}
|
||||
this.args = newargs;
|
||||
}
|
||||
@ -79,7 +79,7 @@ public class SetZoneConfigCommand extends AbstractZoneMakerCommand {
|
||||
// first param was to print, shift again
|
||||
String[] newargs = new String[this.args.length - 1];
|
||||
for (int i = 1; i < this.args.length; i++) {
|
||||
newargs[i-1] = args[i];
|
||||
newargs[i - 1] = this.args[i];
|
||||
}
|
||||
this.args = newargs;
|
||||
}
|
||||
|
@ -10,8 +10,14 @@ import com.tommytony.war.Team;
|
||||
|
||||
/**
|
||||
* Sends a message to all team-members
|
||||
<<<<<<< HEAD
|
||||
*
|
||||
* @author Tim Düsterhus
|
||||
=======
|
||||
*
|
||||
* @author das-schaf
|
||||
*
|
||||
>>>>>>> 174126209b48a201d04de613eaae26503605fa94
|
||||
*/
|
||||
public class TeamCommand extends AbstractWarCommand {
|
||||
public TeamCommand(WarCommandHandler handler, CommandSender sender, String[] args) {
|
||||
|
@ -27,8 +27,7 @@ public class WarzonesCommand extends AbstractWarCommand {
|
||||
String warzonesMessage = "Warzones: ";
|
||||
if (War.war.getWarzones().isEmpty()) {
|
||||
warzonesMessage += "none.";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (Warzone warzone : War.war.getWarzones()) {
|
||||
warzonesMessage += warzone.getName() + " (" + warzone.getTeams().size() + " teams, ";
|
||||
int playerTotal = 0;
|
||||
|
@ -193,7 +193,8 @@ public class WarHub {
|
||||
/**
|
||||
* Resets the sign of the given warzone
|
||||
*
|
||||
* @param Warzone zone
|
||||
* @param Warzone
|
||||
* zone
|
||||
*/
|
||||
public void resetZoneSign(Warzone zone) {
|
||||
BlockFace left;
|
||||
|
@ -151,8 +151,7 @@ public class Warzone {
|
||||
String teamsMessage = "Teams: ";
|
||||
if (this.getTeams().isEmpty()) {
|
||||
teamsMessage += "none.";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (Team team : this.getTeams()) {
|
||||
teamsMessage += team.getName() + " (" + team.getPoints() + " points, " + team.getRemainingLifes() + "/" + this.getLifePool() + " lives left. ";
|
||||
for (Player member : team.getPlayers()) {
|
||||
|
@ -5,7 +5,6 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
@ -285,14 +284,20 @@ public class WarMapper {
|
||||
WarHub hub = War.war.getWarHub();
|
||||
if (hub != null) {
|
||||
String orientationStr = "";
|
||||
if (BlockFace.SOUTH == hub.getOrientation()) {
|
||||
switch (hub.getOrientation()) {
|
||||
case SOUTH:
|
||||
orientationStr = "south";
|
||||
} else if (BlockFace.EAST == hub.getOrientation()) {
|
||||
break;
|
||||
case EAST:
|
||||
orientationStr = "east";
|
||||
} else if (BlockFace.NORTH == hub.getOrientation()) {
|
||||
break;
|
||||
case NORTH:
|
||||
orientationStr = "north";
|
||||
} else {
|
||||
break;
|
||||
case WEST:
|
||||
default:
|
||||
orientationStr = "west";
|
||||
break;
|
||||
}
|
||||
hubStr = hub.getLocation().getBlockX() + "," + hub.getLocation().getBlockY() + "," + hub.getLocation().getBlockZ() + ","
|
||||
+ hub.getLocation().getWorld().getName() + "," + orientationStr;
|
||||
|
@ -43,9 +43,12 @@ public class ZoneVolumeMapper {
|
||||
/**
|
||||
* Loads the given volume
|
||||
*
|
||||
* @param ZoneVolume volume Volume to load
|
||||
* @param String zoneName Zone to load the volume from
|
||||
* @param World world The world the zone is located
|
||||
* @param ZoneVolume
|
||||
* volume Volume to load
|
||||
* @param String
|
||||
* zoneName Zone to load the volume from
|
||||
* @param World
|
||||
* world The world the zone is located
|
||||
* @param boolean onlyLoadCorners Should only the corners be loaded
|
||||
* @return integer Changed blocks
|
||||
*/
|
||||
@ -275,7 +278,8 @@ public class ZoneVolumeMapper {
|
||||
/**
|
||||
* Parses an inventory string
|
||||
*
|
||||
* @param String invString string to parse
|
||||
* @param String
|
||||
* invString string to parse
|
||||
* @return List<ItemStack> Parsed items
|
||||
*/
|
||||
private static List<ItemStack> readInventoryString(String invString) {
|
||||
@ -306,8 +310,10 @@ public class ZoneVolumeMapper {
|
||||
/**
|
||||
* Saves the given volume
|
||||
*
|
||||
* @param Volume volume Volume to save
|
||||
* @param String zoneName The warzone the volume is located
|
||||
* @param Volume
|
||||
* volume Volume to save
|
||||
* @param String
|
||||
* zoneName The warzone the volume is located
|
||||
* @return integer Number of written blocks
|
||||
*/
|
||||
public static int save(Volume volume, String zoneName) {
|
||||
@ -473,9 +479,12 @@ public class ZoneVolumeMapper {
|
||||
/**
|
||||
* Saves the Volume as a background-job
|
||||
*
|
||||
* @param ZoneVolme volume volume to save
|
||||
* @param String zoneName The zone the volume is located
|
||||
* @param War war Instance of war
|
||||
* @param ZoneVolme
|
||||
* volume volume to save
|
||||
* @param String
|
||||
* zoneName The zone the volume is located
|
||||
* @param War
|
||||
* war Instance of war
|
||||
* @param long tickDelay delay before beginning the task
|
||||
*/
|
||||
private static void saveAsJob(ZoneVolume volume, String zoneName, long tickDelay) {
|
||||
@ -486,8 +495,10 @@ public class ZoneVolumeMapper {
|
||||
/**
|
||||
* Deletes the given volume
|
||||
*
|
||||
* @param Volume volume volume to delete
|
||||
* @param War war Instance of war
|
||||
* @param Volume
|
||||
* volume volume to delete
|
||||
* @param War
|
||||
* war Instance of war
|
||||
*/
|
||||
public static void delete(Volume volume) {
|
||||
ZoneVolumeMapper.deleteFile("War/dat/volume-" + volume.getName() + ".dat");
|
||||
@ -500,8 +511,10 @@ public class ZoneVolumeMapper {
|
||||
/**
|
||||
* Deletes a volume file
|
||||
*
|
||||
* @param String path path of file
|
||||
* @param War war Instance of war
|
||||
* @param String
|
||||
* path path of file
|
||||
* @param War
|
||||
* war Instance of war
|
||||
*/
|
||||
private static void deleteFile(String path) {
|
||||
File volFile = new File(path);
|
||||
|
Loading…
Reference in New Issue
Block a user