From f2892fdef30fd01129fc13806e98afb65bb361fb Mon Sep 17 00:00:00 2001 From: Driftay Date: Fri, 2 Aug 2019 17:01:33 -0400 Subject: [PATCH] Main Class Renamed and Instance Method --- javadoc/com/massivecraft/factions/P.html | 2 +- src/main/java/META-INF/MANIFEST.MF | 3 - .../java/com/massivecraft/factions/Conf.java | 8 +- .../factions/{SaberFactions.java => P.java} | 36 ++-- .../factions/cmd/CmdAutoHelp.java | 6 +- .../com/massivecraft/factions/cmd/CmdBan.java | 4 +- .../massivecraft/factions/cmd/CmdBanner.java | 20 +- .../massivecraft/factions/cmd/CmdBypass.java | 6 +- .../massivecraft/factions/cmd/CmdChatSpy.java | 6 +- .../factions/cmd/CmdCheckpoint.java | 2 +- .../massivecraft/factions/cmd/CmdChest.java | 4 +- .../massivecraft/factions/cmd/CmdConfig.java | 8 +- .../massivecraft/factions/cmd/CmdCreate.java | 8 +- .../factions/cmd/CmdDelFWarp.java | 4 +- .../massivecraft/factions/cmd/CmdDisband.java | 6 +- .../massivecraft/factions/cmd/CmdFWarp.java | 4 +- .../com/massivecraft/factions/cmd/CmdFly.java | 18 +- .../massivecraft/factions/cmd/CmdFocus.java | 4 +- .../factions/cmd/CmdGetVault.java | 8 +- .../massivecraft/factions/cmd/CmdGrace.java | 4 +- .../massivecraft/factions/cmd/CmdHelp.java | 12 +- .../factions/cmd/CmdInventorySee.java | 4 +- .../massivecraft/factions/cmd/CmdJoin.java | 6 +- .../massivecraft/factions/cmd/CmdKick.java | 8 +- .../massivecraft/factions/cmd/CmdList.java | 4 +- .../massivecraft/factions/cmd/CmdNear.java | 6 +- .../massivecraft/factions/cmd/CmdOpen.java | 4 +- .../factions/cmd/CmdPaypalSee.java | 6 +- .../factions/cmd/CmdPaypalSet.java | 6 +- .../massivecraft/factions/cmd/CmdPerm.java | 4 +- .../factions/cmd/CmdPermanent.java | 4 +- .../factions/cmd/CmdPowerBoost.java | 4 +- .../massivecraft/factions/cmd/CmdReload.java | 10 +- .../massivecraft/factions/cmd/CmdRules.java | 10 +- .../factions/cmd/CmdSeeChunk.java | 11 +- .../factions/cmd/CmdSetFWarp.java | 6 +- .../massivecraft/factions/cmd/CmdShow.java | 6 +- .../massivecraft/factions/cmd/CmdStuck.java | 30 +-- .../com/massivecraft/factions/cmd/CmdTag.java | 2 +- .../com/massivecraft/factions/cmd/CmdTnt.java | 8 +- .../massivecraft/factions/cmd/CmdTntFill.java | 14 +- .../factions/cmd/CmdTpBanner.java | 4 +- .../factions/cmd/CmdUpgrades.java | 4 +- .../massivecraft/factions/cmd/CmdVault.java | 4 +- .../massivecraft/factions/cmd/CmdVersion.java | 6 +- .../factions/cmd/CmdViewChest.java | 4 +- .../massivecraft/factions/cmd/FCmdRoot.java | 24 +-- .../massivecraft/factions/cmd/FCommand.java | 4 +- .../factions/cmd/alts/CmdAlts.java | 6 +- .../factions/cmd/alts/CmdAltsList.java | 4 +- .../factions/cmd/alts/CmdInviteAlt.java | 4 +- .../factions/cmd/claim/CmdCorner.java | 4 +- .../factions/cmd/claim/CmdSafeunclaimall.java | 4 +- .../factions/cmd/claim/CmdUnclaim.java | 10 +- .../factions/cmd/claim/CmdUnclaimall.java | 6 +- .../factions/cmd/claim/CmdWarunclaimall.java | 4 +- .../factions/cmd/econ/CmdMoney.java | 4 +- .../factions/cmd/econ/CmdMoneyDeposit.java | 4 +- .../factions/cmd/econ/CmdMoneyTransferFf.java | 4 +- .../factions/cmd/econ/CmdMoneyTransferFp.java | 4 +- .../factions/cmd/econ/CmdMoneyTransferPf.java | 4 +- .../factions/cmd/econ/CmdMoneyWithdraw.java | 4 +- .../factions/cmd/logout/LogoutHandler.java | 6 +- .../factions/cmd/points/CmdPoints.java | 6 +- .../cmd/relational/FRelationCommand.java | 6 +- .../factions/integration/Econ.java | 14 +- .../factions/integration/Worldguard.java | 6 +- .../integration/dynmap/EngineDynmap.java | 2 +- .../listeners/FactionsBlockListener.java | 48 ++--- .../listeners/FactionsChatListener.java | 8 +- .../listeners/FactionsEntityListener.java | 9 +- .../listeners/FactionsExploitListener.java | 4 +- .../listeners/FactionsPlayerListener.java | 58 +++--- .../factions/scoreboards/FScoreboard.java | 6 +- .../scoreboards/FSidebarProvider.java | 4 +- .../factions/scoreboards/FTeamWrapper.java | 16 +- .../scoreboards/sidebar/FDefaultSidebar.java | 8 +- .../scoreboards/sidebar/FInfoSidebar.java | 4 +- .../factions/struct/Permission.java | 4 +- .../factions/struct/Relation.java | 4 +- .../massivecraft/factions/struct/Role.java | 6 +- .../factions/util/AutoLeaveProcessTask.java | 4 +- .../factions/util/AutoLeaveTask.java | 6 +- .../util/ClipPlaceholderAPIManager.java | 6 +- .../factions/util/LocationTypeAdapter.java | 6 +- .../util/MapFLocToStringSetTypeAdapter.java | 6 +- .../massivecraft/factions/util/MiscUtil.java | 10 +- .../factions/util/MyLocationTypeAdapter.java | 6 +- .../util/Particles/ParticleEffect.java | 1 - .../util/PermissionsMapTypeAdapter.java | 4 +- .../factions/util/SpiralTask.java | 8 +- .../massivecraft/factions/util/UtilFly.java | 18 +- .../factions/util/WarmUpUtil.java | 4 +- .../massivecraft/factions/util/WarpGUI.java | 42 ++-- .../massivecraft/factions/zcore/MCommand.java | 4 +- .../massivecraft/factions/zcore/MPlugin.java | 2 +- .../zcore/MPluginSecretPlayerListener.java | 2 +- .../factions/zcore/fperms/Access.java | 6 +- .../zcore/fperms/PermissableAction.java | 12 +- .../fperms/gui/PermissableActionGUI.java | 48 ++--- .../fperms/gui/PermissableRelationGUI.java | 36 ++-- .../zcore/fupgrades/CropUpgrades.java | 8 +- .../factions/zcore/fupgrades/EXPUpgrade.java | 9 +- .../zcore/fupgrades/FUpgradesGUI.java | 182 +++++++++--------- .../zcore/fupgrades/RedstoneUpgrade.java | 6 +- .../zcore/fupgrades/SpawnerUpgrades.java | 8 +- .../factions/zcore/persist/MemoryBoard.java | 19 +- .../factions/zcore/persist/MemoryFPlayer.java | 88 ++++----- .../zcore/persist/MemoryFPlayers.java | 4 +- .../factions/zcore/persist/MemoryFaction.java | 30 +-- .../zcore/persist/json/FactionsJSON.java | 4 +- .../zcore/persist/json/JSONBoard.java | 16 +- .../zcore/persist/json/JSONFPlayers.java | 8 +- .../zcore/persist/json/JSONFactions.java | 8 +- .../factions/zcore/util/DiscUtil.java | 4 +- .../factions/zcore/util/TagReplacer.java | 22 +-- .../factions/zcore/util/TagUtil.java | 24 +-- .../factions/zcore/util/TextUtil.java | 2 +- src/main/resources/config.yml | 2 +- src/main/resources/lang/it_IT.yml | 2 +- src/main/resources/plugin.yml | 2 +- 121 files changed, 665 insertions(+), 675 deletions(-) delete mode 100644 src/main/java/META-INF/MANIFEST.MF rename src/main/java/com/massivecraft/factions/{SaberFactions.java => P.java} (94%) diff --git a/javadoc/com/massivecraft/factions/P.html b/javadoc/com/massivecraft/factions/P.html index 215145e7..319fd4f0 100644 --- a/javadoc/com/massivecraft/factions/P.html +++ b/javadoc/com/massivecraft/factions/P.html @@ -108,7 +108,7 @@ var activeTableTab = "activeTableTab";
  • com.massivecraft.factions.zcore.MPlugin
  • diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF deleted file mode 100644 index f43662f0..00000000 --- a/src/main/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: com.massivecraft.factions.SaberFactions - diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index b1ddf81e..92a79f8a 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -377,7 +377,7 @@ public class Conf { territoryDenyUseageMaterials.add(Material.BUCKET); territoryDenyUseageMaterials.add(Material.WATER_BUCKET); territoryDenyUseageMaterials.add(Material.LAVA_BUCKET); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { territoryDenyUseageMaterials.add(Material.ARMOR_STAND); } @@ -389,7 +389,7 @@ public class Conf { territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET); territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET); territoryDenyUseageMaterialsWhenOffline.add(Material.LAVA_BUCKET); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { territoryDenyUseageMaterialsWhenOffline.add(Material.ARMOR_STAND); } safeZoneNerfedCreatureTypes.add(EntityType.BLAZE); @@ -416,11 +416,11 @@ public class Conf { } public static void load() { - SaberFactions.plugin.persist.loadOrSaveDefault(i, Conf.class, "conf"); + P.p.persist.loadOrSaveDefault(i, Conf.class, "conf"); } public static void save() { - SaberFactions.plugin.persist.save(i); + P.p.persist.save(i); } public enum Backend { diff --git a/src/main/java/com/massivecraft/factions/SaberFactions.java b/src/main/java/com/massivecraft/factions/P.java similarity index 94% rename from src/main/java/com/massivecraft/factions/SaberFactions.java rename to src/main/java/com/massivecraft/factions/P.java index 0c911ce2..1166d0e2 100644 --- a/src/main/java/com/massivecraft/factions/SaberFactions.java +++ b/src/main/java/com/massivecraft/factions/P.java @@ -47,11 +47,11 @@ import java.util.logging.Level; import java.util.stream.Collectors; -public class SaberFactions extends MPlugin { +public class P extends MPlugin { // Our single plugin instance. // Single 4 life. - public static SaberFactions plugin; + public static P p; public static Permission perms = null; // This plugin sets the boolean true when fully enabled. // Plugins can check this boolean while hooking in have @@ -80,8 +80,8 @@ public class SaberFactions extends MPlugin { private Listener[] eventsListener; public static Economy econ = null; - public SaberFactions() { - plugin = this; + public P() { + p = this; } public boolean getLocked() { @@ -134,26 +134,26 @@ public class SaberFactions extends MPlugin { // Vault dependency check. if (getServer().getPluginManager().getPlugin("Vault") == null) { log("Vault is not present, the plugin will not run properly."); - getServer().getPluginManager().disablePlugin(plugin); + getServer().getPluginManager().disablePlugin(p); return; } int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]); switch (version) { case 7: - SaberFactions.plugin.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles."); + P.p.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles."); mc17 = true; break; case 8: - SaberFactions.plugin.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable."); + P.p.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable."); mc18 = true; break; case 13: - SaberFactions.plugin.log("Minecraft Version 1.13 found, New Items will be used."); + P.p.log("Minecraft Version 1.13 found, New Items will be used."); mc113 = true; break; case 14: - SaberFactions.plugin.log("Minecraft Version 1.14 found."); + P.p.log("Minecraft Version 1.14 found."); mc114 = true; break; } @@ -220,7 +220,7 @@ public class SaberFactions extends MPlugin { } if (getServer().getPluginManager().getPlugin("Skript") != null) { - log("Skript was found! Registering SaberFactions Addon..."); + log("Skript was found! Registering P Addon..."); skriptAddon = Skript.registerAddon(this); try { skriptAddon.loadClasses("com.massivecraft.factions.skript", "expressions"); @@ -253,8 +253,8 @@ public class SaberFactions extends MPlugin { getCommand(this.refCommand).setTabCompleter(this); - RegisteredServiceProvider rsp = SaberFactions.this.getServer().getServicesManager().getRegistration(Economy.class); - SaberFactions.econ = rsp.getProvider(); + RegisteredServiceProvider rsp = P.this.getServer().getServicesManager().getRegistration(Economy.class); + P.econ = rsp.getProvider(); if (getDescription().getFullName().contains("BETA")) { divider(); @@ -268,7 +268,7 @@ public class SaberFactions extends MPlugin { this.postEnable(); this.loadSuccessful = true; // Set startup finished to true. to give plugins hooking in a greenlight - SaberFactions.startupFinished = true; + P.startupFinished = true; } public SkriptAddon getSkriptAddon() { @@ -429,14 +429,14 @@ public class SaberFactions extends MPlugin { public ItemStack createLazyItem(Material material, int amount, short datavalue, String name, String lore) { ItemStack item = new ItemStack(material, amount, datavalue); ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(color(SaberFactions.plugin.getConfig().getString(name))); - meta.setLore(colorList(SaberFactions.plugin.getConfig().getStringList(lore))); + meta.setDisplayName(color(P.p.getConfig().getString(name))); + meta.setLore(colorList(P.p.getConfig().getStringList(lore))); item.setItemMeta(meta); return item; } public Economy getEcon() { - RegisteredServiceProvider rsp = SaberFactions.plugin.getServer().getServicesManager().getRegistration(Economy.class); + RegisteredServiceProvider rsp = P.p.getServer().getServicesManager().getRegistration(Economy.class); Economy econ = rsp.getProvider(); return econ; } @@ -512,11 +512,11 @@ public class SaberFactions extends MPlugin { as.setVisible(false); //Makes the ArmorStand invisible as.setGravity(false); //Make sure it doesn't fall as.setCanPickupItems(false); //I'm not sure what happens if you leave this as it is, but you might as well disable it - as.setCustomName(SaberFactions.plugin.color(text)); //Set this to the text you want + as.setCustomName(P.p.color(text)); //Set this to the text you want as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not final ArmorStand armorStand = as; - Bukkit.getScheduler().scheduleSyncDelayedTask(SaberFactions.plugin, () -> { + Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, () -> { armorStand.remove(); getLogger().info("Removing Hologram."); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java b/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java index 72fc4abe..193843fe 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java @@ -1,16 +1,16 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.CommandVisibility; import com.massivecraft.factions.zcore.MCommand; import com.massivecraft.factions.zcore.util.TL; import java.util.ArrayList; -public class CmdAutoHelp extends MCommand { +public class CmdAutoHelp extends MCommand

    { public CmdAutoHelp() { - super(SaberFactions.plugin); + super(P.p); this.aliases.add("?"); this.aliases.add("h"); this.aliases.add("help"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBan.java b/src/main/java/com/massivecraft/factions/cmd/CmdBan.java index 6ed521af..94305d1b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBan.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBan.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.event.FPlayerLeaveEvent; import com.massivecraft.factions.struct.BanInfo; import com.massivecraft.factions.struct.Permission; @@ -81,7 +81,7 @@ public class CmdBan extends FCommand { if (event.isCancelled()) { // if someone cancels a ban, we'll get people complaining here. So lets log it. - SaberFactions.plugin.log(Level.WARNING, "Attempted to ban {0} but someone cancelled the kick event. This isn't good.", target.getName()); + P.p.log(Level.WARNING, "Attempted to ban {0} but someone cancelled the kick event. This isn't good.", target.getName()); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBanner.java b/src/main/java/com/massivecraft/factions/cmd/CmdBanner.java index 98257813..a52cb6e2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBanner.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBanner.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.util.XMaterial; import com.massivecraft.factions.zcore.util.TL; @@ -33,28 +33,28 @@ public class CmdBanner extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fbanners.Enabled")) { + if (!P.p.getConfig().getBoolean("fbanners.Enabled")) { msg(TL.COMMAND_BANNER_DISABLED); return; } - if (!fme.hasMoney(SaberFactions.plugin.getConfig().getInt("fbanners.Banner-Cost", 5000))) { + if (!fme.hasMoney(P.p.getConfig().getInt("fbanners.Banner-Cost", 5000))) { msg(TL.COMMAND_BANNER_NOTENOUGHMONEY); return; } - takeMoney(fme, SaberFactions.plugin.getConfig().getInt("fbanners.Banner-Cost", 5000)); + takeMoney(fme, P.p.getConfig().getInt("fbanners.Banner-Cost", 5000)); - //ItemStack warBanner = SaberFactions.plugin.createItem(Material.BANNER, 1, (short) 1, SaberFactions.plugin.getConfig().getString("fbanners.Item.Name"), SaberFactions.plugin.getConfig().getStringList("fbanners.Item.Lore")); + //ItemStack warBanner = P.p.createItem(Material.BANNER, 1, (short) 1, P.p.getConfig().getString("fbanners.Item.Name"), P.p.getConfig().getStringList("fbanners.Item.Lore")); //BannerMeta bannerMeta = (BannerMeta) warBanner.getItemMeta(); ItemStack warBanner = fme.getFaction().getBanner(); if (warBanner != null) { ItemMeta warmeta = warBanner.getItemMeta(); - warmeta.setDisplayName(SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fbanners.Item.Name"))); - warmeta.setLore(SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fbanners.Item.Lore"))); + warmeta.setDisplayName(P.p.color(P.p.getConfig().getString("fbanners.Item.Name"))); + warmeta.setLore(P.p.colorList(P.p.getConfig().getStringList("fbanners.Item.Lore"))); warBanner.setItemMeta(warmeta); } else { - warBanner = SaberFactions.plugin.createItem(XMaterial.BLACK_BANNER.parseMaterial(), 1, (short) 1, SaberFactions.plugin.getConfig().getString("fbanners.Item.Name"), SaberFactions.plugin.getConfig().getStringList("fbanners.Item.Lore")); + warBanner = P.p.createItem(XMaterial.BLACK_BANNER.parseMaterial(), 1, (short) 1, P.p.getConfig().getString("fbanners.Item.Name"), P.p.getConfig().getStringList("fbanners.Item.Lore")); } fme.msg(TL.COMMAND_BANNER_SUCCESS); warBanner.setAmount(1); @@ -63,7 +63,7 @@ public class CmdBanner extends FCommand { public boolean hasMoney(FPlayer fme, int amt) { - Economy econ = SaberFactions.plugin.getEcon(); + Economy econ = P.p.getEcon(); if (econ.getBalance(fme.getPlayer()) >= amt) { return true; } else { @@ -74,7 +74,7 @@ public class CmdBanner extends FCommand { public void takeMoney(FPlayer fme, int amt) { if (hasMoney(fme, amt)) { - Economy econ = SaberFactions.plugin.getEcon(); + Economy econ = P.p.getEcon(); econ.withdrawPlayer(fme.getPlayer(), amt); fme.sendMessage(TL.COMMAND_BANNER_MONEYTAKE.toString().replace("{amount}", amt + "")); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java index 806fa370..4899eef1 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -30,10 +30,10 @@ public class CmdBypass extends FCommand { // TODO: Move this to a transient field in the model?? if (fme.isAdminBypassing()) { fme.msg(TL.COMMAND_BYPASS_ENABLE.toString()); - SaberFactions.plugin.log(fme.getName() + TL.COMMAND_BYPASS_ENABLELOG.toString()); + P.p.log(fme.getName() + TL.COMMAND_BYPASS_ENABLELOG.toString()); } else { fme.msg(TL.COMMAND_BYPASS_DISABLE.toString()); - SaberFactions.plugin.log(fme.getName() + TL.COMMAND_BYPASS_DISABLELOG.toString()); + P.p.log(fme.getName() + TL.COMMAND_BYPASS_DISABLELOG.toString()); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java index 24479162..1a087d32 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -28,10 +28,10 @@ public class CmdChatSpy extends FCommand { if (fme.isSpyingChat()) { fme.msg(TL.COMMAND_CHATSPY_ENABLE); - SaberFactions.plugin.log(fme.getName() + TL.COMMAND_CHATSPY_ENABLELOG.toString()); + P.p.log(fme.getName() + TL.COMMAND_CHATSPY_ENABLELOG.toString()); } else { fme.msg(TL.COMMAND_CHATSPY_DISABLE); - SaberFactions.plugin.log(fme.getName() + TL.COMMAND_CHATSPY_DISABLELOG.toString()); + P.p.log(fme.getName() + TL.COMMAND_CHATSPY_DISABLELOG.toString()); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdCheckpoint.java b/src/main/java/com/massivecraft/factions/cmd/CmdCheckpoint.java index 2a0effdd..15548424 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdCheckpoint.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdCheckpoint.java @@ -26,7 +26,7 @@ public class CmdCheckpoint extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("checkpoints.Enabled")) { + if (!P.p.getConfig().getBoolean("checkpoints.Enabled")) { fme.msg(TL.COMMAND_CHECKPOINT_DISABLED); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChest.java b/src/main/java/com/massivecraft/factions/cmd/CmdChest.java index f9ee33c1..efe418ff 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChest.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChest.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.fperms.Access; @@ -30,7 +30,7 @@ public class CmdChest extends FCommand { public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fchest.Enabled")) { + if (!P.p.getConfig().getBoolean("fchest.Enabled")) { fme.sendMessage("This command is disabled!"); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java index f6272f27..0e13e754 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.ChatColor; @@ -231,10 +231,10 @@ public class CmdConfig extends FCommand { if (!success.isEmpty()) { if (sender instanceof Player) { sendMessage(success); - SaberFactions.plugin.log(success + TL.COMMAND_CONFIG_LOG.format((Player) sender)); - } else // using SaberFactions.plugin.log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log + P.p.log(success + TL.COMMAND_CONFIG_LOG.format((Player) sender)); + } else // using P.p.log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log { - SaberFactions.plugin.log(success); + P.p.log(success); } } // save change to disk diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java index 2bd41afe..22e473c2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java @@ -97,7 +97,7 @@ public class CmdCreate extends FCommand { // That way we don't have to mess up deleting more stuff. // And prevent the user from being returned to NORMAL after deleting his old faction. fme.setRole(Role.LEADER); - if (SaberFactions.plugin.getConfig().getBoolean("faction-creation-broadcast", true)) { + if (P.p.getConfig().getBoolean("faction-creation-broadcast", true)) { for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) { follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower)); } @@ -110,16 +110,16 @@ public class CmdCreate extends FCommand { if (Conf.logFactionCreate) - SaberFactions.plugin.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag); + P.p.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag); - if (SaberFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) + if (P.p.getConfig().getBoolean("fpaypal.Enabled")) this.fme.msg(TL.COMMAND_PAYPALSET_CREATED); if (Conf.useCustomDefaultPermissions) faction.setDefaultPerms(); if (Conf.usePermissionHints) fme.msg(TL.COMMAND_HINT_PERMISSION); - fme.setCooldown("create", System.currentTimeMillis() + (SaberFactions.plugin.getConfig().getInt("fcooldowns.f-create") * 1000)); + fme.setCooldown("create", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-create") * 1000)); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java index a422fa06..b9605fae 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -35,7 +35,7 @@ public class CmdDelFWarp extends FCommand { } private boolean transact(FPlayer player) { - return !SaberFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SaberFactions.plugin.getConfig().getDouble("warp-cost.delwarp", 5), TL.COMMAND_DELFWARP_TODELETE.toString(), TL.COMMAND_DELFWARP_FORDELETE.toString()); + return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.delwarp", 5), TL.COMMAND_DELFWARP_TODELETE.toString(), TL.COMMAND_DELFWARP_FORDELETE.toString()); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java index b815cba2..161474ea 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java @@ -87,15 +87,15 @@ public class CmdDisband extends FCommand { if ((fme!= null && !disbandMap.containsKey(me.getUniqueId().toString())) && faction.getTnt() > 0) { msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + "")); disbandMap.put(me.getUniqueId().toString(), faction.getId()); - Bukkit.getScheduler().scheduleSyncDelayedTask(SaberFactions.plugin, () -> disbandMap.remove(me.getUniqueId().toString()), 200L); + Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, () -> disbandMap.remove(me.getUniqueId().toString()), 200L); } else if (faction.getId().equals(disbandMap.get(me.getUniqueId().toString())) || faction.getTnt() == 0) { - if (SaberFactions.plugin.getConfig().getBoolean("faction-disband-broadcast", true)) { + if (P.p.getConfig().getBoolean("faction-disband-broadcast", true)) { for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) { String amountString = senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(follower); UtilFly.checkFly(this.fme, Board.getInstance().getFactionAt(new FLocation(follower))); if (follower.getFaction() == faction) { follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString); - fme.setCooldown("disband", System.currentTimeMillis() + (SaberFactions.plugin.getConfig().getInt("fcooldowns.f-disband") * 1000)); + fme.setCooldown("disband", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-disband") * 1000)); } else { follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower)); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java index 2ade1c7a..7cf053c1 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.util.WarmUpUtil; @@ -80,7 +80,7 @@ public class CmdFWarp extends FCommand { } private boolean transact(FPlayer player) { - return !SaberFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SaberFactions.plugin.getConfig().getDouble("warp-cost.warp", 5), TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString()); + return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.warp", 5), TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString()); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java index 67c99272..43a39e9b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java @@ -39,11 +39,11 @@ public class CmdFly extends FCommand { public static void startParticles() { // Just a secondary check. - if (!SaberFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) { + if (!P.p.getConfig().getBoolean("ffly.Particles.Enabled")) { return; } - id = Bukkit.getScheduler().scheduleSyncRepeatingTask(SaberFactions.plugin, () -> { + id = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> { for (String name : flyMap.keySet()) { Player player = Bukkit.getPlayer(name); if (player == null) { @@ -52,7 +52,7 @@ public class CmdFly extends FCommand { if (!player.isFlying()) { continue; } - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { if (player.getGameMode() == GameMode.SPECTATOR) { continue; } @@ -61,12 +61,12 @@ public class CmdFly extends FCommand { if (FPlayers.getInstance().getByPlayer(player).isVanished()) { // Actually, vanished players (such as admins) should not display particles to prevent others from knowing their vanished assistance for moderation. // But we can keep it as a config. - if (SaberFactions.plugin.getConfig().getBoolean("ffly.Particles.Enable-While-Vanished")) { + if (P.p.getConfig().getBoolean("ffly.Particles.Enable-While-Vanished")) { return; } continue; } - if (SaberFactions.plugin.useNonPacketParticles) { + if (P.p.useNonPacketParticles) { // 1.9+ based servers will use the built in particleAPI instead of packet based. // any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working. // So setting the amount to 0 spawns 1 in the precise location @@ -84,7 +84,7 @@ public class CmdFly extends FCommand { } public static void startFlyCheck() { - flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(SaberFactions.plugin, () -> { //threw the exception for now, until I recode fly :( Cringe. + flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> { //threw the exception for now, until I recode fly :( Cringe. checkTaskState(); if (flyMap.keySet().size() != 0) { for (String name : flyMap.keySet()) { @@ -95,7 +95,7 @@ public class CmdFly extends FCommand { if (player == null || !player.isFlying() || player.getGameMode() == GameMode.CREATIVE - || !SaberFactions.plugin.mc17 && player.getGameMode() == GameMode.SPECTATOR) { + || !P.p.mc17 && player.getGameMode() == GameMode.SPECTATOR) { continue; } FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); @@ -171,7 +171,7 @@ public class CmdFly extends FCommand { @Override public void perform() { // Disabled by default. - if (!SaberFactions.plugin.getConfig().getBoolean("enable-faction-flight", false)) { + if (!P.p.getConfig().getBoolean("enable-faction-flight", false)) { fme.msg(TL.COMMAND_FLY_DISABLED); return; } @@ -212,7 +212,7 @@ public class CmdFly extends FCommand { fme.setFlying(true); flyMap.put(player.getName(), true); if (id == -1) { - if (SaberFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) { + if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")) { startParticles(); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFocus.java b/src/main/java/com/massivecraft/factions/cmd/CmdFocus.java index 90820775..a6e4e4cb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFocus.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFocus.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.scoreboards.FTeamWrapper; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -24,7 +24,7 @@ public class CmdFocus } public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("ffocus.Enabled")) { + if (!P.p.getConfig().getBoolean("ffocus.Enabled")) { fme.msg(TL.GENERIC_DISABLED); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java b/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java index ad579870..452adc2d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.Location; @@ -27,12 +27,12 @@ public class CmdGetVault extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fvault.Enabled")) { + if (!P.p.getConfig().getBoolean("fvault.Enabled")) { fme.sendMessage("This command is disabled!"); return; } Location vaultLocation = fme.getFaction().getVault(); - ItemStack vault = SaberFactions.plugin.createItem(Material.CHEST, 1, (short) 0, SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fvault.Item.Name")), SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fvault.Item.Lore"))); + ItemStack vault = P.p.createItem(Material.CHEST, 1, (short) 0, P.p.color(P.p.getConfig().getString("fvault.Item.Name")), P.p.colorList(P.p.getConfig().getStringList("fvault.Item.Lore"))); //check if vault is set @@ -43,7 +43,7 @@ public class CmdGetVault extends FCommand { //has enough money? - int amount = SaberFactions.plugin.getConfig().getInt("fvault.Price"); + int amount = P.p.getConfig().getInt("fvault.Price"); if (!fme.hasMoney(amount)) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdGrace.java b/src/main/java/com/massivecraft/factions/cmd/CmdGrace.java index 2de4c895..ab340b9a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdGrace.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdGrace.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -24,7 +24,7 @@ public class CmdGrace extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("f-grace.Enabled")) { + if (!P.p.getConfig().getBoolean("f-grace.Enabled")) { fme.msg(TL.GENERIC_DISABLED); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java b/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java index ca27a175..beda0e84 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -40,7 +40,7 @@ public class CmdHelp extends FCommand { @Override public void perform() { - if (SaberFactions.plugin.getConfig().getBoolean("use-old-help", true)) { + if (P.p.getConfig().getBoolean("use-old-help", true)) { if (helpPages == null) { updateHelp(); } @@ -57,9 +57,9 @@ public class CmdHelp extends FCommand { sendMessage(helpPages.get(page)); return; } - ConfigurationSection help = SaberFactions.plugin.getConfig().getConfigurationSection("help"); + ConfigurationSection help = P.p.getConfig().getConfigurationSection("help"); if (help == null) { - help = SaberFactions.plugin.getConfig().createSection("help"); // create new help section + help = P.p.getConfig().createSection("help"); // create new help section List error = new ArrayList<>(); error.add("&cUpdate help messages in config.yml!"); error.add("&cSet use-old-help for legacy help messages"); @@ -72,7 +72,7 @@ public class CmdHelp extends FCommand { return; } for (String helpLine : page) { - sendMessage(SaberFactions.plugin.txt.parse(helpLine)); + sendMessage(P.p.txt.parse(helpLine)); } } @@ -189,7 +189,7 @@ public class CmdHelp extends FCommand { pageLines.add(p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdWarunclaimall.getUseageTemplate(true)); //TODO:TL - pageLines.add(p.txt.parse("Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + SaberFactions.plugin.txt.parse("") + " works on safe/war zones as well.")); + pageLines.add(p.txt.parse("Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("") + " works on safe/war zones as well.")); pageLines.add(p.cmdBase.cmdPeaceful.getUseageTemplate(true)); helpPages.add(pageLines); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdInventorySee.java b/src/main/java/com/massivecraft/factions/cmd/CmdInventorySee.java index 8b0fc2cb..e318ac9b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdInventorySee.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdInventorySee.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.fperms.Access; @@ -37,7 +37,7 @@ public class CmdInventorySee extends FCommand { @Override public void perform() { - if (SaberFactions.plugin.getConfig().getBoolean("f-inventory-see.Enabled")) { + if (P.p.getConfig().getBoolean("f-inventory-see.Enabled")) { fme.msg(TL.GENERIC_DISABLED); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java index 8a769cdb..34479693 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java @@ -83,7 +83,7 @@ public class CmdJoin extends FCommand { if (level == 0) { limit = Conf.factionMemberLimit; } else { - limit = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Members.Members-Limit.level-" + level); + limit = P.p.getConfig().getInt("fupgrades.MainMenu.Members.Members-Limit.level-" + level); } if (limit > 0 && faction.getFPlayers().size() >= limit && !faction.altInvited(fme)) { @@ -145,9 +145,9 @@ public class CmdJoin extends FCommand { if (Conf.logFactionJoin) { if (samePlayer) { - SaberFactions.plugin.log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag()); + P.p.log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag()); } else { - SaberFactions.plugin.log(TL.COMMAND_JOIN_MOVEDLOG.toString(), fme.getName(), fplayer.getName(), faction.getTag()); + P.p.log(TL.COMMAND_JOIN_MOVEDLOG.toString(), fme.getName(), fplayer.getName(), faction.getTag()); } } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java index 06edabe1..772338de 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.event.FPlayerLeaveEvent; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; @@ -68,8 +68,8 @@ public class CmdKick extends FCommand { } if(toKick.isAlt()){ - msg(SaberFactions.plugin.color("&cToo few arguments, &eUse like this:")); - msg(SaberFactions.plugin.color("&b/f alts,alt kick &3")); + msg(P.p.color("&cToo few arguments, &eUse like this:")); + msg(P.p.color("&b/f alts,alt kick &3")); return; } @@ -129,7 +129,7 @@ public class CmdKick extends FCommand { fme.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(fme), toKickFaction.describeTo(fme)); } if (Conf.logFactionKick) { - SaberFactions.plugin.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag()); + P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag()); } if (toKick.getRole() == Role.LEADER) { toKickFaction.promoteNewLeader(); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdList.java b/src/main/java/com/massivecraft/factions/cmd/CmdList.java index e6458ae4..487d7398 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdList.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdList.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; import com.massivecraft.factions.Factions; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TagUtil; @@ -51,7 +51,7 @@ public class CmdList extends FCommand { // remove exempt factions if (fme != null && fme.getPlayer() != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")) { - List exemptFactions = SaberFactions.plugin.getConfig().getStringList("show-exempt"); + List exemptFactions = P.p.getConfig().getStringList("show-exempt"); factionList.removeIf(next -> exemptFactions.contains(next.getTag())); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdNear.java b/src/main/java/com/massivecraft/factions/cmd/CmdNear.java index f750661c..2fd4fe38 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdNear.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdNear.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -26,12 +26,12 @@ public class CmdNear extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fnear.Enabled")) { + if (!P.p.getConfig().getBoolean("fnear.Enabled")) { fme.msg(TL.COMMAND_NEAR_DISABLED_MSG); return; } - double range = SaberFactions.plugin.getConfig().getInt("fnear.Radius"); + double range = P.p.getConfig().getInt("fnear.Radius"); String format = TL.COMMAND_NEAR_FORMAT.toString(); fme.msg(TL.COMMAND_NEAR_USE_MSG); for (Entity e : me.getNearbyEntities(range, 255, range)) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java b/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java index bbd3b2fd..c5ba53d9 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -52,7 +52,7 @@ public class CmdOpen extends FCommand { } fplayer.msg(TL.COMMAND_OPEN_CHANGED, myFaction.getTag(fplayer.getFaction()), open); } - fme.setCooldown("open", System.currentTimeMillis() + (SaberFactions.plugin.getConfig().getInt("fcooldowns.f-open") * 1000)); + fme.setCooldown("open", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-open") * 1000)); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSee.java b/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSee.java index 4fdf004d..3cc4885d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSee.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSee.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -25,7 +25,7 @@ public class CmdPaypalSee extends FCommand { } @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { + if (!P.p.getConfig().getBoolean("fpaypal.Enabled")) { fme.msg(TL.GENERIC_DISABLED); return; } @@ -50,7 +50,7 @@ public class CmdPaypalSee extends FCommand { msg(TL.GENERIC_NOPERMISSION, "see another factions paypal."); } } else { - msg(SaberFactions.plugin.cmdBase.cmdPaypalSee.getUseageTemplate()); + msg(P.p.cmdBase.cmdPaypalSee.getUseageTemplate()); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSet.java b/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSet.java index d661170e..661518c3 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSet.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSet.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -27,7 +27,7 @@ public class CmdPaypalSet extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { + if (!P.p.getConfig().getBoolean("fpaypal.Enabled")) { fme.msg(TL.GENERIC_DISABLED); return; } @@ -54,7 +54,7 @@ public class CmdPaypalSet extends FCommand { msg(TL.GENERIC_NOPERMISSION, "set another factions paypal!"); } } else { - msg(SaberFactions.plugin.cmdBase.cmdPaypalSet.getUseageTemplate()); + msg(P.p.cmdBase.cmdPaypalSet.getUseageTemplate()); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java b/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java index 7e4cb7fc..3a5fb94a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.fperms.Access; @@ -105,7 +105,7 @@ public class CmdPerm extends FCommand { } fme.msg(TL.COMMAND_PERM_SET, argAsString(1), access.name(), argAsString(0)); - SaberFactions.plugin.log(String.format(TL.COMMAND_PERM_SET.toString(), argAsString(1), access.name(), argAsString(0)) + " for faction " + fme.getTag()); + P.p.log(String.format(TL.COMMAND_PERM_SET.toString(), argAsString(1), access.name(), argAsString(0)) + " for faction " + fme.getTag()); } private Permissable getPermissable(String name) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java b/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java index 2582759a..5d80e4b4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -43,7 +43,7 @@ public class CmdPermanent extends FCommand { faction.setPermanent(true); } - SaberFactions.plugin.log((fme == null ? "A server admin" : fme.getName()) + " " + change + " the faction \"" + faction.getTag() + "\"."); + P.p.log((fme == null ? "A server admin" : fme.getName()) + " " + change + " the faction \"" + faction.getTag() + "\"."); // Inform all players for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java index ab1c866a..17259fb2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -77,7 +77,7 @@ public class CmdPowerBoost extends FCommand { int roundedPower = (int) Math.round(targetPower); msg(TL.COMMAND_POWERBOOST_BOOST, target, roundedPower); if (!senderIsConsole) { - SaberFactions.plugin.log(TL.COMMAND_POWERBOOST_BOOSTLOG.toString(), fme.getName(), target, roundedPower); + P.p.log(TL.COMMAND_POWERBOOST_BOOSTLOG.toString(), fme.getName(), target, roundedPower); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdReload.java b/src/main/java/com/massivecraft/factions/cmd/CmdReload.java index 09f88744..160e2661 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdReload.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdReload.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -26,12 +26,12 @@ public class CmdReload extends FCommand { long timeInitStart = System.currentTimeMillis(); Conf.load(); Conf.save(); - SaberFactions.plugin.reloadConfig(); - SaberFactions.plugin.loadLang(); + P.p.reloadConfig(); + P.p.loadLang(); - if (SaberFactions.plugin.getConfig().getBoolean("enable-faction-flight")) { - SaberFactions.plugin.factionsFlight = true; + if (P.p.getConfig().getBoolean("enable-faction-flight")) { + P.p.factionsFlight = true; } long timeReload = (System.currentTimeMillis() - timeInitStart); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdRules.java b/src/main/java/com/massivecraft/factions/cmd/CmdRules.java index 43c443e3..71963ca7 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdRules.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdRules.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -29,19 +29,19 @@ public class CmdRules extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("frules.Enabled")) { + if (!P.p.getConfig().getBoolean("frules.Enabled")) { fme.msg(TL.COMMAND_RULES_DISABLED_MSG); return; } if (this.args.size() == 0) { HashMap rules = fme.getFaction().getRulesMap(); if (rules.size() == 0) { - List ruleList = SaberFactions.plugin.getConfig().getStringList("frules.default-rules"); - fme.sendMessage(SaberFactions.plugin.colorList(ruleList)); + List ruleList = P.p.getConfig().getStringList("frules.default-rules"); + fme.sendMessage(P.p.colorList(ruleList)); } else { for (int i = 0; i <= rules.size() - 1; i++) { - fme.sendMessage(SaberFactions.plugin.color(rules.get(i))); + fme.sendMessage(P.p.color(rules.get(i))); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java b/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java index 3c030a7e..030e1107 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FLocation; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.util.Particles.ParticleEffect; import com.massivecraft.factions.util.VisualizeUtil; @@ -12,7 +12,6 @@ import org.bukkit.*; import org.bukkit.entity.Player; import java.util.HashMap; -import java.util.Iterator; public class CmdSeeChunk extends FCommand { @@ -41,7 +40,7 @@ public class CmdSeeChunk extends FCommand { this.useParticles = p.getConfig().getBoolean("see-chunk.particles", true); - interval = SaberFactions.plugin.getConfig().getLong("see-chunk.interval", 10L); + interval = P.p.getConfig().getLong("see-chunk.interval", 10L); if (effect == null) { effect = ParticleEffect.REDSTONE; } @@ -72,7 +71,7 @@ public class CmdSeeChunk extends FCommand { } private void startTask() { - taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(SaberFactions.plugin, () -> { + taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> { for (Object nameObject : seeChunkMap.keySet()) { String name = nameObject + ""; Player player = Bukkit.getPlayer(name); @@ -116,10 +115,10 @@ public class CmdSeeChunk extends FCommand { continue; } if (useParticles) { - if (SaberFactions.plugin.useNonPacketParticles) { + if (P.p.useNonPacketParticles) { // Dust options only exists in the 1.13 API, so we use an // alternative method to achieve this in lower versions. - if (SaberFactions.plugin.mc113) { + if (P.p.mc113) { player.spawnParticle(Particle.REDSTONE, loc, 0, new Particle.DustOptions(Color.RED, 1)); } else { player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 255, 0, 0, 1); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java index 153b65ce..5b7cff3f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; @@ -51,7 +51,7 @@ public class CmdSetFWarp extends FCommand { // Checks if warp with same name already exists and ignores maxWarp check if it does. boolean warpExists = myFaction.isWarp(warp); - int maxWarps = SaberFactions.plugin.getConfig().getInt("max-warps", 5); + int maxWarps = P.p.getConfig().getInt("max-warps", 5); boolean tooManyWarps = maxWarps <= myFaction.getWarps().size(); if (tooManyWarps && !warpExists) { fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps); @@ -73,7 +73,7 @@ public class CmdSetFWarp extends FCommand { } private boolean transact(FPlayer player) { - return !SaberFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SaberFactions.plugin.getConfig().getDouble("warp-cost.setwarp", 5), TL.COMMAND_SETFWARP_TOSET.toString(), TL.COMMAND_SETFWARP_FORSET.toString()); + return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.setwarp", 5), TL.COMMAND_SETFWARP_TOSET.toString(), TL.COMMAND_SETFWARP_FORSET.toString()); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java index 5654b591..c50128dc 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TagReplacer; @@ -57,7 +57,7 @@ public class CmdShow extends FCommand { return; if (fme != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt") - && SaberFactions.plugin.getConfig().getStringList("show-exempt").contains(faction.getTag())) { + && P.p.getConfig().getStringList("show-exempt").contains(faction.getTag())) { msg(TL.COMMAND_SHOW_EXEMPT); return; } @@ -67,7 +67,7 @@ public class CmdShow extends FCommand { return; } - List show = SaberFactions.plugin.getConfig().getStringList("show"); + List show = P.p.getConfig().getStringList("show"); if (show == null || show.isEmpty()) show = defaults; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdStuck.java b/src/main/java/com/massivecraft/factions/cmd/CmdStuck.java index 86167e28..03a77e30 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdStuck.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdStuck.java @@ -35,11 +35,11 @@ public class CmdStuck extends FCommand { final Player player = fme.getPlayer(); final Location sentAt = player.getLocation(); final FLocation chunk = fme.getLastStoodAt(); - final long delay = SaberFactions.plugin.getConfig().getLong("hcf.stuck.delay", 30); - final int radius = SaberFactions.plugin.getConfig().getInt("hcf.stuck.radius", 10); + final long delay = P.p.getConfig().getLong("hcf.stuck.delay", 30); + final int radius = P.p.getConfig().getInt("hcf.stuck.radius", 10); - if (SaberFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) { - long wait = SaberFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis(); + if (P.p.getStuckMap().containsKey(player.getUniqueId())) { + long wait = P.p.getTimers().get(player.getUniqueId()) - System.currentTimeMillis(); String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true); msg(TL.COMMAND_STUCK_EXISTS, time); } else { @@ -49,11 +49,11 @@ public class CmdStuck extends FCommand { return; } - final int id = Bukkit.getScheduler().runTaskLater(SaberFactions.plugin, new BukkitRunnable() { + final int id = Bukkit.getScheduler().runTaskLater(P.p, new BukkitRunnable() { @Override public void run() { - if (!SaberFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) { + if (!P.p.getStuckMap().containsKey(player.getUniqueId())) { return; } @@ -61,8 +61,8 @@ public class CmdStuck extends FCommand { final World world = chunk.getWorld(); if (world.getUID() != player.getWorld().getUID() || sentAt.distance(player.getLocation()) > radius) { msg(TL.COMMAND_STUCK_OUTSIDE.format(radius)); - SaberFactions.plugin.getTimers().remove(player.getUniqueId()); - SaberFactions.plugin.getStuckMap().remove(player.getUniqueId()); + P.p.getTimers().remove(player.getUniqueId()); + P.p.getStuckMap().remove(player.getUniqueId()); return; } @@ -74,18 +74,18 @@ public class CmdStuck extends FCommand { public boolean work() { FLocation chunk = currentFLocation(); Faction faction = board.getFactionAt(chunk); - int buffer = SaberFactions.plugin.getConfig().getInt("world-border.buffer", 0); + int buffer = P.p.getConfig().getInt("world-border.buffer", 0); if (faction.isWilderness() && !chunk.isOutsideWorldBorder(buffer)) { int cx = FLocation.chunkToBlock((int) chunk.getX()); int cz = FLocation.chunkToBlock((int) chunk.getZ()); int y = world.getHighestBlockYAt(cx, cz); Location tp = new Location(world, cx, y, cz); msg(TL.COMMAND_STUCK_TELEPORT, tp.getBlockX(), tp.getBlockY(), tp.getBlockZ()); - SaberFactions.plugin.getTimers().remove(player.getUniqueId()); - SaberFactions.plugin.getStuckMap().remove(player.getUniqueId()); + P.p.getTimers().remove(player.getUniqueId()); + P.p.getStuckMap().remove(player.getUniqueId()); if (!Essentials.handleTeleport(player, tp)) { player.teleport(tp); - SaberFactions.plugin.debug("/f stuck used regular teleport, not essentials!"); + P.p.debug("/f stuck used regular teleport, not essentials!"); } this.stop(); return false; @@ -96,11 +96,11 @@ public class CmdStuck extends FCommand { } }, delay * 20).getTaskId(); - SaberFactions.plugin.getTimers().put(player.getUniqueId(), System.currentTimeMillis() + (delay * 1000)); - long wait = SaberFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis(); + P.p.getTimers().put(player.getUniqueId(), System.currentTimeMillis() + (delay * 1000)); + long wait = P.p.getTimers().get(player.getUniqueId()) - System.currentTimeMillis(); String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true); msg(TL.COMMAND_STUCK_START, time); - SaberFactions.plugin.getStuckMap().put(player.getUniqueId(), id); + P.p.getStuckMap().put(player.getUniqueId(), id); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTag.java b/src/main/java/com/massivecraft/factions/cmd/CmdTag.java index 4a80904f..eb6dc8e0 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTag.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTag.java @@ -86,7 +86,7 @@ public class CmdTag extends FCommand { fplayer.msg(TL.COMMAND_TAG_CHANGED, fme.getColorTo(faction) + oldtag, myFaction.getTag(faction)); } } - fme.setCooldown("tag", System.currentTimeMillis() + (SaberFactions.plugin.getConfig().getInt("fcooldowns.f-tag") * 1000)); + fme.setCooldown("tag", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-tag") * 1000)); FTeamWrapper.updatePrefixes(myFaction); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTnt.java b/src/main/java/com/massivecraft/factions/cmd/CmdTnt.java index dd4dfb78..99b52cf8 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTnt.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTnt.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.fperms.Access; @@ -32,7 +32,7 @@ public class CmdTnt extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("ftnt.Enabled")) { + if (!P.p.getConfig().getBoolean("ftnt.Enabled")) { fme.msg(TL.COMMAND_TNT_DISABLED_MSG); return; } @@ -73,7 +73,7 @@ public class CmdTnt extends FCommand { return; } ItemStack tnt = new ItemStack(Material.TNT, amount); - if (fme.getFaction().getTnt() + amount > SaberFactions.plugin.getConfig().getInt("ftnt.Bank-Limit")) { + if (fme.getFaction().getTnt() + amount > P.p.getConfig().getInt("ftnt.Bank-Limit")) { msg(TL.COMMAND_TNT_EXCEEDLIMIT); return; } @@ -82,7 +82,7 @@ public class CmdTnt extends FCommand { fme.getFaction().addTnt(amount); fme.msg(TL.COMMAND_TNT_DEPOSIT_SUCCESS); - fme.sendMessage(SaberFactions.plugin.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", fme.getFaction().getTnt() + ""))); + fme.sendMessage(P.p.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", fme.getFaction().getTnt() + ""))); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTntFill.java b/src/main/java/com/massivecraft/factions/cmd/CmdTntFill.java index 4c66f5bc..239d0ff5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTntFill.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTntFill.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.fperms.Access; @@ -35,7 +35,7 @@ public class CmdTntFill extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("Tntfill.enabled")) { + if (!P.p.getConfig().getBoolean("Tntfill.enabled")) { this.fme.msg(TL.GENERIC_DISABLED); return; } @@ -51,12 +51,12 @@ public class CmdTntFill extends FCommand { msg(TL.COMMAND_TNTFILL_HEADER); int radius = argAsInt(0, 16); int amount = argAsInt(1, 16); - if (radius > SaberFactions.plugin.getConfig().getInt("Tntfill.max-radius")) { - fme.msg(TL.COMMAND_TNTFILL_RADIUSMAX.toString().replace("{max}", SaberFactions.plugin.getConfig().getInt("Tntfill.max-radius") + "")); + if (radius > P.p.getConfig().getInt("Tntfill.max-radius")) { + fme.msg(TL.COMMAND_TNTFILL_RADIUSMAX.toString().replace("{max}", P.p.getConfig().getInt("Tntfill.max-radius") + "")); return; } - if (amount > SaberFactions.plugin.getConfig().getInt("Tntfill.max-amount")) { - fme.msg(TL.COMMAND_TNTFILL_AMOUNTMAX.toString().replace("{max}", SaberFactions.plugin.getConfig().getInt("Tntfill.max-amount") + "")); + if (amount > P.p.getConfig().getInt("Tntfill.max-amount")) { + fme.msg(TL.COMMAND_TNTFILL_AMOUNTMAX.toString().replace("{max}", P.p.getConfig().getInt("Tntfill.max-amount") + "")); return; } @@ -181,7 +181,7 @@ public class CmdTntFill extends FCommand { return; } ItemStack tnt = new ItemStack(Material.TNT, amount); - if (fme.getFaction().getTnt() + amount > SaberFactions.plugin.getConfig().getInt("ftnt.Bank-Limit")) { + if (fme.getFaction().getTnt() + amount > P.p.getConfig().getInt("ftnt.Bank-Limit")) { msg(TL.COMMAND_TNT_EXCEEDLIMIT); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTpBanner.java b/src/main/java/com/massivecraft/factions/cmd/CmdTpBanner.java index 22cadd63..b7401da5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTpBanner.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTpBanner.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.listeners.FactionsBlockListener; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.util.WarmUpUtil; @@ -25,7 +25,7 @@ public class CmdTpBanner extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fbanners.Enabled")) { + if (!P.p.getConfig().getBoolean("fbanners.Enabled")) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUpgrades.java b/src/main/java/com/massivecraft/factions/cmd/CmdUpgrades.java index c5e629ae..5387856c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUpgrades.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUpgrades.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.fupgrades.FUpgradesGUI; import com.massivecraft.factions.zcore.util.TL; @@ -26,7 +26,7 @@ public class CmdUpgrades extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fupgrades.Enabled")) { + if (!P.p.getConfig().getBoolean("fupgrades.Enabled")) { fme.sendMessage("This command is disabled!"); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdVault.java b/src/main/java/com/massivecraft/factions/cmd/CmdVault.java index 289bccbd..e4a6a7d4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdVault.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdVault.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.fperms.Access; import com.massivecraft.factions.zcore.fperms.PermissableAction; @@ -33,7 +33,7 @@ public class CmdVault extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fvault.Enabled")) { + if (!P.p.getConfig().getBoolean("fvault.Enabled")) { fme.sendMessage("This command is disabled!"); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java b/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java index 6ad1a180..570638b4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -25,8 +25,8 @@ public class CmdVersion extends FCommand { @Override public void perform() { - msg(TL.COMMAND_VERSION_NAME); // Did this so people can differentiate between SaberFactions and FactionsUUID (( Requested Feature )) - msg(TL.COMMAND_VERSION_VERSION, SaberFactions.plugin.getDescription().getFullName()); + msg(TL.COMMAND_VERSION_NAME); // Did this so people can differentiate between P and FactionsUUID (( Requested Feature )) + msg(TL.COMMAND_VERSION_VERSION, P.p.getDescription().getFullName()); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdViewChest.java b/src/main/java/com/massivecraft/factions/cmd/CmdViewChest.java index 5bd34aa5..bfc7323c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdViewChest.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdViewChest.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -25,7 +25,7 @@ public class CmdViewChest extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("fchest.Enabled")) { + if (!P.p.getConfig().getBoolean("fchest.Enabled")) { fme.msg(TL.GENERIC_DISABLED); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java index 0e28b3c0..2e8a9949 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.alts.CmdAlts; import com.massivecraft.factions.cmd.claim.*; import com.massivecraft.factions.cmd.econ.CmdMoney; @@ -248,43 +248,43 @@ public class FCmdRoot extends FCommand { this.addSubCommand(this.cmdFGlobal); this.addSubCommand(this.cmdViewChest); - if (SaberFactions.plugin.getConfig().getBoolean("f-inventory-see.Enabled")) { + if (P.p.getConfig().getBoolean("f-inventory-see.Enabled")) { this.addSubCommand(this.cmdInventorySee); } - if(SaberFactions.plugin.getConfig().getBoolean("f-points.Enabled")){ + if(P.p.getConfig().getBoolean("f-points.Enabled")){ this.addSubCommand(this.cmdPoints); } - if(SaberFactions.plugin.getConfig().getBoolean("f-alts.Enabled")){ + if(P.p.getConfig().getBoolean("f-alts.Enabled")){ this.addSubCommand(this.cmdAlts); } - if (SaberFactions.plugin.getConfig().getBoolean("f-grace.Enabled")) { + if (P.p.getConfig().getBoolean("f-grace.Enabled")) { this.addSubCommand(this.cmdGrace); } if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null) { - SaberFactions.plugin.log("Found CoreProtect, enabling Inspect"); + P.p.log("Found CoreProtect, enabling Inspect"); this.addSubCommand(this.cmdInspect); } else { - SaberFactions.plugin.log("CoreProtect not found, disabling Inspect"); + P.p.log("CoreProtect not found, disabling Inspect"); } - if (SaberFactions.plugin.getConfig().getBoolean("ffocus.Enabled")) { + if (P.p.getConfig().getBoolean("ffocus.Enabled")) { addSubCommand(this.cmdFocus); } - if (SaberFactions.plugin.getConfig().getBoolean("enable-faction-flight", false)) { + if (P.p.getConfig().getBoolean("enable-faction-flight", false)) { this.addSubCommand(this.cmdFly); } if (Bukkit.getServer().getPluginManager().getPlugin("FactionsTop") != null || Bukkit.getServer().getPluginManager().getPlugin("SavageFTOP") != null) { - SaberFactions.plugin.log(Level.INFO, "Found FactionsTop plugin. Disabling our own /f top command."); + P.p.log(Level.INFO, "Found FactionsTop plugin. Disabling our own /f top command."); } else { - SaberFactions.plugin.log(Level.INFO, "Enabling FactionsTop command, this is a very basic /f top please get a dedicated /f top resource if you want land calculation etc."); + P.p.log(Level.INFO, "Enabling FactionsTop command, this is a very basic /f top please get a dedicated /f top resource if you want land calculation etc."); this.addSubCommand(this.cmdTop); } - if (SaberFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { + if (P.p.getConfig().getBoolean("fpaypal.Enabled")) { this.addSubCommand(this.cmdPaypalSet); this.addSubCommand(this.cmdPaypalSee); } diff --git a/src/main/java/com/massivecraft/factions/cmd/FCommand.java b/src/main/java/com/massivecraft/factions/cmd/FCommand.java index f1932fe8..7ed31efa 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCommand.java @@ -13,7 +13,7 @@ import java.text.SimpleDateFormat; import java.util.List; -public abstract class FCommand extends MCommand { +public abstract class FCommand extends MCommand

    { public static final SimpleDateFormat sdf = new SimpleDateFormat(TL.DATE_FORMAT.toString()); @@ -31,7 +31,7 @@ public abstract class FCommand extends MCommand { public boolean isMoneyCommand; public FCommand() { - super(SaberFactions.plugin); + super(P.p); // Due to safety reasons it defaults to disable on lock. disableOnLock = true; diff --git a/src/main/java/com/massivecraft/factions/cmd/alts/CmdAlts.java b/src/main/java/com/massivecraft/factions/cmd/alts/CmdAlts.java index 274f7724..71e7034c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/alts/CmdAlts.java +++ b/src/main/java/com/massivecraft/factions/cmd/alts/CmdAlts.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd.alts; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -34,13 +34,13 @@ public class CmdAlts extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("f-alts.Enabled", false)) { + if (!P.p.getConfig().getBoolean("f-alts.Enabled", false)) { fme.msg(TL.GENERIC_DISABLED); return; } this.commandChain.add(this); - SaberFactions.plugin.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); + P.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/alts/CmdAltsList.java b/src/main/java/com/massivecraft/factions/cmd/alts/CmdAltsList.java index 4ed8e494..799c9af2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/alts/CmdAltsList.java +++ b/src/main/java/com/massivecraft/factions/cmd/alts/CmdAltsList.java @@ -48,8 +48,8 @@ public class CmdAltsList extends FCommand { return; } - msg("There are " + faction.getAltPlayers().size() + " alts in " + faction.getTag() + ":"); - msg("" + Joiner.on(", ").join(faction.getAltPlayers().stream().map(FPlayer::getName).collect(Collectors.toList()))); + msg("There are " + faction.getAltPlayers().size() + " alts in " + faction.getTag() + ":"); + msg(Joiner.on(", ").join(faction.getAltPlayers().stream().map(FPlayer::getName).collect(Collectors.toList()))); } diff --git a/src/main/java/com/massivecraft/factions/cmd/alts/CmdInviteAlt.java b/src/main/java/com/massivecraft/factions/cmd/alts/CmdInviteAlt.java index bfb5ee01..d9fb739e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/alts/CmdInviteAlt.java +++ b/src/main/java/com/massivecraft/factions/cmd/alts/CmdInviteAlt.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd.alts; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; @@ -33,7 +33,7 @@ public class CmdInviteAlt extends FCommand { @Override public void perform() { - if(!SaberFactions.plugin.getConfig().getBoolean("f-alts.Enabled", false)){ + if(!P.p.getConfig().getBoolean("f-alts.Enabled", false)){ fme.msg(TL.GENERIC_DISABLED); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/claim/CmdCorner.java b/src/main/java/com/massivecraft/factions/cmd/claim/CmdCorner.java index 21d42b02..75ed7754 100644 --- a/src/main/java/com/massivecraft/factions/cmd/claim/CmdCorner.java +++ b/src/main/java/com/massivecraft/factions/cmd/claim/CmdCorner.java @@ -27,7 +27,7 @@ public class CmdCorner extends FCommand { @Override public void perform() { FLocation to = new FLocation(me.getLocation()); - if (SaberFactions.plugin.getFactionsPlayerListener().getCorners().contains(to)) { + if (P.p.getFactionsPlayerListener().getCorners().contains(to)) { Faction cornerAt = Board.getInstance().getFactionAt(to); if (cornerAt != null && cornerAt.isNormal() && !cornerAt.equals(fme.getFaction())) { msg(TL.COMMAND_CORNER_CANT_CLAIM); @@ -49,7 +49,7 @@ public class CmdCorner extends FCommand { if (surrounding.isEmpty()) { msg(TL.COMMAND_CORNER_CANT_CLAIM); } else { - new CornerTask(fme, surrounding).runTaskTimer(SaberFactions.plugin, 1L, 1L); + new CornerTask(fme, surrounding).runTaskTimer(P.p, 1L, 1L); } } } else { diff --git a/src/main/java/com/massivecraft/factions/cmd/claim/CmdSafeunclaimall.java b/src/main/java/com/massivecraft/factions/cmd/claim/CmdSafeunclaimall.java index aa289fbe..4f401c00 100644 --- a/src/main/java/com/massivecraft/factions/cmd/claim/CmdSafeunclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/claim/CmdSafeunclaimall.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd.claim; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Factions; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -51,7 +51,7 @@ public class CmdSafeunclaimall extends FCommand { msg(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMED); if (Conf.logLandUnclaims) { - SaberFactions.plugin.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName())); + P.p.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/claim/CmdUnclaim.java b/src/main/java/com/massivecraft/factions/cmd/claim/CmdUnclaim.java index 6914177a..240be501 100644 --- a/src/main/java/com/massivecraft/factions/cmd/claim/CmdUnclaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/claim/CmdUnclaim.java @@ -85,7 +85,7 @@ public class CmdUnclaim extends FCommand { msg(TL.COMMAND_UNCLAIM_SAFEZONE_SUCCESS); if (Conf.logLandUnclaims) { - SaberFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); + P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); } return true; } else { @@ -98,7 +98,7 @@ public class CmdUnclaim extends FCommand { msg(TL.COMMAND_UNCLAIM_WARZONE_SUCCESS); if (Conf.logLandUnclaims) { - SaberFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); + P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); } return true; } else { @@ -109,7 +109,7 @@ public class CmdUnclaim extends FCommand { if (fme.isAdminBypassing()) { LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(target, targetFaction, fme); - Bukkit.getScheduler().runTask(SaberFactions.plugin, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimEvent)); + Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimEvent)); if (unclaimEvent.isCancelled()) { return false; } @@ -120,7 +120,7 @@ public class CmdUnclaim extends FCommand { msg(TL.COMMAND_UNCLAIM_UNCLAIMS); if (Conf.logLandUnclaims) { - SaberFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); + P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); } return true; @@ -171,7 +171,7 @@ public class CmdUnclaim extends FCommand { myFaction.msg(TL.COMMAND_UNCLAIM_FACTIONUNCLAIMED, fme.describeTo(myFaction, true)); if (Conf.logLandUnclaims) { - SaberFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); + P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); } return true; diff --git a/src/main/java/com/massivecraft/factions/cmd/claim/CmdUnclaimall.java b/src/main/java/com/massivecraft/factions/cmd/claim/CmdUnclaimall.java index dbc9c944..3b398d9f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/claim/CmdUnclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/claim/CmdUnclaimall.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd.claim; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.event.LandUnclaimAllEvent; import com.massivecraft.factions.integration.Econ; @@ -45,7 +45,7 @@ public class CmdUnclaimall extends FCommand { } LandUnclaimAllEvent unclaimAllEvent = new LandUnclaimAllEvent(myFaction, fme); - Bukkit.getScheduler().runTask(SaberFactions.plugin, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimAllEvent)); + Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimAllEvent)); if (unclaimAllEvent.isCancelled()) { return; } @@ -54,7 +54,7 @@ public class CmdUnclaimall extends FCommand { myFaction.msg(TL.COMMAND_UNCLAIMALL_UNCLAIMED, fme.describeTo(myFaction, true)); if (Conf.logLandUnclaims) { - SaberFactions.plugin.log(TL.COMMAND_UNCLAIMALL_LOG.format(fme.getName(), myFaction.getTag())); + P.p.log(TL.COMMAND_UNCLAIMALL_LOG.format(fme.getName(), myFaction.getTag())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/claim/CmdWarunclaimall.java b/src/main/java/com/massivecraft/factions/cmd/claim/CmdWarunclaimall.java index cc3be652..768c06ee 100644 --- a/src/main/java/com/massivecraft/factions/cmd/claim/CmdWarunclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/claim/CmdWarunclaimall.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd.claim; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Factions; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; @@ -50,7 +50,7 @@ public class CmdWarunclaimall extends FCommand { if (Conf.logLandUnclaims) { - SaberFactions.plugin.log(TL.COMMAND_WARUNCLAIMALL_LOG.format(fme.getName())); + P.p.log(TL.COMMAND_WARUNCLAIMALL_LOG.format(fme.getName())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoney.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoney.java index 70be643b..7feafb2e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoney.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoney.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd.econ; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.zcore.util.TL; @@ -42,7 +42,7 @@ public class CmdMoney extends FCommand { @Override public void perform() { this.commandChain.add(this); - SaberFactions.plugin.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); + P.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyDeposit.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyDeposit.java index 2f0e2c71..fcd00b52 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyDeposit.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyDeposit.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd.econ; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; @@ -40,7 +40,7 @@ public class CmdMoneyDeposit extends FCommand { boolean success = Econ.transferMoney(fme, fme, faction, amount); if (success && Conf.logMoneyTransactions) { - SaberFactions.plugin.log(ChatColor.stripColor(SaberFactions.plugin.txt.parse(TL.COMMAND_MONEYDEPOSIT_DEPOSITED.toString(), fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); + P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYDEPOSIT_DEPOSITED.toString(), fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFf.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFf.java index 094ab850..f04dffee 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFf.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFf.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd.econ; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; @@ -51,7 +51,7 @@ public class CmdMoneyTransferFf extends FCommand { if (success && Conf.logMoneyTransactions) { String name = sender instanceof Player ? fme.getName() : sender.getName(); - SaberFactions.plugin.log(ChatColor.stripColor(SaberFactions.plugin.txt.parse(TL.COMMAND_MONEYTRANSFERFF_TRANSFER.toString(), name, Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); + P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYTRANSFERFF_TRANSFER.toString(), name, Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFp.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFp.java index aaff5490..268b573d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFp.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFp.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd.econ; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; @@ -50,7 +50,7 @@ public class CmdMoneyTransferFp extends FCommand { boolean success = Econ.transferMoney(fme, from, to, amount); if (success && Conf.logMoneyTransactions) { - SaberFactions.plugin.log(ChatColor.stripColor(SaberFactions.plugin.txt.parse(TL.COMMAND_MONEYTRANSFERFP_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); + P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYTRANSFERFP_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferPf.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferPf.java index 88137bf9..1356ea61 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferPf.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferPf.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd.econ; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; @@ -50,7 +50,7 @@ public class CmdMoneyTransferPf extends FCommand { boolean success = Econ.transferMoney(fme, from, to, amount); if (success && Conf.logMoneyTransactions) { - SaberFactions.plugin.log(ChatColor.stripColor(SaberFactions.plugin.txt.parse(TL.COMMAND_MONEYTRANSFERPF_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); + P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYTRANSFERPF_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyWithdraw.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyWithdraw.java index e87e1867..ad523c5f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyWithdraw.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyWithdraw.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd.econ; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; @@ -54,7 +54,7 @@ public class CmdMoneyWithdraw extends FCommand { boolean success = Econ.transferMoney(fme, faction, fme, amount); if (success && Conf.logMoneyTransactions) { - SaberFactions.plugin.log(ChatColor.stripColor(SaberFactions.plugin.txt.parse(TL.COMMAND_MONEYWITHDRAW_WITHDRAW.toString(), fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); + P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYWITHDRAW_WITHDRAW.toString(), fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/logout/LogoutHandler.java b/src/main/java/com/massivecraft/factions/cmd/logout/LogoutHandler.java index ee9a9eb8..881fcfaa 100644 --- a/src/main/java/com/massivecraft/factions/cmd/logout/LogoutHandler.java +++ b/src/main/java/com/massivecraft/factions/cmd/logout/LogoutHandler.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.cmd.logout; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -35,9 +35,9 @@ public class LogoutHandler { public void applyLogoutCooldown(Player player) { logoutCooldown.put(player.getUniqueId(), System.currentTimeMillis() + (30 * 1000)); - Bukkit.getScheduler().runTaskLater(SaberFactions.plugin, () -> { + Bukkit.getScheduler().runTaskLater(P.p, () -> { if(isLogoutActive(player)) { - player.setMetadata("Logout", new FixedMetadataValue(SaberFactions.plugin, true)); + player.setMetadata("Logout", new FixedMetadataValue(P.p, true)); player.kickPlayer(String.valueOf(TL.COMMAND_LOGOUT_KICK_MESSAGE)); cancelLogout(player); } diff --git a/src/main/java/com/massivecraft/factions/cmd/points/CmdPoints.java b/src/main/java/com/massivecraft/factions/cmd/points/CmdPoints.java index fb30dcb9..dc7077e3 100644 --- a/src/main/java/com/massivecraft/factions/cmd/points/CmdPoints.java +++ b/src/main/java/com/massivecraft/factions/cmd/points/CmdPoints.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.cmd.points; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.zcore.util.TL; @@ -31,12 +31,12 @@ public class CmdPoints extends FCommand { @Override public void perform() { - if (!SaberFactions.plugin.getConfig().getBoolean("f-points.Enabled", true)) { + if (!P.p.getConfig().getBoolean("f-points.Enabled", true)) { fme.msg(TL.GENERIC_DISABLED); return; } this.commandChain.add(this); - SaberFactions.plugin.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); + P.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/relational/FRelationCommand.java b/src/main/java/com/massivecraft/factions/cmd/relational/FRelationCommand.java index bb730476..df48e160 100644 --- a/src/main/java/com/massivecraft/factions/cmd/relational/FRelationCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/relational/FRelationCommand.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd.relational; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.event.FactionRelationEvent; import com.massivecraft.factions.event.FactionRelationWishEvent; @@ -104,8 +104,8 @@ public abstract class FRelationCommand extends FCommand { } private boolean hasMaxRelations(Faction them, Relation targetRelation) { - int max = SaberFactions.plugin.getConfig().getInt("max-relations." + targetRelation.toString(), -1); - if (SaberFactions.plugin.getConfig().getBoolean("max-relations.enabled", false)) { + int max = P.p.getConfig().getInt("max-relations." + targetRelation.toString(), -1); + if (P.p.getConfig().getBoolean("max-relations.enabled", false)) { if (max != -1) { if (myFaction.getRelationCount(targetRelation) >= max) { msg(TL.COMMAND_RELATIONS_EXCEEDS_ME, max, targetRelation.getPluralTranslation()); diff --git a/src/main/java/com/massivecraft/factions/integration/Econ.java b/src/main/java/com/massivecraft/factions/integration/Econ.java index 2ea35b99..dc40aba4 100644 --- a/src/main/java/com/massivecraft/factions/integration/Econ.java +++ b/src/main/java/com/massivecraft/factions/integration/Econ.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.integration; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; @@ -34,24 +34,24 @@ public class Econ { String integrationFail = "Economy integration is " + (Conf.econEnabled ? "enabled, but" : "disabled, and") + " the plugin \"Vault\" "; if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) { - SaberFactions.plugin.log(integrationFail + "is not installed."); + P.p.log(integrationFail + "is not installed."); return; } RegisteredServiceProvider rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { - SaberFactions.plugin.log(integrationFail + "is not hooked into an economy plugin."); + P.p.log(integrationFail + "is not hooked into an economy plugin."); return; } econ = rsp.getProvider(); - SaberFactions.plugin.log("Economy integration through Vault plugin successful."); + P.p.log("Economy integration through Vault plugin successful."); if (!Conf.econEnabled) { - SaberFactions.plugin.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true"); + P.p.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true"); } - SaberFactions.plugin.cmdBase.cmdHelp.updateHelp(); + P.p.cmdBase.cmdHelp.updateHelp(); } public static boolean shouldBeUsed() { @@ -82,7 +82,7 @@ public class Econ { public static void sendBalanceInfo(FPlayer to, EconomyParticipator about) { if (!shouldBeUsed()) { - SaberFactions.plugin.log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin."); + P.p.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/main/java/com/massivecraft/factions/integration/Worldguard.java b/src/main/java/com/massivecraft/factions/integration/Worldguard.java index 47544c7e..b93e6e9e 100644 --- a/src/main/java/com/massivecraft/factions/integration/Worldguard.java +++ b/src/main/java/com/massivecraft/factions/integration/Worldguard.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.integration; import com.massivecraft.factions.FLocation; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; @@ -38,11 +38,11 @@ public class Worldguard { if (wgplug == null || !(wgplug instanceof WorldGuardPlugin)) { enabled = false; wg = null; - SaberFactions.plugin.log("Could not hook to WorldGuard. WorldGuard checks are disabled."); + P.p.log("Could not hook to WorldGuard. WorldGuard checks are disabled."); } else { wg = (WorldGuardPlugin) wgplug; enabled = true; - SaberFactions.plugin.log("Successfully hooked to WorldGuard."); + P.p.log("Successfully hooked to WorldGuard."); } } diff --git a/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java b/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java index a423fad4..62264fe9 100644 --- a/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java +++ b/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java @@ -113,7 +113,7 @@ public class EngineDynmap { } // Shedule non thread safe sync at the end! - Bukkit.getScheduler().scheduleSyncRepeatingTask(SaberFactions.plugin, () -> { + Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> { final Map homes = createHomes(); final Map areas = createAreas(); diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index cbcd6189..c1575631 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -87,7 +87,7 @@ public class FactionsBlockListener implements Listener { return false; } else if (!otherFaction.getId().equals(myFaction.getId())) { // If the faction target is not my own - if (SaberFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded()) + if (P.p.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded()) return true; // Get faction pain build access relation to me boolean pain = !justCheck && otherFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW; @@ -174,7 +174,7 @@ public class FactionsBlockListener implements Listener { @EventHandler public void onVaultPlace(BlockPlaceEvent e) { if (e.getItemInHand().getType() == Material.CHEST) { - ItemStack vault = SaberFactions.plugin.createItem(Material.CHEST, 1, (short) 0, SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fvault.Item.Name")), SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fvault.Item.Lore"))); + ItemStack vault = P.p.createItem(Material.CHEST, 1, (short) 0, P.p.color(P.p.getConfig().getString("fvault.Item.Name")), P.p.colorList(P.p.getConfig().getStringList("fvault.Item.Lore"))); if (e.getItemInHand().isSimilar(vault)) { FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer()); if (fme.getFaction().getVault() != null) { @@ -200,7 +200,7 @@ public class FactionsBlockListener implements Listener { Material blockMaterial = blockLoc.getBlock().getType(); - if (blockMaterial == Material.CHEST || (SaberFactions.plugin.getConfig().getBoolean("fvault.No-Hoppers-near-vault") && blockMaterial == Material.HOPPER)) { + if (blockMaterial == Material.CHEST || (P.p.getConfig().getBoolean("fvault.No-Hoppers-near-vault") && blockMaterial == Material.HOPPER)) { e.setCancelled(true); fme.msg(TL.COMMAND_GETVAULT_CHESTNEAR); return; @@ -219,7 +219,7 @@ public class FactionsBlockListener implements Listener { @EventHandler public void onHopperPlace(BlockPlaceEvent e) { - if (e.getItemInHand().getType() != Material.HOPPER && !SaberFactions.plugin.getConfig().getBoolean("fvault.No-Hoppers-near-vault")) { + if (e.getItemInHand().getType() != Material.HOPPER && !P.p.getConfig().getBoolean("fvault.No-Hoppers-near-vault")) { return; } @@ -266,7 +266,7 @@ public class FactionsBlockListener implements Listener { Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(targetLoc)); // Check if the piston is moving in a faction's territory. This disables pistons entirely in faction territory. - if (otherFaction.isNormal() && SaberFactions.plugin.getConfig().getBoolean("disable-pistons-in-territory", false)) { + if (otherFaction.isNormal() && P.p.getConfig().getBoolean("disable-pistons-in-territory", false)) { event.setCancelled(true); return; } @@ -285,7 +285,7 @@ public class FactionsBlockListener implements Listener { @EventHandler public void onBannerPlace(BlockPlaceEvent e) { - if (SaberFactions.plugin.mc17) { + if (P.p.mc17) { return; } @@ -295,11 +295,11 @@ public class FactionsBlockListener implements Listener { ItemStack warBanner = fme.getFaction().getBanner(); if (warBanner != null) { ItemMeta warmeta = warBanner.getItemMeta(); - warmeta.setDisplayName(SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fbanners.Item.Name"))); - warmeta.setLore(SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fbanners.Item.Lore"))); + warmeta.setDisplayName(P.p.color(P.p.getConfig().getString("fbanners.Item.Name"))); + warmeta.setLore(P.p.colorList(P.p.getConfig().getStringList("fbanners.Item.Lore"))); warBanner.setItemMeta(warmeta); } else { - warBanner = SaberFactions.plugin.createItem(XMaterial.BLACK_BANNER.parseMaterial(), 1, (short) 1, SaberFactions.plugin.getConfig().getString("fbanners.Item.Name"), SaberFactions.plugin.getConfig().getStringList("fbanners.Item.Lore")); + warBanner = P.p.createItem(XMaterial.BLACK_BANNER.parseMaterial(), 1, (short) 1, P.p.getConfig().getString("fbanners.Item.Name"), P.p.getConfig().getStringList("fbanners.Item.Lore")); } if (warBanner.isSimilar(bannerInHand)) { @@ -308,12 +308,12 @@ public class FactionsBlockListener implements Listener { e.setCancelled(true); return; } - int bannerTime = SaberFactions.plugin.getConfig().getInt("fbanners.Banner-Time") * 20; + int bannerTime = P.p.getConfig().getInt("fbanners.Banner-Time") * 20; Location placedLoc = e.getBlockPlaced().getLocation(); FLocation fplacedLoc = new FLocation(placedLoc); - if ((Board.getInstance().getFactionAt(fplacedLoc).isWarZone() && SaberFactions.plugin.getConfig().getBoolean("fbanners.Placeable.Warzone")) - || (fme.getFaction().getRelationTo(Board.getInstance().getFactionAt(fplacedLoc)) == Relation.ENEMY) && SaberFactions.plugin.getConfig().getBoolean("fbanners.Placeable.Enemy")) { + if ((Board.getInstance().getFactionAt(fplacedLoc).isWarZone() && P.p.getConfig().getBoolean("fbanners.Placeable.Warzone")) + || (fme.getFaction().getRelationTo(Board.getInstance().getFactionAt(fplacedLoc)) == Relation.ENEMY) && P.p.getConfig().getBoolean("fbanners.Placeable.Enemy")) { if (bannerCooldownMap.containsKey(fme.getTag())) { fme.msg(TL.WARBANNER_COOLDOWN); e.setCancelled(true); @@ -321,29 +321,29 @@ public class FactionsBlockListener implements Listener { } for (FPlayer fplayer : fme.getFaction().getFPlayers()) { // if (fplayer == fme) { continue; } //Idk if I wanna not send the title to the player - fplayer.getPlayer().sendTitle(SaberFactions.plugin.color(fme.getTag() + " Placed A WarBanner!"), SaberFactions.plugin.color("&7use &c/f tpbanner&7 to tp to the banner!"), 10, 70, 20); + fplayer.getPlayer().sendTitle(P.p.color(fme.getTag() + " Placed A WarBanner!"), P.p.color("&7use &c/f tpbanner&7 to tp to the banner!"), 10, 70, 20); } bannerCooldownMap.put(fme.getTag(), true); bannerLocations.put(fme.getTag(), e.getBlockPlaced().getLocation()); - int bannerCooldown = SaberFactions.plugin.getConfig().getInt("fbanners.Banner-Place-Cooldown"); + int bannerCooldown = P.p.getConfig().getInt("fbanners.Banner-Place-Cooldown"); ArmorStand as = (ArmorStand) e.getBlockPlaced().getLocation().add(0.5, 1, 0.5).getWorld().spawnEntity(e.getBlockPlaced().getLocation().add(0.5, 1, 0.5), EntityType.ARMOR_STAND); //Spawn the ArmorStand as.setVisible(false); //Makes the ArmorStand invisible as.setGravity(false); //Make sure it doesn't fall as.setCanPickupItems(false); //I'm not sure what happens if you leave this as it is, but you might as well disable it - as.setCustomName(SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fbanners.BannerHolo").replace("{Faction}", fme.getTag()))); //Set this to the text you want + as.setCustomName(P.p.color(P.p.getConfig().getString("fbanners.BannerHolo").replace("{Faction}", fme.getTag()))); //Set this to the text you want as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not ArmorStand armorStand = as; String tag = fme.getTag(); - Bukkit.getScheduler().scheduleSyncDelayedTask(SaberFactions.plugin, () -> bannerCooldownMap.remove(tag), Long.parseLong(bannerCooldown + "")); + Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, () -> bannerCooldownMap.remove(tag), Long.parseLong(bannerCooldown + "")); Block banner = e.getBlockPlaced(); Material bannerType = banner.getType(); Faction bannerFaction = fme.getFaction(); banner.getWorld().strikeLightningEffect(banner.getLocation()); // e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_LIGHTNING_IMPACT,2.0F,0.5F); - int radius = SaberFactions.plugin.getConfig().getInt("fbanners.Banner-Effect-Radius"); - List effects = SaberFactions.plugin.getConfig().getStringList("fbanners.Effects"); - int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(SaberFactions.plugin, () -> { + int radius = P.p.getConfig().getInt("fbanners.Banner-Effect-Radius"); + List effects = P.p.getConfig().getStringList("fbanners.Effects"); + int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> { for (Entity e1 : banner.getLocation().getWorld().getNearbyEntities(banner.getLocation(), radius, 255, radius)) { if (e1 instanceof Player) { @@ -364,7 +364,7 @@ public class FactionsBlockListener implements Listener { } } }, 0L, 20L); - Bukkit.getScheduler().scheduleSyncDelayedTask(SaberFactions.plugin, () -> { + Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, () -> { banner.setType(Material.AIR); as.remove(); banner.getWorld().strikeLightningEffect(banner.getLocation()); @@ -403,7 +403,7 @@ public class FactionsBlockListener implements Listener { @EventHandler public void onFallingBlock(EntityChangeBlockEvent event) { - if(!SaberFactions.plugin.getConfig().getBoolean("Falling-Block-Fix.Enabled")) + if(!P.p.getConfig().getBoolean("Falling-Block-Fix.Enabled")) return; Faction faction = Board.getInstance().getFactionAt(new FLocation(event.getBlock())); @@ -416,7 +416,7 @@ public class FactionsBlockListener implements Listener { //Grace @EventHandler public void onBreak(EntityExplodeEvent e) { - if (!SaberFactions.plugin.getConfig().getBoolean("f-grace.Enabled")) + if (!P.p.getConfig().getBoolean("f-grace.Enabled")) return; if (!graceisEnabled()) { @@ -426,7 +426,7 @@ public class FactionsBlockListener implements Listener { @EventHandler public void entityDamage(EntityDamageEvent e) { - if (!SaberFactions.plugin.getConfig().getBoolean("f-grace.Enabled")) + if (!P.p.getConfig().getBoolean("f-grace.Enabled")) return; if (!graceisEnabled()) { @@ -441,7 +441,7 @@ public class FactionsBlockListener implements Listener { @EventHandler public void onTNTPlace(BlockPlaceEvent e1) { FPlayer fp = FPlayers.getInstance().getByPlayer(e1.getPlayer()); - if (!SaberFactions.plugin.getConfig().getBoolean("f-grace.Enabled")) + if (!P.p.getConfig().getBoolean("f-grace.Enabled")) return; if (!graceisEnabled() && !fp.isAdminBypassing()) { diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java index b9b2617b..1e840646 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java @@ -180,9 +180,9 @@ public class FactionsChatListener implements Listener { listeningPlayer.sendMessage(String.format(yourFormat, talkingPlayer.getDisplayName(), msg)); } catch (UnknownFormatConversionException ex) { Conf.chatTagInsertIndex = 0; - SaberFactions.plugin.log(Level.SEVERE, "Critical error in chat message formatting!"); - SaberFactions.plugin.log(Level.SEVERE, "NOTE: This has been automatically fixed right now by setting chatTagInsertIndex to 0."); - SaberFactions.plugin.log(Level.SEVERE, "For a more proper fix, please read this regarding chat configuration: http://massivecraft.com/plugins/factions/config#Chat_configuration"); + P.p.log(Level.SEVERE, "Critical error in chat message formatting!"); + P.p.log(Level.SEVERE, "NOTE: This has been automatically fixed right now by setting chatTagInsertIndex to 0."); + P.p.log(Level.SEVERE, "For a more proper fix, please read this regarding chat configuration: http://massivecraft.com/plugins/factions/config#Chat_configuration"); return; } } @@ -202,7 +202,7 @@ public class FactionsChatListener implements Listener { player.teleport(fme.getFaction().getWarp(warp).getLocation()); fme.msg(TL.COMMAND_FWARP_WARPED, warp); } - }, SaberFactions.plugin.getConfig().getLong("warmups.f-warp", 0)); + }, P.p.getConfig().getLong("warmups.f-warp", 0)); } } \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index 7aa87f83..cb9dab02 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -19,7 +19,6 @@ import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause; import org.bukkit.event.hanging.HangingPlaceEvent; -import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.potion.PotionEffect; @@ -227,9 +226,9 @@ public class FactionsEntityListener implements Listener { return; } UUID uuid = player.getUniqueId(); - if (SaberFactions.plugin.getStuckMap().containsKey(uuid)) { + if (P.p.getStuckMap().containsKey(uuid)) { FPlayers.getInstance().getByPlayer(player).msg(TL.COMMAND_STUCK_CANCELLED); - SaberFactions.plugin.getStuckMap().remove(uuid); + P.p.getStuckMap().remove(uuid); } } @@ -645,7 +644,7 @@ public class FactionsEntityListener implements Listener { @EventHandler public void onTravel(PlayerPortalEvent event) { - if (!SaberFactions.plugin.getConfig().getBoolean("portals.limit", false)) { + if (!P.p.getConfig().getBoolean("portals.limit", false)) { return; // Don't do anything if they don't want us to. } @@ -664,7 +663,7 @@ public class FactionsEntityListener implements Listener { } FPlayer fp = FPlayers.getInstance().getByPlayer(event.getPlayer()); - String mininumRelation = SaberFactions.plugin.getConfig().getString("portals.minimum-relation", "MEMBER"); // Defaults to Neutral if typed wrong. + String mininumRelation = P.p.getConfig().getString("portals.minimum-relation", "MEMBER"); // Defaults to Neutral if typed wrong. if (!fp.getFaction().getRelationTo(faction).isAtLeast(Relation.fromString(mininumRelation))) { event.setCancelled(true); } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java index 29cbd95e..50ad9813 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.listeners; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.util.XMaterial; import org.bukkit.Location; import org.bukkit.Material; @@ -30,7 +30,7 @@ public class FactionsExploitListener implements Listener { Block block = event.getToBlock(); // Added this so it wont die on 1.14 :) - if (SaberFactions.plugin.mc114) { + if (P.p.mc114) { Material source = event.getBlock().getType(); Material target = block.getType(); if ((target == Material.REDSTONE_WIRE || target == Material.TRIPWIRE) && (source == Material.AIR || source == Material.LEGACY_STATIONARY_LAVA || source == Material.LEGACY_LAVA)) { diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index d2967b31..1c742b5e 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -56,10 +56,10 @@ public class FactionsPlayerListener implements Listener { public FactionsPlayerListener() { this.corners = new HashSet<>(); - for (Player player : SaberFactions.plugin.getServer().getOnlinePlayers()) { + for (Player player : P.p.getServer().getOnlinePlayers()) { initPlayer(player); } - for (World world : SaberFactions.plugin.getServer().getWorlds()) { + for (World world : P.p.getServer().getWorlds()) { WorldBorder border = world.getWorldBorder(); if (border != null) { int cornerCoord = (int) ((border.getSize() - 1.0) / 2.0); @@ -102,7 +102,7 @@ public class FactionsPlayerListener implements Listener { return false; } - if (SaberFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded()) { + if (P.p.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded()) { return true; } @@ -184,7 +184,7 @@ public class FactionsPlayerListener implements Listener { return false; } - if (SaberFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded()) + if (P.p.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded()) return true; if (otherFaction.getId().equals(myFaction.getId()) && me.getRole() == Role.LEADER) return true; @@ -306,15 +306,15 @@ public class FactionsPlayerListener implements Listener { me.login(); // set kills / deaths // Check for Faction announcements. Let's delay this so they actually see it. - Bukkit.getScheduler().runTaskLater(SaberFactions.plugin, () -> { + Bukkit.getScheduler().runTaskLater(P.p, () -> { if (me.isOnline()) { me.getFaction().sendUnreadAnnouncements(me); } }, 33L); // Don't ask me why. - if (SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", false)) { + if (P.p.getConfig().getBoolean("scoreboard.default-enabled", false)) { FScoreboard.init(me); - FScoreboard.get(me).setDefaultSidebar(new FDefaultSidebar(), SaberFactions.plugin.getConfig().getInt("scoreboard.default-update-interval", 20)); + FScoreboard.get(me).setDefaultSidebar(new FDefaultSidebar(), P.p.getConfig().getInt("scoreboard.default-update-interval", 20)); FScoreboard.get(me).setSidebarVisibility(me.showScoreboard()); } @@ -329,17 +329,17 @@ public class FactionsPlayerListener implements Listener { fallMap.put(me.getPlayer(), false); - Bukkit.getScheduler().scheduleSyncDelayedTask(SaberFactions.plugin, () -> fallMap.remove(me.getPlayer()), 180L); + Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, () -> fallMap.remove(me.getPlayer()), 180L); if (me.isSpyingChat() && !player.hasPermission(Permission.CHATSPY.node)) { me.setSpyingChat(false); - SaberFactions.plugin.log(Level.INFO, "Found %s spying chat without permission on login. Disabled their chat spying.", player.getName()); + P.p.log(Level.INFO, "Found %s spying chat without permission on login. Disabled their chat spying.", player.getName()); } if (me.isAdminBypassing() && !player.hasPermission(Permission.BYPASS.node)) { me.setIsAdminBypassing(false); - SaberFactions.plugin.log(Level.INFO, "Found %s on admin Bypass without permission on login. Disabled it for them.", player.getName()); + P.p.log(Level.INFO, "Found %s on admin Bypass without permission on login. Disabled it for them.", player.getName()); } @@ -373,10 +373,10 @@ public class FactionsPlayerListener implements Listener { me.logout(); // cache kills / deaths // if player is waiting for fstuck teleport but leaves, remove - if (SaberFactions.plugin.getStuckMap().containsKey(me.getPlayer().getUniqueId())) { + if (P.p.getStuckMap().containsKey(me.getPlayer().getUniqueId())) { FPlayers.getInstance().getByPlayer(me.getPlayer()).msg(TL.COMMAND_STUCK_CANCELLED); - SaberFactions.plugin.getStuckMap().remove(me.getPlayer().getUniqueId()); - SaberFactions.plugin.getTimers().remove(me.getPlayer().getUniqueId()); + P.p.getStuckMap().remove(me.getPlayer().getUniqueId()); + P.p.getTimers().remove(me.getPlayer().getUniqueId()); } Faction myFaction = me.getFaction(); @@ -413,11 +413,11 @@ public class FactionsPlayerListener implements Listener { public void enableFly(FPlayer me) { if (!me.getPlayer().hasPermission("factions.fly")) return; - if (SaberFactions.plugin.getConfig().getBoolean("ffly.AutoEnable")) { + if (P.p.getConfig().getBoolean("ffly.AutoEnable")) { me.setFlying(true); CmdFly.flyMap.put(me.getName(), true); if (CmdFly.id == -1) { - if (SaberFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) { + if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")) { CmdFly.startParticles(); } } @@ -533,25 +533,25 @@ public class FactionsPlayerListener implements Listener { if (changedFaction) { Bukkit.getServer().getPluginManager().callEvent(new FPlayerEnteredFactionEvent(factionTo, factionFrom, me)); - if (SaberFactions.plugin.getConfig().getBoolean("Title.Show-Title")) { - String title = SaberFactions.plugin.getConfig().getString("Title.Format.Title"); + if (P.p.getConfig().getBoolean("Title.Show-Title")) { + String title = P.p.getConfig().getString("Title.Format.Title"); title = title.replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag()); title = parseAllPlaceholders(title, factionTo, player); - String subTitle = SaberFactions.plugin.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag()); + String subTitle = P.p.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag()); subTitle = parseAllPlaceholders(subTitle, factionTo, player); - if (!SaberFactions.plugin.mc17) { - if (!SaberFactions.plugin.mc18) { - me.getPlayer().sendTitle(SaberFactions.plugin.color(title), SaberFactions.plugin.color(subTitle), SaberFactions.plugin.getConfig().getInt("Title.Options.FadeInTime"), - SaberFactions.plugin.getConfig().getInt("Title.Options.ShowTime"), - SaberFactions.plugin.getConfig().getInt("Title.Options.FadeOutTime")); + if (!P.p.mc17) { + if (!P.p.mc18) { + me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle), P.p.getConfig().getInt("Title.Options.FadeInTime"), + P.p.getConfig().getInt("Title.Options.ShowTime"), + P.p.getConfig().getInt("Title.Options.FadeOutTime")); } else { - me.getPlayer().sendTitle(SaberFactions.plugin.color(title), SaberFactions.plugin.color(subTitle)); + me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle)); } } } // enable fly :) - if (SaberFactions.plugin.factionsFlight && me.hasFaction() && !me.isFlying()) { + if (P.p.factionsFlight && me.hasFaction() && !me.isFlying()) { if (factionTo == me.getFaction()) enableFly(me); // bypass checks Relation relationTo = factionTo.getRelationTo(me); @@ -592,12 +592,12 @@ public class FactionsPlayerListener implements Listener { if (me.isMapAutoUpdating()) { if (showTimes.containsKey(player.getUniqueId()) && (showTimes.get(player.getUniqueId()) > System.currentTimeMillis())) { - if (SaberFactions.plugin.getConfig().getBoolean("findfactionsexploit.log", false)) { - SaberFactions.plugin.log(Level.WARNING, "%s tried to show a faction map too soon and triggered exploit blocker.", player.getName()); + if (P.p.getConfig().getBoolean("findfactionsexploit.log", false)) { + P.p.log(Level.WARNING, "%s tried to show a faction map too soon and triggered exploit blocker.", player.getName()); } } else { me.sendFancyMessage(Board.getInstance().getMap(me, to, player.getLocation().getYaw())); - showTimes.put(player.getUniqueId(), System.currentTimeMillis() + SaberFactions.plugin.getConfig().getLong("findfactionsexploit.cooldown", 2000)); + showTimes.put(player.getUniqueId(), System.currentTimeMillis() + P.p.getConfig().getLong("findfactionsexploit.cooldown", 2000)); } } else { Faction myFaction = me.getFaction(); @@ -880,7 +880,7 @@ public class FactionsPlayerListener implements Listener { return PermissableAction.DOOR; if (material.name().toUpperCase().contains("BUTTON") || material.name().toUpperCase().contains("PRESSURE")) return PermissableAction.BUTTON; - if (SaberFactions.plugin.mc113) { + if (P.p.mc113) { switch (material) { case LEVER: return PermissableAction.LEVER; diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java index ec4b1425..9dd6304e 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.scoreboards; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @@ -109,7 +109,7 @@ public class FScoreboard { updateObjective(); } } - }.runTaskTimer(SaberFactions.plugin, updateInterval, updateInterval); + }.runTaskTimer(P.p, updateInterval, updateInterval); } public void setTemporarySidebar(final FSidebarProvider provider) { @@ -132,7 +132,7 @@ public class FScoreboard { updateObjective(); } } - }.runTaskLater(SaberFactions.plugin, SaberFactions.plugin.getConfig().getInt("scoreboard.expiration", 7) * 20); + }.runTaskLater(P.p, P.p.getConfig().getInt("scoreboard.expiration", 7) * 20); } private void updateObjective() { diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java b/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java index 5aa24fdf..e6d686f9 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.scoreboards; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TagUtil; @@ -37,6 +37,6 @@ public abstract class FSidebarProvider { // we assume it's broken up into two lines, so returning our tl will suffice. return TL.COMMAND_SHOW_NOHOME.toString(); } - return SaberFactions.plugin.txt.parse(line); // finally add color :) + return P.p.txt.parse(line); // finally add color :) } } \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java b/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java index 9e2e5e5d..90d4a3ac 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java @@ -39,13 +39,13 @@ public class FTeamWrapper { return; } - if (!SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false) || SaberFactions.plugin.getConfig().getBoolean("See-Invisible-Faction-Members")) { + if (!P.p.getConfig().getBoolean("scoreboard.default-prefixes", false) || P.p.getConfig().getBoolean("See-Invisible-Faction-Members")) { return; } if (updating.add(faction)) { - Bukkit.getScheduler().runTask(SaberFactions.plugin, () -> { + Bukkit.getScheduler().runTask(P.p, () -> { updating.remove(faction); applyUpdates(faction); }); @@ -61,7 +61,7 @@ public class FTeamWrapper { return; } - if (!SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false) || SaberFactions.plugin.getConfig().getBoolean("See-Invisible-Faction-Members")) { + if (!P.p.getConfig().getBoolean("scoreboard.default-prefixes", false) || P.p.getConfig().getBoolean("See-Invisible-Faction-Members")) { return; } @@ -153,7 +153,7 @@ public class FTeamWrapper { } private void updatePrefixes() { - if (SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { + if (P.p.getConfig().getBoolean("scoreboard.default-prefixes", false)) { for (FScoreboard fboard : teams.keySet()) { updatePrefix(fboard); } @@ -161,19 +161,19 @@ public class FTeamWrapper { } private void updatePrefix(FScoreboard fboard) { - if (SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { + if (P.p.getConfig().getBoolean("scoreboard.default-prefixes", false)) { FPlayer fplayer = fboard.getFPlayer(); Team team = teams.get(fboard); boolean focused = false; - if (SaberFactions.plugin.getConfig().getBoolean("See-Invisible-Faction-Members", false)) { + if (P.p.getConfig().getBoolean("See-Invisible-Faction-Members", false)) { team.setCanSeeFriendlyInvisibles(true); } - if ((SaberFactions.plugin.getConfig().getBoolean("ffocus.Enabled")) && (fplayer.getFaction() != null) && (fplayer.getFaction().getFocused() != null)) { + if ((P.p.getConfig().getBoolean("ffocus.Enabled")) && (fplayer.getFaction() != null) && (fplayer.getFaction().getFocused() != null)) { for (FPlayer fp : faction.getFPlayersWhereOnline(true)) { if (fplayer.getFaction().getFocused().equalsIgnoreCase(fp.getName())) { - team.setPrefix(ChatColor.translateAlternateColorCodes('&', SaberFactions.plugin.getConfig().getString("ffocus.Prefix", "&7»&b"))); + team.setPrefix(ChatColor.translateAlternateColorCodes('&', P.p.getConfig().getString("ffocus.Prefix", "&7»&b"))); focused = true; } } diff --git a/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FDefaultSidebar.java b/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FDefaultSidebar.java index d1f80500..93fc70ea 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FDefaultSidebar.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FDefaultSidebar.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.scoreboards.sidebar; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.scoreboards.FSidebarProvider; import java.util.ArrayList; @@ -12,21 +12,21 @@ public class FDefaultSidebar extends FSidebarProvider { @Override public String getTitle(FPlayer fplayer) { - return replaceTags(fplayer, SaberFactions.plugin.getConfig().getString("scoreboard.default-title", "{name}")); + return replaceTags(fplayer, P.p.getConfig().getString("scoreboard.default-title", "{name}")); } @Override public List getLines(FPlayer fplayer) { if (fplayer.hasFaction()) { return getOutput(fplayer, "scoreboard.default"); - } else if (SaberFactions.plugin.getConfig().getBoolean("scoreboard.factionless-enabled", false)) { + } else if (P.p.getConfig().getBoolean("scoreboard.factionless-enabled", false)) { return getOutput(fplayer, "scoreboard.factionless"); } return getOutput(fplayer, "scoreboard.default"); // no faction, factionless-board disabled } public List getOutput(FPlayer fplayer, String list) { - List lines = SaberFactions.plugin.getConfig().getStringList(list); + List lines = P.p.getConfig().getStringList(list); if (lines == null || lines.isEmpty()) { return new ArrayList<>(); diff --git a/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java b/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java index 54affc82..5ca0dc0e 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.scoreboards.sidebar; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.scoreboards.FSidebarProvider; import java.util.List; @@ -22,7 +22,7 @@ public class FInfoSidebar extends FSidebarProvider { @Override public List getLines(FPlayer fplayer) { - List lines = SaberFactions.plugin.getConfig().getStringList("scoreboard.finfo"); + List lines = P.p.getConfig().getStringList("scoreboard.finfo"); ListIterator it = lines.listIterator(); while (it.hasNext()) { diff --git a/src/main/java/com/massivecraft/factions/struct/Permission.java b/src/main/java/com/massivecraft/factions/struct/Permission.java index 05b563bb..238bca5f 100644 --- a/src/main/java/com/massivecraft/factions/struct/Permission.java +++ b/src/main/java/com/massivecraft/factions/struct/Permission.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.struct; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import org.bukkit.command.CommandSender; public enum Permission { @@ -128,7 +128,7 @@ public enum Permission { } public boolean has(CommandSender sender, boolean informSenderIfNot) { - return SaberFactions.plugin.perm.has(sender, this.node, informSenderIfNot); + return P.p.perm.has(sender, this.node, informSenderIfNot); } public boolean has(CommandSender sender) { diff --git a/src/main/java/com/massivecraft/factions/struct/Relation.java b/src/main/java/com/massivecraft/factions/struct/Relation.java index c903915d..9682706c 100644 --- a/src/main/java/com/massivecraft/factions/struct/Relation.java +++ b/src/main/java/com/massivecraft/factions/struct/Relation.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.struct; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.util.XMaterial; import com.massivecraft.factions.zcore.fperms.Permissable; import com.massivecraft.factions.zcore.util.TL; @@ -199,7 +199,7 @@ public enum Relation implements Permissable { // Utility method to build items for F Perm GUI @Override public ItemStack buildItem() { - final ConfigurationSection RELATION_CONFIG = SaberFactions.plugin.getConfig().getConfigurationSection("fperm-gui.relation"); + final ConfigurationSection RELATION_CONFIG = P.p.getConfig().getConfigurationSection("fperm-gui.relation"); String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", "")); List lore = new ArrayList<>(); diff --git a/src/main/java/com/massivecraft/factions/struct/Role.java b/src/main/java/com/massivecraft/factions/struct/Role.java index 42af855a..b157d61a 100644 --- a/src/main/java/com/massivecraft/factions/struct/Role.java +++ b/src/main/java/com/massivecraft/factions/struct/Role.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.struct; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.util.XMaterial; import com.massivecraft.factions.zcore.fperms.Permissable; import com.massivecraft.factions.zcore.util.TL; @@ -113,7 +113,7 @@ public enum Role implements Permissable { // Utility method to build items for F Perm GUI @Override public ItemStack buildItem() { - final ConfigurationSection RELATION_CONFIG = SaberFactions.plugin.getConfig().getConfigurationSection("fperm-gui.relation"); + final ConfigurationSection RELATION_CONFIG = P.p.getConfig().getConfigurationSection("fperm-gui.relation"); String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", "")); List lore = new ArrayList<>(); @@ -132,7 +132,7 @@ public enum Role implements Permissable { itemMeta.setDisplayName(displayName); itemMeta.setLore(lore); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); } diff --git a/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java b/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java index ab4205a2..75c8dd98 100644 --- a/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java +++ b/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java @@ -50,13 +50,13 @@ public class AutoLeaveProcessTask extends BukkitRunnable { // Check if they should be exempt from this. if (!fplayer.willAutoLeave()) { - SaberFactions.plugin.debug(Level.INFO, fplayer.getName() + " was going to be auto-removed but was set not to."); + P.p.debug(Level.INFO, fplayer.getName() + " was going to be auto-removed but was set not to."); continue; } if (fplayer.isOffline() && now - fplayer.getLastLoginTime() > toleranceMillis) { if (Conf.logFactionLeave || Conf.logFactionKick) { - SaberFactions.plugin.log("Player " + fplayer.getName() + " was auto-removed due to inactivity."); + P.p.log("Player " + fplayer.getName() + " was auto-removed due to inactivity."); } // if player is faction admin, sort out the faction since he's going away diff --git a/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java b/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java index cb8ff422..1dfbeeeb 100644 --- a/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java +++ b/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.util; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; public class AutoLeaveTask implements Runnable { @@ -18,11 +18,11 @@ public class AutoLeaveTask implements Runnable { } task = new AutoLeaveProcessTask(); - task.runTaskTimer(SaberFactions.plugin, 1, 1); + task.runTaskTimer(P.p, 1, 1); // maybe setting has been changed? if so, restart this task at new rate if (this.rate != Conf.autoLeaveRoutineRunsEveryXMinutes) { - SaberFactions.plugin.startAutoLeaveTask(true); + P.p.startAutoLeaveTask(true); } } } diff --git a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java index 51cd3444..4cd94c9b 100644 --- a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java +++ b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java @@ -35,7 +35,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R // Return the plugin version since this expansion is bundled with the dependency @Override public String getVersion() { - return SaberFactions.plugin.getDescription().getVersion(); + return P.p.getDescription().getVersion(); } @@ -80,7 +80,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fPlayer.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX; return fPlayer.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fPlayer.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized); case "player_group": - return SaberFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fPlayer.getId()))); + return P.p.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fPlayer.getId()))); case "player_balance": return Econ.isSetup() ? Econ.getFriendlyBalance(fPlayer) : TL.ECON_OFF.format("balance"); case "player_power": @@ -123,7 +123,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R case "faction_warps": return String.valueOf(faction.getWarps().size()); case "faction_raidable": - boolean raid = SaberFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && faction.getLandRounded() >= faction.getPowerRounded(); + boolean raid = P.p.getConfig().getBoolean("hcf.raidable", false) && faction.getLandRounded() >= faction.getPowerRounded(); return raid ? TL.RAIDABLE_TRUE.toString() : TL.RAIDABLE_FALSE.toString(); case "faction_home_world": return faction.hasHome() ? faction.getHome().getWorld().getName() : ""; diff --git a/src/main/java/com/massivecraft/factions/util/LocationTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/LocationTypeAdapter.java index 3c8eb907..4febd8d3 100644 --- a/src/main/java/com/massivecraft/factions/util/LocationTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/LocationTypeAdapter.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.util; import com.google.gson.*; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -21,7 +21,7 @@ public class LocationTypeAdapter implements JsonSerializer, JsonDeseri return object; } catch (Exception ex) { ex.printStackTrace(); - SaberFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Location."); + P.p.log(Level.WARNING, "Error encountered while serializing a Location."); return object; } } @@ -38,7 +38,7 @@ public class LocationTypeAdapter implements JsonSerializer, JsonDeseri object.get("z").getAsDouble()); } catch (Exception ex) { ex.printStackTrace(); - SaberFactions.plugin.log(Level.WARNING, "Error encountered while" + + P.p.log(Level.WARNING, "Error encountered while" + " deserializing a Location."); return null; } diff --git a/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java index b6a55686..88cda92b 100644 --- a/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.util; import com.google.gson.*; import com.massivecraft.factions.FLocation; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import java.lang.reflect.Type; import java.util.HashSet; @@ -50,7 +50,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer errors = new ArrayList<>(); if (getComparisonString(str).length() < Conf.factionTagLengthMin) { - errors.add(SaberFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_TOOSHORT.toString(), Conf.factionTagLengthMin)); + errors.add(P.p.txt.parse(TL.GENERIC_FACTIONTAG_TOOSHORT.toString(), Conf.factionTagLengthMin)); } if (str.length() > Conf.factionTagLengthMax) { - errors.add(SaberFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_TOOLONG.toString(), Conf.factionTagLengthMax)); + errors.add(P.p.txt.parse(TL.GENERIC_FACTIONTAG_TOOLONG.toString(), Conf.factionTagLengthMax)); } for (char c : str.toCharArray()) { if (!substanceChars.contains(String.valueOf(c))) { - errors.add(SaberFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c)); + errors.add(P.p.txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c)); } } @@ -96,7 +96,7 @@ public class MiscUtil { // Fix for some data being broken when we added the recruit rank. if (player.getRole() == null) { player.setRole(Role.NORMAL); - SaberFactions.plugin.log(Level.WARNING, String.format("Player %s had null role. Setting them to normal. This isn't good D:", player.getName())); + P.p.log(Level.WARNING, String.format("Player %s had null role. Setting them to normal. This isn't good D:", player.getName())); } switch (player.getRole()) { diff --git a/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java index 2fed4401..49746b2f 100644 --- a/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.util; import com.google.gson.*; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import java.lang.reflect.Type; import java.util.logging.Level; @@ -32,7 +32,7 @@ public class MyLocationTypeAdapter implements JsonDeserializer, Js } catch (Exception ex) { ex.printStackTrace(); - SaberFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a LazyLocation."); + P.p.log(Level.WARNING, "Error encountered while deserializing a LazyLocation."); return null; } } @@ -52,7 +52,7 @@ public class MyLocationTypeAdapter implements JsonDeserializer, Js return obj; } catch (Exception ex) { ex.printStackTrace(); - SaberFactions.plugin.log(Level.WARNING, "Error encountered while serializing a LazyLocation."); + P.p.log(Level.WARNING, "Error encountered while serializing a LazyLocation."); return obj; } } diff --git a/src/main/java/com/massivecraft/factions/util/Particles/ParticleEffect.java b/src/main/java/com/massivecraft/factions/util/Particles/ParticleEffect.java index 7ffe0846..f22c9d06 100644 --- a/src/main/java/com/massivecraft/factions/util/Particles/ParticleEffect.java +++ b/src/main/java/com/massivecraft/factions/util/Particles/ParticleEffect.java @@ -1,6 +1,5 @@ package com.massivecraft.factions.util.Particles; -import com.massivecraft.factions.SaberFactions; import com.massivecraft.factions.util.XMaterial; import org.bukkit.Bukkit; import org.bukkit.Color; diff --git a/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java index 59663023..c69f370c 100644 --- a/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.util; import com.google.gson.*; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.fperms.Access; @@ -62,7 +62,7 @@ public class PermissionsMapTypeAdapter implements JsonDeserializer { + Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> { for (FPlayer fp : FPlayers.getInstance().getOnlinePlayers()) { if (fp.isFlying()) fp.checkIfNearbyEnemies(); } - }, 0, SaberFactions.plugin.getConfig().getInt("fly-task-interval", 10)); + }, 0, P.p.getConfig().getInt("fly-task-interval", 10)); } public static void setFly(FPlayer fp, boolean fly, boolean silent, boolean damage) { - if (!SaberFactions.plugin.getConfig().getBoolean("enable-faction-flight")) + if (!P.p.getConfig().getBoolean("enable-faction-flight")) return; fp.getPlayer().setAllowFlight(fly); @@ -43,7 +43,7 @@ public class UtilFly { } public static void checkFly(FPlayer me, Faction factionTo) { - if (!SaberFactions.plugin.getConfig().getBoolean("enable-faction-flight")) + if (!P.p.getConfig().getBoolean("enable-faction-flight")) return; if (me.isAdminBypassing() && me.isFlying()) @@ -81,13 +81,13 @@ public class UtilFly { public static void setFallDamage(FPlayer fp, boolean fly, boolean damage) { if (!fly) { if (!damage) { - fp.sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", SaberFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3) + "")); + fp.sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", P.p.getConfig().getInt("fly-falldamage-cooldown", 3) + "")); } - int cooldown = SaberFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3); + int cooldown = P.p.getConfig().getInt("fly-falldamage-cooldown", 3); if (cooldown > 0) { fp.setTakeFallDamage(false); - Bukkit.getScheduler().runTaskLater(SaberFactions.plugin, () -> fp.setTakeFallDamage(true), 20L * cooldown); + Bukkit.getScheduler().runTaskLater(P.p, () -> fp.setTakeFallDamage(true), 20L * cooldown); } } } diff --git a/src/main/java/com/massivecraft/factions/util/WarmUpUtil.java b/src/main/java/com/massivecraft/factions/util/WarmUpUtil.java index c854909d..2a16cb2b 100644 --- a/src/main/java/com/massivecraft/factions/util/WarmUpUtil.java +++ b/src/main/java/com/massivecraft/factions/util/WarmUpUtil.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.util; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.util.TL; public class WarmUpUtil { @@ -21,7 +21,7 @@ public class WarmUpUtil { player.msg(TL.WARMUPS_ALREADY); } else { player.msg(translationKey.format(action, delay)); - int id = SaberFactions.plugin.getServer().getScheduler().runTaskLater(SaberFactions.plugin, () -> { + int id = P.p.getServer().getScheduler().runTaskLater(P.p, () -> { player.stopWarmup(); runnable.run(); }, delay * 20).getTaskId(); diff --git a/src/main/java/com/massivecraft/factions/util/WarpGUI.java b/src/main/java/com/massivecraft/factions/util/WarpGUI.java index 4685fa77..6fc00124 100644 --- a/src/main/java/com/massivecraft/factions/util/WarpGUI.java +++ b/src/main/java/com/massivecraft/factions/util/WarpGUI.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.util; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.Bukkit; @@ -34,14 +34,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI { public WarpGUI(FPlayer fme) { this.fme = fme; - this.section = SaberFactions.plugin.getConfig().getConfigurationSection("fwarp-gui"); + this.section = P.p.getConfig().getConfigurationSection("fwarp-gui"); } @Override public void build() { if (section == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return; } @@ -49,14 +49,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI { guiSize = section.getInt("rows", 3); if (guiSize > 6) { guiSize = 6; - SaberFactions.plugin.log(Level.INFO, "Warp GUI size out of bounds, defaulting to 6"); + P.p.log(Level.INFO, "Warp GUI size out of bounds, defaulting to 6"); } guiSize *= 9; String guiName = ChatColor.translateAlternateColorCodes('&', section.getString("name", "FactionPermissions")); warpGUI = Bukkit.createInventory(this, guiSize, guiName); - maxWarps = SaberFactions.plugin.getConfig().getInt("max-warps", 5); + maxWarps = P.p.getConfig().getInt("max-warps", 5); Set factionWarps = fme.getFaction().getWarps().keySet(); List warpOpenSlots = section.getIntegerList("warp-slots"); @@ -64,7 +64,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI { buildDummyItems(); if (maxWarps != warpOpenSlots.size()) { - SaberFactions.plugin.log(Level.SEVERE, "Invalid warp slots for GUI, Please use same value as max warps"); + P.p.log(Level.SEVERE, "Invalid warp slots for GUI, Please use same value as max warps"); return; } @@ -102,12 +102,12 @@ public class WarpGUI implements InventoryHolder, FactionGUI { } else { fme.setEnteringPassword(true, warp); fme.msg(TL.COMMAND_FWARP_PASSWORD_REQUIRED); - Bukkit.getScheduler().runTaskLater(SaberFactions.plugin, () -> { + Bukkit.getScheduler().runTaskLater(P.p, () -> { if (fme.isEnteringPassword()) { fme.msg(TL.COMMAND_FWARP_PASSWORD_TIMEOUT); fme.setEnteringPassword(false, ""); } - }, SaberFactions.plugin.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20); + }, P.p.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20); } } } @@ -119,15 +119,15 @@ public class WarpGUI implements InventoryHolder, FactionGUI { player.teleport(fme.getFaction().getWarp(warp).getLocation()); fme.msg(TL.COMMAND_FWARP_WARPED, warp); } - }, SaberFactions.plugin.getConfig().getLong("warmups.f-warp", 0)); + }, P.p.getConfig().getLong("warmups.f-warp", 0)); } private boolean transact(FPlayer player) { - if (!SaberFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing()) { + if (!P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing()) { return true; } - double cost = SaberFactions.plugin.getConfig().getDouble("warp-cost.warp", 5); + double cost = P.p.getConfig().getDouble("warp-cost.warp", 5); if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) { return true; @@ -143,8 +143,8 @@ public class WarpGUI implements InventoryHolder, FactionGUI { private ItemStack buildItem(String warp) { ConfigurationSection warpItemSection = section.getConfigurationSection("warp-item"); if (warpItemSection == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return new ItemStack(Material.AIR); } @@ -178,7 +178,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI { string = ChatColor.translateAlternateColorCodes('&', string); string = string.replace("{warp}", warp); string = string.replace("{warp-protected}", faction.hasWarpPassword(warp) ? "Enabled" : "Disabled"); - string = string.replace("{warp-cost}", !SaberFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) ? "Disabled" : Integer.toString(SaberFactions.plugin.getConfig().getInt("warp-cost.warp", 5))); + string = string.replace("{warp-cost}", !P.p.getConfig().getBoolean("warp-cost.enabled", false) ? "Disabled" : Integer.toString(P.p.getConfig().getInt("warp-cost.warp", 5))); return string; } @@ -188,7 +188,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI { try { dummyId = Integer.parseInt(key); } catch (NumberFormatException exception) { - SaberFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); + P.p.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); continue; } @@ -200,7 +200,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI { List dummyIdSlots = section.getIntegerList("dummy-slots." + key); for (Integer slot : dummyIdSlots) { if (slot + 1 > guiSize || slot < 0) { - SaberFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); + P.p.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); continue; } dummySlots.add(slot); @@ -213,14 +213,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI { final ConfigurationSection dummySection = section.getConfigurationSection("dummy-items." + id); if (dummySection == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return new ItemStack(Material.AIR); } Material material = Material.matchMaterial(dummySection.getString("material", "")); if (material == null) { - SaberFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id); + P.p.log(Level.WARNING, "Invalid material for dummy item: " + id); return null; } @@ -238,7 +238,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI { ItemMeta itemMeta = itemStack.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); } diff --git a/src/main/java/com/massivecraft/factions/zcore/MCommand.java b/src/main/java/com/massivecraft/factions/zcore/MCommand.java index 4ad7e163..8aba6288 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MCommand.java +++ b/src/main/java/com/massivecraft/factions/zcore/MCommand.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.zcore; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TextUtil; @@ -311,7 +311,7 @@ public abstract class MCommand { s = s.replace("{power}", power); } if (s.contains("{group}")) { - String group = SaberFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(player.getId()))); + String group = P.p.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(player.getId()))); s = s.replace("{group}", group); } return s; diff --git a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java index 0b49b425..94a4955f 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java +++ b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java @@ -242,7 +242,7 @@ public abstract class MPlugin extends JavaPlugin { // COMMAND HANDLING // -------------------------------------------- // - // can be overridden by SaberFactions method, to provide option + // can be overridden by P method, to provide option public boolean logPlayerCommands() { return true; } diff --git a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java b/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java index 21d5c142..e8f91a7b 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java @@ -40,7 +40,7 @@ public class MPluginSecretPlayerListener implements Listener { /* Should be handled by stuff in FactionsChatListener Player speaker = event.getPlayer(); String format = event.getFormat(); - format = format.replace(Conf.chatTagReplaceString, SaberFactions.plugin.getPlayerFactionTag(speaker)).replace("[FACTION_TITLE]", SaberFactions.plugin.getPlayerTitle(speaker)); + format = format.replace(Conf.chatTagReplaceString, P.p.getPlayerFactionTag(speaker)).replace("[FACTION_TITLE]", P.p.getPlayerTitle(speaker)); event.setFormat(format); */ } diff --git a/src/main/java/com/massivecraft/factions/zcore/fperms/Access.java b/src/main/java/com/massivecraft/factions/zcore/fperms/Access.java index bd10a7f9..be7a1e06 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/Access.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/Access.java @@ -1,8 +1,6 @@ package com.massivecraft.factions.zcore.fperms; -import org.bukkit.ChatColor; - -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; public enum Access { ALLOW("Allow"), @@ -37,7 +35,7 @@ public enum Access { return name(); } - public String getColor() { return SaberFactions.plugin.getConfig().getString("fperm-gui.action.Access-Colors." + this.name); } + public String getColor() { return P.p.getConfig().getString("fperm-gui.action.Access-Colors." + this.name); } public static Access booleanToAccess(boolean access) { if (access) return Access.ALLOW; diff --git a/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java b/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java index f6245790..8aa43764 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.zcore.fperms; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.util.XMaterial; import org.bukkit.DyeColor; import org.bukkit.Material; @@ -92,11 +92,11 @@ public enum PermissableAction { // Utility method to build items for F Perm GUI public ItemStack buildItem(FPlayer fme, Permissable permissable) { - final ConfigurationSection section = SaberFactions.plugin.getConfig().getConfigurationSection("fperm-gui.action"); + final ConfigurationSection section = P.p.getConfig().getConfigurationSection("fperm-gui.action"); if (section == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return new ItemStack(Material.AIR); } @@ -128,7 +128,7 @@ public enum PermissableAction { } // If under the 1.13 version we will use the colorable option. - if (!SaberFactions.plugin.mc113 && !SaberFactions.plugin.mc114) { + if (!P.p.mc113 && !P.p.mc114) { //TODO see if it's working in other version than 1.13 and 1.14 DyeColor dyeColor = null; @@ -152,7 +152,7 @@ public enum PermissableAction { } for (String loreLine : section.getStringList("placeholder-item.lore")) lore.add(replacePlaceholders(loreLine, fme, permissable)); - if (!SaberFactions.plugin.mc17) itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); + if (!P.p.mc17) itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); itemMeta.setDisplayName(displayName); itemMeta.setLore(lore); diff --git a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionGUI.java b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionGUI.java index 858ba63c..780916cd 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionGUI.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionGUI.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.zcore.fperms.gui; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.util.FactionGUI; import com.massivecraft.factions.util.XMaterial; import com.massivecraft.factions.zcore.fperms.Access; @@ -37,20 +37,20 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { public PermissableActionGUI(FPlayer fme, Permissable permissable) { this.fme = fme; this.permissable = permissable; - this.section = SaberFactions.plugin.getConfig().getConfigurationSection("fperm-gui.action"); + this.section = P.p.getConfig().getConfigurationSection("fperm-gui.action"); } public void build() { if (section == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return; } guiSize = section.getInt("rows", 3); if (guiSize > 6) { guiSize = 6; - SaberFactions.plugin.log(Level.INFO, "Action GUI size out of bounds, defaulting to 6"); + P.p.log(Level.INFO, "Action GUI size out of bounds, defaulting to 6"); } guiSize *= 9; @@ -64,7 +64,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { continue; } if (slot + 1 > guiSize || slot < 0) { - SaberFactions.plugin.log(Level.WARNING, "Invalid slot for: " + key.toUpperCase()); + P.p.log(Level.WARNING, "Invalid slot for: " + key.toUpperCase()); continue; } @@ -75,7 +75,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { PermissableAction permissableAction = PermissableAction.fromString(key.toUpperCase().replace('-', '_')); if (permissableAction == null) { - SaberFactions.plugin.log(Level.WARNING, "Invalid permissable action: " + key.toUpperCase()); + P.p.log(Level.WARNING, "Invalid permissable action: " + key.toUpperCase()); continue; } @@ -102,7 +102,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { actionSlots.put(slot, action); } } - SaberFactions.plugin.log(Level.WARNING, "Missing action: " + action.name()); + P.p.log(Level.WARNING, "Missing action: " + action.name()); } } @@ -148,7 +148,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { actionGUI.setItem(slot, action.buildItem(fme, permissable)); fme.msg(TL.COMMAND_PERM_SET, action.name(), access.name(), permissable.name()); - SaberFactions.plugin.log(String.format(TL.COMMAND_PERM_SET.toString(), action.name(), access.name(), permissable.name()) + " for faction " + fme.getTag()); + P.p.log(String.format(TL.COMMAND_PERM_SET.toString(), action.name(), access.name(), permissable.name()) + " for faction " + fme.getTag()); } private void buildItems() { @@ -158,7 +158,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { ItemStack item = permissableAction.buildItem(fme, permissable); if (item == null) { - SaberFactions.plugin.log(Level.WARNING, "Invalid item for: " + permissableAction.toString().toUpperCase()); + P.p.log(Level.WARNING, "Invalid item for: " + permissableAction.toString().toUpperCase()); continue; } @@ -174,8 +174,8 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { private ItemStack getSpecialItem(SpecialItem specialItem) { if (section == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return new ItemStack(Material.AIR); } @@ -183,7 +183,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { case RELATION: return permissable.buildItem(); case BACK: - ConfigurationSection backButtonConfig = SaberFactions.plugin.getConfig().getConfigurationSection("fperm-gui.back-item"); + ConfigurationSection backButtonConfig = P.p.getConfig().getConfigurationSection("fperm-gui.back-item"); ItemStack backButton = new ItemStack(XMaterial.matchXMaterial(backButtonConfig.getString("material")).parseItem()); ItemMeta backButtonMeta = backButton.getItemMeta(); @@ -195,7 +195,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } backButtonMeta.setLore(lore); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { backButtonMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); } @@ -209,8 +209,8 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { private void buildDummyItems() { if (section == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return; } @@ -219,7 +219,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { try { dummyId = Integer.parseInt(key); } catch (NumberFormatException exception) { - SaberFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); + P.p.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); continue; } @@ -229,7 +229,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } ItemMeta meta = dummyItem.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { meta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); } @@ -238,7 +238,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { List dummySlots = section.getIntegerList("dummy-items." + key); for (Integer slot : dummySlots) { if (slot + 1 > guiSize || slot < 0) { - SaberFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); + P.p.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); continue; } usedDummySlots.add(slot); @@ -248,17 +248,17 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } private ItemStack buildDummyItem(int id) { - final ConfigurationSection dummySection = SaberFactions.plugin.getConfig().getConfigurationSection("fperm-gui.dummy-items." + id); + final ConfigurationSection dummySection = P.p.getConfig().getConfigurationSection("fperm-gui.dummy-items." + id); if (dummySection == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build dummy items for F PERM GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build dummy items for F PERM GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return new ItemStack(Material.AIR); } Material material = XMaterial.matchXMaterial(dummySection.getString("material", "")).parseMaterial(); if (material == null) { - SaberFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id); + P.p.log(Level.WARNING, "Invalid material for dummy item: " + id); return null; } @@ -284,7 +284,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } itemMeta.setLore(lore); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); } diff --git a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableRelationGUI.java b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableRelationGUI.java index bac30ac1..5db684bd 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableRelationGUI.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableRelationGUI.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.zcore.fperms.gui; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.util.FactionGUI; @@ -35,13 +35,13 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { public PermissableRelationGUI(FPlayer fme) { this.fme = fme; - this.section = SaberFactions.plugin.getConfig().getConfigurationSection("fperm-gui.relation"); + this.section = P.p.getConfig().getConfigurationSection("fperm-gui.relation"); } public void build() { if (section == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return; } @@ -49,7 +49,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { guiSize = section.getInt("rows", 3); if (guiSize > 5) { guiSize = 5; - SaberFactions.plugin.log(Level.INFO, "Relation GUI size out of bounds, defaulting to 5"); + P.p.log(Level.INFO, "Relation GUI size out of bounds, defaulting to 5"); } guiSize *= 9; @@ -62,12 +62,12 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { continue; } if (slot + 1 > guiSize && slot > 0) { - SaberFactions.plugin.log(Level.WARNING, "Invalid slot of " + key.toUpperCase() + " in relation GUI skipping it"); + P.p.log(Level.WARNING, "Invalid slot of " + key.toUpperCase() + " in relation GUI skipping it"); continue; } if (getPermissable(key) == null) { - SaberFactions.plugin.log(Level.WARNING, "Invalid permissable " + key.toUpperCase() + " skipping it"); + P.p.log(Level.WARNING, "Invalid permissable " + key.toUpperCase() + " skipping it"); continue; } @@ -112,7 +112,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { ItemStack item = permissable.buildItem(); if (item == null) { - SaberFactions.plugin.log(Level.WARNING, "Invalid material for " + permissable.toString().toUpperCase() + " skipping it"); + P.p.log(Level.WARNING, "Invalid material for " + permissable.toString().toUpperCase() + " skipping it"); continue; } @@ -122,8 +122,8 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { private void buildDummyItems() { if (section == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return; } @@ -132,7 +132,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { try { dummyId = Integer.parseInt(key); } catch (NumberFormatException exception) { - SaberFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); + P.p.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); continue; } @@ -142,7 +142,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { } ItemMeta meta = dummyItem.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { meta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); } @@ -151,7 +151,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { List dummySlots = section.getIntegerList("dummy-items." + key); for (Integer slot : dummySlots) { if (slot + 1 > guiSize || slot < 0) { - SaberFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); + P.p.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); continue; } relationGUI.setItem(slot, dummyItem); @@ -160,17 +160,17 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { } private ItemStack buildDummyItem(int id) { - final ConfigurationSection dummySection = SaberFactions.plugin.getConfig().getConfigurationSection("fperm-gui.dummy-items." + id); + final ConfigurationSection dummySection = P.p.getConfig().getConfigurationSection("fperm-gui.dummy-items." + id); if (dummySection == null) { - SaberFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + P.p.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + P.p.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return new ItemStack(Material.AIR); } Material material = Material.matchMaterial(dummySection.getString("material", "")); if (material == null) { - SaberFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id); + P.p.log(Level.WARNING, "Invalid material for dummy item: " + id); return null; } @@ -196,7 +196,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { } itemMeta.setLore(lore); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); } diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/CropUpgrades.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/CropUpgrades.java index 14318b29..f9740dc4 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/CropUpgrades.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/CropUpgrades.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.zcore.fupgrades; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.util.XMaterial; import org.bukkit.CropState; import org.bukkit.Material; @@ -30,13 +30,13 @@ public class CropUpgrades implements Listener { switch (level) { case 1: - chance = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-1"); + chance = P.p.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-1"); break; case 2: - chance = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-2"); + chance = P.p.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-2"); break; case 3: - chance = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-3"); + chance = P.p.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-3"); break; } diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java index 8c0835f0..1402acef 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java @@ -3,9 +3,8 @@ package com.massivecraft.factions.zcore.fupgrades; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDeathEvent; @@ -30,13 +29,13 @@ public class EXPUpgrade implements Listener { switch (level) { case 1: - multiplier = SaberFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-1"); + multiplier = P.p.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-1"); break; case 2: - multiplier = SaberFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-2"); + multiplier = P.p.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-2"); break; case 3: - multiplier = SaberFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-3"); + multiplier = P.p.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-3"); break; } diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java index b7b44c28..016a1728 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.zcore.fupgrades; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -21,29 +21,29 @@ import java.util.List; public class FUpgradesGUI implements Listener { public void openMainMenu(FPlayer fme) { - Inventory inventory = Bukkit.createInventory(null, 45, SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", fme.getFaction().getTag()))); - List dummySlots = SaberFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.DummyItem.slots"); - Material dummyMaterial = Material.getMaterial(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.DummyItem.Type")); - int dummyAmount = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.DummyItem.Amount"); - short dummyData = Short.parseShort(SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.DummyItem.Damage") + ""); - ItemStack dummyItem = SaberFactions.plugin.createItem(dummyMaterial, + Inventory inventory = Bukkit.createInventory(null, 45, P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", fme.getFaction().getTag()))); + List dummySlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.DummyItem.slots"); + Material dummyMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.DummyItem.Type")); + int dummyAmount = P.p.getConfig().getInt("fupgrades.MainMenu.DummyItem.Amount"); + short dummyData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.DummyItem.Damage") + ""); + ItemStack dummyItem = P.p.createItem(dummyMaterial, dummyAmount, dummyData, - SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.DummyItem.Name")), - SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.DummyItem.Lore"))); + P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.DummyItem.Name")), + P.p.colorList(P.p.getConfig().getStringList("fupgrades.MainMenu.DummyItem.Lore"))); for (int i = 0; i <= dummySlots.size() - 1; i++) { inventory.setItem(dummySlots.get(i), dummyItem); } ItemStack[] items = buildItems(fme); - List cropSlots = SaberFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Crops.CropItem.slots"); - List spawnerSlots = SaberFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); - List expSlots = SaberFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots"); - List chestSlots = SaberFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots"); - List powerSlots = SaberFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Power.PowerItem.slots"); - List redSlots = SaberFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Redstone.RedstoneItem.slots"); - List memberSlots = SaberFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Members.MembersItem.slots"); + List cropSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Crops.CropItem.slots"); + List spawnerSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); + List expSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots"); + List chestSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots"); + List powerSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Power.PowerItem.slots"); + List redSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Redstone.RedstoneItem.slots"); + List memberSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Members.MembersItem.slots"); for (int i = 0; i < cropSlots.size(); i++) if (cropSlots.get(i) != -1) inventory.setItem(cropSlots.get(i), items[2]); @@ -75,7 +75,7 @@ public class FUpgradesGUI implements Listener { return; FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getWhoClicked()); - if (e.getView().getTitle().equalsIgnoreCase(SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", fme.getFaction().getTag())))) { + if (e.getView().getTitle().equalsIgnoreCase(P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", fme.getFaction().getTag())))) { e.setCancelled(true); ItemStack[] items = buildItems(fme); ItemStack cropItem = items[2]; @@ -92,13 +92,13 @@ public class FUpgradesGUI implements Listener { case 3: return; case 2: - upgradeItem(fme, UpgradeType.CROP, 3, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-3")); + upgradeItem(fme, UpgradeType.CROP, 3, P.p.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-3")); break; case 1: - upgradeItem(fme, UpgradeType.CROP, 2, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-2")); + upgradeItem(fme, UpgradeType.CROP, 2, P.p.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-2")); break; case 0: - upgradeItem(fme, UpgradeType.CROP, 1, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-1")); + upgradeItem(fme, UpgradeType.CROP, 1, P.p.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-1")); break; } } else if (e.getCurrentItem().equals(powerItem)) { @@ -107,15 +107,15 @@ public class FUpgradesGUI implements Listener { case 3: return; case 2: - upgradeItem(fme, UpgradeType.POWER, 3, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.Cost.level-3")); + upgradeItem(fme, UpgradeType.POWER, 3, P.p.getConfig().getInt("fupgrades.MainMenu.Power.Cost.level-3")); updatePower(fme.getFaction()); break; case 1: - upgradeItem(fme, UpgradeType.POWER, 2, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.Cost.level-2")); + upgradeItem(fme, UpgradeType.POWER, 2, P.p.getConfig().getInt("fupgrades.MainMenu.Power.Cost.level-2")); updatePower(fme.getFaction()); break; case 0: - upgradeItem(fme, UpgradeType.POWER, 1, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.Cost.level-1")); + upgradeItem(fme, UpgradeType.POWER, 1, P.p.getConfig().getInt("fupgrades.MainMenu.Power.Cost.level-1")); updatePower(fme.getFaction()); break; } @@ -125,13 +125,13 @@ public class FUpgradesGUI implements Listener { case 3: return; case 2: - upgradeItem(fme, UpgradeType.SPAWNER, 3, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-3")); + upgradeItem(fme, UpgradeType.SPAWNER, 3, P.p.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-3")); break; case 1: - upgradeItem(fme, UpgradeType.SPAWNER, 2, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-2")); + upgradeItem(fme, UpgradeType.SPAWNER, 2, P.p.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-2")); break; case 0: - upgradeItem(fme, UpgradeType.SPAWNER, 1, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-1")); + upgradeItem(fme, UpgradeType.SPAWNER, 1, P.p.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-1")); break; } } else if (e.getCurrentItem().equals(expItem)) { @@ -141,13 +141,13 @@ public class FUpgradesGUI implements Listener { case 3: return; case 2: - upgradeItem(fme, UpgradeType.EXP, 3, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-3")); + upgradeItem(fme, UpgradeType.EXP, 3, P.p.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-3")); break; case 1: - upgradeItem(fme, UpgradeType.EXP, 2, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-2")); + upgradeItem(fme, UpgradeType.EXP, 2, P.p.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-2")); break; case 0: - upgradeItem(fme, UpgradeType.EXP, 1, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-1")); + upgradeItem(fme, UpgradeType.EXP, 1, P.p.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-1")); break; } } else if (e.getCurrentItem().equals(redItem)) { @@ -156,7 +156,7 @@ public class FUpgradesGUI implements Listener { case 1: return; case 0: - upgradeItem(fme, UpgradeType.REDSTONE, 1, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Redstone.Cost")); + upgradeItem(fme, UpgradeType.REDSTONE, 1, P.p.getConfig().getInt("fupgrades.MainMenu.Redstone.Cost")); break; } } else if (e.getCurrentItem().equals(chestitem)) { @@ -165,27 +165,27 @@ public class FUpgradesGUI implements Listener { case 3: return; case 2: { - if (upgradeItem(fme, UpgradeType.CHEST, 3, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-3"))) + if (upgradeItem(fme, UpgradeType.CHEST, 3, P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-3"))) updateChests(fme.getFaction()); break; } case 1: { - if (upgradeItem(fme, UpgradeType.CHEST, 2, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-2"))) + if (upgradeItem(fme, UpgradeType.CHEST, 2, P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-2"))) updateChests(fme.getFaction()); break; } case 0: { - if (upgradeItem(fme, UpgradeType.CHEST, 1, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-1"))) + if (upgradeItem(fme, UpgradeType.CHEST, 1, P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-1"))) updateChests(fme.getFaction()); break; } } } else if(e.getCurrentItem().equals(memberItem)){ int memberLevel = fme.getFaction().getUpgrade(UpgradeType.MEMBERS) + 1; - if(!SaberFactions.plugin.getConfig().isSet("fupgrades.MainMenu.Members.Cost.level-" + memberLevel)){ + if(!P.p.getConfig().isSet("fupgrades.MainMenu.Members.Cost.level-" + memberLevel)){ return; } - int cost = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Members.Cost.level-" + memberLevel); + int cost = P.p.getConfig().getInt("fupgrades.MainMenu.Members.Cost.level-" + memberLevel); if(hasMoney(fme, cost)){ fme.getFaction().setUpgrade(UpgradeType.MEMBERS, memberLevel); fme.getPlayer().closeInventory(); @@ -196,7 +196,7 @@ public class FUpgradesGUI implements Listener { } private void updateChests(Faction faction) { - String invName = SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fchest.Inventory-Title")); + String invName = P.p.color(P.p.getConfig().getString("fchest.Inventory-Title")); for (Player player : faction.getOnlinePlayers()) { if (player.getInventory().getTitle() != null && player.getInventory().getTitle().equalsIgnoreCase(invName)) @@ -208,13 +208,13 @@ public class FUpgradesGUI implements Listener { switch (level) { case 1: - size = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1"); + size = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1"); break; case 2: - size = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2"); + size = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2"); break; case 3: - size = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3"); + size = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3"); break; } faction.setChestSize(size * 9); @@ -226,13 +226,13 @@ public class FUpgradesGUI implements Listener { switch (level) { case 1: - power = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.Power-Boost.level-1"); + power = P.p.getConfig().getInt("fupgrades.MainMenu.Power.Power-Boost.level-1"); break; case 2: - power = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.Power-Boost.level-2"); + power = P.p.getConfig().getInt("fupgrades.MainMenu.Power.Power-Boost.level-2"); break; case 3: - power = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.Power-Boost.level-3"); + power = P.p.getConfig().getInt("fupgrades.MainMenu.Power.Power-Boost.level-3"); break; } faction.setPowerBoost(power); @@ -240,21 +240,21 @@ public class FUpgradesGUI implements Listener { @SuppressWarnings("Duplicates") private ItemStack[] buildItems(FPlayer fme) { - Material expMaterial = Material.getMaterial(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Type")); - int expAmt = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Amount"); - short expData = Short.parseShort(SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Damage") + ""); - String expName = SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Name")); - List expLore = SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.EXP.EXPItem.Lore")); + Material expMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Type")); + int expAmt = P.p.getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Amount"); + short expData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Damage") + ""); + String expName = P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Name")); + List expLore = P.p.colorList(P.p.getConfig().getStringList("fupgrades.MainMenu.EXP.EXPItem.Lore")); int expLevel = fme.getFaction().getUpgrade(UpgradeType.EXP); for (int i = 0; i <= expLore.size() - 1; i++) expLore.set(i, expLore.get(i).replace("{level}", expLevel + "")); - ItemStack expItem = SaberFactions.plugin.createItem(expMaterial, expAmt, expData, expName, expLore); + ItemStack expItem = P.p.createItem(expMaterial, expAmt, expData, expName, expLore); if (expLevel >= 1) { ItemMeta itemMeta = expItem.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); @@ -263,11 +263,11 @@ public class FUpgradesGUI implements Listener { expItem.setAmount(expLevel); } - Material spawnerMaterial = Material.getMaterial(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Type")); - int spawnerAmt = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Amount"); - short spawnerData = Short.parseShort(SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Damage") + ""); - String spawnerName = SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Name")); - List spawnerLore = SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Spawners.SpawnerItem.Lore")); + Material spawnerMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Type")); + int spawnerAmt = P.p.getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Amount"); + short spawnerData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Damage") + ""); + String spawnerName = P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Name")); + List spawnerLore = P.p.colorList(P.p.getConfig().getStringList("fupgrades.MainMenu.Spawners.SpawnerItem.Lore")); int spawnerLevel = fme.getFaction().getUpgrade(UpgradeType.SPAWNER); for (int i = 0; i <= spawnerLore.size() - 1; i++) { @@ -276,11 +276,11 @@ public class FUpgradesGUI implements Listener { - Material cropMaterial = Material.getMaterial(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Type")); - int cropAmt = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Amount"); - short cropData = Short.parseShort(SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Damage") + ""); - String cropName = SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Name")); - List cropLore = SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Crops.CropItem.Lore")); + Material cropMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Type")); + int cropAmt = P.p.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Amount"); + short cropData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Damage") + ""); + String cropName = P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Name")); + List cropLore = P.p.colorList(P.p.getConfig().getStringList("fupgrades.MainMenu.Crops.CropItem.Lore")); int cropLevel = fme.getFaction().getUpgrade(UpgradeType.CROP); for (int i = 0; i <= cropLore.size() - 1; i++) { @@ -289,12 +289,12 @@ public class FUpgradesGUI implements Listener { cropLore.set(i, line); } - ItemStack cropItem = SaberFactions.plugin.createItem(cropMaterial, cropAmt, cropData, cropName, cropLore); + ItemStack cropItem = P.p.createItem(cropMaterial, cropAmt, cropData, cropName, cropLore); cropItem.getItemMeta().setLore(cropLore); if (cropLevel >= 1) { ItemMeta itemMeta = cropItem.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); @@ -303,11 +303,11 @@ public class FUpgradesGUI implements Listener { cropItem.setAmount(cropLevel); } - ItemStack spawnerItem = SaberFactions.plugin.createItem(spawnerMaterial, spawnerAmt, spawnerData, spawnerName, spawnerLore); + ItemStack spawnerItem = P.p.createItem(spawnerMaterial, spawnerAmt, spawnerData, spawnerName, spawnerLore); spawnerItem.getItemMeta().setLore(spawnerLore); if (spawnerLevel >= 1) { ItemMeta itemMeta = spawnerItem.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); @@ -316,11 +316,11 @@ public class FUpgradesGUI implements Listener { spawnerItem.setAmount(spawnerLevel); } - Material chestMaterial = Material.getMaterial(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Type")); - int chesttAmt = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Amount"); - short chestData = Short.parseShort(SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Damage") + ""); - String chestName = SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Name", "&e&lUpgrade Chest Size")); - List chestLore = SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Chest.ChestItem.Lore")); + Material chestMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Type")); + int chesttAmt = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Amount"); + short chestData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Damage") + ""); + String chestName = P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Name", "&e&lUpgrade Chest Size")); + List chestLore = P.p.colorList(P.p.getConfig().getStringList("fupgrades.MainMenu.Chest.ChestItem.Lore")); int chestlevel = fme.getFaction().getUpgrade(UpgradeType.CHEST); for (int i = 0; i <= chestLore.size() - 1; i++) { @@ -329,11 +329,11 @@ public class FUpgradesGUI implements Listener { chestLore.set(i, line); } - ItemStack chestItem = SaberFactions.plugin.createItem(chestMaterial, chesttAmt, chestData, chestName, chestLore); + ItemStack chestItem = P.p.createItem(chestMaterial, chesttAmt, chestData, chestName, chestLore); if (chestlevel >= 1) { ItemMeta itemMeta = chestItem.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); @@ -342,11 +342,11 @@ public class FUpgradesGUI implements Listener { chestItem.setAmount(chestlevel); } - Material memberMaterial = Material.getMaterial(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Members.MembersItem.Type")); - int memberAmt = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Members.MembersItem.Amount"); - short memberData = Short.parseShort(SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Members.MembersItem.Damage") + ""); - String memberName = SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Members.MembersItem.Name", "&e&lUpgrade Member Size")); - List memberLore = SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Members.MembersItem.Lore")); + Material memberMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.Members.MembersItem.Type")); + int memberAmt = P.p.getConfig().getInt("fupgrades.MainMenu.Members.MembersItem.Amount"); + short memberData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.Members.MembersItem.Damage") + ""); + String memberName = P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.Members.MembersItem.Name", "&e&lUpgrade Member Size")); + List memberLore = P.p.colorList(P.p.getConfig().getStringList("fupgrades.MainMenu.Members.MembersItem.Lore")); int memberlevel = fme.getFaction().getUpgrade(UpgradeType.MEMBERS); for (int i = 0; i <= memberLore.size() - 1; i++) { @@ -355,11 +355,11 @@ public class FUpgradesGUI implements Listener { memberLore.set(i, line); } - ItemStack memberItem = SaberFactions.plugin.createItem(memberMaterial, memberAmt, memberData, memberName, memberLore); + ItemStack memberItem = P.p.createItem(memberMaterial, memberAmt, memberData, memberName, memberLore); if (memberlevel >= 1) { ItemMeta itemMeta = memberItem.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); @@ -368,11 +368,11 @@ public class FUpgradesGUI implements Listener { memberItem.setAmount(memberlevel); } - Material powerMaterial = Material.getMaterial(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Power.PowerItem.Type")); - int powerAmt = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.PowerItem.Amount"); - short powerData = Short.parseShort(SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.PowerItem.Damage") + ""); - String powerName = SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Power.PowerItem.Name")); - List powerLore = SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Power.PowerItem.Lore")); + Material powerMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.Power.PowerItem.Type")); + int powerAmt = P.p.getConfig().getInt("fupgrades.MainMenu.Power.PowerItem.Amount"); + short powerData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.Power.PowerItem.Damage") + ""); + String powerName = P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.Power.PowerItem.Name")); + List powerLore = P.p.colorList(P.p.getConfig().getStringList("fupgrades.MainMenu.Power.PowerItem.Lore")); int powerLevel = fme.getFaction().getUpgrade(UpgradeType.POWER); for (int i = 0; i <= powerLore.size() - 1; i++) { @@ -381,12 +381,12 @@ public class FUpgradesGUI implements Listener { powerLore.set(i, line); } - ItemStack powerItem = SaberFactions.plugin.createItem(powerMaterial, powerAmt, powerData, powerName, powerLore); + ItemStack powerItem = P.p.createItem(powerMaterial, powerAmt, powerData, powerName, powerLore); powerItem.getItemMeta().setLore(powerLore); if (powerLevel >= 1) { ItemMeta itemMeta = powerItem.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); @@ -395,11 +395,11 @@ public class FUpgradesGUI implements Listener { powerItem.setAmount(powerLevel); } - Material redMaterial = Material.getMaterial(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Redstone.RedstoneItem.Type")); - int redAmt = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Redstone.RedstoneItem.Amount"); - short redData = Short.parseShort(SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Redstone.RedstoneItem.Damage") + ""); - String redName = SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fupgrades.MainMenu.Redstone.RedstoneItem.Name")); - List redLore = SaberFactions.plugin.colorList(SaberFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Redstone.RedstoneItem.Lore")); + Material redMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.Redstone.RedstoneItem.Type")); + int redAmt = P.p.getConfig().getInt("fupgrades.MainMenu.Redstone.RedstoneItem.Amount"); + short redData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.Redstone.RedstoneItem.Damage") + ""); + String redName = P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.Redstone.RedstoneItem.Name")); + List redLore = P.p.colorList(P.p.getConfig().getStringList("fupgrades.MainMenu.Redstone.RedstoneItem.Lore")); int redLevel = fme.getFaction().getUpgrade(UpgradeType.REDSTONE); for (int i = 0; i <= redLore.size() - 1; i++) { @@ -408,12 +408,12 @@ public class FUpgradesGUI implements Listener { redLore.set(i, line); } - ItemStack redItem = SaberFactions.plugin.createItem(redMaterial, redAmt, redData, redName, redLore); + ItemStack redItem = P.p.createItem(redMaterial, redAmt, redData, redName, redLore); redItem.getItemMeta().setLore(redLore); if (redLevel >= 1) { ItemMeta itemMeta = redItem.getItemMeta(); - if (!SaberFactions.plugin.mc17) { + if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/RedstoneUpgrade.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/RedstoneUpgrade.java index 6c3f8e86..4c3f876c 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/RedstoneUpgrade.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/RedstoneUpgrade.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.zcore.fupgrades; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockFromToEvent; @@ -14,7 +14,7 @@ public class RedstoneUpgrade implements Listener { @EventHandler public void onWaterRedstone(BlockFromToEvent e) { - List unbreakable = SaberFactions.plugin.getConfig().getStringList("no-water-destroy.Item-List"); + List unbreakable = P.p.getConfig().getStringList("no-water-destroy.Item-List"); String block = e.getToBlock().getType().toString(); FLocation floc = new FLocation(e.getToBlock().getLocation()); Faction factionAtLoc = Board.getInstance().getFactionAt(floc); @@ -23,7 +23,7 @@ public class RedstoneUpgrade implements Listener { int level = factionAtLoc.getUpgrade(UpgradeType.REDSTONE); if (level != 0) { if (level == 1) { - SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Redstone.Cost"); + P.p.getConfig().getInt("fupgrades.MainMenu.Redstone.Cost"); } if (unbreakable.contains(block)) { e.setCancelled(true); diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/SpawnerUpgrades.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/SpawnerUpgrades.java index d8456d6c..861cd936 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/SpawnerUpgrades.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/SpawnerUpgrades.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.zcore.fupgrades; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.SpawnerSpawnEvent; @@ -20,13 +20,13 @@ public class SpawnerUpgrades implements Listener { if (level != 0) { switch (level) { case 1: - lowerSpawnerDelay(e, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-1")); + lowerSpawnerDelay(e, P.p.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-1")); break; case 2: - lowerSpawnerDelay(e, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-2")); + lowerSpawnerDelay(e, P.p.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-2")); break; case 3: - lowerSpawnerDelay(e, SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-3")); + lowerSpawnerDelay(e, P.p.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-3")); break; } } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java index 6dc72279..0ec657f1 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java @@ -6,7 +6,6 @@ import com.massivecraft.factions.*; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.util.AsciiCompass; -import com.massivecraft.factions.util.LazyLocation; import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TagReplacer; import com.massivecraft.factions.zcore.util.TagUtil; @@ -153,7 +152,7 @@ public abstract class MemoryBoard extends Board { while (iter.hasNext()) { Entry entry = iter.next(); if (!Factions.getInstance().isValidFactionId(entry.getValue())) { - SaberFactions.plugin.log("Board cleaner removed " + entry.getValue() + " from " + entry.getKey()); + P.p.log("Board cleaner removed " + entry.getValue() + " from " + entry.getKey()); iter.remove(); } } @@ -195,12 +194,12 @@ public abstract class MemoryBoard extends Board { Faction faction = fplayer.getFaction(); ArrayList ret = new ArrayList<>(); Faction factionLoc = getFactionAt(flocation); - ret.add(new FancyMessage(ChatColor.DARK_GRAY + SaberFactions.plugin.txt.titleize("(" + flocation.getCoordString() + ") " + factionLoc.getTag(fplayer)))); - int buffer = SaberFactions.plugin.getConfig().getInt("world-border.buffer", 0); + ret.add(new FancyMessage(ChatColor.DARK_GRAY + P.p.txt.titleize("(" + flocation.getCoordString() + ") " + factionLoc.getTag(fplayer)))); + int buffer = P.p.getConfig().getInt("world-border.buffer", 0); // Get the compass - ArrayList asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.DARK_GREEN, SaberFactions.plugin.txt.parse("")); + ArrayList asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.DARK_GREEN, P.p.txt.parse("")); int halfWidth = Conf.mapWidth / 2; // Use player's value for height @@ -287,16 +286,16 @@ public abstract class MemoryBoard extends Board { @SuppressWarnings("unused") private List getToolTip(Faction faction, FPlayer to) { List ret = new ArrayList<>(); - List show = SaberFactions.plugin.getConfig().getStringList("map"); + List show = P.p.getConfig().getStringList("map"); if (!faction.isNormal()) { String tag = faction.getTag(to); // send header and that's all String header = show.get(0); if (TagReplacer.HEADER.contains(header)) { - ret.add(SaberFactions.plugin.txt.titleize(tag)); + ret.add(P.p.txt.titleize(tag)); } else { - ret.add(SaberFactions.plugin.txt.parse(TagReplacer.FACTION.replace(header, tag))); + ret.add(P.p.txt.parse(TagReplacer.FACTION.replace(header, tag))); } return ret; // we only show header for non-normal factions } @@ -316,7 +315,7 @@ public abstract class MemoryBoard extends Board { List fancy = TagUtil.parseFancy(faction, to, parsed); if (fancy != null) { for (FancyMessage msg : fancy) { - ret.add((SaberFactions.plugin.txt.parse(msg.toOldMessageFormat()))); + ret.add((P.p.txt.parse(msg.toOldMessageFormat()))); } } continue; @@ -330,7 +329,7 @@ public abstract class MemoryBoard extends Board { if (parsed.contains("%")) { parsed = parsed.replaceAll("%", ""); // Just in case it got in there before we disallowed it. } - ret.add(SaberFactions.plugin.txt.parse(parsed)); + ret.add(P.p.txt.parse(parsed)); } } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index 2f4e3ea5..0bd4a189 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -106,7 +106,7 @@ public abstract class MemoryFPlayer implements FPlayer { this.powerBoost = 0.0; this.getKills(); this.getDeaths(); - this.showScoreboard = SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", false); + this.showScoreboard = P.p.getConfig().getBoolean("scoreboard.default-enabled", false); this.mapHeight = Conf.mapHeight; if (!Conf.newPlayerStartingFactionID.equals("0") && Factions.getInstance().isValidFactionId(Conf.newPlayerStartingFactionID)) { @@ -136,7 +136,7 @@ public abstract class MemoryFPlayer implements FPlayer { this.getDeaths(); this.isAdminBypassing = other.isAdminBypassing; this.notificationsEnabled = other.notificationsEnabled; - this.showScoreboard = SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", true); + this.showScoreboard = P.p.getConfig().getBoolean("scoreboard.default-enabled", true); this.mapHeight = Conf.mapHeight; } @@ -264,7 +264,7 @@ public abstract class MemoryFPlayer implements FPlayer { public void setAutoLeave(boolean willLeave) { this.willAutoLeave = willLeave; - SaberFactions.plugin.debug(name + " set autoLeave to " + willLeave); + P.p.debug(name + " set autoLeave to " + willLeave); } public long getLastFrostwalkerMessage() { @@ -616,7 +616,7 @@ public abstract class MemoryFPlayer implements FPlayer { } PowerRegenEvent powerRegenEvent = new PowerRegenEvent(getFaction(), this); - Bukkit.getScheduler().runTask(SaberFactions.plugin, () -> Bukkit.getServer().getPluginManager().callEvent(powerRegenEvent)); + Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getServer().getPluginManager().callEvent(powerRegenEvent)); if (!powerRegenEvent.isCancelled()) this.alterPower(millisPassed * Conf.powerPerMinute / 60000); // millisPerMinute : 60 * 1000 @@ -673,10 +673,10 @@ public abstract class MemoryFPlayer implements FPlayer { boolean showChat = true; if (showInfoBoard(toShow)) { FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow)); - showChat = SaberFactions.plugin.getConfig().getBoolean("scoreboard.also-send-chat", true); + showChat = P.p.getConfig().getBoolean("scoreboard.also-send-chat", true); } if (showChat) { - this.sendMessage(SaberFactions.plugin.txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this)))); + this.sendMessage(P.p.txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this)))); } } @@ -691,7 +691,7 @@ public abstract class MemoryFPlayer implements FPlayer { * @return true if should show, otherwise false. */ public boolean showInfoBoard(Faction toShow) { - return showScoreboard && !toShow.isWarZone() && !toShow.isWilderness() && !toShow.isSafeZone() && SaberFactions.plugin.getConfig().contains("scoreboard.finfo") && SaberFactions.plugin.getConfig().getBoolean("scoreboard.finfo-enabled", false) && FScoreboard.get(this) != null; + return showScoreboard && !toShow.isWarZone() && !toShow.isWilderness() && !toShow.isSafeZone() && P.p.getConfig().contains("scoreboard.finfo") && P.p.getConfig().getBoolean("scoreboard.finfo-enabled", false) && FScoreboard.get(this) != null; } @Override @@ -755,7 +755,7 @@ public abstract class MemoryFPlayer implements FPlayer { } if (Conf.logFactionLeave) { - SaberFactions.plugin.log(TL.LEAVE_LEFT.format(this.getName(), myFaction.getTag())); + P.p.log(TL.LEAVE_LEFT.format(this.getName(), myFaction.getTag())); } } @@ -779,7 +779,7 @@ public abstract class MemoryFPlayer implements FPlayer { Factions.getInstance().removeFaction(myFaction.getId()); if (Conf.logFactionDisband) { - SaberFactions.plugin.log(TL.LEAVE_DISBANDEDLOG.format(myFaction.getTag(), myFaction.getId(), this.getName())); + P.p.log(TL.LEAVE_DISBANDEDLOG.format(myFaction.getTag(), myFaction.getId(), this.getName())); } } } @@ -797,16 +797,16 @@ public abstract class MemoryFPlayer implements FPlayer { Faction myFaction = getFaction(); Faction currentFaction = Board.getInstance().getFactionAt(flocation); int ownedLand = forFaction.getLandRounded(); - int factionBuffer = SaberFactions.plugin.getConfig().getInt("hcf.buffer-zone", 0); - int worldBuffer = SaberFactions.plugin.getConfig().getInt("world-border.buffer", 0); + int factionBuffer = P.p.getConfig().getInt("hcf.buffer-zone", 0); + int worldBuffer = P.p.getConfig().getInt("world-border.buffer", 0); if (Conf.worldGuardChecking && Worldguard.checkForRegionsInChunk(flocation)) { // Checks for WorldGuard regions in the chunk attempting to be claimed - error = SaberFactions.plugin.txt.parse(TL.CLAIM_PROTECTED.toString()); - } else if (flocation.isOutsideWorldBorder(SaberFactions.plugin.getConfig().getInt("world-border.buffer", 0))) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString()); + error = P.p.txt.parse(TL.CLAIM_PROTECTED.toString()); + } else if (flocation.isOutsideWorldBorder(P.p.getConfig().getInt("world-border.buffer", 0))) { + error = P.p.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString()); } else if (Conf.useWorldConfigurationsAsWhitelist != Conf.worldsNoClaiming.contains(flocation.getWorldName())) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_DISABLED.toString()); + error = P.p.txt.parse(TL.CLAIM_DISABLED.toString()); } else if (this.isAdminBypassing()) { return true; } else if (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer())) { @@ -816,50 +816,50 @@ public abstract class MemoryFPlayer implements FPlayer { } else if (currentFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW) { return true; } else if (myFaction != forFaction) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this)); + error = P.p.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this)); } else if (forFaction == currentFaction) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_ALREADYOWN.toString(), forFaction.describeTo(this, true)); + error = P.p.txt.parse(TL.CLAIM_ALREADYOWN.toString(), forFaction.describeTo(this, true)); } else if (this.getRole().value < Role.MODERATOR.value) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_MUSTBE.toString(), Role.MODERATOR.getTranslation()); + error = P.p.txt.parse(TL.CLAIM_MUSTBE.toString(), Role.MODERATOR.getTranslation()); } else if (forFaction.getFPlayers().size() < Conf.claimsRequireMinFactionMembers) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_MEMBERS.toString(), Conf.claimsRequireMinFactionMembers); + error = P.p.txt.parse(TL.CLAIM_MEMBERS.toString(), Conf.claimsRequireMinFactionMembers); } else if (currentFaction.isSafeZone()) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_SAFEZONE.toString()); + error = P.p.txt.parse(TL.CLAIM_SAFEZONE.toString()); } else if (currentFaction.isWarZone()) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_WARZONE.toString()); - } else if (SaberFactions.plugin.getConfig().getBoolean("hcf.allow-overclaim", true) && ownedLand >= forFaction.getPowerRounded()) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_POWER.toString()); + error = P.p.txt.parse(TL.CLAIM_WARZONE.toString()); + } else if (P.p.getConfig().getBoolean("hcf.allow-overclaim", true) && ownedLand >= forFaction.getPowerRounded()) { + error = P.p.txt.parse(TL.CLAIM_POWER.toString()); } else if (Conf.claimedLandsMax != 0 && ownedLand >= Conf.claimedLandsMax && forFaction.isNormal()) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_LIMIT.toString()); + error = P.p.txt.parse(TL.CLAIM_LIMIT.toString()); } else if (currentFaction.getRelationTo(forFaction) == Relation.ALLY) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_ALLY.toString()); + error = P.p.txt.parse(TL.CLAIM_ALLY.toString()); } else if (Conf.claimsMustBeConnected && !this.isAdminBypassing() && myFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !Board.getInstance().isConnectedLocation(flocation, myFaction) && (!Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !currentFaction.isNormal())) { if (Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_CONTIGIOUS.toString()); + error = P.p.txt.parse(TL.CLAIM_CONTIGIOUS.toString()); } else { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_FACTIONCONTIGUOUS.toString()); + error = P.p.txt.parse(TL.CLAIM_FACTIONCONTIGUOUS.toString()); } } else if (factionBuffer > 0 && Board.getInstance().hasFactionWithin(flocation, myFaction, factionBuffer)) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_TOOCLOSETOOTHERFACTION.format(factionBuffer)); + error = P.p.txt.parse(TL.CLAIM_TOOCLOSETOOTHERFACTION.format(factionBuffer)); } else if (flocation.isOutsideWorldBorder(worldBuffer)) { if (worldBuffer > 0) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer)); + error = P.p.txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer)); } else { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString()); + error = P.p.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString()); } } else if (currentFaction.isNormal()) { if (myFaction.isPeaceful()) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_PEACEFUL.toString(), currentFaction.getTag(this)); + error = P.p.txt.parse(TL.CLAIM_PEACEFUL.toString(), currentFaction.getTag(this)); } else if (currentFaction.isPeaceful()) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_PEACEFULTARGET.toString(), currentFaction.getTag(this)); + error = P.p.txt.parse(TL.CLAIM_PEACEFULTARGET.toString(), currentFaction.getTag(this)); } else if (!currentFaction.hasLandInflation()) { // TODO more messages WARN current faction most importantly - error = SaberFactions.plugin.txt.parse(TL.CLAIM_THISISSPARTA.toString(), currentFaction.getTag(this)); - } else if (currentFaction.hasLandInflation() && !SaberFactions.plugin.getConfig().getBoolean("hcf.allow-overclaim", true)) { + error = P.p.txt.parse(TL.CLAIM_THISISSPARTA.toString(), currentFaction.getTag(this)); + } else if (currentFaction.hasLandInflation() && !P.p.getConfig().getBoolean("hcf.allow-overclaim", true)) { // deny over claim when it normally would be allowed. - error = SaberFactions.plugin.txt.parse(TL.CLAIM_OVERCLAIM_DISABLED.toString()); + error = P.p.txt.parse(TL.CLAIM_OVERCLAIM_DISABLED.toString()); } else if (!Board.getInstance().isBorderLocation(flocation)) { - error = SaberFactions.plugin.txt.parse(TL.CLAIM_BORDER.toString()); + error = P.p.txt.parse(TL.CLAIM_BORDER.toString()); } } // TODO: Add more else if statements. @@ -880,7 +880,7 @@ public abstract class MemoryFPlayer implements FPlayer { } public void msg(String str, Object... args) { - this.sendMessage(SaberFactions.plugin.txt.parse(str, args)); + this.sendMessage(P.p.txt.parse(str, args)); } public void msg(TL translation, Object... args) { @@ -923,7 +923,7 @@ public abstract class MemoryFPlayer implements FPlayer { if (!damage) { msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled"); if (!fly) { - sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", SaberFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3) + "")); + sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", P.p.getConfig().getInt("fly-falldamage-cooldown", 3) + "")); } } else { @@ -932,7 +932,7 @@ public abstract class MemoryFPlayer implements FPlayer { // If leaving fly mode, don't let them take fall damage for x seconds. if (!fly) { - int cooldown = SaberFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3); + int cooldown = P.p.getConfig().getInt("fly-falldamage-cooldown", 3); CmdFly.flyMap.remove(player.getName()); // If the value is 0 or lower, make them take fall damage. @@ -940,7 +940,7 @@ public abstract class MemoryFPlayer implements FPlayer { // Short task so we're just doing it in method. Not clean but eh. if (cooldown > 0) { setTakeFallDamage(false); - Bukkit.getScheduler().runTaskLater(SaberFactions.plugin, () -> setTakeFallDamage(true), 20L * cooldown); + Bukkit.getScheduler().runTaskLater(P.p, () -> setTakeFallDamage(true), 20L * cooldown); } } @@ -1221,7 +1221,7 @@ public abstract class MemoryFPlayer implements FPlayer { } LandClaimEvent claimEvent = new LandClaimEvent(flocation, forFaction, this); - Bukkit.getScheduler().runTask(SaberFactions.plugin, () -> Bukkit.getPluginManager().callEvent(claimEvent)); + Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getPluginManager().callEvent(claimEvent)); if (claimEvent.isCancelled()) { return false; } @@ -1248,7 +1248,7 @@ public abstract class MemoryFPlayer implements FPlayer { Board.getInstance().setFactionAt(forFaction, flocation); if (Conf.logLandClaims) { - SaberFactions.plugin.log(TL.CLAIM_CLAIMEDLOG.toString(), this.getName(), flocation.getCoordString(), forFaction.getTag()); + P.p.log(TL.CLAIM_CLAIMEDLOG.toString(), this.getName(), flocation.getCoordString(), forFaction.getTag()); } return true; @@ -1277,7 +1277,7 @@ public abstract class MemoryFPlayer implements FPlayer { @Override public boolean hasMoney(int amt) { - Economy econ = SaberFactions.plugin.getEcon(); + Economy econ = P.p.getEcon(); if (econ.getBalance(getPlayer()) >= amt) { return true; } else { @@ -1296,7 +1296,7 @@ public abstract class MemoryFPlayer implements FPlayer { @Override public void takeMoney(int amt) { if (hasMoney(amt)) { - Economy econ = SaberFactions.plugin.getEcon(); + Economy econ = P.p.getEcon(); econ.withdrawPlayer(getPlayer(), amt); sendMessage(TL.GENERIC_MONEYTAKE.toString().replace("{amount}", commas(amt))); } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayers.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayers.java index 7e402bbc..9483be35 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayers.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayers.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.zcore.persist; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Factions; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; @@ -17,7 +17,7 @@ public abstract class MemoryFPlayers extends FPlayers { public void clean() { for (FPlayer fplayer : this.fPlayers.values()) { if (!Factions.getInstance().isValidFactionId(fplayer.getFactionId())) { - SaberFactions.plugin.log("Reset faction data (invalid faction:" + fplayer.getFactionId() + ") for player " + fplayer.getName()); + P.p.log("Reset faction data (invalid faction:" + fplayer.getFactionId() + ") for player " + fplayer.getName()); fplayer.resetFactionData(false); } } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java index 4365c43e..0d6efa5c 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -308,7 +308,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { if (Conf.logFactionDisband) { //TODO: Format this correctly and translate. - SaberFactions.plugin.log("The faction " + this.getTag() + " (" + this.getId() + ") was disbanded by " + (disbanderIsConsole ? "console command" : fdisbander.getName()) + "."); + P.p.log("The faction " + this.getTag() + " (" + this.getId() + ") was disbanded by " + (disbanderIsConsole ? "console command" : fdisbander.getName()) + "."); } if (Econ.shouldBeUsed() && !disbanderIsConsole) { @@ -324,7 +324,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { String amountString = Econ.moneyString(amount); msg(TL.COMMAND_DISBAND_HOLDINGS, amountString); //TODO: Format this correctly and translate - SaberFactions.plugin.log(fdisbander.getName() + " has been given bank holdings of " + amountString + " from disbanding " + this.getTag() + "."); + P.p.log(fdisbander.getName() + " has been given bank holdings of " + amountString + " from disbanding " + this.getTag() + "."); } } } @@ -407,16 +407,16 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { int size = 9; switch (getUpgrade(UpgradeType.CHEST)) { case 1: - size = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1") * 9; + size = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1") * 9; break; case 2: - size = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2") * 9; + size = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2") * 9; break; case 3: - size = SaberFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3") * 9; + size = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3") * 9; break; } - chest = Bukkit.createInventory(null, size, SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fchest.Inventory-Title"))); + chest = Bukkit.createInventory(null, size, P.p.color(P.p.getConfig().getString("fchest.Inventory-Title"))); return chest; } @@ -424,7 +424,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { @Override public void setChestSize(int chestSize) { ItemStack[] contents = this.getChestInventory().getContents(); - chest = Bukkit.createInventory(null, chestSize, SaberFactions.plugin.color(SaberFactions.plugin.getConfig().getString("fchest.Inventory-Title"))); + chest = Bukkit.createInventory(null, chestSize, P.p.color(P.p.getConfig().getString("fchest.Inventory-Title"))); chest.setContents(contents); } @@ -604,7 +604,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public boolean isPowerFrozen() { - int freezeSeconds = SaberFactions.plugin.getConfig().getInt("hcf.powerfreeze", 0); + int freezeSeconds = P.p.getConfig().getInt("hcf.powerfreeze", 0); return freezeSeconds != 0 && System.currentTimeMillis() - lastDeath < freezeSeconds * 1000; } @@ -690,7 +690,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public void resetPerms() { - SaberFactions.plugin.log(Level.WARNING, "Resetting permissions for Faction: " + tag); + P.p.log(Level.WARNING, "Resetting permissions for Faction: " + tag); permissions.clear(); @@ -827,7 +827,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { if (this.relationWish.containsKey(otherFaction.getId())) { return this.relationWish.get(otherFaction.getId()); } - return Relation.fromString(SaberFactions.plugin.getConfig().getString("default-relation", "neutral")); // Always default to old behavior. + return Relation.fromString(P.p.getConfig().getString("default-relation", "neutral")); // Always default to old behavior. } public void setRelationWish(Faction otherFaction, Relation relation) { @@ -1033,7 +1033,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { return ret; } - for (Player player : SaberFactions.plugin.getServer().getOnlinePlayers()) { + for (Player player : P.p.getServer().getOnlinePlayers()) { FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); if (fplayer.getFaction() == this && !fplayer.isAlt()) { ret.add(player); @@ -1051,7 +1051,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { return false; } - for (Player player : SaberFactions.plugin.getServer().getOnlinePlayers()) { + for (Player player : P.p.getServer().getOnlinePlayers()) { FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); if (fplayer != null && fplayer.getFaction() == this) { return true; @@ -1103,7 +1103,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { // no members left and faction isn't permanent, so disband it if (Conf.logFactionDisband) { - SaberFactions.plugin.log("The faction " + this.getTag() + " (" + this.getId() + ") has been disbanded since it has no members left" + (autoLeave ? " and by inactivity" : "") + "."); + P.p.log("The faction " + this.getTag() + " (" + this.getId() + ") has been disbanded since it has no members left" + (autoLeave ? " and by inactivity" : "") + "."); } for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { @@ -1121,7 +1121,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { replacements.get(0).setRole(Role.LEADER); //TODO:TL this.msg("Faction admin %s has been removed. %s has been promoted as the new faction admin.", oldLeader == null ? "" : oldLeader.getName(), replacements.get(0).getName()); - SaberFactions.plugin.log("Faction " + this.getTag() + " (" + this.getId() + ") admin was removed. Replacement admin: " + replacements.get(0).getName()); + P.p.log("Faction " + this.getTag() + " (" + this.getId() + ") admin was removed. Replacement admin: " + replacements.get(0).getName()); } } @@ -1129,7 +1129,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { // Messages // ----------------------------------------------// public void msg(String message, Object... args) { - message = SaberFactions.plugin.txt.parse(message, args); + message = P.p.txt.parse(message, args); for (FPlayer fplayer : this.getFPlayersWhereOnline(true)) { fplayer.sendMessage(message); diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/json/FactionsJSON.java b/src/main/java/com/massivecraft/factions/zcore/persist/json/FactionsJSON.java index 948a7c9f..b9d7da42 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/json/FactionsJSON.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/json/FactionsJSON.java @@ -23,7 +23,7 @@ public class FactionsJSON { new BukkitRunnable() { @Override public void run() { - Logger logger = SaberFactions.plugin.getLogger(); + Logger logger = P.p.getLogger(); logger.info("Beginning Board conversion to JSON"); new JSONBoard().convertFrom((MemoryBoard) Board.getInstance()); logger.info("Board Converted"); @@ -40,6 +40,6 @@ public class FactionsJSON { } logger.info("Conversion Complete"); } - }.runTaskAsynchronously(SaberFactions.plugin); + }.runTaskAsynchronously(P.p); } } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONBoard.java b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONBoard.java index aedf479b..fc15f2ea 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONBoard.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONBoard.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.zcore.persist.json; import com.google.gson.reflect.TypeToken; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.persist.MemoryBoard; import com.massivecraft.factions.zcore.util.DiscUtil; @@ -16,7 +16,7 @@ import java.util.TreeMap; public class JSONBoard extends MemoryBoard { - private static transient File file = new File(SaberFactions.plugin.getDataFolder(), "board.json"); + private static transient File file = new File(P.p.getDataFolder(), "board.json"); // -------------------------------------------- // // Persistance @@ -67,14 +67,14 @@ public class JSONBoard extends MemoryBoard { } public void forceSave(boolean sync) { - DiscUtil.writeCatch(file, SaberFactions.plugin.gson.toJson(dumpAsSaveFormat()), sync); + DiscUtil.writeCatch(file, P.p.gson.toJson(dumpAsSaveFormat()), sync); } public boolean load() { - SaberFactions.plugin.log("Loading board from disk"); + P.p.log("Loading board from disk"); if (!file.exists()) { - SaberFactions.plugin.log("No board to load from disk. Creating new file."); + P.p.log("No board to load from disk. Creating new file."); forceSave(); return true; } @@ -82,12 +82,12 @@ public class JSONBoard extends MemoryBoard { try { Type type = new TypeToken>>() { }.getType(); - Map> worldCoordIds = SaberFactions.plugin.gson.fromJson(DiscUtil.read(file), type); + Map> worldCoordIds = P.p.gson.fromJson(DiscUtil.read(file), type); loadFromSaveFormat(worldCoordIds); - SaberFactions.plugin.log("Loaded " + flocationIds.size() + " board locations"); + P.p.log("Loaded " + flocationIds.size() + " board locations"); } catch (Exception e) { e.printStackTrace(); - SaberFactions.plugin.log("Failed to load the board from disk."); + P.p.log("Failed to load the board from disk."); return false; } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java index 1566a61e..907c6310 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java @@ -6,7 +6,7 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.persist.MemoryFPlayer; import com.massivecraft.factions.zcore.persist.MemoryFPlayers; import com.massivecraft.factions.zcore.util.DiscUtil; @@ -26,8 +26,8 @@ public class JSONFPlayers extends MemoryFPlayers { private File file; public JSONFPlayers() { - file = new File(SaberFactions.plugin.getDataFolder(), "players.json"); - gson = SaberFactions.plugin.gson; + file = new File(P.p.getDataFolder(), "players.json"); + gson = P.p.gson; } public Gson getGson() { @@ -75,7 +75,7 @@ public class JSONFPlayers extends MemoryFPlayers { } this.fPlayers.clear(); this.fPlayers.putAll(fplayers); - SaberFactions.plugin.log("Loaded " + fPlayers.size() + " players"); + P.p.log("Loaded " + fPlayers.size() + " players"); } private Map loadCore() { diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFactions.java b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFactions.java index 196fc0f2..4599ce35 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFactions.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFactions.java @@ -7,7 +7,7 @@ import com.google.gson.reflect.TypeToken; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; import com.massivecraft.factions.Factions; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.persist.MemoryFaction; import com.massivecraft.factions.zcore.persist.MemoryFactions; import com.massivecraft.factions.zcore.util.DiscUtil; @@ -26,8 +26,8 @@ public class JSONFactions extends MemoryFactions { private final File file; public JSONFactions() { - this.file = new File(SaberFactions.plugin.getDataFolder(), "factions.json"); - this.gson = SaberFactions.plugin.gson; + this.file = new File(P.p.getDataFolder(), "factions.json"); + this.gson = P.p.gson; this.nextId = 1; } @@ -68,7 +68,7 @@ public class JSONFactions extends MemoryFactions { this.factions.putAll(factions); super.load(); - SaberFactions.plugin.log("Loaded " + factions.size() + " Factions"); + P.p.log("Loaded " + factions.size() + " Factions"); } private Map loadCore() { diff --git a/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java index c34d205e..25db32a2 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java @@ -1,6 +1,6 @@ package com.massivecraft.factions.zcore.util; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import org.bukkit.Bukkit; import java.io.*; @@ -80,7 +80,7 @@ public class DiscUtil { lock.unlock(); } } else { - Bukkit.getScheduler().runTaskAsynchronously(SaberFactions.plugin, () -> { + Bukkit.getScheduler().runTaskAsynchronously(P.p, () -> { lock.lock(); try { write(file, content); diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java b/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java index 2e9027d2..e2952e4f 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java @@ -126,22 +126,22 @@ public enum TagReplacer { case FACTIONLESS: return String.valueOf(Factions.getInstance().getWilderness().getFPlayersWhereOnline(true).size()); case MAX_ALLIES: - if (SaberFactions.plugin.getConfig().getBoolean("max-relations.enabled", true)) { - return String.valueOf(SaberFactions.plugin.getConfig().getInt("max-relations.ally", 10)); + if (P.p.getConfig().getBoolean("max-relations.enabled", true)) { + return String.valueOf(P.p.getConfig().getInt("max-relations.ally", 10)); } return TL.GENERIC_INFINITY.toString(); case MAX_ENEMIES: - if (SaberFactions.plugin.getConfig().getBoolean("max-relations.enabled", true)) { - return String.valueOf(SaberFactions.plugin.getConfig().getInt("max-relations.enemy", 10)); + if (P.p.getConfig().getBoolean("max-relations.enabled", true)) { + return String.valueOf(P.p.getConfig().getInt("max-relations.enemy", 10)); } return TL.GENERIC_INFINITY.toString(); case MAX_TRUCES: - if (SaberFactions.plugin.getConfig().getBoolean("max-relations.enabled", true)) { - return String.valueOf(SaberFactions.plugin.getConfig().getInt("max-relations.truce", 10)); + if (P.p.getConfig().getBoolean("max-relations.enabled", true)) { + return String.valueOf(P.p.getConfig().getInt("max-relations.truce", 10)); } return TL.GENERIC_INFINITY.toString(); case MAX_WARPS: - return String.valueOf(SaberFactions.plugin.getConfig().getInt("max-warps", 5)); + return String.valueOf(P.p.getConfig().getInt("max-warps", 5)); default: } return null; @@ -159,12 +159,12 @@ public enum TagReplacer { return getValue(); } - boolean minimal = SaberFactions.plugin.getConfig().getBoolean("minimal-show", false); + boolean minimal = P.p.getConfig().getBoolean("minimal-show", false); if (fp != null) { switch (this) { case HEADER: - return SaberFactions.plugin.txt.titleize(fac.getTag(fp)); + return P.p.txt.titleize(fac.getTag(fp)); case PLAYER_NAME: return fp.getName(); case FACTION: @@ -173,7 +173,7 @@ public enum TagReplacer { String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX; return fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized); case PLAYER_GROUP: - return SaberFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fp.getId()))); + return P.p.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fp.getId()))); case PLAYER_BALANCE: return Econ.isSetup() ? Econ.getFriendlyBalance(fp) : TL.ECON_OFF.format("balance"); case PLAYER_POWER: @@ -216,7 +216,7 @@ public enum TagReplacer { case CREATE_DATE: return TL.sdf.format(fac.getFoundedDate()); case RAIDABLE: - boolean raid = SaberFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && fac.getLandRounded() >= fac.getPowerRounded(); + boolean raid = P.p.getConfig().getBoolean("hcf.raidable", false) && fac.getLandRounded() >= fac.getPowerRounded(); return raid ? TL.RAIDABLE_TRUE.toString() : TL.RAIDABLE_FALSE.toString(); case HOME_WORLD: return fac.hasHome() ? fac.getHome().getWorld().getName() : minimal ? null : "{ig}"; diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java index 37c7f2a6..b51d092a 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java @@ -4,7 +4,7 @@ package com.massivecraft.factions.zcore.util; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import com.massivecraft.factions.Factions; -import com.massivecraft.factions.SaberFactions; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.util.MiscUtil; import me.clip.placeholderapi.PlaceholderAPI; @@ -98,11 +98,11 @@ public class TagUtil { } public static String parsePlaceholders(Player player, String line) { - if (SaberFactions.plugin.isClipPlaceholderAPIHooked() && player.isOnline()) { + if (P.p.isClipPlaceholderAPIHooked() && player.isOnline()) { line = PlaceholderAPI.setPlaceholders(player, line); } - if (SaberFactions.plugin.isMVdWPlaceholderAPIHooked() && player.isOnline()) { + if (P.p.isMVdWPlaceholderAPIHooked() && player.isOnline()) { line = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(player, line); } @@ -134,11 +134,11 @@ public class TagUtil { */ protected static List getFancy(Faction target, FPlayer fme, TagReplacer type, String prefix) { List fancyMessages = new ArrayList<>(); - boolean minimal = SaberFactions.plugin.getConfig().getBoolean("minimal-show", false); + boolean minimal = P.p.getConfig().getBoolean("minimal-show", false); switch (type) { case ALLIES_LIST: - FancyMessage currentAllies = SaberFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentAllies = P.p.txt.parseFancy(prefix); boolean firstAlly = true; for (Faction otherFaction : Factions.getInstance().getAllFactions()) { if (otherFaction == target) { @@ -158,7 +158,7 @@ public class TagUtil { fancyMessages.add(currentAllies); return firstAlly && minimal ? null : fancyMessages; // we must return here and not outside the switch case ENEMIES_LIST: - FancyMessage currentEnemies = SaberFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentEnemies = P.p.txt.parseFancy(prefix); boolean firstEnemy = true; for (Faction otherFaction : Factions.getInstance().getAllFactions()) { if (otherFaction == target) { @@ -178,7 +178,7 @@ public class TagUtil { fancyMessages.add(currentEnemies); return firstEnemy && minimal ? null : fancyMessages; // we must return here and not outside the switch case TRUCES_LIST: - FancyMessage currentTruces = SaberFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentTruces = P.p.txt.parseFancy(prefix); boolean firstTruce = true; for (Faction otherFaction : Factions.getInstance().getAllFactions()) { if (otherFaction == target) { @@ -198,7 +198,7 @@ public class TagUtil { fancyMessages.add(currentTruces); return firstTruce && minimal ? null : fancyMessages; // we must return here and not outside the switch case ONLINE_LIST: - FancyMessage currentOnline = SaberFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentOnline = P.p.txt.parseFancy(prefix); boolean firstOnline = true; for (FPlayer p : MiscUtil.rankOrder(target.getFPlayersWhereOnline(true, fme))) { if (fme != null && fme.getPlayer() != null && !fme.getPlayer().canSee(p.getPlayer())) { @@ -216,7 +216,7 @@ public class TagUtil { fancyMessages.add(currentOnline); return firstOnline && minimal ? null : fancyMessages; // we must return here and not outside the switch case OFFLINE_LIST: - FancyMessage currentOffline = SaberFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentOffline = P.p.txt.parseFancy(prefix); boolean firstOffline = true; for (FPlayer p : MiscUtil.rankOrder(target.getFPlayers())) { String name = p.getNameAndTitle(); @@ -234,7 +234,7 @@ public class TagUtil { fancyMessages.add(currentOffline); return firstOffline && minimal ? null : fancyMessages; // we must return here and not outside the switch case ALTS: - FancyMessage alts = SaberFactions.plugin.txt.parseFancy(prefix); + FancyMessage alts = P.p.txt.parseFancy(prefix); boolean firstAlt = true; for (FPlayer p : target.getAltPlayers()) { String name = p.getName(); @@ -271,7 +271,7 @@ public class TagUtil { */ private static List tipFaction(Faction faction) { List lines = new ArrayList<>(); - for (String line : SaberFactions.plugin.getConfig().getStringList("tooltips.list")) { + for (String line : P.p.getConfig().getStringList("tooltips.list")) { lines.add(ChatColor.translateAlternateColorCodes('&', TagUtil.parsePlain(faction, line))); } return lines; @@ -285,7 +285,7 @@ public class TagUtil { */ private static List tipPlayer(FPlayer fplayer) { List lines = new ArrayList<>(); - for (String line : SaberFactions.plugin.getConfig().getStringList("tooltips.show")) { + for (String line : P.p.getConfig().getStringList("tooltips.show")) { lines.add(ChatColor.translateAlternateColorCodes('&', TagUtil.parsePlain(fplayer, line))); } return lines; diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java index 93ed22c5..c5b88478 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java @@ -106,7 +106,7 @@ public class TextUtil { // -------------------------------------------- // public static String parseColorAcc(String string) { - return string.replace("`e", "").replace("`r", ChatColor.RED.toString()).replace("`R", ChatColor.DARK_RED.toString()).replace("`y", ChatColor.YELLOW.toString()).replace("`Y", ChatColor.GOLD.toString()).replace("`g", ChatColor.GREEN.toString()).replace("`G", ChatColor.DARK_GREEN.toString()).replace("`a", ChatColor.AQUA.toString()).replace("`A", ChatColor.DARK_AQUA.toString()).replace("`b", ChatColor.BLUE.toString()).replace("`B", ChatColor.DARK_BLUE.toString()).replace("`plugin", ChatColor.LIGHT_PURPLE.toString()).replace("`SaberFactions", ChatColor.DARK_PURPLE.toString()).replace("`k", ChatColor.BLACK.toString()).replace("`s", ChatColor.GRAY.toString()).replace("`S", ChatColor.DARK_GRAY.toString()).replace("`w", ChatColor.WHITE.toString()); + return string.replace("`e", "").replace("`r", ChatColor.RED.toString()).replace("`R", ChatColor.DARK_RED.toString()).replace("`y", ChatColor.YELLOW.toString()).replace("`Y", ChatColor.GOLD.toString()).replace("`g", ChatColor.GREEN.toString()).replace("`G", ChatColor.DARK_GREEN.toString()).replace("`a", ChatColor.AQUA.toString()).replace("`A", ChatColor.DARK_AQUA.toString()).replace("`b", ChatColor.BLUE.toString()).replace("`B", ChatColor.DARK_BLUE.toString()).replace("`plugin", ChatColor.LIGHT_PURPLE.toString()).replace("`P", ChatColor.DARK_PURPLE.toString()).replace("`k", ChatColor.BLACK.toString()).replace("`s", ChatColor.GRAY.toString()).replace("`S", ChatColor.DARK_GRAY.toString()).replace("`w", ChatColor.WHITE.toString()); } public static String parseColorTags(String string) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 80d89421..9183975b 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -814,7 +814,7 @@ f-points: # | Faction Focus | # # +------------------------------------------------------+ # ############################################################ -#Note This will ONLY work if you have SaberFactions Scoreboard Enabled! +#Note This will ONLY work if you have the Scoreboard Enabled! ffocus: Enabled: true Prefix: '&7»&b' diff --git a/src/main/resources/lang/it_IT.yml b/src/main/resources/lang/it_IT.yml index 775fc25c..f389a1c4 100644 --- a/src/main/resources/lang/it_IT.yml +++ b/src/main/resources/lang/it_IT.yml @@ -1,4 +1,4 @@ -# Lang file for SaberFactions by drtshock & Driftay +# Lang file for P by drtshock & Driftay # Use & for color codes. # Made with love <3 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a7e094d8..ae5672c7 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: Factions version: ${project.version} api-version: 1.13 -main: com.massivecraft.factions.SaberFactions +main: com.massivecraft.factions.P authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage, SvenjaReißaus, FroggyKnight, Driftay] softdepend: [Skript, CoreProtect, PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop]