From c8870d10d43d90ed3028528da3364b95a35ef6a8 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Tue, 9 Apr 2013 13:12:13 +0200 Subject: [PATCH] MCorify the MPlugin class Factions slightly. --- src/com/massivecraft/factions/Board.java | 20 +++--- src/com/massivecraft/factions/Conf.java | 4 +- src/com/massivecraft/factions/FPlayer.java | 34 +++++------ src/com/massivecraft/factions/FPlayers.java | 8 +-- src/com/massivecraft/factions/Faction.java | 8 +-- .../massivecraft/factions/FactionColl.java | 14 ++--- src/com/massivecraft/factions/Factions.java | 61 ++++++++++++------- src/com/massivecraft/factions/Perm.java | 2 +- .../adapters/LocationTypeAdapter.java | 4 +- .../massivecraft/factions/cmd/CmdAdmin.java | 4 +- .../factions/cmd/CmdAutoHelp.java | 2 +- .../massivecraft/factions/cmd/CmdCape.java | 2 +- .../massivecraft/factions/cmd/CmdConfig.java | 2 +- .../massivecraft/factions/cmd/CmdCreate.java | 2 +- .../massivecraft/factions/cmd/CmdDisband.java | 4 +- .../massivecraft/factions/cmd/CmdHelp.java | 2 +- .../massivecraft/factions/cmd/CmdJoin.java | 4 +- .../massivecraft/factions/cmd/CmdKick.java | 2 +- .../massivecraft/factions/cmd/CmdMoney.java | 2 +- .../factions/cmd/CmdMoneyDeposit.java | 2 +- .../factions/cmd/CmdMoneyTransferFf.java | 2 +- .../factions/cmd/CmdMoneyTransferFp.java | 2 +- .../factions/cmd/CmdMoneyTransferPf.java | 2 +- .../factions/cmd/CmdMoneyWithdraw.java | 2 +- .../factions/cmd/CmdPowerBoost.java | 2 +- .../massivecraft/factions/cmd/CmdReload.java | 2 +- .../massivecraft/factions/cmd/CmdUnclaim.java | 2 +- .../factions/cmd/CmdUnclaimall.java | 2 +- .../massivecraft/factions/cmd/CmdVersion.java | 2 +- .../massivecraft/factions/cmd/FCmdRoot.java | 4 +- .../massivecraft/factions/cmd/FCommand.java | 2 +- .../factions/integration/Econ.java | 10 +-- .../integration/EssentialsFeatures.java | 4 +- .../factions/integration/LWCFeatures.java | 2 +- .../factions/integration/SpoutFeatures.java | 8 +-- .../integration/SpoutMainListener.java | 6 +- .../factions/integration/Worldguard.java | 4 +- .../herochat/HerochatFeatures.java | 4 +- .../listeners/FactionsChatListener.java | 2 +- .../massivecraft/factions/struct/FPerm.java | 2 +- .../factions/struct/TerritoryAccess.java | 4 +- .../factions/util/AutoLeaveTask.java | 2 +- .../factions/util/EconLandRewardTask.java | 2 +- .../factions/util/SpiralTask.java | 4 +- 44 files changed, 139 insertions(+), 122 deletions(-) diff --git a/src/com/massivecraft/factions/Board.java b/src/com/massivecraft/factions/Board.java index 508b3bbd..2c428d45 100644 --- a/src/com/massivecraft/factions/Board.java +++ b/src/com/massivecraft/factions/Board.java @@ -23,7 +23,7 @@ import com.massivecraft.factions.zcore.util.DiscUtil; public class Board { - private static transient File file = new File(Factions.p.getDataFolder(), "board.json"); + private static transient File file = new File(Factions.get().getDataFolder(), "board.json"); private static transient HashMap flocationIds = new HashMap(); //----------------------------------------------// @@ -132,7 +132,7 @@ public class Board if(Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled()) LWCFeatures.clearAllChests(entry.getKey()); - Factions.p.log("Board cleaner removed "+entry.getValue().getHostFactionID()+" from "+entry.getKey()); + Factions.get().log("Board cleaner removed "+entry.getValue().getHostFactionID()+" from "+entry.getKey()); iter.remove(); } } @@ -188,7 +188,7 @@ public class Board { ArrayList ret = new ArrayList(); Faction factionLoc = getFactionAt(flocation); - ret.add(Factions.p.txt.titleize("("+flocation.getCoordString()+") "+factionLoc.getTag(observer))); + ret.add(Factions.get().txt.titleize("("+flocation.getCoordString()+") "+factionLoc.getTag(observer))); int halfWidth = Conf.mapWidth / 2; int halfHeight = Conf.mapHeight / 2; @@ -234,7 +234,7 @@ public class Board } // Get the compass - ArrayList asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, Factions.p.txt.parse("")); + ArrayList asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, Factions.get().txt.parse("")); // Add the compass ret.set(1, asciiCompass.get(0)+ret.get(1).substring(3*3)); @@ -309,12 +309,12 @@ public class Board try { - DiscUtil.write(file, Factions.p.gson.toJson(dumpAsSaveFormat())); + DiscUtil.write(file, Factions.get().gson.toJson(dumpAsSaveFormat())); } catch (Exception e) { e.printStackTrace(); - Factions.p.log("Failed to save the board to disk."); + Factions.get().log("Failed to save the board to disk."); return false; } @@ -323,11 +323,11 @@ public class Board public static boolean load() { - Factions.p.log("Loading board from disk"); + Factions.get().log("Loading board from disk"); if ( ! file.exists()) { - Factions.p.log("No board to load from disk. Creating new file."); + Factions.get().log("No board to load from disk. Creating new file."); save(); return true; } @@ -335,13 +335,13 @@ public class Board try { Type type = new TypeToken>>(){}.getType(); - Map> worldCoordIds = Factions.p.gson.fromJson(DiscUtil.read(file), type); + Map> worldCoordIds = Factions.get().gson.fromJson(DiscUtil.read(file), type); loadFromSaveFormat(worldCoordIds); } catch (Exception e) { e.printStackTrace(); - Factions.p.log("Failed to load the board from disk."); + Factions.get().log("Failed to load the board from disk."); return false; } diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index a758e89c..d619273f 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -347,11 +347,11 @@ public class Conf private static transient Conf i = new Conf(); public static void load() { - Factions.p.persist.loadOrSaveDefault(i, Conf.class, "conf"); + Factions.get().persist.loadOrSaveDefault(i, Conf.class, "conf"); } public static void save() { - Factions.p.persist.save(i); + Factions.get().persist.save(i); } } diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index d1b16436..5c588e84 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -453,7 +453,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator return; } Faction factionHere = Board.getFactionAt(this.getLastStoodAt()); - String msg = Factions.p.txt.parse("")+" ~ "+factionHere.getTag(this); + String msg = Factions.get().txt.parse("")+" ~ "+factionHere.getTag(this); if (factionHere.getDescription().length() > 0) { msg += " - "+factionHere.getDescription(); @@ -516,7 +516,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator } if (Conf.logFactionLeave) - Factions.p.log(this.getName()+" left the faction: "+myFaction.getTag()); + Factions.get().log(this.getName()+" left the faction: "+myFaction.getTag()); } this.resetFactionData(); @@ -531,7 +531,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator myFaction.detach(); if (Conf.logFactionDisband) - Factions.p.log("The faction "+myFaction.getTag()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving."); + Factions.get().log("The faction "+myFaction.getTag()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving."); } } @@ -546,11 +546,11 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator if (Conf.worldGuardChecking && Worldguard.checkForRegionsInChunk(location)) { // Checks for WorldGuard regions in the chunk attempting to be claimed - error = Factions.p.txt.parse("This land is protected"); + error = Factions.get().txt.parse("This land is protected"); } else if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) { - error = Factions.p.txt.parse("Sorry, this world has land claiming disabled."); + error = Factions.get().txt.parse("Sorry, this world has land claiming disabled."); } else if (this.hasAdminMode()) { @@ -558,7 +558,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator } else if (forFaction == currentFaction) { - error = Factions.p.txt.parse("%s already own this land.", forFaction.describeTo(this, true)); + error = Factions.get().txt.parse("%s already own this land.", forFaction.describeTo(this, true)); } else if ( ! FPerm.TERRITORY.has(this, forFaction, true)) { @@ -566,23 +566,23 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator } else if (forFaction.getFPlayers().size() < Conf.claimsRequireMinFactionMembers) { - error = Factions.p.txt.parse("Factions must have at least %s members to claim land.", Conf.claimsRequireMinFactionMembers); + error = Factions.get().txt.parse("Factions must have at least %s members to claim land.", Conf.claimsRequireMinFactionMembers); } else if (ownedLand >= forFaction.getPowerRounded()) { - error = Factions.p.txt.parse("You can't claim more land! You need more power!"); + error = Factions.get().txt.parse("You can't claim more land! You need more power!"); } else if (Conf.claimedLandsMax != 0 && ownedLand >= Conf.claimedLandsMax && ! forFaction.getFlag(FFlag.INFPOWER)) { - error = Factions.p.txt.parse("Limit reached. You can't claim more land!"); + error = Factions.get().txt.parse("Limit reached. You can't claim more land!"); } else if ( ! Conf.claimingFromOthersAllowed && currentFaction.isNormal()) { - error = Factions.p.txt.parse("You may not claim land from others."); + error = Factions.get().txt.parse("You may not claim land from others."); } else if (currentFaction.getRelationTo(forFaction).isAtLeast(Rel.TRUCE) && ! currentFaction.isNone()) { - error = Factions.p.txt.parse("You can't claim this land due to your relation with the current owner."); + error = Factions.get().txt.parse("You can't claim this land due to your relation with the current owner."); } else if ( @@ -594,20 +594,20 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator ) { if (Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction) - error = Factions.p.txt.parse("You can only claim additional land which is connected to your first claim or controlled by another faction!"); + error = Factions.get().txt.parse("You can only claim additional land which is connected to your first claim or controlled by another faction!"); else - error = Factions.p.txt.parse("You can only claim additional land which is connected to your first claim!"); + error = Factions.get().txt.parse("You can only claim additional land which is connected to your first claim!"); } else if (currentFaction.isNormal()) { if ( ! currentFaction.hasLandInflation()) { // TODO more messages WARN current faction most importantly - error = Factions.p.txt.parse("%s owns this land and is strong enough to keep it.", currentFaction.getTag(this)); + error = Factions.get().txt.parse("%s owns this land and is strong enough to keep it.", currentFaction.getTag(this)); } else if ( ! Board.isBorderLocation(flocation)) { - error = Factions.p.txt.parse("You must start claiming land at the border of the territory."); + error = Factions.get().txt.parse("You must start claiming land at the border of the territory."); } } @@ -673,7 +673,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator SpoutFeatures.updateTerritoryDisplayLoc(flocation); if (Conf.logLandClaims) - Factions.p.log(this.getName()+" claimed land at ("+flocation.getCoordString()+") for the faction: "+forFaction.getTag()); + Factions.get().log(this.getName()+" claimed land at ("+flocation.getCoordString()+") for the faction: "+forFaction.getTag()); return true; } @@ -692,6 +692,6 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator public void msg(String str, Object... args) { - this.sendMessage(Factions.p.txt.parse(str, args)); + this.sendMessage(Factions.get().txt.parse(str, args)); } } diff --git a/src/com/massivecraft/factions/FPlayers.java b/src/com/massivecraft/factions/FPlayers.java index ecaf09b5..eee27c96 100644 --- a/src/com/massivecraft/factions/FPlayers.java +++ b/src/com/massivecraft/factions/FPlayers.java @@ -14,7 +14,7 @@ public class FPlayers extends PlayerEntityCollection { public static FPlayers i = new FPlayers(); - Factions p = Factions.p; + Factions p = Factions.get(); private FPlayers() { @@ -23,8 +23,8 @@ public class FPlayers extends PlayerEntityCollection FPlayer.class, new CopyOnWriteArrayList(), new ConcurrentSkipListMap(String.CASE_INSENSITIVE_ORDER), - new File(Factions.p.getDataFolder(), "players.json"), - Factions.p.gson + new File(Factions.get().getDataFolder(), "players.json"), + Factions.get().gson ); this.setCreative(true); @@ -63,7 +63,7 @@ public class FPlayers extends PlayerEntityCollection if (fplayer.isOffline() && now - fplayer.getLastLoginTime() > toleranceMillis) { if (Conf.logFactionLeave || Conf.logFactionKick) - Factions.p.log("Player "+fplayer.getName()+" was auto-removed due to inactivity."); + Factions.get().log("Player "+fplayer.getName()+" was auto-removed due to inactivity."); // if player is faction leader, sort out the faction since he's going away if (fplayer.getRole() == Rel.LEADER) diff --git a/src/com/massivecraft/factions/Faction.java b/src/com/massivecraft/factions/Faction.java index 598b4831..27e23667 100644 --- a/src/com/massivecraft/factions/Faction.java +++ b/src/com/massivecraft/factions/Faction.java @@ -452,7 +452,7 @@ public class Faction extends Entity implements EconomyParticipator ArrayList ret = new ArrayList(); //if (this.isPlayerFreeType()) return ret; - for (Player player: Factions.p.getServer().getOnlinePlayers()) + for (Player player: Factions.get().getServer().getOnlinePlayers()) { FPlayer fplayer = FPlayers.i.get(player); if (fplayer.getFaction() == this) @@ -488,7 +488,7 @@ public class Faction extends Entity implements EconomyParticipator // no members left and faction isn't permanent, so disband it if (Conf.logFactionDisband) - Factions.p.log("The faction "+this.getTag()+" ("+this.getId()+") has been disbanded since it has no members left."); + Factions.get().log("The faction "+this.getTag()+" ("+this.getId()+") has been disbanded since it has no members left."); for (FPlayer fplayer : FPlayers.i.getOnline()) { @@ -503,7 +503,7 @@ public class Faction extends Entity implements EconomyParticipator oldLeader.setRole(Rel.MEMBER); replacements.get(0).setRole(Rel.LEADER); this.msg("Faction leader %s has been removed. %s has been promoted as the new faction leader.", oldLeader == null ? "" : oldLeader.getName(), replacements.get(0).getName()); - Factions.p.log("Faction "+this.getTag()+" ("+this.getId()+") leader was removed. Replacement leader: "+replacements.get(0).getName()); + Factions.get().log("Faction "+this.getTag()+" ("+this.getId()+") leader was removed. Replacement leader: "+replacements.get(0).getName()); } } @@ -512,7 +512,7 @@ public class Faction extends Entity implements EconomyParticipator //----------------------------------------------// public void msg(String message, Object... args) { - message = Factions.p.txt.parse(message, args); + message = Factions.get().txt.parse(message, args); for (FPlayer fplayer : this.getFPlayersWhereOnline(true)) { diff --git a/src/com/massivecraft/factions/FactionColl.java b/src/com/massivecraft/factions/FactionColl.java index 23ef14df..bf4973ab 100644 --- a/src/com/massivecraft/factions/FactionColl.java +++ b/src/com/massivecraft/factions/FactionColl.java @@ -23,7 +23,7 @@ public class FactionColl extends EntityCollection { public static FactionColl i = new FactionColl(); - Factions p = Factions.p; + Factions p = Factions.get(); private FactionColl() { @@ -32,8 +32,8 @@ public class FactionColl extends EntityCollection Faction.class, new CopyOnWriteArrayList(), new ConcurrentHashMap(), - new File(Factions.p.getDataFolder(), "factions.json"), - Factions.p.gson + new File(Factions.get().getDataFolder(), "factions.json"), + Factions.get().gson ); } @@ -209,19 +209,19 @@ public class FactionColl extends EntityCollection if(MiscUtil.getComparisonString(str).length() < Conf.factionTagLengthMin) { - errors.add(Factions.p.txt.parse("The faction tag can't be shorter than %s chars.", Conf.factionTagLengthMin)); + errors.add(Factions.get().txt.parse("The faction tag can't be shorter than %s chars.", Conf.factionTagLengthMin)); } if(str.length() > Conf.factionTagLengthMax) { - errors.add(Factions.p.txt.parse("The faction tag can't be longer than %s chars.", Conf.factionTagLengthMax)); + errors.add(Factions.get().txt.parse("The faction tag can't be longer than %s chars.", Conf.factionTagLengthMax)); } for (char c : str.toCharArray()) { if ( ! MiscUtil.substanceChars.contains(String.valueOf(c))) { - errors.add(Factions.p.txt.parse("Faction tag must be alphanumeric. \"%s\" is not allowed.", c)); + errors.add(Factions.get().txt.parse("Faction tag must be alphanumeric. \"%s\" is not allowed.", c)); } } @@ -265,7 +265,7 @@ public class FactionColl extends EntityCollection { if ( ! Econ.shouldBeUsed()) return; - Factions.p.log("Running econLandRewardRoutine..."); + Factions.get().log("Running econLandRewardRoutine..."); for (Faction faction : this.get()) { int landCount = faction.getLandRounded(); diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/Factions.java index 460f0919..56bc207e 100644 --- a/src/com/massivecraft/factions/Factions.java +++ b/src/com/massivecraft/factions/Factions.java @@ -46,17 +46,26 @@ import org.bukkit.craftbukkit.libs.com.google.gson.GsonBuilder; public class Factions extends MPlugin { - // Our single plugin instance - public static Factions p; + // -------------------------------------------- // + // INSTANCE & CONSTRUCT + // -------------------------------------------- // + + private static Factions i; + public static Factions get() { return i; } + public Factions() { Factions.i = this; } + + // -------------------------------------------- // + // FIELDS + // -------------------------------------------- // // Listeners - public final FactionsPlayerListener playerListener; - public final FactionsChatListener chatListener; - public final FactionsEntityListener entityListener; - public final FactionsExploitListener exploitListener; - public final FactionsBlockListener blockListener; - public final FactionsServerListener serverListener; - public final FactionsAppearanceListener appearanceListener; + public FactionsPlayerListener playerListener; + public FactionsChatListener chatListener; + public FactionsEntityListener entityListener; + public FactionsExploitListener exploitListener; + public FactionsBlockListener blockListener; + public FactionsServerListener serverListener; + public FactionsAppearanceListener appearanceListener; // Persistance related private boolean locked = false; @@ -68,19 +77,11 @@ public class Factions extends MPlugin // Commands public FCmdRoot cmdBase; public CmdAutoHelp cmdAutoHelp; - - public Factions() - { - p = this; - this.playerListener = new FactionsPlayerListener(this); - this.chatListener = new FactionsChatListener(this); - this.entityListener = new FactionsEntityListener(this); - this.exploitListener = new FactionsExploitListener(); - this.blockListener = new FactionsBlockListener(this); - this.serverListener = new FactionsServerListener(this); - this.appearanceListener = new FactionsAppearanceListener(this); - } + // -------------------------------------------- // + // OVERRIDE + // -------------------------------------------- // + @Override public void onEnable() { @@ -127,14 +128,27 @@ public class Factions extends MPlugin startEconLandRewardTask(false); // Register Event Handlers + this.playerListener = new FactionsPlayerListener(this); getServer().getPluginManager().registerEvents(this.playerListener, this); + + this.chatListener = new FactionsChatListener(this); getServer().getPluginManager().registerEvents(this.chatListener, this); + + this.entityListener = new FactionsEntityListener(this); getServer().getPluginManager().registerEvents(this.entityListener, this); + + this.exploitListener = new FactionsExploitListener(); getServer().getPluginManager().registerEvents(this.exploitListener, this); + + this.blockListener = new FactionsBlockListener(this); getServer().getPluginManager().registerEvents(this.blockListener, this); + + this.serverListener = new FactionsServerListener(this); getServer().getPluginManager().registerEvents(this.serverListener, this); + + this.appearanceListener = new FactionsAppearanceListener(this); getServer().getPluginManager().registerEvents(this.appearanceListener, this); - + postEnable(); this.loadSuccessful = true; } @@ -171,6 +185,9 @@ public class Factions extends MPlugin super.onDisable(); } + + + public void startAutoLeaveTask(boolean restartIfRunning) { if (AutoLeaveTask != null) diff --git a/src/com/massivecraft/factions/Perm.java b/src/com/massivecraft/factions/Perm.java index aaba125f..319be9fd 100644 --- a/src/com/massivecraft/factions/Perm.java +++ b/src/com/massivecraft/factions/Perm.java @@ -91,7 +91,7 @@ public enum Perm public boolean has(CommandSender sender, boolean informSenderIfNot) { - return Factions.p.perm.has(sender, this.node, informSenderIfNot); + return Factions.get().perm.has(sender, this.node, informSenderIfNot); } public boolean has(CommandSender sender) diff --git a/src/com/massivecraft/factions/adapters/LocationTypeAdapter.java b/src/com/massivecraft/factions/adapters/LocationTypeAdapter.java index 0c2f08f6..bb3b52b8 100644 --- a/src/com/massivecraft/factions/adapters/LocationTypeAdapter.java +++ b/src/com/massivecraft/factions/adapters/LocationTypeAdapter.java @@ -44,7 +44,7 @@ public class LocationTypeAdapter implements JsonDeserializer, Json catch (Exception ex) { ex.printStackTrace(); - Factions.p.log(Level.WARNING, "Error encountered while deserializing a LazyLocation."); + Factions.get().log(Level.WARNING, "Error encountered while deserializing a LazyLocation."); return null; } } @@ -67,7 +67,7 @@ public class LocationTypeAdapter implements JsonDeserializer, Json catch (Exception ex) { ex.printStackTrace(); - Factions.p.log(Level.WARNING, "Error encountered while serializing a LazyLocation."); + Factions.get().log(Level.WARNING, "Error encountered while serializing a LazyLocation."); return obj; } } diff --git a/src/com/massivecraft/factions/cmd/CmdAdmin.java b/src/com/massivecraft/factions/cmd/CmdAdmin.java index 72d08ba9..435a39f2 100644 --- a/src/com/massivecraft/factions/cmd/CmdAdmin.java +++ b/src/com/massivecraft/factions/cmd/CmdAdmin.java @@ -30,12 +30,12 @@ public class CmdAdmin extends FCommand if ( fme.hasAdminMode()) { fme.msg("You have enabled admin bypass mode."); - Factions.p.log(fme.getName() + " has ENABLED admin bypass mode."); + Factions.get().log(fme.getName() + " has ENABLED admin bypass mode."); } else { fme.msg("You have disabled admin bypass mode."); - Factions.p.log(fme.getName() + " DISABLED admin bypass mode."); + Factions.get().log(fme.getName() + " DISABLED admin bypass mode."); } } } diff --git a/src/com/massivecraft/factions/cmd/CmdAutoHelp.java b/src/com/massivecraft/factions/cmd/CmdAutoHelp.java index df70571e..ffb694fd 100644 --- a/src/com/massivecraft/factions/cmd/CmdAutoHelp.java +++ b/src/com/massivecraft/factions/cmd/CmdAutoHelp.java @@ -10,7 +10,7 @@ public class CmdAutoHelp extends MCommand { public CmdAutoHelp() { - super(Factions.p); + super(Factions.get()); this.aliases.add("?"); this.aliases.add("h"); this.aliases.add("help"); diff --git a/src/com/massivecraft/factions/cmd/CmdCape.java b/src/com/massivecraft/factions/cmd/CmdCape.java index 9612bd9e..fd4a3bd3 100644 --- a/src/com/massivecraft/factions/cmd/CmdCape.java +++ b/src/com/massivecraft/factions/cmd/CmdCape.java @@ -30,7 +30,7 @@ public class CmdCape extends FCommand public void perform() { this.commandChain.add(this); - Factions.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); + Factions.get().cmdAutoHelp.execute(this.sender, this.args, this.commandChain); } } diff --git a/src/com/massivecraft/factions/cmd/CmdConfig.java b/src/com/massivecraft/factions/cmd/CmdConfig.java index f0cfe5d8..15090e7a 100644 --- a/src/com/massivecraft/factions/cmd/CmdConfig.java +++ b/src/com/massivecraft/factions/cmd/CmdConfig.java @@ -386,7 +386,7 @@ public class CmdConfig extends FCommand sendMessage(success); if (sender instanceof Player) { - Factions.p.log(success + " Command was run by "+fme.getName()+"."); + Factions.get().log(success + " Command was run by "+fme.getName()+"."); } } // save change to disk diff --git a/src/com/massivecraft/factions/cmd/CmdCreate.java b/src/com/massivecraft/factions/cmd/CmdCreate.java index 09a4dac2..f08c3a71 100644 --- a/src/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/com/massivecraft/factions/cmd/CmdCreate.java @@ -98,7 +98,7 @@ public class CmdCreate extends FCommand msg("You should now: %s", p.cmdBase.cmdDescription.getUseageTemplate()); if (Conf.logFactionCreate) - Factions.p.log(fme.getName()+" created a new faction: "+tag); + Factions.get().log(fme.getName()+" created a new faction: "+tag); } } diff --git a/src/com/massivecraft/factions/cmd/CmdDisband.java b/src/com/massivecraft/factions/cmd/CmdDisband.java index f8fbe29b..bebd6d89 100644 --- a/src/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdDisband.java @@ -73,7 +73,7 @@ public class CmdDisband extends FCommand } } if (Conf.logFactionDisband) - Factions.p.log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+"."); + Factions.get().log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+"."); if (Econ.shouldBeUsed() && ! senderIsConsole) { @@ -85,7 +85,7 @@ public class CmdDisband extends FCommand { String amountString = Econ.moneyString(amount); msg("You have been given the disbanded faction's bank, totaling %s.", amountString); - Factions.p.log(fme.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+"."); + Factions.get().log(fme.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+"."); } } diff --git a/src/com/massivecraft/factions/cmd/CmdHelp.java b/src/com/massivecraft/factions/cmd/CmdHelp.java index d9b9a803..ba8d7227 100644 --- a/src/com/massivecraft/factions/cmd/CmdHelp.java +++ b/src/com/massivecraft/factions/cmd/CmdHelp.java @@ -162,7 +162,7 @@ public class CmdHelp extends FCommand pageLines.add(p.txt.parse("/f claim safezone claim land for the Safe Zone")); pageLines.add(p.txt.parse("/f claim warzone claim land for the War Zone")); pageLines.add(p.txt.parse("/f autoclaim [safezone|warzone] take a guess")); - pageLines.add(p.txt.parse("Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + Factions.p.txt.parse("") + " works on safe/war zones as well.")); + pageLines.add(p.txt.parse("Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + Factions.get().txt.parse("") + " works on safe/war zones as well.")); helpPages.add(pageLines); pageLines = new ArrayList(); diff --git a/src/com/massivecraft/factions/cmd/CmdJoin.java b/src/com/massivecraft/factions/cmd/CmdJoin.java index ef065bdf..72d8c4f7 100644 --- a/src/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdJoin.java @@ -103,9 +103,9 @@ public class CmdJoin extends FCommand if (Conf.logFactionJoin) { if (samePlayer) - Factions.p.log("%s joined the faction %s.", fplayer.getName(), faction.getTag()); + Factions.get().log("%s joined the faction %s.", fplayer.getName(), faction.getTag()); else - Factions.p.log("%s moved the player %s into the faction %s.", fme.getName(), fplayer.getName(), faction.getTag()); + Factions.get().log("%s moved the player %s into the faction %s.", fme.getName(), fplayer.getName(), faction.getTag()); } } } diff --git a/src/com/massivecraft/factions/cmd/CmdKick.java b/src/com/massivecraft/factions/cmd/CmdKick.java index 6b37ca2b..38ac0eda 100644 --- a/src/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/com/massivecraft/factions/cmd/CmdKick.java @@ -79,7 +79,7 @@ public class CmdKick extends FCommand } if (Conf.logFactionKick) - Factions.p.log((senderIsConsole ? "A console command" : fme.getName())+" kicked "+you.getName()+" from the faction: "+yourFaction.getTag()); + Factions.get().log((senderIsConsole ? "A console command" : fme.getName())+" kicked "+you.getName()+" from the faction: "+yourFaction.getTag()); if (you.getRole() == Rel.LEADER) yourFaction.promoteNewLeader(); diff --git a/src/com/massivecraft/factions/cmd/CmdMoney.java b/src/com/massivecraft/factions/cmd/CmdMoney.java index 4a6b71ef..860ec4ec 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoney.java +++ b/src/com/massivecraft/factions/cmd/CmdMoney.java @@ -41,7 +41,7 @@ public class CmdMoney extends FCommand public void perform() { this.commandChain.add(this); - Factions.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); + Factions.get().cmdAutoHelp.execute(this.sender, this.args, this.commandChain); } } diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java b/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java index 20f37bf8..0e4d51e0 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java @@ -39,7 +39,7 @@ public class CmdMoneyDeposit extends FCommand boolean success = Econ.transferMoney(fme, fme, faction, amount); if (success && Conf.logMoneyTransactions) - Factions.p.log(ChatColor.stripColor(Factions.p.txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java index f8759a25..50831a01 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java @@ -42,6 +42,6 @@ public class CmdMoneyTransferFf extends FCommand boolean success = Econ.transferMoney(fme, from, to, amount); if (success && Conf.logMoneyTransactions) - Factions.p.log(ChatColor.stripColor(Factions.p.txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java index 2ab73dd8..505d56b3 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java @@ -42,6 +42,6 @@ public class CmdMoneyTransferFp extends FCommand boolean success = Econ.transferMoney(fme, from, to, amount); if (success && Conf.logMoneyTransactions) - Factions.p.log(ChatColor.stripColor(Factions.p.txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java b/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java index ef65cf2f..193de3c0 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java @@ -42,6 +42,6 @@ public class CmdMoneyTransferPf extends FCommand boolean success = Econ.transferMoney(fme, from, to, amount); if (success && Conf.logMoneyTransactions) - Factions.p.log(ChatColor.stripColor(Factions.p.txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java b/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java index 065f1528..2e5eff4a 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java @@ -37,6 +37,6 @@ public class CmdMoneyWithdraw extends FCommand boolean success = Econ.transferMoney(fme, faction, fme, amount); if (success && Conf.logMoneyTransactions) - Factions.p.log(ChatColor.stripColor(Factions.p.txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdPowerBoost.java b/src/com/massivecraft/factions/cmd/CmdPowerBoost.java index d86f8034..be8c4133 100644 --- a/src/com/massivecraft/factions/cmd/CmdPowerBoost.java +++ b/src/com/massivecraft/factions/cmd/CmdPowerBoost.java @@ -67,6 +67,6 @@ public class CmdPowerBoost extends FCommand msg(""+target+" now has a power bonus/penalty of "+targetPower+" to min and max power levels."); if (!senderIsConsole) - Factions.p.log(fme.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+"."); + Factions.get().log(fme.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+"."); } } diff --git a/src/com/massivecraft/factions/cmd/CmdReload.java b/src/com/massivecraft/factions/cmd/CmdReload.java index 2649321b..8ce46a77 100644 --- a/src/com/massivecraft/factions/cmd/CmdReload.java +++ b/src/com/massivecraft/factions/cmd/CmdReload.java @@ -65,7 +65,7 @@ public class CmdReload extends FCommand } else { - Factions.p.log("RELOAD CANCELLED - SPECIFIED FILE INVALID"); + Factions.get().log("RELOAD CANCELLED - SPECIFIED FILE INVALID"); msg("Invalid file specified. Valid files: all, conf, board, factions, players"); return; } diff --git a/src/com/massivecraft/factions/cmd/CmdUnclaim.java b/src/com/massivecraft/factions/cmd/CmdUnclaim.java index 6d4289ad..d290a981 100644 --- a/src/com/massivecraft/factions/cmd/CmdUnclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdUnclaim.java @@ -64,7 +64,7 @@ public class CmdUnclaim extends FCommand myFaction.msg("%s unclaimed some land.", fme.describeTo(myFaction, true)); if (Conf.logLandUnclaims) - Factions.p.log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag()); + Factions.get().log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag()); } } diff --git a/src/com/massivecraft/factions/cmd/CmdUnclaimall.java b/src/com/massivecraft/factions/cmd/CmdUnclaimall.java index 2e83a430..a486fcb7 100644 --- a/src/com/massivecraft/factions/cmd/CmdUnclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdUnclaimall.java @@ -54,7 +54,7 @@ public class CmdUnclaimall extends FCommand SpoutFeatures.updateTerritoryDisplayLoc(null); if (Conf.logLandUnclaims) - Factions.p.log(fme.getName()+" unclaimed everything for the faction: "+myFaction.getTag()); + Factions.get().log(fme.getName()+" unclaimed everything for the faction: "+myFaction.getTag()); } } diff --git a/src/com/massivecraft/factions/cmd/CmdVersion.java b/src/com/massivecraft/factions/cmd/CmdVersion.java index dd32e8ea..8dade371 100644 --- a/src/com/massivecraft/factions/cmd/CmdVersion.java +++ b/src/com/massivecraft/factions/cmd/CmdVersion.java @@ -25,6 +25,6 @@ public class CmdVersion extends FCommand @Override public void perform() { - msg("You are running "+Factions.p.getDescription().getFullName()); + msg("You are running "+Factions.get().getDescription().getFullName()); } } diff --git a/src/com/massivecraft/factions/cmd/FCmdRoot.java b/src/com/massivecraft/factions/cmd/FCmdRoot.java index 9225d448..25365046 100644 --- a/src/com/massivecraft/factions/cmd/FCmdRoot.java +++ b/src/com/massivecraft/factions/cmd/FCmdRoot.java @@ -69,7 +69,7 @@ public class FCmdRoot extends FCommand this.setHelpShort("The faction base command"); this.helpLong.add(p.txt.parseTags("This command contains all faction stuff.")); - this.addSubCommand(Factions.p.cmdAutoHelp); + this.addSubCommand(Factions.get().cmdAutoHelp); this.addSubCommand(this.cmdList); this.addSubCommand(this.cmdShow); this.addSubCommand(this.cmdPower); @@ -118,7 +118,7 @@ public class FCmdRoot extends FCommand public void perform() { this.commandChain.add(this); - Factions.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); + Factions.get().cmdAutoHelp.execute(this.sender, this.args, this.commandChain); } } diff --git a/src/com/massivecraft/factions/cmd/FCommand.java b/src/com/massivecraft/factions/cmd/FCommand.java index bb6967d2..3b756279 100644 --- a/src/com/massivecraft/factions/cmd/FCommand.java +++ b/src/com/massivecraft/factions/cmd/FCommand.java @@ -32,7 +32,7 @@ public abstract class FCommand extends MCommand public FCommand() { - super(Factions.p); + super(Factions.get()); // Due to safety reasons it defaults to disable on lock. disableOnLock = true; diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 628f91b8..baffd407 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -32,22 +32,22 @@ public class Econ if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) { - Factions.p.log(integrationFail+"is not installed."); + Factions.get().log(integrationFail+"is not installed."); return; } RegisteredServiceProvider rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { - Factions.p.log(integrationFail+"is not hooked into an economy plugin."); + Factions.get().log(integrationFail+"is not hooked into an economy plugin."); return; } econ = rsp.getProvider(); - Factions.p.log("Economy integration through Vault plugin successful."); + Factions.get().log("Economy integration through Vault plugin successful."); if ( ! Conf.econEnabled) - Factions.p.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true"); + Factions.get().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true"); oldMoneyDoTransfer(); } @@ -78,7 +78,7 @@ public class Econ { if (!shouldBeUsed()) { - Factions.p.log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin."); + Factions.get().log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin."); return; } to.msg("%s's balance is %s.", about.describeTo(to, true), Econ.moneyString(econ.getBalance(about.getAccountId()))); diff --git a/src/com/massivecraft/factions/integration/EssentialsFeatures.java b/src/com/massivecraft/factions/integration/EssentialsFeatures.java index cc25fa30..b7b8720b 100644 --- a/src/com/massivecraft/factions/integration/EssentialsFeatures.java +++ b/src/com/massivecraft/factions/integration/EssentialsFeatures.java @@ -92,8 +92,8 @@ public class EssentialsFeatures essChat = instance; try { - Bukkit.getServer().getPluginManager().registerEvents(new LocalChatListener(), Factions.p); - Factions.p.log("Found and will integrate chat with newer "+essChat.getDescription().getFullName()); + Bukkit.getServer().getPluginManager().registerEvents(new LocalChatListener(), Factions.get()); + Factions.get().log("Found and will integrate chat with newer "+essChat.getDescription().getFullName()); } catch (NoSuchMethodError ex) { diff --git a/src/com/massivecraft/factions/integration/LWCFeatures.java b/src/com/massivecraft/factions/integration/LWCFeatures.java index 76e3a83f..a47731e2 100644 --- a/src/com/massivecraft/factions/integration/LWCFeatures.java +++ b/src/com/massivecraft/factions/integration/LWCFeatures.java @@ -29,7 +29,7 @@ public class LWCFeatures if(test == null || !test.isEnabled()) return; lwc = ((LWCPlugin)test).getLWC(); - Factions.p.log("Successfully hooked into LWC!"+(Conf.lwcIntegration ? "" : " Integration is currently disabled, though (\"lwcIntegration\").")); + Factions.get().log("Successfully hooked into LWC!"+(Conf.lwcIntegration ? "" : " Integration is currently disabled, though (\"lwcIntegration\").")); } public static boolean getEnabled() diff --git a/src/com/massivecraft/factions/integration/SpoutFeatures.java b/src/com/massivecraft/factions/integration/SpoutFeatures.java index c2b10363..0bc742b7 100644 --- a/src/com/massivecraft/factions/integration/SpoutFeatures.java +++ b/src/com/massivecraft/factions/integration/SpoutFeatures.java @@ -50,9 +50,9 @@ public class SpoutFeatures if (enabled == true) return true; enabled = true; - Factions.p.log("Found and will use features of "+plugin.getDescription().getFullName()); + Factions.get().log("Found and will use features of "+plugin.getDescription().getFullName()); mainListener = new SpoutMainListener(); - Bukkit.getPluginManager().registerEvents(mainListener, Factions.p); + Bukkit.getPluginManager().registerEvents(mainListener, Factions.get()); return true; } @@ -112,7 +112,7 @@ public class SpoutFeatures public static void updateCapeShortly(final Object ofrom, final Object oto) { - Factions.p.getServer().getScheduler().scheduleSyncDelayedTask(Factions.p, new Runnable() + Factions.get().getServer().getScheduler().scheduleSyncDelayedTask(Factions.get(), new Runnable() { @Override public void run() @@ -168,7 +168,7 @@ public class SpoutFeatures public static void updateTitleShortly(final Object ofrom, final Object oto) { - Factions.p.getServer().getScheduler().scheduleSyncDelayedTask(Factions.p, new Runnable() + Factions.get().getServer().getScheduler().scheduleSyncDelayedTask(Factions.get(), new Runnable() { @Override public void run() diff --git a/src/com/massivecraft/factions/integration/SpoutMainListener.java b/src/com/massivecraft/factions/integration/SpoutMainListener.java index 473c5df5..c8523d3d 100644 --- a/src/com/massivecraft/factions/integration/SpoutMainListener.java +++ b/src/com/massivecraft/factions/integration/SpoutMainListener.java @@ -107,7 +107,7 @@ public class SpoutMainListener implements Listener label.setWidth(1).setHeight(1); // prevent Spout's questionable new "no default size" warning label.setScale(Conf.spoutTerritoryDisplaySize); - sPlayer.getMainScreen().attachWidget(Factions.p, label); + sPlayer.getMainScreen().attachWidget(Factions.get(), label); territoryLabels.put(player.getName(), label); } @@ -135,7 +135,7 @@ public class SpoutMainListener implements Listener label.setWidth(1).setHeight(1); // prevent Spout's questionable new "no default size" warning label.setScale(Conf.spoutTerritoryNoticeSize); label.setY(Conf.spoutTerritoryNoticeTop); - sPlayer.getMainScreen().attachWidget(Factions.p, label); + sPlayer.getMainScreen().attachWidget(Factions.get(), label); territoryChangeLabels.put(player.getName(), label); } @@ -172,7 +172,7 @@ public class SpoutMainListener implements Listener label.setWidth(1).setHeight(1); // prevent Spout's questionable new "no default size" warning label.setScale(Conf.spoutTerritoryDisplaySize); label.setY((int)(10 * Conf.spoutTerritoryDisplaySize)); - sPlayer.getMainScreen().attachWidget(Factions.p, label); + sPlayer.getMainScreen().attachWidget(Factions.get(), label); accessLabels.put(player.getName(), label); } diff --git a/src/com/massivecraft/factions/integration/Worldguard.java b/src/com/massivecraft/factions/integration/Worldguard.java index 2cc9f577..b1457c73 100644 --- a/src/com/massivecraft/factions/integration/Worldguard.java +++ b/src/com/massivecraft/factions/integration/Worldguard.java @@ -39,13 +39,13 @@ public class Worldguard { enabled = false; wg = null; - Factions.p.log("Could not hook to WorldGuard. WorldGuard checks are disabled."); + Factions.get().log("Could not hook to WorldGuard. WorldGuard checks are disabled."); } else { wg = (WorldGuardPlugin) wgplug; enabled = true; - Factions.p.log("Successfully hooked to WorldGuard."); + Factions.get().log("Successfully hooked to WorldGuard."); } } diff --git a/src/com/massivecraft/factions/integration/herochat/HerochatFeatures.java b/src/com/massivecraft/factions/integration/herochat/HerochatFeatures.java index a9a3260d..9f9b6b80 100644 --- a/src/com/massivecraft/factions/integration/herochat/HerochatFeatures.java +++ b/src/com/massivecraft/factions/integration/herochat/HerochatFeatures.java @@ -13,7 +13,7 @@ public class HerochatFeatures implements Listener Plugin plug = Bukkit.getServer().getPluginManager().getPlugin("Herochat"); if (plug == null) return; if (!plug.getClass().getName().equals("com.dthielke.herochat.Herochat")) return; - Bukkit.getPluginManager().registerEvents(new HerochatListener(Factions.p), Factions.p); - Factions.p.log("Integration with Herochat successful"); + Bukkit.getPluginManager().registerEvents(new HerochatListener(Factions.get()), Factions.get()); + Factions.get().log("Integration with Herochat successful"); } } diff --git a/src/com/massivecraft/factions/listeners/FactionsChatListener.java b/src/com/massivecraft/factions/listeners/FactionsChatListener.java index d8e49478..bb002b6e 100644 --- a/src/com/massivecraft/factions/listeners/FactionsChatListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsChatListener.java @@ -46,7 +46,7 @@ public class FactionsChatListener implements Listener } catch (Exception e) { - Factions.p.log(Level.SEVERE, "A reflection trick is broken! This will lead to glitchy relation-colored-chat."); + Factions.get().log(Level.SEVERE, "A reflection trick is broken! This will lead to glitchy relation-colored-chat."); } parsePattern = Pattern.compile("[{\\[]factions?_([a-zA-Z_]+)[}\\]]"); diff --git a/src/com/massivecraft/factions/struct/FPerm.java b/src/com/massivecraft/factions/struct/FPerm.java index 9df7c3db..2e062a39 100644 --- a/src/com/massivecraft/factions/struct/FPerm.java +++ b/src/com/massivecraft/factions/struct/FPerm.java @@ -170,7 +170,7 @@ public enum FPerm fplayer.msg(errorpattern, hostFaction.describeTo(fplayer, true), this.getDescription()); if (Perm.ADMIN.has(fplayer.getPlayer())) { - fplayer.msg("You can bypass by using " + Factions.p.cmdBase.cmdBypass.getUseageTemplate(false)); + fplayer.msg("You can bypass by using " + Factions.get().cmdBase.cmdBypass.getUseageTemplate(false)); } } return ret; diff --git a/src/com/massivecraft/factions/struct/TerritoryAccess.java b/src/com/massivecraft/factions/struct/TerritoryAccess.java index 487cd31d..f1f7007c 100644 --- a/src/com/massivecraft/factions/struct/TerritoryAccess.java +++ b/src/com/massivecraft/factions/struct/TerritoryAccess.java @@ -262,7 +262,7 @@ public class TerritoryAccess implements JsonDeserializer, JsonS catch (Exception ex) { ex.printStackTrace(); - Factions.p.log(Level.WARNING, "Error encountered while deserializing TerritoryAccess data."); + Factions.get().log(Level.WARNING, "Error encountered while deserializing TerritoryAccess data."); return null; } } @@ -313,7 +313,7 @@ public class TerritoryAccess implements JsonDeserializer, JsonS catch (Exception ex) { ex.printStackTrace(); - Factions.p.log(Level.WARNING, "Error encountered while serializing TerritoryAccess data."); + Factions.get().log(Level.WARNING, "Error encountered while serializing TerritoryAccess data."); return null; } } diff --git a/src/com/massivecraft/factions/util/AutoLeaveTask.java b/src/com/massivecraft/factions/util/AutoLeaveTask.java index 89014be0..e02f22d1 100644 --- a/src/com/massivecraft/factions/util/AutoLeaveTask.java +++ b/src/com/massivecraft/factions/util/AutoLeaveTask.java @@ -19,6 +19,6 @@ public class AutoLeaveTask implements Runnable // maybe setting has been changed? if so, restart task at new rate if (this.rate != Conf.autoLeaveRoutineRunsEveryXMinutes) - Factions.p.startAutoLeaveTask(true); + Factions.get().startAutoLeaveTask(true); } } diff --git a/src/com/massivecraft/factions/util/EconLandRewardTask.java b/src/com/massivecraft/factions/util/EconLandRewardTask.java index 0563b8cf..6799e3c5 100644 --- a/src/com/massivecraft/factions/util/EconLandRewardTask.java +++ b/src/com/massivecraft/factions/util/EconLandRewardTask.java @@ -19,7 +19,7 @@ public class EconLandRewardTask implements Runnable { FactionColl.i.econLandRewardRoutine(); // maybe setting has been changed? if so, restart task at new rate if (this.rate != Conf.econLandRewardTaskRunsEveryXMinutes) - Factions.p.startEconLandRewardTask(true); + Factions.get().startEconLandRewardTask(true); } } diff --git a/src/com/massivecraft/factions/util/SpiralTask.java b/src/com/massivecraft/factions/util/SpiralTask.java index ef8917df..0ae41398 100644 --- a/src/com/massivecraft/factions/util/SpiralTask.java +++ b/src/com/massivecraft/factions/util/SpiralTask.java @@ -48,7 +48,7 @@ public abstract class SpiralTask implements Runnable this.world = Bukkit.getWorld(fLocation.getWorldName()); if (this.world == null) { - Factions.p.log(Level.WARNING, "[SpiralTask] A valid world must be specified!"); + Factions.get().log(Level.WARNING, "[SpiralTask] A valid world must be specified!"); this.stop(); return; } @@ -59,7 +59,7 @@ public abstract class SpiralTask implements Runnable this.readyToGo = true; // get this party started - this.setTaskID(Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Factions.p, this, 2, 2)); + this.setTaskID(Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Factions.get(), this, 2, 2)); } /*