Resolving conflicts while merging Tim's style cleanup.

This commit is contained in:
taoneill 2011-08-31 20:11:35 -04:00
commit 3b0518ece0
34 changed files with 342 additions and 302 deletions

View File

@ -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;
@ -32,9 +31,9 @@ import com.tommytony.war.utils.*;
/**
* Main class of War
*
* @author tommytony, Tim Düsterhus
* @package bukkit.tommytony.war
*
* @author tommytony, Tim Düsterhus
* @package bukkit.tommytony.war
*/
public class War extends JavaPlugin {
public static PermissionHandler permissionHandler;
@ -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();
@ -142,7 +143,7 @@ public class War extends JavaPlugin {
this.getDefaultLoadout().put(2, new ItemStack(Material.ARROW, 7));
this.getDefaultLoadout().put(3, new ItemStack(Material.IRON_PICKAXE, 1, (byte) 8));
this.getDefaultLoadout().put(4, new ItemStack(Material.STONE_SPADE, 1, (byte) 8));
this.getDefaultReward().put( 0, new ItemStack(Material.CAKE, 1));
this.getDefaultReward().put(0, new ItemStack(Material.CAKE, 1));
WarMapper.load();
this.getServer().getScheduler().scheduleAsyncDelayedTask(this, new HelmetProtectionTask());
@ -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();
}
@ -191,9 +190,11 @@ 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();
@ -218,9 +219,11 @@ 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);
@ -411,7 +414,7 @@ public class War extends JavaPlugin {
this.setDefaultResetOnUnload(onOff.equals("on") || onOff.equals("true"));
}
if (commandSender instanceof Player) {
Player player = (Player)commandSender;
Player player = (Player) commandSender;
if (namedParams.containsKey("loadout")) {
this.inventoryToLoadout(player, this.getDefaultLoadout());
}
@ -431,45 +434,45 @@ public class War extends JavaPlugin {
public String printConfig(Warzone zone) {
return "Warzone " + zone.getName() + " config - "
+ "lifepool:" + zone.getLifePool() + " "
+ "teamsize:" + zone.getTeamCap() + " "
+ "maxscore:" + zone.getScoreCap() + " "
+ "ff:" + onOffStr(zone.getFriendlyFire())
+ "autoassign:" + onOffStr(zone.getAutoAssignOnly())
+ "blockheads:" + 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());
+ "lifepool:" + zone.getLifePool() + " "
+ "teamsize:" + zone.getTeamCap() + " "
+ "maxscore:" + zone.getScoreCap() + " "
+ "ff:" + this.onOffStr(zone.getFriendlyFire())
+ "autoassign:" + this.onOffStr(zone.getAutoAssignOnly())
+ "blockheads:" + this.onOffStr(zone.isBlockHeads())
+ "spawnstyle:" + zone.getSpawnStyle() + " "
+ "monumentheal:" + zone.getMonumentHeal() + " "
+ "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())
+ "- 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())
+ "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());
+ "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:" + 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:" + 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) {
if(makeThisAString) {
if (makeThisAString) {
return "on ";
} else {
return "off ";
@ -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);
}
@ -517,7 +499,7 @@ public class War extends JavaPlugin {
}
public void msg(CommandSender sender, String str) {
if(sender instanceof Player) {
if (sender instanceof Player) {
String out = ChatColor.GRAY + "War> " + ChatColor.WHITE + this.colorKnownTokens(str, ChatColor.WHITE) + " ";
ChatFixUtil.sendMessage(sender, out);
} else {
@ -526,7 +508,7 @@ public class War extends JavaPlugin {
}
public void badMsg(CommandSender sender, String str) {
if(sender instanceof Player) {
if (sender instanceof Player) {
String out = ChatColor.GRAY + "War> " + ChatColor.RED + this.colorKnownTokens(str, ChatColor.RED) + " ";
ChatFixUtil.sendMessage(sender, out);
} else {
@ -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) {

View File

@ -18,22 +18,26 @@ import com.tommytony.war.Team;
import com.tommytony.war.Warzone;
/**
*
*
* @author tommytony
*
*
*/
public class WarBlockListener extends BlockListener {
/**
* @see BlockListener.onBlockPlace()
* @see BlockListener.onBlockPlace()
*/
@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);
@ -110,11 +114,13 @@ public class WarBlockListener extends BlockListener {
}
/**
* @see BlockListener.onBlockBreak()
* @see BlockListener.onBlockBreak()
*/
@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) {

View File

@ -9,19 +9,22 @@ import bukkit.tommytony.war.command.*;
/**
* Handles commands received by War
*
* @author Tim Düsterhus
* @package bukkit.tommytony.war
*
* @author Tim Düsterhus
* @package bukkit.tommytony.war
*/
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,20 +105,16 @@ 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();
}
if(commandObj != null) {
if (commandObj != null) {
boolean handled = commandObj.handle();
if(!handled) {
if (!handled) {
War.war.badMsg(sender, cmd.getUsage());
}
}

View File

@ -25,16 +25,17 @@ import com.tommytony.war.Warzone;
/**
* Handles Entity-Events
*
* @author tommytony, Tim Düsterhus
* @package bukkit.tommytony.war
*
* @author tommytony, Tim Düsterhus
* @package bukkit.tommytony.war
*/
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();
@ -132,13 +133,14 @@ public class WarEntityListener extends EntityListener {
/**
* Protects important structures from explosions
*
* @see EntityListener.onEntityExplode()
*
* @see EntityListener.onEntityExplode()
*/
@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) {
@ -164,12 +166,14 @@ public class WarEntityListener extends EntityListener {
/**
* Handles damage on Players
*
* @see EntityListener.onEntityDamage()
*
* @see EntityListener.onEntityDamage()
*/
@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;
@ -221,12 +227,14 @@ public class WarEntityListener extends EntityListener {
/**
* Prevents creatures from spawning in warzones if no creatures is active
*
* @see EntityListener.onCreatureSpawn()
*
* @see EntityListener.onCreatureSpawn()
*/
@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);
@ -238,17 +246,19 @@ public class WarEntityListener extends EntityListener {
/**
* Prevents health regaining caused by peaceful mode
*
* @see EntityListener.onEntityRegainHealth()
*
* @see EntityListener.onEntityRegainHealth()
*/
@Override
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
if (!War.war.isLoaded()) return;
// break if reason was not regen
if (event.getRegainReason() != RegainReason.REGEN) return;
if (!War.war.isLoaded() || 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);

View File

@ -28,15 +28,15 @@ import com.tommytony.war.ZoneLobby;
import com.tommytony.war.ZoneSetter;
/**
* @author tommytony, Tim Düsterhus
* @package bukkit.tommytony.war
* @author tommytony, Tim Düsterhus
* @package bukkit.tommytony.war
*/
public class WarPlayerListener extends PlayerListener {
private java.util.Random random = new java.util.Random();
/**
* Correctly removes quitting players from warzones
*
*
* @see PlayerListener.onPlayerQuit()
*/
@Override
@ -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);

View File

@ -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);
}
/**

View File

@ -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();
}
}

View File

@ -6,5 +6,9 @@ package bukkit.tommytony.war.command;
* @author Tim Düsterhus
*/
public class NotZoneMakerException extends Exception {
/**
*
*/
private static final long serialVersionUID = -5412011034665080340L;
}

View File

@ -22,7 +22,7 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
CommandSender commandSender = this.getSender();
boolean isFirstParamWarzone = false;
if(this.args.length > 0 && !this.args[0].contains(":")) {
if (this.args.length > 0 && !this.args[0].contains(":")) {
// warzone name maybe in first place
Warzone zoneByName = Warzone.getZoneByName(this.args[0]);
if (zoneByName != null) {
@ -32,14 +32,14 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
}
if (this.getSender() instanceof Player) {
Player player = (Player)commandSender;
Player player = (Player) commandSender;
Warzone zoneByLoc = Warzone.getZoneByLocation(player);
ZoneLobby lobbyByLoc = ZoneLobby.getLobbyByLocation(player);
if(zoneByLoc == null && lobbyByLoc != null) {
if (zoneByLoc == null && lobbyByLoc != null) {
zoneByLoc = lobbyByLoc.getZone();
}
if(zoneByLoc != null) {
if (zoneByLoc != null) {
zone = zoneByLoc;
}
}
@ -50,11 +50,11 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
}
if (isFirstParamWarzone) {
if(this.args.length > 1) {
if (this.args.length > 1) {
// 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,9 +64,9 @@ 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) {
if (this.args.length > 0) {
// the config may have changed, requiring a reset for spawn styles etc.
zone.getVolume().resetBlocks();
}
@ -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;

View File

@ -23,7 +23,7 @@ public class SetZoneConfigCommand extends AbstractZoneMakerCommand {
CommandSender commandSender = this.getSender();
boolean isFirstParamWarzone = false;
boolean wantsToPrint = false;
if (this.args.length == 0) {
return false;
} else {
@ -33,59 +33,59 @@ public class SetZoneConfigCommand extends AbstractZoneMakerCommand {
if (zoneByName != null) {
zone = zoneByName;
isFirstParamWarzone = true;
} else if (this.args[0].equals("-p") || this.args[0].equals("print")){
} else if (this.args[0].equals("-p") || this.args[0].equals("print")) {
wantsToPrint = true;
}
}
if (this.getSender() instanceof Player) {
player = (Player)commandSender;
player = (Player) commandSender;
Warzone zoneByLoc = Warzone.getZoneByLocation(player);
ZoneLobby lobbyByLoc = ZoneLobby.getLobbyByLocation(player);
if(zoneByLoc == null && lobbyByLoc != null) {
if (zoneByLoc == null && lobbyByLoc != null) {
zoneByLoc = lobbyByLoc.getZone();
}
if(zoneByLoc != null) {
if (zoneByLoc != null) {
zone = zoneByLoc;
}
}
}
if (zone == null) {
// No warzone found, whatever the mean, escape
return false;
}
if (isFirstParamWarzone) {
if(this.args.length == 1) {
if (this.args.length == 1) {
// Only one param: the warzone name - default to usage
return false;
}
// 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;
}
// args have been shifted if needed
if(this.args.length > 0 && (this.args[0].equals("-p") || this.args[0].equals("print"))) {
if (this.args.length > 0 && (this.args[0].equals("-p") || this.args[0].equals("print"))) {
// only printing
if(this.args.length == 1) {
if (this.args.length == 1) {
this.msg(War.war.printConfig(zone));
return true;
} else {
// 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;
}
wantsToPrint = true;
}
}
// We have a warzone and indexed-from-0 arguments, let's update
if (War.war.updateZoneFromNamedParams(zone, player, this.args)) {
this.msg("Saving config and resetting warzone " + zone.getName() + ".");
@ -95,7 +95,7 @@ public class SetZoneConfigCommand extends AbstractZoneMakerCommand {
zone.getLobby().getVolume().resetBlocks();
}
zone.initializeZone(); // bring back team spawns etc
if (wantsToPrint) {
this.msg("Warzone config saved. Zone reset. " + War.war.printConfig(zone));
} else {
@ -109,7 +109,7 @@ public class SetZoneConfigCommand extends AbstractZoneMakerCommand {
} else {
this.badMsg("Failed to read named parameters.");
}
return true;
}
}

View File

@ -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) {

View File

@ -11,7 +11,7 @@ import com.tommytony.war.Warzone;
/**
* Lists all warzones
*
*
* @author Tim Düsterhus
*/
public class WarzonesCommand extends AbstractWarCommand {
@ -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;

View File

@ -8,9 +8,9 @@ import org.bukkit.block.BlockFace;
import com.tommytony.war.volumes.Volume;
/**
*
*
* @author tommytony
*
*
*/
public class Monument {
private Location location;

View File

@ -15,9 +15,9 @@ import com.tommytony.war.utils.SignHelper;
import com.tommytony.war.volumes.Volume;
/**
*
*
* @author tommytony
*
*
*/
public class Team {
private List<Player> players = new ArrayList<Player>();

View File

@ -7,9 +7,9 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
/**
*
*
* @author tommytony
*
*
*/
public class TeamKinds {
private static final List<TeamKind> teamKinds = new ArrayList<TeamKind>();

View File

@ -1,9 +1,9 @@
package com.tommytony.war;
/**
*
*
* @author tommytony
*
*
*/
public class TeamSpawnStyles {
public static final String INVISIBLE = "invisible";

View File

@ -15,9 +15,9 @@ import com.tommytony.war.volumes.BlockInfo;
import com.tommytony.war.volumes.Volume;
/**
*
* @author tommytony, Tim Düsterhus
* @package com.tommytony.war
*
* @author tommytony, Tim Düsterhus
* @package com.tommytony.war
*/
public class WarHub {
private Location location;
@ -192,8 +192,9 @@ public class WarHub {
/**
* Resets the sign of the given warzone
*
* @param Warzone zone
*
* @param Warzone
* zone
*/
public void resetZoneSign(Warzone zone) {
BlockFace left;

View File

@ -29,9 +29,9 @@ import com.tommytony.war.utils.InventoryStash;
import com.tommytony.war.volumes.ZoneVolume;
/**
*
* @author tommytony
* @package com.tommytony.war
*
* @author tommytony
* @package com.tommytony.war
*/
public class Warzone {
private String name;
@ -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()) {
@ -212,7 +211,7 @@ public class Warzone {
/**
* Goes back to the saved state of the warzone (resets only block types, not physics). Also teleports all players back to their respective spawns.
*
*
* @return
*/
public void initializeZone() {
@ -964,7 +963,7 @@ public class Warzone {
public void setSpawnStyle(String spawnStyle) {
this.spawnStyle = spawnStyle;
for(Team team : this.teams) {
for (Team team : this.teams) {
team.setTeamSpawn(team.getTeamSpawn());
}
}

View File

@ -18,9 +18,9 @@ import com.tommytony.war.volumes.Volume;
import com.tommytony.war.volumes.ZoneVolume;
/**
*
*
* @author tommytony
*
*
*/
public class ZoneLobby {
private final Warzone warzone;
@ -41,7 +41,7 @@ public class ZoneLobby {
/**
* Use this constructor with /setzonelobby <n/s/e/w>
*
*
* @param war
* @param warzone
* @param wall
@ -59,7 +59,7 @@ public class ZoneLobby {
/**
* Use this constructor with /setzonelobby <zonename>. Makes sure the lobby is not sticking inside the zone.
*
*
* @param war
* @param warzone
* @param wall
@ -115,7 +115,7 @@ public class ZoneLobby {
/**
* Changes the lobby's position. Orientation is determined from the player location. Creates volume or resets. Saves new lobby blocks.
*
*
* @param playerLocation
*/
public void setLocation(Location playerLocation) {
@ -174,7 +174,7 @@ public class ZoneLobby {
/**
* Classic way of creating a lobby. Lobby position goes to middle of zone wall. Creates volume or resets. Saves new lobby blocks.
*
*
* @param newWall
*/
public void setWall(BlockFace newWall) {
@ -243,7 +243,7 @@ public class ZoneLobby {
private void calculateLobbyWidth() {
int noOfTeams = this.warzone.getTeams().size();
if(this.warzone.isAutoAssignOnly()) {
if (this.warzone.isAutoAssignOnly()) {
noOfTeams = 1;
}
int lobbyWidth = noOfTeams * 4 + 5;
@ -477,7 +477,7 @@ public class ZoneLobby {
Block autoAssignGateBlock = BlockInfo.getBlock(this.warzone.getWorld(), this.autoAssignGate);
this.setBlock(autoAssignGateBlock.getFace(BlockFace.DOWN), (Material.GLOWSTONE));
int size = teams.size();
if(size > 0) {
if (size > 0) {
TeamKind[] doorBlockKinds = new TeamKind[7];
for (int i = 0; i < 7; i++) {
doorBlockKinds[i] = teams.get(i % size).getKind();

View File

@ -14,9 +14,9 @@ import com.tommytony.war.volumes.BlockInfo;
import bukkit.tommytony.war.War;
/**
*
*
* @author tommytony
*
*
*/
public class ZoneWallGuard {
private Player player;

View File

@ -32,7 +32,7 @@ public class RestoreWarhubJob implements Runnable {
if (hubStrSplit.length > 3) {
worldName = hubStrSplit[3];
world = War.war.getServer().getWorld(worldName);
if(hubStrSplit.length > 4) {
if (hubStrSplit.length > 4) {
hubOrientation = hubStrSplit[4];
}
} else {

View File

@ -30,9 +30,9 @@ import com.tommytony.war.volumes.ZoneVolume;
/**
* The ZoneVolumeMapper take the blocks from disk and sets them in the worlds, since the ZoneVolume doesn't hold its blocks in memory like regular Volumes.
*
*
* @author tommytony
*
*
*/
public class PreDeGaulleZoneVolumeMapper {

View File

@ -10,7 +10,7 @@ import java.util.Properties;
/**
* Used for accessing and creating .[properties] files, reads them as utf-8, saves as utf-8. Internationalization is key importance especially for character codes.
*
*
* @author Nijikokun
* @version 1.0.4, %G%
*/
@ -27,7 +27,7 @@ public final class PropertiesFile {
/**
* Creates or opens a properties file using specified filename
*
*
* @param fileName
*/
public PropertiesFile(String fileName) {
@ -48,7 +48,7 @@ public final class PropertiesFile {
/**
* The loader for property files, it reads the file as UTF8 or converts the string into UTF8. Used for simple runthrough's, loading, or reloading of the file.
*
*
* @throws IOException
*/
public void load() throws IOException {
@ -88,20 +88,20 @@ public final class PropertiesFile {
* Returns a Map of all <code>key=value</code> properties in the file as <code>&lt;key (java.lang.String), value (java.lang.String)></code> <br />
* <br />
* Example: <blockquote>
*
*
* <pre>
* PropertiesFile settings = new PropertiesFile(&quot;settings.properties&quot;);
* Map&lt;String, String&gt; mappedSettings;
*
*
* try {
* mappedSettings = settings.returnMap();
* } catch (Exception ex) {
* log.info(&quot;Failed mapping settings.properties&quot;);
* }
* </pre>
*
*
* </blockquote>
*
*
* @return <code>map</code> - Simple Map HashMap of the entire <code>key=value</code> as <code>&lt;key (java.lang.String), value (java.lang.String)></code>
* @throws Exception
* If the properties file doesn't exist.
@ -113,7 +113,7 @@ public final class PropertiesFile {
/**
* Checks to see if the .[properties] file contains the given <code>key</code>.
*
*
* @param var
* The key we are going to be checking the existance of.
* @return <code>Boolean</code> - True if the <code>key</code> exists, false if it cannot be found.
@ -124,7 +124,7 @@ public final class PropertiesFile {
/**
* Checks to see if this <code>key</code> exists in the .[properties] file.
*
*
* @param var
* The key we are grabbing the value of.
* @return <code>java.lang.String</code> - True if the <code>key</code> exists, false if it cannot be found.
@ -135,7 +135,7 @@ public final class PropertiesFile {
/**
* Remove a key from the file if it exists. This will save() which will invoke a load() on the file.
*
*
* @see #save()
* @param var
* The <code>key</code> that will be removed from the file
@ -149,7 +149,7 @@ public final class PropertiesFile {
/**
* Checks the existance of a <code>key</code>.
*
*
* @see #containsKey(java.lang.String)
* @param key
* The <code>key</code> in question of existance.
@ -161,7 +161,7 @@ public final class PropertiesFile {
/**
* Returns the value of the <code>key</code> given as a <code>String</code>, however we do not set a string if no <code>key</code> is found.
*
*
* @see #getProperty(java.lang.String)
* @param key
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to "" or empty.
@ -176,7 +176,7 @@ public final class PropertiesFile {
/**
* Returns the value of the <code>key</code> given as a <code>String</code>. If it is not found, it will invoke saving the default <code>value</code> to the properties file.
*
*
* @see #setString(java.lang.String, java.lang.String)
* @see #getProperty(java.lang.String)
* @param key
@ -196,7 +196,7 @@ public final class PropertiesFile {
/**
* Save the value given as a <code>String</code> on the specified key.
*
*
* @see #save()
* @param key
* The <code>key</code> that we will be addressing the <code>value</code> to.
@ -210,7 +210,7 @@ public final class PropertiesFile {
/**
* Returns the value of the <code>key</code> given in a Integer, however we do not set a string if no <code>key</code> is found.
*
*
* @see #getProperty(String var)
* @param key
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0
@ -225,7 +225,7 @@ public final class PropertiesFile {
/**
* Returns the int value of a key
*
*
* @see #setInt(String key, int value)
* @param key
* The key that we will be grabbing the value from, if no value is found set and return <code>value</code>
@ -245,7 +245,7 @@ public final class PropertiesFile {
/**
* Save the value given as a <code>int</code> on the specified key.
*
*
* @see #save()
* @param key
* The <code>key</code> that we will be addressing the <code>value</code> to.
@ -260,7 +260,7 @@ public final class PropertiesFile {
/**
* Returns the value of the <code>key</code> given in a Double, however we do not set a string if no <code>key</code> is found.
*
*
* @see #getProperty(String var)
* @param key
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0.0
@ -275,7 +275,7 @@ public final class PropertiesFile {
/**
* Returns the double value of a key
*
*
* @see #setDouble(String key, double value)
* @param key
* The key that we will be grabbing the value from, if no value is found set and return <code>value</code>
@ -294,7 +294,7 @@ public final class PropertiesFile {
/**
* Save the value given as a <code>double</code> on the specified key.
*
*
* @see #save()
* @param key
* The <code>key</code> that we will be addressing the <code>value</code> to.
@ -309,7 +309,7 @@ public final class PropertiesFile {
/**
* Returns the value of the <code>key</code> given in a Long, however we do not set a string if no <code>key</code> is found.
*
*
* @see #getProperty(String var)
* @param key
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0L
@ -324,7 +324,7 @@ public final class PropertiesFile {
/**
* Returns the long value of a key
*
*
* @see #setLong(String key, long value)
* @param key
* The key that we will be grabbing the value from, if no value is found set and return <code>value</code>
@ -343,7 +343,7 @@ public final class PropertiesFile {
/**
* Save the value given as a <code>long</code> on the specified key.
*
*
* @see #save()
* @param key
* The <code>key</code> that we will be addressing the <code>value</code> to.
@ -358,7 +358,7 @@ public final class PropertiesFile {
/**
* Returns the value of the <code>key</code> given in a Boolean, however we do not set a string if no <code>key</code> is found.
*
*
* @see #getProperty(String var)
* @param key
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to false
@ -373,7 +373,7 @@ public final class PropertiesFile {
/**
* Returns the boolean value of a key
*
*
* @see #setBoolean(String key, boolean value)
* @param key
* The key that we will be grabbing the value from, if no value is found set and return <code>value</code>
@ -392,7 +392,7 @@ public final class PropertiesFile {
/**
* Save the value given as a <code>boolean</code> on the specified key.
*
*
* @see #save()
* @param key
* The <code>key</code> that we will be addressing the <code>value</code> to.

View File

@ -20,9 +20,9 @@ import bukkit.tommytony.war.War;
import com.tommytony.war.volumes.Volume;
/**
*
*
* @author tommytony
*
*
*/
public class VolumeMapper {

View File

@ -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;
@ -17,9 +16,9 @@ import com.tommytony.war.jobs.RestoreWarhubJob;
import com.tommytony.war.jobs.RestoreWarzonesJob;
/**
*
*
* @author tommytony
*
*
*/
public class WarMapper {
@ -285,17 +284,23 @@ public class WarMapper {
WarHub hub = War.war.getWarHub();
if (hub != null) {
String orientationStr = "";
if (BlockFace.SOUTH == hub.getOrientation()) {
orientationStr = "south";
} else if (BlockFace.EAST == hub.getOrientation()) {
orientationStr = "east";
} else if (BlockFace.NORTH == hub.getOrientation()) {
orientationStr = "north";
} else {
orientationStr = "west";
switch (hub.getOrientation()) {
case SOUTH:
orientationStr = "south";
break;
case EAST:
orientationStr = "east";
break;
case NORTH:
orientationStr = "north";
break;
case WEST:
default:
orientationStr = "west";
break;
}
hubStr = hub.getLocation().getBlockX() + "," + hub.getLocation().getBlockY() + "," + hub.getLocation().getBlockZ() + ","
+ hub.getLocation().getWorld().getName() + "," + orientationStr;
+ hub.getLocation().getWorld().getName() + "," + orientationStr;
VolumeMapper.save(hub.getVolume(), "");
}
warConfig.setString("warhub", hubStr);

View File

@ -23,9 +23,9 @@ import com.tommytony.war.volumes.Volume;
import com.tommytony.war.volumes.ZoneVolume;
/**
*
*
* @author tommytony
*
*
*/
public class WarzoneMapper {

View File

@ -34,20 +34,23 @@ import com.tommytony.war.volumes.ZoneVolume;
/**
* The ZoneVolumeMapper take the blocks from disk and sets them in the worlds, since the ZoneVolume doesn't hold its blocks in memory like regular Volumes.
*
* @author tommytony, Tim Düsterhus
* @package com.tommytony.war.mappers
*
* @author tommytony, Tim Düsterhus
* @package com.tommytony.war.mappers
*/
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 boolean onlyLoadCorners Should only the corners be loaded
* @return integer Changed blocks
*
* @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
*/
public static int load(ZoneVolume volume, String zoneName, World world, boolean onlyLoadCorners) {
File cornersFile = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName + "/volume-" + volume.getName() + ".corners");
@ -274,9 +277,10 @@ public class ZoneVolumeMapper {
/**
* Parses an inventory string
*
* @param String invString string to parse
* @return List<ItemStack> Parsed items
*
* @param String
* invString string to parse
* @return List<ItemStack> Parsed items
*/
private static List<ItemStack> readInventoryString(String invString) {
List<ItemStack> items = new ArrayList<ItemStack>();
@ -305,10 +309,12 @@ public class ZoneVolumeMapper {
/**
* Saves the given volume
*
* @param Volume volume Volume to save
* @param String zoneName The warzone the volume is located
* @return integer Number of written blocks
*
* @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) {
int noOfSavedBlocks = 0;
@ -472,11 +478,14 @@ 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 long tickDelay delay before beginning the task
*
* @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) {
ZoneVolumeSaveJob job = new ZoneVolumeSaveJob(volume, zoneName);
@ -485,9 +494,11 @@ 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");
@ -499,9 +510,11 @@ 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);
@ -512,4 +525,4 @@ public class ZoneVolumeMapper {
}
}
}
}
}

View File

@ -6,15 +6,15 @@ import org.bukkit.command.CommandSender;
/**
* The purpose of this tool is twofold: 1: Avoid client crashes due to bad color formating. 2: Make color continue on word wrapping
*
*
* In minecraft the degree sign is used as a prefix to another char to create a color. For example the code for white is "\u00A7f". The "\u00A7" is the unicode notation for the degree sign and the "f" means white.
*
*
* When does minecraft wrap the text? After how many chars? Answer: Because the font isn't monospace this differs depending on what you write. However we can fit 53 "M" without wrapping and the 54th char would then wrap (be at the beginning of the next line instead) As there is no broader char than "M" we can know for sure the minimum line length is 53. Note that this means the number of DISPLAYED chars per row is 53. A degree sign and the char after will NOT count, as they will not be displayed as chars.
*
*
* Good to know: Numbers have the same font width as an M.
*
*
* When does the client crash? Answer: When a row ends with a degree char and optionally another sign after. Another way to say the same: When a line ends with either a broken or valid color notation. AND The client will ALWAYS crash if the sign after the last displayed char in a row is a degree char. A goofy way to explatin it: For a line with only "M" and numbers, the fiftyfourth "displayed char" musn't be a degree sign.
*
*
* WARNING: Above is a hypothesis I have created based on what my experiments have shown. I am fairly sure it is correct but please help me test it further.
*/
public class ChatFixUtil {
@ -23,13 +23,13 @@ public class ChatFixUtil {
/**
* This method wraps the msg for you at row lengths of 53, avoids client crash scenarios and makes the previous color continue on the next line.
*
*
* The upsides with filtering your messages through this method are: - No client crashes. - Line wrapping with preserved color.
*
*
* The downsides are: - The width of the chat window will not be used to it's fullest. For example you can fit more that 53 commas (,) in a chatwindow row but the line would break after 53 displayed chars.
*
*
* Suggested usage: NO NEED TO USE the fix method for static help pages in your plugin. As the text is static you can make sure there is no client crash yourself and be able to use the full line length.
*
*
* DO USE in cases like where you output colored messages with playernames in your plugin. As the player names have different length there is potential for client crash.
*/
public static ArrayList<String> fix(String msg) {

View File

@ -50,4 +50,4 @@ public class DeferredBlockReset {
public String[] getLines() {
return this.lines;
}
}
}

View File

@ -5,9 +5,9 @@ import org.bukkit.World;
import org.bukkit.block.Block;
/**
*
*
* @author tommytony
*
*
*/
public class BlockInfo {
private int x;

View File

@ -5,9 +5,9 @@ import org.bukkit.World;
import org.bukkit.block.Block;
/**
*
* @author tommytony
* @deprecated Broken, don't use.
*
* @author tommytony
* @deprecated Broken, don't use.
*/
@Deprecated
public class CenteredVolume extends Volume {

View File

@ -10,9 +10,9 @@ import org.bukkit.block.BlockFace;
import bukkit.tommytony.war.War;
/**
*
*
* @author tommytony
*
*
*/
@Deprecated
public class VerticalVolume extends Volume {

View File

@ -22,9 +22,9 @@ import bukkit.tommytony.war.War;
import com.tommytony.war.jobs.BlockResetJob;
/**
*
*
* @author tommytony
*
*
*/
public class Volume {
private final String name;

View File

@ -11,9 +11,9 @@ import com.tommytony.war.Warzone;
import com.tommytony.war.mappers.ZoneVolumeMapper;
/**
*
*
* @author tommytony
*
*
*/
public class ZoneVolume extends Volume {