diff --git a/src/com/massivecraft/factions/cmd/CmdFlag.java b/src/com/massivecraft/factions/cmd/CmdFlag.java index 1aa7ef7f..ff8b2d47 100644 --- a/src/com/massivecraft/factions/cmd/CmdFlag.java +++ b/src/com/massivecraft/factions/cmd/CmdFlag.java @@ -11,7 +11,6 @@ public class CmdFlag extends FCommand { super(); this.aliases.add("flag"); - this.aliases.add("flags"); //this.requiredArgs.add(""); this.optionalArgs.put("faction", "your"); diff --git a/src/com/massivecraft/factions/cmd/CmdHelp.java b/src/com/massivecraft/factions/cmd/CmdHelp.java index 5368b6cd..339c61a1 100644 --- a/src/com/massivecraft/factions/cmd/CmdHelp.java +++ b/src/com/massivecraft/factions/cmd/CmdHelp.java @@ -61,7 +61,7 @@ public class CmdHelp extends FCommand ArrayList pageLines; pageLines = new ArrayList(); - pageLines.add( p.cmdBase.cmdHelp.getUseageTemplate(true) ); + //pageLines.add( p.cmdBase.cmdHelp.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdList.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdShow.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdPower.getUseageTemplate(true) ); diff --git a/src/com/massivecraft/factions/cmd/CmdPerm.java b/src/com/massivecraft/factions/cmd/CmdPerm.java index f104bd42..52931a08 100644 --- a/src/com/massivecraft/factions/cmd/CmdPerm.java +++ b/src/com/massivecraft/factions/cmd/CmdPerm.java @@ -15,7 +15,6 @@ public class CmdPerm extends FCommand { super(); this.aliases.add("perm"); - this.aliases.add("perms"); //this.requiredArgs.add(""); this.optionalArgs.put("faction", "your"); diff --git a/src/com/massivecraft/factions/cmd/CmdSeeChunk.java b/src/com/massivecraft/factions/cmd/CmdSeeChunk.java index 914edc37..5763fbc0 100644 --- a/src/com/massivecraft/factions/cmd/CmdSeeChunk.java +++ b/src/com/massivecraft/factions/cmd/CmdSeeChunk.java @@ -56,12 +56,12 @@ public class CmdSeeChunk extends FCommand public void showPillar(Player player, World world, int blockX, int blockZ) { - Location loc = new Location(world, blockX, 0, blockZ); - for (int blockY = 0; blockY <=127; blockY++) + for (int blockY = 0; blockY < world.getMaxHeight(); blockY++) { - loc.setY(blockY); + Location loc = new Location(world, blockX, blockY, blockZ); if (loc.getBlock().getTypeId() != 0) continue; - VisualizeUtil.addLocation(player, loc.clone(), blockY % 5 == 0 ? Material.GLOWSTONE.getId() : Material.GLASS.getId()); + int typeId = blockY % 5 == 0 ? Material.GLOWSTONE.getId() : Material.GLASS.getId(); + VisualizeUtil.addLocation(player, loc, typeId); } } diff --git a/src/com/massivecraft/factions/cmd/FCmdRoot.java b/src/com/massivecraft/factions/cmd/FCmdRoot.java index 92c37f4d..bc714cfb 100644 --- a/src/com/massivecraft/factions/cmd/FCmdRoot.java +++ b/src/com/massivecraft/factions/cmd/FCmdRoot.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import java.util.Collections; import com.massivecraft.factions.Conf; +import com.massivecraft.factions.P; public class FCmdRoot extends FCommand { @@ -17,7 +18,6 @@ public class FCmdRoot extends FCommand public CmdDescription cmdDescription = new CmdDescription(); public CmdDisband cmdDisband = new CmdDisband(); public CmdFlag cmdFlag = new CmdFlag(); - public CmdHelp cmdHelp = new CmdHelp(); public CmdHome cmdHome = new CmdHome(); public CmdInvite cmdInvite = new CmdInvite(); public CmdJoin cmdJoin = new CmdJoin(); @@ -67,47 +67,45 @@ public class FCmdRoot extends FCommand this.setHelpShort("The faction base command"); this.helpLong.add(p.txt.parseTags("This command contains all faction stuff.")); - //this.subCommands.add(p.cmdHelp); - - this.addSubCommand(this.cmdLeader); - this.addSubCommand(this.cmdAutoClaim); - this.addSubCommand(this.cmdBypass); - this.addSubCommand(this.cmdCape); - this.addSubCommand(this.cmdClaim); - this.addSubCommand(this.cmdConfig); - this.addSubCommand(this.cmdCreate); - this.addSubCommand(this.cmdDeinvite); - this.addSubCommand(this.cmdDescription); - this.addSubCommand(this.cmdDisband); - this.addSubCommand(this.cmdFlag); - this.addSubCommand(this.cmdHelp); - this.addSubCommand(this.cmdHome); - this.addSubCommand(this.cmdInvite); - this.addSubCommand(this.cmdJoin); - this.addSubCommand(this.cmdKick); - this.addSubCommand(this.cmdLeave); + this.addSubCommand(P.p.cmdAutoHelp); this.addSubCommand(this.cmdList); - this.addSubCommand(this.cmdLock); - this.addSubCommand(this.cmdMap); - this.addSubCommand(this.cmdOfficer); - this.addSubCommand(this.cmdMoney); - this.addSubCommand(this.cmdOpen); - this.addSubCommand(this.cmdPerm); + this.addSubCommand(this.cmdShow); this.addSubCommand(this.cmdPower); - this.addSubCommand(this.cmdPowerBoost); + this.addSubCommand(this.cmdJoin); + this.addSubCommand(this.cmdLeave); + this.addSubCommand(this.cmdHome); + this.addSubCommand(this.cmdCreate); + this.addSubCommand(this.cmdSethome); + this.addSubCommand(this.cmdTag); + this.addSubCommand(this.cmdDescription); + this.addSubCommand(this.cmdCape); + this.addSubCommand(this.cmdPerm); + this.addSubCommand(this.cmdFlag); + this.addSubCommand(this.cmdInvite); + this.addSubCommand(this.cmdDeinvite); + this.addSubCommand(this.cmdOpen); + this.addSubCommand(this.cmdMoney); + this.addSubCommand(this.cmdClaim); + this.addSubCommand(this.cmdAutoClaim); + this.addSubCommand(this.cmdUnclaim); + this.addSubCommand(this.cmdUnclaimall); + this.addSubCommand(this.cmdKick); + this.addSubCommand(this.cmdOfficer); + this.addSubCommand(this.cmdLeader); + this.addSubCommand(this.cmdTitle); + this.addSubCommand(this.cmdMap); + this.addSubCommand(this.cmdSeeChunks); + this.addSubCommand(this.cmdDisband); this.addSubCommand(this.cmdRelationAlly); this.addSubCommand(this.cmdRelationEnemy); this.addSubCommand(this.cmdRelationNeutral); this.addSubCommand(this.cmdRelationTruce); + this.addSubCommand(this.cmdBypass); + this.addSubCommand(this.cmdPowerBoost); + this.addSubCommand(this.cmdLock); this.addSubCommand(this.cmdReload); + this.addSubCommand(this.cmdConfig); this.addSubCommand(this.cmdSaveAll); - this.addSubCommand(this.cmdSeeChunks); - this.addSubCommand(this.cmdSethome); - this.addSubCommand(this.cmdShow); - this.addSubCommand(this.cmdTag); - this.addSubCommand(this.cmdTitle); - this.addSubCommand(this.cmdUnclaim); - this.addSubCommand(this.cmdUnclaimall); this.addSubCommand(this.cmdVersion); } @@ -115,7 +113,7 @@ public class FCmdRoot extends FCommand public void perform() { this.commandChain.add(this); - this.cmdHelp.execute(this.sender, this.args, this.commandChain); + P.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); } } diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index cb18c735..075600d1 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -48,7 +48,7 @@ public class Econ if ( ! Conf.econEnabled) P.p.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true"); - P.p.cmdBase.cmdHelp.updateHelp(); + //P.p.cmdBase.cmdHelp.updateHelp(); oldMoneyDoTransfer(); } diff --git a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 7ba67e07..5c61c4aa 100644 --- a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -18,7 +18,6 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerPreLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.util.NumberConversions; @@ -396,10 +395,4 @@ public class FactionsPlayerListener implements Listener VisualizeUtil.clear(event.getPlayer()); } - - @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerPreLogin(PlayerPreLoginEvent event) - { - VisualizeUtil.onPlayerPreLogin(event.getName()); - } } diff --git a/src/com/massivecraft/factions/util/VisualizeUtil.java b/src/com/massivecraft/factions/util/VisualizeUtil.java index b2770e5b..cf8213ff 100644 --- a/src/com/massivecraft/factions/util/VisualizeUtil.java +++ b/src/com/massivecraft/factions/util/VisualizeUtil.java @@ -18,10 +18,19 @@ import org.bukkit.entity.Player; public class VisualizeUtil { protected static Map> playerLocations = new HashMap>(); - - public static void onPlayerPreLogin(String name) + public static Set getPlayerLocations(Player player) { - playerLocations.put(name, new HashSet()); + return getPlayerLocations(player.getName()); + } + public static Set getPlayerLocations(String playerName) + { + Set ret = playerLocations.get(playerName); + if (ret == null) + { + ret = new HashSet(); + playerLocations.put(playerName, ret); + } + return ret; } // -------------------------------------------- // @@ -30,13 +39,13 @@ public class VisualizeUtil public static void addLocation(Player player, Location location, int typeId, byte data) { - playerLocations.get(player.getName()).add(location); + getPlayerLocations(player).add(location); player.sendBlockChange(location, typeId, data); } public static void addLocation(Player player, Location location, int typeId) { - playerLocations.get(player.getName()).add(location); + getPlayerLocations(player).add(location); player.sendBlockChange(location, typeId, (byte) 0); } @@ -46,7 +55,7 @@ public class VisualizeUtil public static void addLocations(Player player, Map locationMaterialIds) { - Set ploc = playerLocations.get(player.getName()); + Set ploc = getPlayerLocations(player); for (Entry entry : locationMaterialIds.entrySet()) { ploc.add(entry.getKey()); @@ -56,7 +65,7 @@ public class VisualizeUtil public static void addLocations(Player player, Collection locations, int typeId) { - Set ploc = playerLocations.get(player.getName()); + Set ploc = getPlayerLocations(player); for (Location location : locations) { ploc.add(location); @@ -66,7 +75,7 @@ public class VisualizeUtil public static void addBlocks(Player player, Collection blocks, int typeId) { - Set ploc = playerLocations.get(player.getName()); + Set ploc = getPlayerLocations(player); for (Block block : blocks) { Location location = block.getLocation(); @@ -81,14 +90,14 @@ public class VisualizeUtil public static void clear(Player player) { - Set locations = playerLocations.get(player.getName()); + Set locations = getPlayerLocations(player); if (locations == null) return; for (Location location : locations) { Block block = location.getWorld().getBlockAt(location); player.sendBlockChange(location, block.getTypeId(), block.getData()); } - playerLocations.remove(player); + locations.clear(); } }