From b1b9bd1b735aadda7cc99f14b97443162eb266ae Mon Sep 17 00:00:00 2001 From: ProSavage Date: Tue, 6 Nov 2018 23:38:43 -0600 Subject: [PATCH] Reformatted Code --- .../java/com/massivecraft/factions/Conf.java | 46 +- .../com/massivecraft/factions/FLocation.java | 16 +- .../massivecraft/factions/MassiveStats.java | 12 +- .../massivecraft/factions/SavageFactions.java | 53 +- .../massivecraft/factions/cmd/CmdAdmin.java | 8 +- .../factions/cmd/CmdAutoClaim.java | 2 +- .../factions/cmd/CmdAutoHelp.java | 2 +- .../com/massivecraft/factions/cmd/CmdBan.java | 6 +- .../massivecraft/factions/cmd/CmdBanlist.java | 2 +- .../massivecraft/factions/cmd/CmdBanner.java | 18 +- .../massivecraft/factions/cmd/CmdBoom.java | 6 +- .../massivecraft/factions/cmd/CmdBypass.java | 6 +- .../massivecraft/factions/cmd/CmdChat.java | 4 +- .../massivecraft/factions/cmd/CmdChatSpy.java | 6 +- .../factions/cmd/CmdCheckpoint.java | 2 +- .../massivecraft/factions/cmd/CmdChest.java | 6 +- .../massivecraft/factions/cmd/CmdClaim.java | 4 +- .../factions/cmd/CmdColeader.java | 8 +- .../massivecraft/factions/cmd/CmdConfig.java | 10 +- .../massivecraft/factions/cmd/CmdConvert.java | 2 +- .../massivecraft/factions/cmd/CmdCreate.java | 10 +- .../factions/cmd/CmdDeinvite.java | 4 +- .../factions/cmd/CmdDelFWarp.java | 4 +- .../massivecraft/factions/cmd/CmdDemote.java | 2 +- .../factions/cmd/CmdDescription.java | 4 +- .../massivecraft/factions/cmd/CmdFWarp.java | 10 +- .../com/massivecraft/factions/cmd/CmdFly.java | 60 +- .../factions/cmd/CmdGetVault.java | 8 +- .../massivecraft/factions/cmd/CmdHelp.java | 10 +- .../massivecraft/factions/cmd/CmdHome.java | 22 +- .../massivecraft/factions/cmd/CmdInvite.java | 6 +- .../massivecraft/factions/cmd/CmdJoin.java | 20 +- .../massivecraft/factions/cmd/CmdKick.java | 16 +- .../massivecraft/factions/cmd/CmdList.java | 10 +- .../massivecraft/factions/cmd/CmdLock.java | 2 +- .../massivecraft/factions/cmd/CmdLogins.java | 4 +- .../com/massivecraft/factions/cmd/CmdMap.java | 6 +- .../com/massivecraft/factions/cmd/CmdMod.java | 4 +- .../factions/cmd/CmdMoneyBalance.java | 2 +- .../factions/cmd/CmdMoneyDeposit.java | 2 +- .../factions/cmd/CmdMoneyTransferFf.java | 2 +- .../factions/cmd/CmdMoneyTransferFp.java | 2 +- .../factions/cmd/CmdMoneyTransferPf.java | 2 +- .../factions/cmd/CmdMoneyWithdraw.java | 2 +- .../massivecraft/factions/cmd/CmdNear.java | 4 +- .../massivecraft/factions/cmd/CmdOpen.java | 4 +- .../massivecraft/factions/cmd/CmdOwner.java | 14 +- .../factions/cmd/CmdOwnerList.java | 8 +- .../factions/cmd/CmdPaypalSee.java | 6 +- .../factions/cmd/CmdPaypalSet.java | 4 +- .../massivecraft/factions/cmd/CmdPerm.java | 2 +- .../factions/cmd/CmdPermanent.java | 2 +- .../massivecraft/factions/cmd/CmdPower.java | 4 +- .../factions/cmd/CmdPowerBoost.java | 6 +- .../massivecraft/factions/cmd/CmdReload.java | 8 +- .../massivecraft/factions/cmd/CmdRules.java | 8 +- .../com/massivecraft/factions/cmd/CmdSB.java | 2 +- .../factions/cmd/CmdSafeunclaimall.java | 2 +- .../factions/cmd/CmdSeeChunk.java | 6 +- .../factions/cmd/CmdSetBanner.java | 3 +- .../factions/cmd/CmdSetDefaultRole.java | 2 +- .../factions/cmd/CmdSetFWarp.java | 12 +- .../factions/cmd/CmdSetMaxVaults.java | 2 +- .../massivecraft/factions/cmd/CmdSethome.java | 10 +- .../massivecraft/factions/cmd/CmdShow.java | 10 +- .../massivecraft/factions/cmd/CmdStealth.java | 4 +- .../massivecraft/factions/cmd/CmdStuck.java | 36 +- .../com/massivecraft/factions/cmd/CmdTag.java | 6 +- .../massivecraft/factions/cmd/CmdTitle.java | 4 +- .../com/massivecraft/factions/cmd/CmdTnt.java | 18 +- .../massivecraft/factions/cmd/CmdTntFill.java | 24 +- .../factions/cmd/CmdToggleAllianceChat.java | 4 +- .../com/massivecraft/factions/cmd/CmdTop.java | 12 +- .../factions/cmd/CmdTpBanner.java | 8 +- .../massivecraft/factions/cmd/CmdUnban.java | 6 +- .../massivecraft/factions/cmd/CmdUnclaim.java | 22 +- .../factions/cmd/CmdUnclaimall.java | 6 +- .../factions/cmd/CmdUpgrades.java | 2 +- .../massivecraft/factions/cmd/CmdVault.java | 2 +- .../massivecraft/factions/cmd/CmdVersion.java | 2 +- .../factions/cmd/CmdWarunclaimall.java | 2 +- .../massivecraft/factions/cmd/FCmdRoot.java | 14 +- .../massivecraft/factions/cmd/FCommand.java | 34 +- .../factions/cmd/FPromoteCommand.java | 8 +- .../factions/cmd/FRelationCommand.java | 14 +- .../factions/integration/Econ.java | 58 +- .../factions/integration/Essentials.java | 2 +- .../factions/integration/Worldguard.java | 14 +- .../integration/dynmap/EngineDynmap.java | 43 +- .../integration/dynmap/TempAreaMarker.java | 6 +- .../integration/dynmap/TempMarker.java | 6 +- .../integration/dynmap/TempMarkerSet.java | 2 +- .../listeners/FactionsBlockListener.java | 540 +++++++++--------- .../listeners/FactionsChatListener.java | 30 +- .../listeners/FactionsEntityListener.java | 122 ++-- .../listeners/FactionsExploitListener.java | 14 +- .../listeners/FactionsPlayerListener.java | 1 - .../scoreboards/BufferedObjective.java | 6 +- .../factions/scoreboards/FScoreboard.java | 6 +- .../scoreboards/FSidebarProvider.java | 2 +- .../factions/scoreboards/FTeamWrapper.java | 30 +- .../scoreboards/sidebar/FDefaultSidebar.java | 4 +- .../scoreboards/sidebar/FInfoSidebar.java | 2 +- .../factions/struct/Permission.java | 2 +- .../factions/struct/Relation.java | 2 +- .../factions/util/AutoLeaveProcessTask.java | 10 +- .../factions/util/AutoLeaveTask.java | 6 +- .../util/ClipPlaceholderAPIManager.java | 6 +- .../factions/util/EnumTypeAdapter.java | 6 +- .../factions/util/InventoryTypeAdapter.java | 2 - .../factions/util/LazyLocation.java | 148 ++--- .../factions/util/LocationTypeAdapter.java | 44 +- .../util/MapFLocToStringSetTypeAdapter.java | 6 +- .../massivecraft/factions/util/MiscUtil.java | 4 +- .../factions/util/MultiversionMaterials.java | 111 ++-- .../factions/util/MyLocationTypeAdapter.java | 4 +- .../util/Particles/ParticleEffect.java | 142 ++--- .../util/Particles/ReflectionUtils.java | 4 +- .../util/PermissionsMapTypeAdapter.java | 2 +- .../factions/util/RelationUtil.java | 4 +- .../factions/util/SpiralTask.java | 36 +- .../factions/util/VisualizeUtil.java | 11 +- .../factions/util/WarmUpUtil.java | 4 +- .../massivecraft/factions/util/WarpGUI.java | 46 +- .../massivecraft/factions/zcore/MCommand.java | 13 +- .../massivecraft/factions/zcore/MPlugin.java | 12 +- .../zcore/MPluginSecretPlayerListener.java | 6 +- .../zcore/fperms/PermissableAction.java | 14 +- .../fperms/gui/PermissableActionGUI.java | 54 +- .../fperms/gui/PermissableRelationGUI.java | 38 +- .../zcore/fupgrades/CropUpgrades.java | 16 +- .../factions/zcore/fupgrades/EXPUpgrade.java | 6 +- .../zcore/fupgrades/FUpgradesGUI.java | 134 ++--- .../zcore/fupgrades/SpawnerUpgrades.java | 6 +- .../factions/zcore/nbtapi/NBTCompound.java | 3 +- .../factions/zcore/nbtapi/NBTFile.java | 2 +- .../factions/zcore/nbtapi/NBTList.java | 8 +- .../zcore/nbtapi/NBTListCompound.java | 2 +- .../zcore/nbtapi/NBTReflectionUtil.java | 142 ++--- .../factions/zcore/persist/MemoryBoard.java | 44 +- .../factions/zcore/persist/MemoryFPlayer.java | 169 +++--- .../zcore/persist/MemoryFPlayers.java | 4 +- .../factions/zcore/persist/MemoryFaction.java | 69 +-- .../zcore/persist/MemoryFactions.java | 20 +- .../factions/zcore/persist/SaveTask.java | 2 +- .../zcore/persist/json/FactionsJSON.java | 8 +- .../zcore/persist/json/JSONBoard.java | 18 +- .../zcore/persist/json/JSONFPlayers.java | 22 +- .../zcore/persist/json/JSONFactions.java | 14 +- .../factions/zcore/util/DiscUtil.java | 6 +- .../factions/zcore/util/PermUtil.java | 4 +- .../factions/zcore/util/Persist.java | 6 +- .../massivecraft/factions/zcore/util/TL.java | 18 +- .../factions/zcore/util/TagReplacer.java | 24 +- .../factions/zcore/util/TagUtil.java | 24 +- .../factions/zcore/util/TextUtil.java | 6 +- 156 files changed, 1589 insertions(+), 1593 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index 5ca29cc3..020c82a2 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -35,7 +35,7 @@ public class Conf { public static ChatColor colorWar = ChatColor.DARK_RED; // Power public static double powerPlayerMax = 10.0; - public static double powerPlayerMin = -10.0; + public static double powerPlayerMin = - 10.0; public static double powerPlayerStarting = 0.0; public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power public static double powerPerDeath = 4.0; // A death makes you lose 4 power @@ -346,27 +346,27 @@ public class Conf { territoryEnemyDenyCommands.add("tpa"); - territoryProtectedMaterials.add(SavageFactions.plugin.WOODEN_DOOR); - territoryProtectedMaterials.add(SavageFactions.plugin.TRAP_DOOR); - territoryProtectedMaterials.add(SavageFactions.plugin.FENCE_GATE); + territoryProtectedMaterials.add(SavageFactions.plugin.WOODEN_DOOR); + territoryProtectedMaterials.add(SavageFactions.plugin.TRAP_DOOR); + territoryProtectedMaterials.add(SavageFactions.plugin.FENCE_GATE); territoryProtectedMaterials.add(Material.DISPENSER); territoryProtectedMaterials.add(Material.CHEST); territoryProtectedMaterials.add(Material.FURNACE); - territoryProtectedMaterials.add(SavageFactions.plugin.BURNING_FURNACE); - territoryProtectedMaterials.add(SavageFactions.plugin.DIODE_BLOCK_OFF); - territoryProtectedMaterials.add(SavageFactions.plugin.DIODE_BLOCK_ON); + territoryProtectedMaterials.add(SavageFactions.plugin.BURNING_FURNACE); + territoryProtectedMaterials.add(SavageFactions.plugin.DIODE_BLOCK_OFF); + territoryProtectedMaterials.add(SavageFactions.plugin.DIODE_BLOCK_ON); territoryProtectedMaterials.add(Material.JUKEBOX); territoryProtectedMaterials.add(Material.BREWING_STAND); - territoryProtectedMaterials.add(SavageFactions.plugin.ENCHANTMENT_TABLE); + territoryProtectedMaterials.add(SavageFactions.plugin.ENCHANTMENT_TABLE); territoryProtectedMaterials.add(Material.CAULDRON); - territoryProtectedMaterials.add(SavageFactions.plugin.ENCHANTMENT_TABLE); + territoryProtectedMaterials.add(SavageFactions.plugin.ENCHANTMENT_TABLE); territoryProtectedMaterials.add(Material.BEACON); territoryProtectedMaterials.add(Material.ANVIL); territoryProtectedMaterials.add(Material.TRAPPED_CHEST); territoryProtectedMaterials.add(Material.DROPPER); territoryProtectedMaterials.add(Material.HOPPER); - territoryDenyUseageMaterials.add(SavageFactions.plugin.FIREBALL); + territoryDenyUseageMaterials.add(SavageFactions.plugin.FIREBALL); territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL); territoryDenyUseageMaterials.add(Material.BUCKET); territoryDenyUseageMaterials.add(Material.WATER_BUCKET); @@ -377,32 +377,32 @@ public class Conf { territoryDenyUseageMaterials.add(MultiversionMaterials.JUNGLE_BUTTON.parseMaterial()); territoryDenyUseageMaterials.add(MultiversionMaterials.OAK_BUTTON.parseMaterial()); territoryDenyUseageMaterials.add(MultiversionMaterials.STONE_BUTTON.parseMaterial()); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { territoryDenyUseageMaterials.add(Material.ARMOR_STAND); } - territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.WOODEN_DOOR); - territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.TRAP_DOOR); - territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.FENCE_GATE); + territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.WOODEN_DOOR); + territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.TRAP_DOOR); + territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.FENCE_GATE); territoryProtectedMaterialsWhenOffline.add(Material.DISPENSER); territoryProtectedMaterialsWhenOffline.add(Material.CHEST); territoryProtectedMaterialsWhenOffline.add(Material.FURNACE); - territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.BURNING_FURNACE); - territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.DIODE_BLOCK_OFF); - territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.DIODE_BLOCK_OFF); + territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.BURNING_FURNACE); + territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.DIODE_BLOCK_OFF); + territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.DIODE_BLOCK_OFF); territoryProtectedMaterialsWhenOffline.add(Material.JUKEBOX); territoryProtectedMaterialsWhenOffline.add(Material.BREWING_STAND); - territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.ENCHANTMENT_TABLE); + territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.ENCHANTMENT_TABLE); territoryProtectedMaterialsWhenOffline.add(Material.CAULDRON); - territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.SOIL); + territoryProtectedMaterialsWhenOffline.add(SavageFactions.plugin.SOIL); territoryProtectedMaterialsWhenOffline.add(Material.BEACON); territoryProtectedMaterialsWhenOffline.add(Material.ANVIL); territoryProtectedMaterialsWhenOffline.add(Material.TRAPPED_CHEST); territoryProtectedMaterialsWhenOffline.add(Material.DROPPER); territoryProtectedMaterialsWhenOffline.add(Material.HOPPER); - territoryDenyUseageMaterialsWhenOffline.add(SavageFactions.plugin.FIREBALL); + territoryDenyUseageMaterialsWhenOffline.add(SavageFactions.plugin.FIREBALL); territoryDenyUseageMaterialsWhenOffline.add(Material.FLINT_AND_STEEL); territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET); territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET); @@ -413,7 +413,7 @@ public class Conf { territoryDenyUseageMaterialsWhenOffline.add(MultiversionMaterials.JUNGLE_BUTTON.parseMaterial()); territoryDenyUseageMaterialsWhenOffline.add(MultiversionMaterials.OAK_BUTTON.parseMaterial()); territoryDenyUseageMaterialsWhenOffline.add(MultiversionMaterials.STONE_BUTTON.parseMaterial()); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { territoryDenyUseageMaterialsWhenOffline.add(Material.ARMOR_STAND); } safeZoneNerfedCreatureTypes.add(EntityType.BLAZE); @@ -434,11 +434,11 @@ public class Conf { } public static void load() { - SavageFactions.plugin.persist.loadOrSaveDefault(i, Conf.class, "conf"); + SavageFactions.plugin.persist.loadOrSaveDefault(i, Conf.class, "conf"); } public static void save() { - SavageFactions.plugin.persist.save(i); + SavageFactions.plugin.persist.save(i); } public enum Backend { diff --git a/src/main/java/com/massivecraft/factions/FLocation.java b/src/main/java/com/massivecraft/factions/FLocation.java index ab754be5..04a2aa8a 100644 --- a/src/main/java/com/massivecraft/factions/FLocation.java +++ b/src/main/java/com/massivecraft/factions/FLocation.java @@ -11,7 +11,7 @@ import java.util.LinkedHashSet; import java.util.Set; public class FLocation implements Serializable { - private static final long serialVersionUID = -8292915234027387983L; + private static final long serialVersionUID = - 8292915234027387983L; private static final boolean worldBorderSupport; static { @@ -64,7 +64,7 @@ public class FLocation implements Serializable { //----------------------------------------------// public static FLocation fromString(String string) { - int index = string.indexOf(",", 0); + int index = string.indexOf(","); int start = 1; String worldName = string.substring(start, index); start = index + 1; @@ -99,10 +99,6 @@ public class FLocation implements Serializable { return regionVal << 5; // "<< 5" == "* 32" } - public Chunk getChunk(){ - return Bukkit.getWorld(worldName).getChunkAt(x, z); - } - public static HashSet getArea(FLocation from, FLocation to) { HashSet ret = new HashSet<>(); @@ -115,6 +111,10 @@ public class FLocation implements Serializable { return ret; } + public Chunk getChunk() { + return Bukkit.getWorld(worldName).getChunkAt(x, z); + } + public String getWorldName() { return worldName; } @@ -191,7 +191,7 @@ public class FLocation implements Serializable { * @return whether this location is outside of the border */ public boolean isOutsideWorldBorder(int buffer) { - if (!worldBorderSupport) { + if (! worldBorderSupport) { return false; } @@ -247,7 +247,7 @@ public class FLocation implements Serializable { if (obj == this) { return true; } - if (!(obj instanceof FLocation)) { + if (! (obj instanceof FLocation)) { return false; } diff --git a/src/main/java/com/massivecraft/factions/MassiveStats.java b/src/main/java/com/massivecraft/factions/MassiveStats.java index 8d65fc8c..b42c43d3 100644 --- a/src/main/java/com/massivecraft/factions/MassiveStats.java +++ b/src/main/java/com/massivecraft/factions/MassiveStats.java @@ -31,7 +31,7 @@ import java.net.URL; * @author Sam Jakob Harker, Brianna Hazel O'Keefe * @version 3.0 */ -@SuppressWarnings("all") +@SuppressWarnings ("all") public class MassiveStats implements Listener { /* START: MASSIVESTATS SETTINGS */ @@ -224,7 +224,7 @@ public class MassiveStats implements Listener { } // and only notify operators - or players with the correct permission. - if (!event.getPlayer().isOp() && !event.getPlayer().hasPermission(MassiveStats.MASSIVE_UPDATE_PERMISSION)) { + if (! event.getPlayer().isOp() && ! event.getPlayer().hasPermission(MassiveStats.MASSIVE_UPDATE_PERMISSION)) { return; } @@ -258,7 +258,7 @@ class MassiveStatsUpdateTask extends BukkitRunnable { } @Override - @SuppressWarnings("all") + @SuppressWarnings ("all") public void run() { try { // Generate the request payload and serialize it as JSON. @@ -431,7 +431,7 @@ class MassiveStatsDataRequest { } } - @SuppressWarnings("all") + @SuppressWarnings ("all") public String serialize() { //return object.toString(); try { @@ -446,7 +446,7 @@ class MassiveStatsDataRequest { } -@SuppressWarnings("unused") +@SuppressWarnings ("unused") final class MassiveStatsDataResponse { private final boolean isUpToDate; @@ -456,7 +456,7 @@ final class MassiveStatsDataResponse { MassiveStatsDataResponse(boolean isUpToDate, String newVersion, String updateMessage) { this.isUpToDate = isUpToDate; - if (!isUpToDate) { + if (! isUpToDate) { this.newVersion = newVersion; this.updateMessage = updateMessage; return; diff --git a/src/main/java/com/massivecraft/factions/SavageFactions.java b/src/main/java/com/massivecraft/factions/SavageFactions.java index 36597073..127a4cae 100644 --- a/src/main/java/com/massivecraft/factions/SavageFactions.java +++ b/src/main/java/com/massivecraft/factions/SavageFactions.java @@ -60,7 +60,12 @@ public class SavageFactions extends MPlugin { public boolean mc113 = false; public boolean useNonPacketParticles = false; public boolean factionsFlight = false; - + //multiversion material fields + public Material SUGAR_CANE_BLOCK, BANNER, CROPS, REDSTONE_LAMP_ON, + STAINED_GLASS, STATIONARY_WATER, STAINED_CLAY, WOOD_BUTTON, + SOIL, MOB_SPANWER, THIN_GLASS, IRON_FENCE, NETHER_FENCE, FENCE, + WOODEN_DOOR, TRAP_DOOR, FENCE_GATE, BURNING_FURNACE, DIODE_BLOCK_OFF, + DIODE_BLOCK_ON, ENCHANTMENT_TABLE, FIREBALL; // Persistence related private boolean locked = false; private Integer AutoLeaveTask = null; @@ -68,7 +73,6 @@ public class SavageFactions extends MPlugin { private ClipPlaceholderAPIManager clipPlaceholderAPIManager; private boolean mvdwPlaceholderAPIManager = false; - public SavageFactions() { plugin = this; } @@ -114,15 +118,15 @@ public class SavageFactions extends MPlugin { // Vault dependency check. if (SavageFactions.plugin.getServer().getPluginManager().getPlugin("Vault") == null) { SavageFactions.plugin.log("Vault is not present, the plugin will not run properly."); - this.onDisable(); - Bukkit.getScheduler().scheduleSyncDelayedTask(this, - new Runnable() { - @Override - public void run() { - SavageFactions.plugin.getServer().getPluginManager().disablePlugin(SavageFactions.plugin); - } - }, 20L); - return; + this.onDisable(); + Bukkit.getScheduler().scheduleSyncDelayedTask(this, + new Runnable() { + @Override + public void run() { + SavageFactions.plugin.getServer().getPluginManager().disablePlugin(SavageFactions.plugin); + } + }, 20L); + return; } @@ -141,7 +145,7 @@ public class SavageFactions extends MPlugin { setupMultiversionMaterials(); log("==== End Setup ===="); - if (!preEnable()) { + if (! preEnable()) { return; } this.loadSuccessful = false; @@ -189,8 +193,6 @@ public class SavageFactions extends MPlugin { new MassiveStats(this); - - if (version > 8) { useNonPacketParticles = true; SavageFactions.plugin.log("Minecraft Version 1.9 or higher found, using non packet based particle API"); @@ -201,7 +203,6 @@ public class SavageFactions extends MPlugin { } - // Register Event Handlers getServer().getPluginManager().registerEvents(new FactionsPlayerListener(this), this); getServer().getPluginManager().registerEvents(new FactionsChatListener(this), this); @@ -224,19 +225,11 @@ public class SavageFactions extends MPlugin { } - this.setupPlaceholderAPI(); - this.postEnable(); + this.setupPlaceholderAPI(); + this.postEnable(); this.loadSuccessful = true; } - - //multiversion material fields - public Material SUGAR_CANE_BLOCK, BANNER, CROPS, REDSTONE_LAMP_ON, - STAINED_GLASS, STATIONARY_WATER, STAINED_CLAY, WOOD_BUTTON, - SOIL, MOB_SPANWER, THIN_GLASS, IRON_FENCE, NETHER_FENCE, FENCE, - WOODEN_DOOR, TRAP_DOOR, FENCE_GATE, BURNING_FURNACE, DIODE_BLOCK_OFF, - DIODE_BLOCK_ON, ENCHANTMENT_TABLE, FIREBALL; - private void setupMultiversionMaterials() { if (mc113) { BANNER = Material.valueOf("LEGACY_BANNER"); @@ -263,7 +256,7 @@ public class SavageFactions extends MPlugin { FIREBALL = Material.valueOf("LEGACY_FIREBALL"); } else { - if (!mc17) { + if (! mc17) { BANNER = Material.valueOf("BANNER"); } CROPS = Material.valueOf("CROPS"); @@ -427,7 +420,7 @@ public class SavageFactions extends MPlugin { public void startAutoLeaveTask(boolean restartIfRunning) { if (AutoLeaveTask != null) { - if (!restartIfRunning) { + if (! restartIfRunning) { return; } this.getServer().getScheduler().cancelTask(AutoLeaveTask); @@ -547,7 +540,7 @@ public class SavageFactions extends MPlugin { // TODO: GET THIS BACK AND WORKING public boolean isFactionsCommand(String check) { - return !(check == null || check.isEmpty()) && this.handleCommand(null, check, true); + return ! (check == null || check.isEmpty()) && this.handleCommand(null, check, true); } // Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat @@ -569,7 +562,7 @@ public class SavageFactions extends MPlugin { } // if listener isn't set, or config option is disabled, give back uncolored tag - if (listener == null || !Conf.chatTagRelationColored) { + if (listener == null || ! Conf.chatTagRelationColored) { tag = me.getChatTag().trim(); } else { FPlayer you = FPlayers.getInstance().getByPlayer(listener); @@ -648,7 +641,7 @@ public class SavageFactions extends MPlugin { } public String getPrimaryGroup(OfflinePlayer player) { - return perms == null || !perms.hasGroupSupport() ? " " : perms.getPrimaryGroup(Bukkit.getWorlds().get(0).toString(), player); + return perms == null || ! perms.hasGroupSupport() ? " " : perms.getPrimaryGroup(Bukkit.getWorlds().get(0).toString(), player); } public void debug(Level level, String s) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java index 265c9b91..90e6dff7 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java @@ -40,17 +40,17 @@ public class CmdAdmin extends FCommand { boolean permAny = Permission.ADMIN_ANY.has(sender, false); Faction targetFaction = fyou.getFaction(); - if (targetFaction != myFaction && !permAny) { + if (targetFaction != myFaction && ! permAny) { msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(fme, true)); return; } - if (fme != null && fme.getRole() != Role.LEADER && ! permAny) { + if (fme != null && fme.getRole() != Role.LEADER && ! permAny) { msg(TL.COMMAND_ADMIN_NOTADMIN); return; } - if (fyou == fme && !permAny) { + if (fyou == fme && ! permAny) { msg(TL.COMMAND_ADMIN_TARGETSELF); return; } @@ -83,7 +83,7 @@ public class CmdAdmin extends FCommand { if (admin != null) { admin.setRole(Role.COLEADER); } - fyou.setRole(Role.LEADER); + fyou.setRole(Role.LEADER); msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(fme, true)); // Inform all players diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java index 5aa47e72..8ee61620 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java @@ -32,7 +32,7 @@ public class CmdAutoClaim extends FCommand { return; } - if (!fme.canClaimForFaction(forFaction)) { + if (! fme.canClaimForFaction(forFaction)) { if (myFaction == forFaction) { msg(TL.COMMAND_AUTOCLAIM_REQUIREDRANK, Role.MODERATOR.getTranslation()); } else { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java b/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java index 438d4a06..798914d3 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java @@ -10,7 +10,7 @@ import java.util.ArrayList; public class CmdAutoHelp extends MCommand { public CmdAutoHelp() { - super(SavageFactions.plugin); + super(SavageFactions.plugin); 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 a6f1eeb1..f13107f9 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBan.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBan.java @@ -35,9 +35,9 @@ public class CmdBan extends FCommand { public void perform() { // Adds bypass to admins and clean permission check - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.BAN); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "ban"); return; } @@ -80,7 +80,7 @@ public class CmdBan extends FCommand { if (event.isCancelled()) { // if someone cancels a ban, we'll get people complaining here. So lets log it. - SavageFactions.plugin.log(Level.WARNING, "Attempted to ban {0} but someone cancelled the kick event. This isn't good.", target.getName()); + SavageFactions.plugin.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/CmdBanlist.java b/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java index 42d8c7e5..4bf83013 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java @@ -33,7 +33,7 @@ public class CmdBanlist extends FCommand { @Override public void perform() { Faction target = myFaction; - if (!args.isEmpty()) { + if (! args.isEmpty()) { target = argAsFaction(0); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBanner.java b/src/main/java/com/massivecraft/factions/cmd/CmdBanner.java index e9833274..0d93de8e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBanner.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBanner.java @@ -31,30 +31,30 @@ public class CmdBanner extends FCommand { @Override public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("fbanners.Enabled")) { + if (! SavageFactions.plugin.getConfig().getBoolean("fbanners.Enabled")) { msg(TL.COMMAND_BANNER_DISABLED); return; } - if (! fme.hasMoney(SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Cost", 5000))) { + if (! fme.hasMoney(SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Cost", 5000))) { msg(TL.COMMAND_BANNER_NOTENOUGHMONEY); return; } - takeMoney(fme, SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Cost", 5000)); + takeMoney(fme, SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Cost", 5000)); - //ItemStack warBanner = SavageFactions.plugin.createItem(Material.BANNER, 1, (short) 1, SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"), SavageFactions.plugin.getConfig().getStringList("fbanners.Item.Lore")); + //ItemStack warBanner = SavageFactions.plugin.createItem(Material.BANNER, 1, (short) 1, SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"), SavageFactions.plugin.getConfig().getStringList("fbanners.Item.Lore")); //BannerMeta bannerMeta = (BannerMeta) warBanner.getItemMeta(); ItemStack warBanner = fme.getFaction().getBanner(); if (warBanner != null) { ItemMeta warmeta = warBanner.getItemMeta(); - warmeta.setDisplayName(SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"))); - warmeta.setLore(SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fbanners.Item.Lore"))); + warmeta.setDisplayName(SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"))); + warmeta.setLore(SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fbanners.Item.Lore"))); warBanner.setItemMeta(warmeta); } else { - warBanner = SavageFactions.plugin.createItem(SavageFactions.plugin.BANNER, 1, (short) 1, SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"), SavageFactions.plugin.getConfig().getStringList("fbanners.Item.Lore")); + warBanner = SavageFactions.plugin.createItem(SavageFactions.plugin.BANNER, 1, (short) 1, SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"), SavageFactions.plugin.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 = SavageFactions.plugin.getEcon(); + Economy econ = SavageFactions.plugin.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 = SavageFactions.plugin.getEcon(); + Economy econ = SavageFactions.plugin.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/CmdBoom.java b/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java index fcbe859f..1bcccfd9 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java @@ -27,17 +27,17 @@ public class CmdBoom extends FCommand { @Override public void perform() { - if (!myFaction.isPeaceful()) { + if (! myFaction.isPeaceful()) { fme.msg(TL.COMMAND_BOOM_PEACEFULONLY); return; } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostNoBoom, TL.COMMAND_BOOM_TOTOGGLE, TL.COMMAND_BOOM_FORTOGGLE)) { + if (! payForCommand(Conf.econCostNoBoom, TL.COMMAND_BOOM_TOTOGGLE, TL.COMMAND_BOOM_FORTOGGLE)) { return; } - myFaction.setPeacefulExplosionsEnabled(this.argAsBool(0, !myFaction.getPeacefulExplosionsEnabled())); + myFaction.setPeacefulExplosionsEnabled(this.argAsBool(0, ! myFaction.getPeacefulExplosionsEnabled())); String enabled = myFaction.noExplosionsInTerritory() ? TL.GENERIC_DISABLED.toString() : TL.GENERIC_ENABLED.toString(); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java index 00052a34..4fc38e1e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java @@ -25,15 +25,15 @@ public class CmdBypass extends FCommand { @Override public void perform() { - fme.setIsAdminBypassing(this.argAsBool(0, !fme.isAdminBypassing())); + fme.setIsAdminBypassing(this.argAsBool(0, ! fme.isAdminBypassing())); // TODO: Move this to a transient field in the model?? if (fme.isAdminBypassing()) { fme.msg(TL.COMMAND_BYPASS_ENABLE.toString()); - SavageFactions.plugin.log(fme.getName() + TL.COMMAND_BYPASS_ENABLELOG.toString()); + SavageFactions.plugin.log(fme.getName() + TL.COMMAND_BYPASS_ENABLELOG.toString()); } else { fme.msg(TL.COMMAND_BYPASS_DISABLE.toString()); - SavageFactions.plugin.log(fme.getName() + TL.COMMAND_BYPASS_DISABLELOG.toString()); + SavageFactions.plugin.log(fme.getName() + TL.COMMAND_BYPASS_DISABLELOG.toString()); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChat.java b/src/main/java/com/massivecraft/factions/cmd/CmdChat.java index 69cff8d8..9c5f6d1b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChat.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChat.java @@ -28,7 +28,7 @@ public class CmdChat extends FCommand { @Override public void perform() { - if (!Conf.factionOnlyChat) { + if (! Conf.factionOnlyChat) { msg(TL.COMMAND_CHAT_DISABLED.toString()); return; } @@ -41,7 +41,7 @@ public class CmdChat extends FCommand { // Only allow Mods and higher rank to switch to this channel. if (modeString.startsWith("m") && fme.getRole().isAtLeast(Role.MODERATOR)) { modeTarget = ChatMode.MOD; - } else if (modeString.startsWith("m") && !fme.getRole().isAtLeast(Role.MODERATOR)) { + } else if (modeString.startsWith("m") && ! fme.getRole().isAtLeast(Role.MODERATOR)) { msg(TL.COMMAND_CHAT_MOD_ONLY); return; } else if (modeString.startsWith("p")) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java index 7a7dd927..555dd379 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java @@ -24,14 +24,14 @@ public class CmdChatSpy extends FCommand { @Override public void perform() { - fme.setSpyingChat(this.argAsBool(0, !fme.isSpyingChat())); + fme.setSpyingChat(this.argAsBool(0, ! fme.isSpyingChat())); if (fme.isSpyingChat()) { fme.msg(TL.COMMAND_CHATSPY_ENABLE); - SavageFactions.plugin.log(fme.getName() + TL.COMMAND_CHATSPY_ENABLELOG.toString()); + SavageFactions.plugin.log(fme.getName() + TL.COMMAND_CHATSPY_ENABLELOG.toString()); } else { fme.msg(TL.COMMAND_CHATSPY_DISABLE); - SavageFactions.plugin.log(fme.getName() + TL.COMMAND_CHATSPY_DISABLELOG.toString()); + SavageFactions.plugin.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 b5ed8bbc..eb342657 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 (! SavageFactions.plugin.getConfig().getBoolean("checkpoints.Enabled")) { + if (! SavageFactions.plugin.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 e5b6f6ad..22fd632b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChest.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChest.java @@ -28,14 +28,14 @@ public class CmdChest extends FCommand { public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("fchest.Enabled")) { + if (! SavageFactions.plugin.getConfig().getBoolean("fchest.Enabled")) { fme.sendMessage("This command is disabled!"); return; } // This permission check is way too explicit but it's clean - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.CHEST); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest"); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java index 2ef27129..44111920 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java @@ -37,7 +37,7 @@ public class CmdClaim extends FCommand { int radius = this.argAsInt(0, 1); // Default to 1 final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY); if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "change faction territory"); @@ -56,7 +56,7 @@ public class CmdClaim extends FCommand { fme.attemptClaim(forFaction, me.getLocation(), true); } else { // radius claim - if (!Permission.CLAIM_RADIUS.has(sender, false)) { + if (! Permission.CLAIM_RADIUS.has(sender, false)) { msg(TL.COMMAND_CLAIM_DENIED); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdColeader.java b/src/main/java/com/massivecraft/factions/cmd/CmdColeader.java index 0e846973..51f6c53c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdColeader.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdColeader.java @@ -50,22 +50,22 @@ public class CmdColeader extends FCommand { boolean permAny = Permission.COLEADER_ANY.has(sender, false); Faction targetFaction = you.getFaction(); - if (targetFaction != myFaction && !permAny) { + if (targetFaction != myFaction && ! permAny) { msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true)); return; } - if (fme != null && fme.getRole() != Role.LEADER && ! permAny) { + if (fme != null && fme.getRole() != Role.LEADER && ! permAny) { msg(TL.COMMAND_COLEADER_NOTADMIN); return; } - if (you == fme && !permAny) { + if (you == fme && ! permAny) { msg(TL.COMMAND_COLEADER_SELF); return; } - if (you.getRole() == Role.LEADER) { + if (you.getRole() == Role.LEADER) { msg(TL.COMMAND_COLEADER_TARGETISADMIN); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java index f71c237a..d9e8300c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java @@ -174,7 +174,7 @@ public class CmdConfig extends FCommand { return; } - @SuppressWarnings("unchecked") Set matSet = (Set) target.get(null); + @SuppressWarnings ("unchecked") Set matSet = (Set) target.get(null); // Material already present, so remove it if (matSet.contains(newMat)) { @@ -192,7 +192,7 @@ public class CmdConfig extends FCommand { // Set else if (innerType == String.class) { - @SuppressWarnings("unchecked") Set stringSet = (Set) target.get(null); + @SuppressWarnings ("unchecked") Set stringSet = (Set) target.get(null); // String already present, so remove it if (stringSet.contains(value.toString())) { @@ -228,13 +228,13 @@ public class CmdConfig extends FCommand { return; } - if (!success.isEmpty()) { + if (! success.isEmpty()) { if (sender instanceof Player) { sendMessage(success); - SavageFactions.plugin.log(success + TL.COMMAND_CONFIG_LOG.format((Player) sender)); + SavageFactions.plugin.log(success + TL.COMMAND_CONFIG_LOG.format((Player) sender)); } else // using SavageFactions.plugin.log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log { - SavageFactions.plugin.log(success); + SavageFactions.plugin.log(success); } } // save change to disk diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java b/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java index 42cf9173..d4d1a194 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java @@ -16,7 +16,7 @@ public class CmdConvert extends FCommand { @Override public void perform() { - if (!(this.sender instanceof ConsoleCommandSender)) { + if (! (this.sender instanceof ConsoleCommandSender)) { this.sender.sendMessage(TL.GENERIC_CONSOLEONLY.toString()); } Backend nb = Backend.valueOf(this.argAsString(0).toUpperCase()); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java index 5549e7fc..6687ea63 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java @@ -52,7 +52,7 @@ public class CmdCreate extends FCommand { } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay - if (!canAffordCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE.toString())) { + if (! canAffordCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE.toString())) { return; } @@ -64,7 +64,7 @@ public class CmdCreate extends FCommand { } // then make 'em pay (if applicable) - if (!payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) { + if (! payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) { return; } @@ -89,7 +89,7 @@ public class CmdCreate extends FCommand { // We should consider adding the role just AFTER joining the faction. // 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); + fme.setRole(Role.LEADER); for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) { follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower)); @@ -98,9 +98,9 @@ public class CmdCreate extends FCommand { msg(TL.COMMAND_CREATE_YOUSHOULD, p.cmdBase.cmdDescription.getUseageTemplate()); if (Conf.logFactionCreate) { - SavageFactions.plugin.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag); + SavageFactions.plugin.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag); } - if (SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { + if (SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { this.fme.msg(TL.COMMAND_PAYPALSET_CREATED); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java index a7a2b7cc..a5e8e058 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java @@ -34,9 +34,9 @@ public class CmdDeinvite extends FCommand { @Override public void perform() { FPlayer you = this.argAsBestFPlayerMatch(0); - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.INVITE); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites"); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java index 4c2473e1..31e6bf85 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java @@ -23,7 +23,7 @@ public class CmdDelFWarp extends FCommand { public void perform() { String warp = argAsString(0); if (myFaction.isWarp(warp)) { - if (!transact(fme)) { + if (! transact(fme)) { return; } myFaction.removeWarp(warp); @@ -34,7 +34,7 @@ public class CmdDelFWarp extends FCommand { } private boolean transact(FPlayer player) { - return ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SavageFactions.plugin.getConfig().getDouble("warp-cost.delwarp", 5), TL.COMMAND_DELFWARP_TODELETE.toString(), TL.COMMAND_DELFWARP_FORDELETE.toString()); + return ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SavageFactions.plugin.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/CmdDemote.java b/src/main/java/com/massivecraft/factions/cmd/CmdDemote.java index 2890d2f5..bec033a4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDemote.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDemote.java @@ -4,6 +4,6 @@ public class CmdDemote extends FPromoteCommand { public CmdDemote() { aliases.add("demote"); - this.relative = -1; + this.relative = - 1; } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java b/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java index 98dc3509..aaa30e1d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java @@ -31,7 +31,7 @@ public class CmdDescription extends FCommand { @Override public void perform() { // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) { + if (! payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) { return; } @@ -39,7 +39,7 @@ public class CmdDescription extends FCommand { // And replace all the % because it messes with string formatting and this is easy way around that. myFaction.setDescription(TextUtil.implode(args, " ").replaceAll("%", "").replaceAll("(&([a-f0-9klmnor]))", "& $2")); - if (!Conf.broadcastDescriptionChanges) { + if (! Conf.broadcastDescriptionChanges) { fme.msg(TL.COMMAND_DESCRIPTION_CHANGED, myFaction.describeTo(fme)); fme.sendMessage(myFaction.getDescription()); return; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java index 1fdc5e09..fac2b070 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java @@ -31,9 +31,9 @@ public class CmdFWarp extends FCommand { @Override public void perform() { //TODO: check if in combat. - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.WARP); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use warps"); return; } @@ -54,13 +54,13 @@ public class CmdFWarp extends FCommand { if (myFaction.isWarp(argAsString(0))) { // Check if requires password and if so, check if valid. CASE SENSITIVE - if (myFaction.hasWarpPassword(warpName) && !myFaction.isWarpPassword(warpName, passwordAttempt)) { + if (myFaction.hasWarpPassword(warpName) && ! myFaction.isWarpPassword(warpName, passwordAttempt)) { fme.msg(TL.COMMAND_FWARP_INVALID_PASSWORD); return; } // Check transaction AFTER password check. - if (!transact(fme)) { + if (! transact(fme)) { return; } final FPlayer fPlayer = fme; @@ -82,7 +82,7 @@ public class CmdFWarp extends FCommand { } private boolean transact(FPlayer player) { - return ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SavageFactions.plugin.getConfig().getDouble("warp-cost.warp", 5), TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString()); + return ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SavageFactions.plugin.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 4e492934..84cf01af 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java @@ -23,8 +23,8 @@ public class CmdFly extends FCommand { public static ConcurrentHashMap flyMap = new ConcurrentHashMap(); - public static int id = -1; - public static int flyid = -1; + public static int id = - 1; + public static int flyid = - 1; public CmdFly() { super(); @@ -39,11 +39,11 @@ public class CmdFly extends FCommand { public static void startParticles() { // Just a secondary check. - if (! SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) { + if (! SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) { return; } - id = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { + id = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { @Override public void run() { for (String name : flyMap.keySet()) { @@ -51,10 +51,10 @@ public class CmdFly extends FCommand { if (player == null) { continue; } - if (!player.isFlying()) { + if (! player.isFlying()) { continue; } - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { if (player.getGameMode() == GameMode.SPECTATOR) { continue; } @@ -63,31 +63,31 @@ 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 (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enable-While-Vanished")) { + if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enable-While-Vanished")) { return; } continue; } - if (SavageFactions.plugin.useNonPacketParticles) { + if (SavageFactions.plugin.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 - player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, -0.35, 0), 0); + player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, - 0.35, 0), 0); } else { - ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16); + ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, - 0.35, 0), 16); } } if (flyMap.keySet().size() == 0) { Bukkit.getScheduler().cancelTask(id); - id = -1; + id = - 1; } } }, 10L, 3L); } public static void startFlyCheck() { - flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { + flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { @Override public void run() throws ConcurrentModificationException { //threw the exception for now, until I recode fly :( Cringe. checkTaskState(); @@ -100,7 +100,7 @@ public class CmdFly extends FCommand { if (player == null) { continue; } - if (!player.isFlying()) { + if (! player.isFlying()) { continue; } FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); @@ -125,7 +125,7 @@ public class CmdFly extends FCommand { FLocation myFloc = new FLocation(player.getLocation()); Faction toFac = Board.getInstance().getFactionAt(myFloc); if (Board.getInstance().getFactionAt(myFloc) != myFaction) { - if (!checkBypassPerms(fPlayer, player, toFac)) { + if (! checkBypassPerms(fPlayer, player, toFac)) { fPlayer.setFlying(false); flyMap.remove(name); continue; @@ -141,25 +141,25 @@ public class CmdFly extends FCommand { private static boolean checkBypassPerms(FPlayer fme, Player me, Faction toFac) { if (toFac != fme.getFaction()) { - if (!me.hasPermission("factions.fly.wilderness") && toFac.isWilderness() || !me.hasPermission("factions.fly.safezone") && toFac.isSafeZone() || !me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) { + if (! me.hasPermission("factions.fly.wilderness") && toFac.isWilderness() || ! me.hasPermission("factions.fly.safezone") && toFac.isSafeZone() || ! me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) { fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme)); return false; } Access access = toFac.getAccess(fme, PermissableAction.FLY); - if ((!(me.hasPermission("factions.fly.enemy") || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) { + if ((! (me.hasPermission("factions.fly.enemy") || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) { fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme)); return false; } - if (!(me.hasPermission("factions.fly.ally") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) { + if (! (me.hasPermission("factions.fly.ally") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) { fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme)); return false; } - if (!(me.hasPermission("factions.fly.truce") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) { + if (! (me.hasPermission("factions.fly.truce") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) { fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme)); return false; } - if (!(me.hasPermission("factions.fly.neutral") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !isSystemFaction(toFac)) { + if (! (me.hasPermission("factions.fly.neutral") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && ! isSystemFaction(toFac)) { fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme)); return false; } @@ -177,7 +177,7 @@ public class CmdFly extends FCommand { public static void checkTaskState() { if (flyMap.keySet().size() == 0) { Bukkit.getScheduler().cancelTask(flyid); - flyid = -1; + flyid = - 1; } } @@ -188,21 +188,21 @@ public class CmdFly extends FCommand { @Override public void perform() { // Disabled by default. - if (! SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight", false)) { + if (! SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight", false)) { fme.msg(TL.COMMAND_FLY_DISABLED); return; } FLocation myfloc = new FLocation(me.getLocation()); Faction toFac = Board.getInstance().getFactionAt(myfloc); - if (!checkBypassPerms(fme, me, toFac)) return; + if (! checkBypassPerms(fme, me, toFac)) return; List entities = this.me.getNearbyEntities(16.0D, 256.0D, 16.0D); - for(int i = 0; i <= entities.size() - 1; ++i) { + for (int i = 0; i <= entities.size() - 1; ++ i) { if (entities.get(i) instanceof Player) { - Player eplayer = (Player)entities.get(i); + Player eplayer = (Player) entities.get(i); FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer); - if (efplayer.getRelationTo(this.fme) == Relation.ENEMY && !efplayer.isStealthEnabled()) { + if (efplayer.getRelationTo(this.fme) == Relation.ENEMY && ! efplayer.isStealthEnabled()) { this.fme.msg(TL.COMMAND_FLY_CHECK_ENEMY); return; } @@ -210,14 +210,14 @@ public class CmdFly extends FCommand { } if (args.size() == 0) { - toggleFlight(!fme.isFlying(), me); + toggleFlight(! fme.isFlying(), me); } else if (args.size() == 1) { toggleFlight(argAsBool(0), me); } } private void toggleFlight(final boolean toggle, final Player player) { - if (!toggle) { + if (! toggle) { fme.setFlying(false); flyMap.remove(player.getName()); return; @@ -230,12 +230,12 @@ public class CmdFly extends FCommand { public void run() { fme.setFlying(true); flyMap.put(player.getName(), true); - if (id == -1) { - if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) { + if (id == - 1) { + if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) { startParticles(); } } - if (flyid == -1) { + if (flyid == - 1) { startFlyCheck(); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java b/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java index 57b76f1c..5a507d00 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java @@ -26,12 +26,12 @@ public class CmdGetVault extends FCommand { @Override public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("fvault.Enabled")) { + if (! SavageFactions.plugin.getConfig().getBoolean("fvault.Enabled")) { fme.sendMessage("This command is disabled!"); return; } Location vaultLocation = fme.getFaction().getVault(); - ItemStack vault = SavageFactions.plugin.createItem(Material.CHEST, 1, (short) 0, SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fvault.Item.Name")), SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fvault.Item.Lore"))); + ItemStack vault = SavageFactions.plugin.createItem(Material.CHEST, 1, (short) 0, SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fvault.Item.Name")), SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fvault.Item.Lore"))); //check if vault is set @@ -42,8 +42,8 @@ public class CmdGetVault extends FCommand { //has enough money? - int amount = SavageFactions.plugin.getConfig().getInt("fvault.Price"); - if (!fme.hasMoney(amount)) { + int amount = SavageFactions.plugin.getConfig().getInt("fvault.Price"); + if (! fme.hasMoney(amount)) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java b/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java index 3df36760..e46084f5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java @@ -40,7 +40,7 @@ public class CmdHelp extends FCommand { @Override public void perform() { - if (SavageFactions.plugin.getConfig().getBoolean("use-old-help", true)) { + if (SavageFactions.plugin.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 = SavageFactions.plugin.getConfig().getConfigurationSection("help"); + ConfigurationSection help = SavageFactions.plugin.getConfig().getConfigurationSection("help"); if (help == null) { - help = SavageFactions.plugin.getConfig().createSection("help"); // create new help section + help = SavageFactions.plugin.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(SavageFactions.plugin.txt.parse(helpLine)); + sendMessage(SavageFactions.plugin.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) + SavageFactions.plugin.txt.parse("") + " works on safe/war zones as well.")); + pageLines.add(p.txt.parse("Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + SavageFactions.plugin.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/CmdHome.java b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java index 31aec298..6bb93bc6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java @@ -40,36 +40,36 @@ public class CmdHome extends FCommand { @Override public void perform() { // TODO: Hide this command on help also. - if (!Conf.homesEnabled) { + if (! Conf.homesEnabled) { fme.msg(TL.COMMAND_HOME_DISABLED); return; } - if (!Conf.homesTeleportCommandEnabled) { + if (! Conf.homesTeleportCommandEnabled) { fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED); return; } - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.HOME); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home"); return; } } - if (!myFaction.hasHome()) { + if (! myFaction.hasHome()) { fme.msg(TL.COMMAND_HOME_NOHOME.toString() + (fme.getRole().value < Role.MODERATOR.value ? TL.GENERIC_ASKYOURLEADER.toString() : TL.GENERIC_YOUSHOULD.toString())); fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate()); return; } - if (!Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) { + if (! Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) { fme.msg(TL.COMMAND_HOME_INENEMY); return; } - if (!Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) { + if (! Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) { fme.msg(TL.COMMAND_HOME_WRONGWORLD); return; } @@ -79,15 +79,15 @@ public class CmdHome extends FCommand { // if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby if (Conf.homesTeleportAllowedEnemyDistance > 0 && - !faction.isSafeZone() && - (!fme.isInOwnTerritory() || (fme.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) { + ! faction.isSafeZone() && + (! fme.isInOwnTerritory() || (fme.isInOwnTerritory() && ! Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) { World w = loc.getWorld(); double x = loc.getX(); double y = loc.getY(); double z = loc.getZ(); for (Player p : me.getServer().getOnlinePlayers()) { - if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w) { + if (p == null || ! p.isOnline() || p.isDead() || p == me || p.getWorld() != w) { continue; } @@ -113,7 +113,7 @@ public class CmdHome extends FCommand { } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostHome, TL.COMMAND_HOME_TOTELEPORT.toString(), TL.COMMAND_HOME_FORTELEPORT.toString())) { + if (! payForCommand(Conf.econCostHome, TL.COMMAND_HOME_TOTELEPORT.toString(), TL.COMMAND_HOME_FORTELEPORT.toString())) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java index 69aa7dc6..c21aee88 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java @@ -44,13 +44,13 @@ public class CmdInvite extends FCommand { } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostInvite, TL.COMMAND_INVITE_TOINVITE.toString(), TL.COMMAND_INVITE_FORINVITE.toString())) { + if (! payForCommand(Conf.econCostInvite, TL.COMMAND_INVITE_TOINVITE.toString(), TL.COMMAND_INVITE_FORINVITE.toString())) { return; } - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.INVITE); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites"); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java index 6250d0d7..14befe22 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java @@ -35,12 +35,12 @@ public class CmdJoin extends FCommand { FPlayer fplayer = this.argAsBestFPlayerMatch(1, fme, false); boolean samePlayer = fplayer == fme; - if (!samePlayer && !Permission.JOIN_OTHERS.has(sender, false)) { + if (! samePlayer && ! Permission.JOIN_OTHERS.has(sender, false)) { msg(TL.COMMAND_JOIN_CANNOTFORCE); return; } - if (!faction.isNormal()) { + if (! faction.isNormal()) { msg(TL.COMMAND_JOIN_SYSTEMFACTION); return; } @@ -62,12 +62,12 @@ public class CmdJoin extends FCommand { return; } - if (!Conf.canLeaveWithNegativePower && fplayer.getPower() < 0) { + if (! Conf.canLeaveWithNegativePower && fplayer.getPower() < 0) { msg(TL.COMMAND_JOIN_NEGATIVEPOWER, fplayer.describeTo(fme, true)); return; } - if (!(faction.getOpen() || faction.isInvited(fplayer) || fme.isAdminBypassing() || Permission.JOIN_ANY.has(sender, false))) { + if (! (faction.getOpen() || faction.isInvited(fplayer) || fme.isAdminBypassing() || Permission.JOIN_ANY.has(sender, false))) { msg(TL.COMMAND_JOIN_REQUIRESINVITATION); if (samePlayer) { faction.msg(TL.COMMAND_JOIN_ATTEMPTEDJOIN, fplayer.describeTo(faction, true)); @@ -76,12 +76,12 @@ public class CmdJoin extends FCommand { } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay - if (samePlayer && !canAffordCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString())) { + if (samePlayer && ! canAffordCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString())) { return; } // Check for ban - if (!fme.isAdminBypassing() && faction.isBanned(fme)) { + if (! fme.isAdminBypassing() && faction.isBanned(fme)) { fme.msg(TL.COMMAND_JOIN_BANNED, faction.getTag(fme)); return; } @@ -94,13 +94,13 @@ public class CmdJoin extends FCommand { } // then make 'em pay (if applicable) - if (samePlayer && !payForCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString(), TL.COMMAND_JOIN_FORJOIN.toString())) { + if (samePlayer && ! payForCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString(), TL.COMMAND_JOIN_FORJOIN.toString())) { return; } fme.msg(TL.COMMAND_JOIN_SUCCESS, fplayer.describeTo(fme, true), faction.getTag(fme)); - if (!samePlayer) { + if (! samePlayer) { fplayer.msg(TL.COMMAND_JOIN_MOVED, fme.describeTo(fplayer, true), faction.getTag(fplayer)); } faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true)); @@ -112,9 +112,9 @@ public class CmdJoin extends FCommand { if (Conf.logFactionJoin) { if (samePlayer) { - SavageFactions.plugin.log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag()); + SavageFactions.plugin.log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag()); } else { - SavageFactions.plugin.log(TL.COMMAND_JOIN_MOVEDLOG.toString(), fme.getName(), fplayer.getName(), faction.getTag()); + SavageFactions.plugin.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 78d78b9f..090c638a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java @@ -47,7 +47,7 @@ public class CmdKick extends FCommand { String s = player.getName(); msg.then(s + " ").color(ChatColor.GRAY).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s); } - if (fme.getRole() == Role.LEADER) { + if (fme.getRole() == Role.LEADER) { // Only add coleader to this for the leader. for (FPlayer player : myFaction.getFPlayersWhereRole(Role.COLEADER)) { String s = player.getName(); @@ -78,9 +78,9 @@ public class CmdKick extends FCommand { // - Check for the kick permission. // - Make sure the player is in the faction. // - Make sure the kicked player has lower rank than the kicker. - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.KICK); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_NOPERMISSION, "kick"); return; } @@ -92,14 +92,14 @@ public class CmdKick extends FCommand { msg(TL.COMMAND_KICK_INSUFFICIENTRANK); return; } - if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) { + if (! Conf.canLeaveWithNegativePower && toKick.getPower() < 0) { msg(TL.COMMAND_KICK_NEGATIVEPOWER); return; } } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay - if (!canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) { + if (! canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) { return; } @@ -111,7 +111,7 @@ public class CmdKick extends FCommand { } // then make 'em pay (if applicable) - if (!payForCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString(), TL.COMMAND_KICK_FORKICK.toString())) { + if (! payForCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString(), TL.COMMAND_KICK_FORKICK.toString())) { return; } @@ -122,9 +122,9 @@ public class CmdKick extends FCommand { fme.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(fme), toKickFaction.describeTo(fme)); } if (Conf.logFactionKick) { - SavageFactions.plugin.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag()); + SavageFactions.plugin.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag()); } - if (toKick.getRole() == Role.LEADER) { + if (toKick.getRole() == Role.LEADER) { toKickFaction.promoteNewLeader(); } toKickFaction.deinvite(toKick); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdList.java b/src/main/java/com/massivecraft/factions/cmd/CmdList.java index 8547e3c0..8b537559 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdList.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdList.java @@ -41,7 +41,7 @@ public class CmdList extends FCommand { @Override public void perform() { // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostList, "to list the factions", "for listing the factions")) { + if (! payForCommand(Conf.econCostList, "to list the factions", "for listing the factions")) { return; } @@ -51,8 +51,8 @@ public class CmdList extends FCommand { factionList.remove(Factions.getInstance().getWarZone()); // remove exempt factions - if (!fme.getPlayer().hasPermission("factions.show.bypassexempt")) { - List exemptFactions = SavageFactions.plugin.getConfig().getStringList("show-exempt"); + if (! fme.getPlayer().hasPermission("factions.show.bypassexempt")) { + List exemptFactions = SavageFactions.plugin.getConfig().getStringList("show-exempt"); Iterator factionIterator = factionList.iterator(); while (factionIterator.hasNext()) { Faction next = factionIterator.next(); @@ -71,7 +71,7 @@ public class CmdList extends FCommand { if (f1Size < f2Size) { return 1; } else if (f1Size > f2Size) { - return -1; + return - 1; } return 0; } @@ -86,7 +86,7 @@ public class CmdList extends FCommand { if (f1Size < f2Size) { return 1; } else if (f1Size > f2Size) { - return -1; + return - 1; } return 0; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdLock.java b/src/main/java/com/massivecraft/factions/cmd/CmdLock.java index c27603bd..9b38481b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdLock.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdLock.java @@ -31,7 +31,7 @@ public class CmdLock extends FCommand { @Override public void perform() { - p.setLocked(this.argAsBool(0, !p.getLocked())); + p.setLocked(this.argAsBool(0, ! p.getLocked())); msg(p.getLocked() ? TL.COMMAND_LOCK_LOCKED : TL.COMMAND_LOCK_UNLOCKED); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdLogins.java b/src/main/java/com/massivecraft/factions/cmd/CmdLogins.java index 08900c48..ef42dc46 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdLogins.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdLogins.java @@ -19,8 +19,8 @@ public class CmdLogins extends FCommand { @Override public void perform() { boolean monitor = fme.isMonitoringJoins(); - fme.msg(TL.COMMAND_LOGINS_TOGGLE, String.valueOf(!monitor)); - fme.setMonitorJoins(!monitor); + fme.msg(TL.COMMAND_LOGINS_TOGGLE, String.valueOf(! monitor)); + fme.setMonitorJoins(! monitor); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMap.java b/src/main/java/com/massivecraft/factions/cmd/CmdMap.java index 6b87bd66..1a57001c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMap.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMap.java @@ -29,11 +29,11 @@ public class CmdMap extends FCommand { @Override public void perform() { if (this.argIsSet(0)) { - if (this.argAsBool(0, !fme.isMapAutoUpdating())) { + if (this.argAsBool(0, ! fme.isMapAutoUpdating())) { // Turn on // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostMap, "to show the map", "for showing the map")) { + if (! payForCommand(Conf.econCostMap, "to show the map", "for showing the map")) { return; } @@ -49,7 +49,7 @@ public class CmdMap extends FCommand { } } else { // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostMap, TL.COMMAND_MAP_TOSHOW, TL.COMMAND_MAP_FORSHOW)) { + if (! payForCommand(Conf.econCostMap, TL.COMMAND_MAP_TOSHOW, TL.COMMAND_MAP_FORSHOW)) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMod.java b/src/main/java/com/massivecraft/factions/cmd/CmdMod.java index b9d904b2..6333bd7a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMod.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMod.java @@ -47,7 +47,7 @@ public class CmdMod extends FCommand { boolean permAny = Permission.MOD_ANY.has(sender, false); Faction targetFaction = you.getFaction(); - if (targetFaction != myFaction && !permAny) { + if (targetFaction != myFaction && ! permAny) { msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true)); return; } @@ -57,7 +57,7 @@ public class CmdMod extends FCommand { return; } - if (you == fme && !permAny) { + if (you == fme && ! permAny) { msg(TL.COMMAND_MOD_SELF); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java index db30f81f..8ab055ce 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java @@ -34,7 +34,7 @@ public class CmdMoneyBalance extends FCommand { if (faction == null) { return; } - if (faction != myFaction && !Permission.MONEY_BALANCE_ANY.has(sender, true)) { + if (faction != myFaction && ! Permission.MONEY_BALANCE_ANY.has(sender, true)) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java index 2cb66e5d..ef2b9110 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java @@ -38,7 +38,7 @@ public class CmdMoneyDeposit extends FCommand { boolean success = Econ.transferMoney(fme, fme, faction, amount); if (success && Conf.logMoneyTransactions) { - SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.txt.parse(TL.COMMAND_MONEYDEPOSIT_DEPOSITED.toString(), fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); + SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.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/CmdMoneyTransferFf.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java index 095154be..24c8fc9a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java @@ -46,7 +46,7 @@ public class CmdMoneyTransferFf extends FCommand { if (success && Conf.logMoneyTransactions) { String name = sender instanceof Player ? fme.getName() : sender.getName(); - SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.txt.parse(TL.COMMAND_MONEYTRANSFERFF_TRANSFER.toString(), name, Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); + SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.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/CmdMoneyTransferFp.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java index 8f05ca68..10d8855e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java @@ -44,7 +44,7 @@ public class CmdMoneyTransferFp extends FCommand { boolean success = Econ.transferMoney(fme, from, to, amount); if (success && Conf.logMoneyTransactions) { - SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.txt.parse(TL.COMMAND_MONEYTRANSFERFP_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); + SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.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/CmdMoneyTransferPf.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java index 5de7d69c..ff549e87 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java @@ -44,7 +44,7 @@ public class CmdMoneyTransferPf extends FCommand { boolean success = Econ.transferMoney(fme, from, to, amount); if (success && Conf.logMoneyTransactions) { - SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.txt.parse(TL.COMMAND_MONEYTRANSFERPF_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); + SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.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/CmdMoneyWithdraw.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java index 05bcf6c1..fcbbddcd 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java @@ -47,7 +47,7 @@ public class CmdMoneyWithdraw extends FCommand { boolean success = Econ.transferMoney(fme, faction, fme, amount); if (success && Conf.logMoneyTransactions) { - SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.txt.parse(TL.COMMAND_MONEYWITHDRAW_WITHDRAW.toString(), fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); + SavageFactions.plugin.log(ChatColor.stripColor(SavageFactions.plugin.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/CmdNear.java b/src/main/java/com/massivecraft/factions/cmd/CmdNear.java index 5afae22c..a7d4041b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdNear.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdNear.java @@ -25,12 +25,12 @@ public class CmdNear extends FCommand { @Override public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("fnear.Enabled")) { + if (! SavageFactions.plugin.getConfig().getBoolean("fnear.Enabled")) { fme.msg(TL.COMMAND_NEAR_DISABLED_MSG); return; } - double range = SavageFactions.plugin.getConfig().getInt("fnear.Radius"); + double range = SavageFactions.plugin.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 460e594b..ba6c2c93 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java @@ -28,11 +28,11 @@ public class CmdOpen extends FCommand { @Override public void perform() { // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) { + if (! payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) { return; } - myFaction.setOpen(this.argAsBool(0, !myFaction.getOpen())); + myFaction.setOpen(this.argAsBool(0, ! myFaction.getOpen())); String open = myFaction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString(); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java b/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java index 6398ae62..80893f89 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java @@ -31,21 +31,21 @@ public class CmdOwner extends FCommand { public void perform() { boolean hasBypass = fme.isAdminBypassing(); - if (!hasBypass && !assertHasFaction()) { + if (! hasBypass && ! assertHasFaction()) { return; } - if (!Conf.ownedAreasEnabled) { + if (! Conf.ownedAreasEnabled) { fme.msg(TL.COMMAND_OWNER_DISABLED); return; } - if (!hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) { + if (! hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) { fme.msg(TL.COMMAND_OWNER_LIMIT, Conf.ownedAreasLimitPerFaction); return; } - if (! hasBypass && ! assertMinRole(Conf.ownedAreasModeratorsCanSet ? Role.MODERATOR : Role.LEADER)) { + if (! hasBypass && ! assertMinRole(Conf.ownedAreasModeratorsCanSet ? Role.MODERATOR : Role.LEADER)) { return; } @@ -53,12 +53,12 @@ public class CmdOwner extends FCommand { Faction factionHere = Board.getInstance().getFactionAt(flocation); if (factionHere != myFaction) { - if (!factionHere.isNormal()) { + if (! factionHere.isNormal()) { fme.msg(TL.COMMAND_OWNER_NOTCLAIMED); return; } - if (!hasBypass) { + if (! hasBypass) { fme.msg(TL.COMMAND_OWNER_WRONGFACTION); return; } @@ -91,7 +91,7 @@ public class CmdOwner extends FCommand { } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostOwner, TL.COMMAND_OWNER_TOSET, TL.COMMAND_OWNER_FORSET)) { + if (! payForCommand(Conf.econCostOwner, TL.COMMAND_OWNER_TOSET, TL.COMMAND_OWNER_FORSET)) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java b/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java index 4bcb5e02..8ad4806a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java @@ -30,11 +30,11 @@ public class CmdOwnerList extends FCommand { public void perform() { boolean hasBypass = fme.isAdminBypassing(); - if (!hasBypass && !assertHasFaction()) { + if (! hasBypass && ! assertHasFaction()) { return; } - if (!Conf.ownedAreasEnabled) { + if (! Conf.ownedAreasEnabled) { fme.msg(TL.COMMAND_OWNERLIST_DISABLED); return; } @@ -42,13 +42,13 @@ public class CmdOwnerList extends FCommand { FLocation flocation = new FLocation(fme); if (Board.getInstance().getFactionAt(flocation) != myFaction) { - if (!hasBypass) { + if (! hasBypass) { fme.msg(TL.COMMAND_OWNERLIST_WRONGFACTION); return; } //TODO: This code won't ever be called. myFaction = Board.getInstance().getFactionAt(flocation); - if (!myFaction.isNormal()) { + if (! myFaction.isNormal()) { fme.msg(TL.COMMAND_OWNERLIST_NOTCLAIMED); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSee.java b/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSee.java index 4f546e30..e7009f47 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSee.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSee.java @@ -5,7 +5,7 @@ import com.massivecraft.factions.SavageFactions; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; -public class CmdPaypalSee extends FCommand{ +public class CmdPaypalSee extends FCommand { public CmdPaypalSee() { aliases.add("seepaypal"); aliases.add("getpaypal"); @@ -20,14 +20,14 @@ public class CmdPaypalSee extends FCommand{ } public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { + if (! SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { fme.msg(TL.GENERIC_DISABLED); } else { Faction faction = argAsFaction(0); String paypal = argAsString(1); if (faction != null) { - if (!faction.isWilderness() && !faction.isSafeZone() && !faction.isWarZone()) { + if (! faction.isWilderness() && ! faction.isSafeZone() && ! faction.isWarZone()) { if (faction.getPaypal() != null) { fme.msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal()); } else { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSet.java b/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSet.java index e72d8dcd..e0b47133 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSet.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPaypalSet.java @@ -4,7 +4,7 @@ import com.massivecraft.factions.SavageFactions; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; -public class CmdPaypalSet extends FCommand{ +public class CmdPaypalSet extends FCommand { public CmdPaypalSet() { this.aliases.add("setpaypal"); @@ -20,7 +20,7 @@ public class CmdPaypalSet extends FCommand{ } public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { + if (! SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { fme.msg(TL.GENERIC_DISABLED); } else { String paypal = argAsString(0); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java b/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java index ab06c022..cde762ea 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java @@ -104,7 +104,7 @@ public class CmdPerm extends FCommand { } fme.msg(TL.COMMAND_PERM_SET, argAsString(1), access.name(), argAsString(0)); - SavageFactions.plugin.log(String.format(TL.COMMAND_PERM_SET.toString(), argAsString(1), access.name(), argAsString(0)) + " for faction " + fme.getTag()); + SavageFactions.plugin.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 a4346b22..369b8415 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java @@ -43,7 +43,7 @@ public class CmdPermanent extends FCommand { faction.setPermanent(true); } - SavageFactions.plugin.log((fme == null ? "A server admin" : fme.getName()) + " " + change + " the faction \"" + faction.getTag() + "\"."); + SavageFactions.plugin.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/CmdPower.java b/src/main/java/com/massivecraft/factions/cmd/CmdPower.java index 5a735ebb..e7c03fd5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPower.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPower.java @@ -32,12 +32,12 @@ public class CmdPower extends FCommand { return; } - if (target != fme && !Permission.POWER_ANY.has(sender, true)) { + if (target != fme && ! Permission.POWER_ANY.has(sender, true)) { return; } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostPower, TL.COMMAND_POWER_TOSHOW, TL.COMMAND_POWER_FORSHOW)) { + if (! payForCommand(Conf.econCostPower, TL.COMMAND_POWER_TOSHOW, TL.COMMAND_POWER_FORSHOW)) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java index c08dc47a..f7949a40 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java @@ -12,7 +12,7 @@ public class CmdPowerBoost extends FCommand { super(); this.aliases.add("powerboost"); - this.requiredArgs.add("plugin|f|player|faction"); + this.requiredArgs.add("plugin|f|player|faction"); this.requiredArgs.add("name"); this.requiredArgs.add("# or reset"); @@ -76,8 +76,8 @@ public class CmdPowerBoost extends FCommand { int roundedPower = (int) Math.round(targetPower); msg(TL.COMMAND_POWERBOOST_BOOST, target, roundedPower); - if (!senderIsConsole) { - SavageFactions.plugin.log(TL.COMMAND_POWERBOOST_BOOSTLOG.toString(), fme.getName(), target, roundedPower); + if (! senderIsConsole) { + SavageFactions.plugin.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 19ce5eb0..825794f6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdReload.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdReload.java @@ -26,13 +26,13 @@ public class CmdReload extends FCommand { public void perform() { long timeInitStart = System.currentTimeMillis(); Conf.load(); - SavageFactions.plugin.reloadConfig(); - SavageFactions.plugin.loadLang(); + SavageFactions.plugin.reloadConfig(); + SavageFactions.plugin.loadLang(); int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]); - if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) { - SavageFactions.plugin.factionsFlight = true; + if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) { + SavageFactions.plugin.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 d37b2a84..52ea1ec8 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdRules.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdRules.java @@ -28,19 +28,19 @@ public class CmdRules extends FCommand { @Override public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("frules.Enabled")) { + if (! SavageFactions.plugin.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 = SavageFactions.plugin.getConfig().getStringList("frules.default-rules"); - fme.sendMessage(SavageFactions.plugin.colorList(ruleList)); + List ruleList = SavageFactions.plugin.getConfig().getStringList("frules.default-rules"); + fme.sendMessage(SavageFactions.plugin.colorList(ruleList)); } else { for (int i = 0; i <= rules.size() - 1; i++) { - fme.sendMessage(SavageFactions.plugin.color(rules.get(i))); + fme.sendMessage(SavageFactions.plugin.color(rules.get(i))); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSB.java b/src/main/java/com/massivecraft/factions/cmd/CmdSB.java index e0f18a3b..cfd3d79a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSB.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSB.java @@ -15,7 +15,7 @@ public class CmdSB extends FCommand { @Override public void perform() { - boolean toggleTo = !fme.showScoreboard(); + boolean toggleTo = ! fme.showScoreboard(); FScoreboard board = FScoreboard.get(fme); if (board == null) { me.sendMessage(TL.COMMAND_TOGGLESB_DISABLED.toString()); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java b/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java index 5dec498b..180dc9c5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java @@ -49,7 +49,7 @@ public class CmdSafeunclaimall extends FCommand { msg(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMED); if (Conf.logLandUnclaims) { - SavageFactions.plugin.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName())); + SavageFactions.plugin.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java b/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java index a5d7b2dd..1f877ee6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java @@ -23,7 +23,7 @@ public class CmdSeeChunk extends FCommand { private boolean useParticles; private int length; private ParticleEffect effect; - private int taskID = -1; + private int taskID = - 1; //I remade it cause of people getting mad that I had the same seechunk as drtshock @@ -62,10 +62,10 @@ public class CmdSeeChunk extends FCommand { } private void manageTask() { - if (taskID != -1) { + if (taskID != - 1) { if (seeChunkMap.keySet().size() == 0) { Bukkit.getScheduler().cancelTask(taskID); - taskID = -1; + taskID = - 1; } } else { startTask(); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSetBanner.java b/src/main/java/com/massivecraft/factions/cmd/CmdSetBanner.java index 6fb554c6..a23ddd38 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSetBanner.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSetBanner.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; -import org.bukkit.Material; public class CmdSetBanner extends FCommand { @@ -20,7 +19,7 @@ public class CmdSetBanner extends FCommand { } public void perform() { - if (!me.getItemInHand().getType().toString().contains("BANNER")) { + if (! me.getItemInHand().getType().toString().contains("BANNER")) { fme.msg(TL.COMMAND_SETBANNER_NOTBANNER); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSetDefaultRole.java b/src/main/java/com/massivecraft/factions/cmd/CmdSetDefaultRole.java index 718ae332..9d029250 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSetDefaultRole.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSetDefaultRole.java @@ -30,7 +30,7 @@ public class CmdSetDefaultRole extends FCommand { return; } - if (target == Role.LEADER) { + if (target == Role.LEADER) { msg(TL.COMMAND_SETDEFAULTROLE_NOTTHATROLE, argAsString(0)); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java index 25a27725..5d6e1e0f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java @@ -30,29 +30,29 @@ public class CmdSetFWarp extends FCommand { @Override public void perform() { - if (!(fme.getRelationToLocation() == Relation.MEMBER)) { + if (! (fme.getRelationToLocation() == Relation.MEMBER)) { fme.msg(TL.COMMAND_SETFWARP_NOTCLAIMED); return; } // This statement allows us to check if they've specifically denied it, or default to // the old setting of allowing moderators to set warps. - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.SETWARP); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps"); return; } } - int maxWarps = SavageFactions.plugin.getConfig().getInt("max-warps", 5); + int maxWarps = SavageFactions.plugin.getConfig().getInt("max-warps", 5); if (maxWarps <= myFaction.getWarps().size()) { fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps); return; } - if (!transact(fme)) { + if (! transact(fme)) { return; } @@ -68,7 +68,7 @@ public class CmdSetFWarp extends FCommand { } private boolean transact(FPlayer player) { - return ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SavageFactions.plugin.getConfig().getDouble("warp-cost.setwarp", 5), TL.COMMAND_SETFWARP_TOSET.toString(), TL.COMMAND_SETFWARP_FORSET.toString()); + return ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(SavageFactions.plugin.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/CmdSetMaxVaults.java b/src/main/java/com/massivecraft/factions/cmd/CmdSetMaxVaults.java index 168e17b2..ed898836 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSetMaxVaults.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSetMaxVaults.java @@ -27,7 +27,7 @@ public class CmdSetMaxVaults extends FCommand { @Override public void perform() { Faction targetFaction = argAsFaction(0); - int value = argAsInt(1, -1); + int value = argAsInt(1, - 1); if (value < 0) { sender.sendMessage(ChatColor.RED + "Number must be greater than 0."); return; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java index 6246fd11..1dae2898 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java @@ -30,7 +30,7 @@ public class CmdSethome extends FCommand { @Override public void perform() { - if (!Conf.homesEnabled) { + if (! Conf.homesEnabled) { fme.msg(TL.COMMAND_SETHOME_DISABLED); return; } @@ -40,16 +40,16 @@ public class CmdSethome extends FCommand { return; } - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.SETHOME); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER && ! Permission.SETHOME_ANY.has(sender, true)) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER && ! Permission.SETHOME_ANY.has(sender, true)) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set home"); return; } } // Can the player set the faction home HERE? - if (!Permission.BYPASS.has(me) && + if (! Permission.BYPASS.has(me) && Conf.homesMustBeInClaimedTerritory && Board.getInstance().getFactionAt(new FLocation(me)) != faction) { fme.msg(TL.COMMAND_SETHOME_NOTCLAIMED); @@ -57,7 +57,7 @@ public class CmdSethome extends FCommand { } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) { + if (! payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java index 8ca6cc07..19781f3d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java @@ -54,23 +54,23 @@ public class CmdShow extends FCommand { return; } - if (fme != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt") + if (fme != null && ! fme.getPlayer().hasPermission("factions.show.bypassexempt") && SavageFactions.plugin.getConfig().getStringList("show-exempt").contains(faction.getTag())) { msg(TL.COMMAND_SHOW_EXEMPT); return; } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostShow, TL.COMMAND_SHOW_TOSHOW, TL.COMMAND_SHOW_FORSHOW)) { + if (! payForCommand(Conf.econCostShow, TL.COMMAND_SHOW_TOSHOW, TL.COMMAND_SHOW_FORSHOW)) { return; } - List show = SavageFactions.plugin.getConfig().getStringList("show"); + List show = SavageFactions.plugin.getConfig().getStringList("show"); if (show == null || show.isEmpty()) { show = defaults; } - if (!faction.isNormal()) { + if (! faction.isNormal()) { String tag = faction.getTag(fme); // send header and that's all String header = show.get(0); @@ -99,7 +99,7 @@ public class CmdShow extends FCommand { } continue; } - if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) { + if (! parsed.contains("{notFrozen}") && ! parsed.contains("{notPermanent}")) { if (parsed.contains("{ig}")) { // replaces all variables with no home TL parsed = parsed.substring(0, parsed.indexOf("{ig}")) + TL.COMMAND_SHOW_NOHOME.toString(); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java b/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java index a1e95c28..8f1c5238 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java @@ -21,8 +21,8 @@ public class CmdStealth extends FCommand { public void perform() { Faction faction = fme.getFaction(); - if (faction != null && !faction.getId().equalsIgnoreCase("0") && !faction.getId().equalsIgnoreCase("none") && !faction.getId().equalsIgnoreCase("safezone") && !faction.getId().equalsIgnoreCase("warzone")) { - fme.setStealth(!fme.isStealthEnabled()); + if (faction != null && ! faction.getId().equalsIgnoreCase("0") && ! faction.getId().equalsIgnoreCase("none") && ! faction.getId().equalsIgnoreCase("safezone") && ! faction.getId().equalsIgnoreCase("warzone")) { + fme.setStealth(! fme.isStealthEnabled()); fme.msg(fme.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE); } else { fme.msg(TL.COMMAND_STEALTH_MUSTBEMEMBER); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdStuck.java b/src/main/java/com/massivecraft/factions/cmd/CmdStuck.java index 5f2b818e..b36a669f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdStuck.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdStuck.java @@ -34,25 +34,25 @@ public class CmdStuck extends FCommand { final Player player = fme.getPlayer(); final Location sentAt = player.getLocation(); final FLocation chunk = fme.getLastStoodAt(); - final long delay = SavageFactions.plugin.getConfig().getLong("hcf.stuck.delay", 30); - final int radius = SavageFactions.plugin.getConfig().getInt("hcf.stuck.radius", 10); + final long delay = SavageFactions.plugin.getConfig().getLong("hcf.stuck.delay", 30); + final int radius = SavageFactions.plugin.getConfig().getInt("hcf.stuck.radius", 10); - if (SavageFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) { - long wait = SavageFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis(); + if (SavageFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) { + long wait = SavageFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis(); String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true); msg(TL.COMMAND_STUCK_EXISTS, time); } else { // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostStuck, TL.COMMAND_STUCK_TOSTUCK.format(fme.getName()), TL.COMMAND_STUCK_FORSTUCK.format(fme.getName()))) { + if (! payForCommand(Conf.econCostStuck, TL.COMMAND_STUCK_TOSTUCK.format(fme.getName()), TL.COMMAND_STUCK_FORSTUCK.format(fme.getName()))) { return; } - final int id = Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new BukkitRunnable() { + final int id = Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new BukkitRunnable() { @Override public void run() { - if (! SavageFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) { + if (! SavageFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) { return; } @@ -60,8 +60,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)); - SavageFactions.plugin.getTimers().remove(player.getUniqueId()); - SavageFactions.plugin.getStuckMap().remove(player.getUniqueId()); + SavageFactions.plugin.getTimers().remove(player.getUniqueId()); + SavageFactions.plugin.getStuckMap().remove(player.getUniqueId()); return; } @@ -73,18 +73,18 @@ public class CmdStuck extends FCommand { public boolean work() { FLocation chunk = currentFLocation(); Faction faction = board.getFactionAt(chunk); - int buffer = SavageFactions.plugin.getConfig().getInt("world-border.buffer", 0); - if (faction.isWilderness() && !chunk.isOutsideWorldBorder(buffer)) { + int buffer = SavageFactions.plugin.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()); - SavageFactions.plugin.getTimers().remove(player.getUniqueId()); - SavageFactions.plugin.getStuckMap().remove(player.getUniqueId()); - if (!Essentials.handleTeleport(player, tp)) { + SavageFactions.plugin.getTimers().remove(player.getUniqueId()); + SavageFactions.plugin.getStuckMap().remove(player.getUniqueId()); + if (! Essentials.handleTeleport(player, tp)) { player.teleport(tp); - SavageFactions.plugin.debug("/f stuck used regular teleport, not essentials!"); + SavageFactions.plugin.debug("/f stuck used regular teleport, not essentials!"); } this.stop(); return false; @@ -95,11 +95,11 @@ public class CmdStuck extends FCommand { } }, delay * 20).getTaskId(); - SavageFactions.plugin.getTimers().put(player.getUniqueId(), System.currentTimeMillis() + (delay * 1000)); - long wait = SavageFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis(); + SavageFactions.plugin.getTimers().put(player.getUniqueId(), System.currentTimeMillis() + (delay * 1000)); + long wait = SavageFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis(); String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true); msg(TL.COMMAND_STUCK_START, time); - SavageFactions.plugin.getStuckMap().put(player.getUniqueId(), id); + SavageFactions.plugin.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 6de99040..3dcf19cd 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTag.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTag.java @@ -33,7 +33,7 @@ public class CmdTag extends FCommand { String tag = this.argAsString(0); // TODO does not first test cover selfcase? - if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) { + if (Factions.getInstance().isTagTaken(tag) && ! MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) { msg(TL.COMMAND_TAG_TAKEN); return; } @@ -45,7 +45,7 @@ public class CmdTag extends FCommand { } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay - if (!canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) { + if (! canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) { return; } @@ -57,7 +57,7 @@ public class CmdTag extends FCommand { } // then make 'em pay (if applicable) - if (!payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) { + if (! payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java b/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java index acd7c6a9..22f541eb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java @@ -34,12 +34,12 @@ public class CmdTitle extends FCommand { args.remove(0); String title = TextUtil.implode(args, " "); - if (!canIAdministerYou(fme, you)) { + if (! canIAdministerYou(fme, you)) { return; } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) { + if (! payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTnt.java b/src/main/java/com/massivecraft/factions/cmd/CmdTnt.java index f0767d76..082ab336 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTnt.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTnt.java @@ -31,14 +31,14 @@ public class CmdTnt extends FCommand { @Override public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("ftnt.Enabled")) { + if (! SavageFactions.plugin.getConfig().getBoolean("ftnt.Enabled")) { fme.msg(TL.COMMAND_TNT_DISABLED_MSG); return; } - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.TNTBANK); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use tnt bank"); return; } @@ -46,7 +46,7 @@ public class CmdTnt extends FCommand { if (args.size() == 2) { if (args.get(0).equalsIgnoreCase("add") || args.get(0).equalsIgnoreCase("a")) { - int testNumber = -1; + int testNumber = - 1; try { testNumber = Integer.parseInt(args.get(1)); } catch (NumberFormatException e) { @@ -73,7 +73,7 @@ public class CmdTnt extends FCommand { return; } ItemStack tnt = new ItemStack(Material.TNT, amount); - if (fme.getFaction().getTnt() + amount > SavageFactions.plugin.getConfig().getInt("ftnt.Bank-Limit")) { + if (fme.getFaction().getTnt() + amount > SavageFactions.plugin.getConfig().getInt("ftnt.Bank-Limit")) { msg(TL.COMMAND_TNT_EXCEEDLIMIT); return; } @@ -82,12 +82,12 @@ public class CmdTnt extends FCommand { fme.getFaction().addTnt(amount); fme.msg(TL.COMMAND_TNT_DEPOSIT_SUCCESS); - fme.sendMessage(SavageFactions.plugin.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", fme.getFaction().getTnt() + ""))); + fme.sendMessage(SavageFactions.plugin.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", fme.getFaction().getTnt() + ""))); return; } if (args.get(0).equalsIgnoreCase("take") || args.get(0).equalsIgnoreCase("t")) { - int testNumber = -1; + int testNumber = - 1; try { testNumber = Integer.parseInt(args.get(1)); } catch (NumberFormatException e) { @@ -105,11 +105,11 @@ public class CmdTnt extends FCommand { } int fullStacks = amount / 64; int remainderAmt = amount % 64; - if ((remainderAmt == 0 && !hasAvaliableSlot(me, fullStacks))) { + if ((remainderAmt == 0 && ! hasAvaliableSlot(me, fullStacks))) { fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE); return; } - if (!hasAvaliableSlot(me, fullStacks + 1)) { + if (! hasAvaliableSlot(me, fullStacks + 1)) { fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTntFill.java b/src/main/java/com/massivecraft/factions/cmd/CmdTntFill.java index 99cabade..9f39ae8d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTntFill.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTntFill.java @@ -34,9 +34,9 @@ public class CmdTntFill extends FCommand { @Override public void perform() { - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.TNTFILL); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use tnt fill"); return; } @@ -46,15 +46,15 @@ public class CmdTntFill extends FCommand { msg(TL.COMMAND_TNTFILL_HEADER); int radius = argAsInt(0, 16); int amount = argAsInt(1, 16); - if (radius > SavageFactions.plugin.getConfig().getInt("Tntfill.max-radius")) { - msg(TL.COMMAND_TNTFILL_RADIUSMAX.toString().replace("{max}", SavageFactions.plugin.getConfig().getInt("Tntfill.max-radius") + "")); + if (radius > SavageFactions.plugin.getConfig().getInt("Tntfill.max-radius")) { + msg(TL.COMMAND_TNTFILL_RADIUSMAX.toString().replace("{max}", SavageFactions.plugin.getConfig().getInt("Tntfill.max-radius") + "")); return; } - if (amount > SavageFactions.plugin.getConfig().getInt("Tntfill.max-amount")) { - msg(TL.COMMAND_TNTFILL_AMOUNTMAX.toString().replace("{max}", SavageFactions.plugin.getConfig().getInt("Tntfill.max-amount") + "")); + if (amount > SavageFactions.plugin.getConfig().getInt("Tntfill.max-amount")) { + msg(TL.COMMAND_TNTFILL_AMOUNTMAX.toString().replace("{max}", SavageFactions.plugin.getConfig().getInt("Tntfill.max-amount") + "")); return; } - int testNumber = -1; + int testNumber = - 1; try { testNumber = Integer.parseInt(args.get(1)); } catch (NumberFormatException e) { @@ -78,8 +78,8 @@ public class CmdTntFill extends FCommand { if (canHold(dispenser, amount)) { int fullStacks = amount / 64; int remainderAmt = amount % 64; - if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) { - if (!fme.getRole().isAtLeast(Role.MODERATOR)) { + if (! inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) { + if (! fme.getRole().isAtLeast(Role.MODERATOR)) { msg(TL.COMMAND_TNTFILL_NOTENOUGH); sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}", amount + "").replace("{dispensers}", counter + "")); me.updateInventory(); @@ -88,7 +88,7 @@ public class CmdTntFill extends FCommand { //msg(TL.COMMAND_TNTFILL_MOD.toString().replace("{role}",fme.getRole().nicename)); bankMode = true; removeFromBank(amount); - if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) { + if (! inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) { msg(TL.COMMAND_TNTFILL_NOTENOUGH); sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}", amount + "").replace("{dispensers}", counter + "")); me.updateInventory(); @@ -124,7 +124,7 @@ public class CmdTntFill extends FCommand { } private void removeFromBank(int amount) { - int testNumber = -1; + int testNumber = - 1; try { testNumber = Integer.parseInt(args.get(1)); } catch (NumberFormatException e) { @@ -177,7 +177,7 @@ public class CmdTntFill extends FCommand { return; } ItemStack tnt = new ItemStack(Material.TNT, amount); - if (fme.getFaction().getTnt() + amount > SavageFactions.plugin.getConfig().getInt("ftnt.Bank-Limit")) { + if (fme.getFaction().getTnt() + amount > SavageFactions.plugin.getConfig().getInt("ftnt.Bank-Limit")) { msg(TL.COMMAND_TNT_EXCEEDLIMIT); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdToggleAllianceChat.java b/src/main/java/com/massivecraft/factions/cmd/CmdToggleAllianceChat.java index 5bea5ac8..4752d9d2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdToggleAllianceChat.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdToggleAllianceChat.java @@ -30,7 +30,7 @@ public class CmdToggleAllianceChat extends FCommand { @Override public void perform() { - if (!Conf.factionOnlyChat) { + if (! Conf.factionOnlyChat) { msg(TL.COMMAND_CHAT_DISABLED.toString()); return; } @@ -38,6 +38,6 @@ public class CmdToggleAllianceChat extends FCommand { boolean ignoring = fme.isIgnoreAllianceChat(); msg(ignoring ? TL.COMMAND_TOGGLEALLIANCECHAT_UNIGNORE : TL.COMMAND_TOGGLEALLIANCECHAT_IGNORE); - fme.setIgnoreAllianceChat(!ignoring); + fme.setIgnoreAllianceChat(! ignoring); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTop.java b/src/main/java/com/massivecraft/factions/cmd/CmdTop.java index 1040557b..437a56d1 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTop.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTop.java @@ -53,7 +53,7 @@ public class CmdTop extends FCommand { if (f1Size < f2Size) { return 1; } else if (f1Size > f2Size) { - return -1; + return - 1; } return 0; } @@ -68,7 +68,7 @@ public class CmdTop extends FCommand { if (f1start > f2start) { return 1; } else if (f1start < f2start) { - return -1; + return - 1; } return 0; } @@ -82,7 +82,7 @@ public class CmdTop extends FCommand { if (f1Size < f2Size) { return 1; } else if (f1Size > f2Size) { - return -1; + return - 1; } return 0; } @@ -96,7 +96,7 @@ public class CmdTop extends FCommand { if (f1Size < f2Size) { return 1; } else if (f1Size > f2Size) { - return -1; + return - 1; } return 0; } @@ -110,7 +110,7 @@ public class CmdTop extends FCommand { if (f1Size < f2Size) { return 1; } else if (f1Size > f2Size) { - return -1; + return - 1; } return 0; } @@ -131,7 +131,7 @@ public class CmdTop extends FCommand { if (f1Size < f2Size) { return 1; } else if (f1Size > f2Size) { - return -1; + return - 1; } return 0; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTpBanner.java b/src/main/java/com/massivecraft/factions/cmd/CmdTpBanner.java index b27ba72f..af6b29e2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTpBanner.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTpBanner.java @@ -25,19 +25,19 @@ public class CmdTpBanner extends FCommand { @Override public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("fbanners.Enabled")) { + if (! SavageFactions.plugin.getConfig().getBoolean("fbanners.Enabled")) { return; } - final FactionsPlayerListener fpl = new FactionsPlayerListener(SavageFactions.plugin); + final FactionsPlayerListener fpl = new FactionsPlayerListener(SavageFactions.plugin); - if (FactionsBlockListener.bannerLocations.containsKey(fme.getTag())) { + if (FactionsBlockListener.bannerLocations.containsKey(fme.getTag())) { fme.msg(TL.COMMAND_TPBANNER_SUCCESS); this.doWarmUp(WarmUpUtil.Warmup.BANNER, TL.WARMUPS_NOTIFY_TELEPORT, "Banner", new Runnable() { @Override public void run() { - me.teleport(FactionsBlockListener.bannerLocations.get(fme.getTag())); + me.teleport(FactionsBlockListener.bannerLocations.get(fme.getTag())); } }, this.p.getConfig().getLong("warmups.f-banner", 0)); } else { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java b/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java index 0b91f001..307c9349 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java @@ -26,9 +26,9 @@ public class CmdUnban extends FCommand { @Override public void perform() { - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.BAN); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER && ! Permission.BAN.has(sender, true)) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER && ! Permission.BAN.has(sender, true)) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage bans"); return; } @@ -40,7 +40,7 @@ public class CmdUnban extends FCommand { return; // the above method sends a message if fails to find someone. } - if (!myFaction.isBanned(target)) { + if (! myFaction.isBanned(target)) { fme.msg(TL.COMMAND_UNBAN_NOTBANNED, target.getName()); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java index 894269dc..3de8f184 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java @@ -35,9 +35,9 @@ public class CmdUnclaim extends FCommand { int radius = this.argAsInt(0, 1); // Default to 1 final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage faction territory"); return; } @@ -53,7 +53,7 @@ public class CmdUnclaim extends FCommand { unClaim(new FLocation(me)); } else { // radius claim - if (!Permission.CLAIM_RADIUS.has(sender, false)) { + if (! Permission.CLAIM_RADIUS.has(sender, false)) { msg(TL.COMMAND_CLAIM_DENIED); return; } @@ -86,7 +86,7 @@ public class CmdUnclaim extends FCommand { msg(TL.COMMAND_UNCLAIM_SAFEZONE_SUCCESS); if (Conf.logLandUnclaims) { - SavageFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); + SavageFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); } return true; } else { @@ -99,7 +99,7 @@ public class CmdUnclaim extends FCommand { msg(TL.COMMAND_UNCLAIM_WARZONE_SUCCESS); if (Conf.logLandUnclaims) { - SavageFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); + SavageFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); } return true; } else { @@ -121,7 +121,7 @@ public class CmdUnclaim extends FCommand { msg(TL.COMMAND_UNCLAIM_UNCLAIMS); if (Conf.logLandUnclaims) { - SavageFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); + SavageFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); } return true; @@ -133,11 +133,11 @@ public class CmdUnclaim extends FCommand { } - if (!assertHasFaction()) { + if (! assertHasFaction()) { return false; } - if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) != Access.ALLOW && !assertMinRole(Role.MODERATOR)) { + if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) != Access.ALLOW && ! assertMinRole(Role.MODERATOR)) { return false; } @@ -158,11 +158,11 @@ public class CmdUnclaim extends FCommand { double refund = Econ.calculateClaimRefund(myFaction.getLandRounded()); if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) { - if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) { + if (! Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) { return false; } } else { - if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) { + if (! Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) { return false; } } @@ -172,7 +172,7 @@ public class CmdUnclaim extends FCommand { myFaction.msg(TL.COMMAND_UNCLAIM_FACTIONUNCLAIMED, fme.describeTo(myFaction, true)); if (Conf.logLandUnclaims) { - SavageFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); + SavageFactions.plugin.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag())); } return true; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java index e9f57ca5..632fa8a0 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java @@ -32,11 +32,11 @@ public class CmdUnclaimall extends FCommand { if (Econ.shouldBeUsed()) { double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded()); if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) { - if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) { + if (! Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) { return; } } else { - if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) { + if (! Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) { return; } } @@ -52,7 +52,7 @@ public class CmdUnclaimall extends FCommand { myFaction.msg(TL.COMMAND_UNCLAIMALL_UNCLAIMED, fme.describeTo(myFaction, true)); if (Conf.logLandUnclaims) { - SavageFactions.plugin.log(TL.COMMAND_UNCLAIMALL_LOG.format(fme.getName(), myFaction.getTag())); + SavageFactions.plugin.log(TL.COMMAND_UNCLAIMALL_LOG.format(fme.getName(), myFaction.getTag())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUpgrades.java b/src/main/java/com/massivecraft/factions/cmd/CmdUpgrades.java index 827b1b0d..1016ca28 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUpgrades.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUpgrades.java @@ -25,7 +25,7 @@ public class CmdUpgrades extends FCommand { @Override public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("fupgrades.Enabled")) { + if (! SavageFactions.plugin.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 13532bc2..6faf40a4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdVault.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdVault.java @@ -32,7 +32,7 @@ public class CmdVault extends FCommand { @Override public void perform() { - if (! SavageFactions.plugin.getConfig().getBoolean("fvault.Enabled")) { + if (! SavageFactions.plugin.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 38fd6a92..e0772fdc 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java @@ -26,7 +26,7 @@ public class CmdVersion extends FCommand { @Override public void perform() { msg(TL.COMMAND_VERSION_NAME); // Did this so people can differentiate between SavageFactions and FactionsUUID (( Requested Feature )) - msg(TL.COMMAND_VERSION_VERSION, SavageFactions.plugin.getDescription().getFullName()); + msg(TL.COMMAND_VERSION_VERSION, SavageFactions.plugin.getDescription().getFullName()); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdWarunclaimall.java b/src/main/java/com/massivecraft/factions/cmd/CmdWarunclaimall.java index f8fc0d7e..f2ceeae5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdWarunclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdWarunclaimall.java @@ -48,7 +48,7 @@ public class CmdWarunclaimall extends FCommand { if (Conf.logLandUnclaims) { - SavageFactions.plugin.log(TL.COMMAND_WARUNCLAIMALL_LOG.format(fme.getName())); + SavageFactions.plugin.log(TL.COMMAND_WARUNCLAIMALL_LOG.format(fme.getName())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java index a860a831..6e589054 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java @@ -124,7 +124,7 @@ public class FCmdRoot extends FCommand { this.setHelpShort("The faction base command"); this.helpLong.add(p.txt.parseTags("This command contains all faction stuff.")); - //this.subCommands.add(plugin.cmdHelp); + //this.subCommands.add(plugin.cmdHelp); this.addSubCommand(this.cmdAdmin); this.addSubCommand(this.cmdAutoClaim); @@ -218,22 +218,22 @@ public class FCmdRoot extends FCommand { if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null) { - SavageFactions.plugin.log("Found CoreProtect, enabling Inspect"); + SavageFactions.plugin.log("Found CoreProtect, enabling Inspect"); this.addSubCommand(this.cmdInspect); } else { - SavageFactions.plugin.log("CoreProtect not found, disabling Inspect"); + SavageFactions.plugin.log("CoreProtect not found, disabling Inspect"); } - if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight", false)) { + if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight", false)) { this.addSubCommand(this.cmdFly); } if (Bukkit.getServer().getPluginManager().isPluginEnabled("FactionsTop")) { - SavageFactions.plugin.log(Level.INFO, "Found FactionsTop plugin. Disabling our own /f top command."); + SavageFactions.plugin.log(Level.INFO, "Found FactionsTop plugin. Disabling our own /f top command."); } else { - SavageFactions.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."); + SavageFactions.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."); this.addSubCommand(this.cmdTop); } - if (SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { + if (SavageFactions.plugin.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 0ec191c2..a082f926 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCommand.java @@ -29,7 +29,7 @@ public abstract class FCommand extends MCommand { public boolean isMoneyCommand; public FCommand() { - super(SavageFactions.plugin); + super(SavageFactions.plugin); // Due to safety reasons it defaults to disable on lock. disableOnLock = true; @@ -62,12 +62,12 @@ public abstract class FCommand extends MCommand { return false; } - if (this.isMoneyCommand && !Conf.econEnabled) { + if (this.isMoneyCommand && ! Conf.econEnabled) { msg("Faction economy features are disabled on this server."); return false; } - if (this.isMoneyCommand && !Conf.bankEnabled) { + if (this.isMoneyCommand && ! Conf.bankEnabled) { msg("The faction bank system is disabled on this server."); return false; } @@ -78,29 +78,29 @@ public abstract class FCommand extends MCommand { @Override public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) { boolean superValid = super.validSenderType(sender, informSenderIfNot); - if (!superValid) { + if (! superValid) { return false; } - if (!(this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin || this.senderMustBeColeader)) { + if (! (this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin || this.senderMustBeColeader)) { return true; } - if (!(sender instanceof Player)) { + if (! (sender instanceof Player)) { return false; } - if (!fme.hasFaction()) { + if (! fme.hasFaction()) { sender.sendMessage(p.txt.parse("You are not member of any faction.")); return false; } - if (this.senderMustBeModerator && !fme.getRole().isAtLeast(Role.MODERATOR)) { + if (this.senderMustBeModerator && ! fme.getRole().isAtLeast(Role.MODERATOR)) { sender.sendMessage(p.txt.parse("Only faction moderators can %s.", this.getHelpShort())); return false; } - if (this.senderMustBeColeader && !fme.getRole().isAtLeast(Role.COLEADER)) { + if (this.senderMustBeColeader && ! fme.getRole().isAtLeast(Role.COLEADER)) { sender.sendMessage(p.txt.parse("Only faction coleaders can %s.", this.getHelpShort())); return false; } @@ -123,7 +123,7 @@ public abstract class FCommand extends MCommand { return true; } - if (!fme.hasFaction()) { + if (! fme.hasFaction()) { sendMessage("You are not member of any faction."); return false; } @@ -160,7 +160,7 @@ public abstract class FCommand extends MCommand { } if (msg && ret == null) { - this.msg("No player \"%s\" could be found.", name); + this.msg("No player \"%s\" could be found.", name); } return ret; @@ -233,7 +233,7 @@ public abstract class FCommand extends MCommand { } if (msg && ret == null) { - this.msg("The faction or player \"%s\" could not be found.", name); + this.msg("The faction or player \"%s\" could not be found.", name); } return ret; @@ -256,7 +256,7 @@ public abstract class FCommand extends MCommand { // -------------------------------------------- // public boolean canIAdministerYou(FPlayer i, FPlayer you) { - if (!i.getFaction().equals(you.getFaction())) { + if (! i.getFaction().equals(you.getFaction())) { i.sendMessage(p.txt.parse("%s is not in the same faction as you.", you.describeTo(i, true))); return false; } @@ -290,14 +290,14 @@ public abstract class FCommand extends MCommand { // if economy is enabled and they're not on the bypass list, make 'em pay; returns true unless person can't afford the cost public boolean payForCommand(double cost, String toDoThis, String forDoingThis) { - if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) { + if (! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) { return true; } if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) { - return Econ.modifyMoney(myFaction, -cost, toDoThis, forDoingThis); + return Econ.modifyMoney(myFaction, - cost, toDoThis, forDoingThis); } else { - return Econ.modifyMoney(fme, -cost, toDoThis, forDoingThis); + return Econ.modifyMoney(fme, - cost, toDoThis, forDoingThis); } } @@ -307,7 +307,7 @@ public abstract class FCommand extends MCommand { // like above, but just make sure they can pay; returns true unless person can't afford the cost public boolean canAffordCommand(double cost, String toDoThis) { - if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) { + if (! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) { return true; } diff --git a/src/main/java/com/massivecraft/factions/cmd/FPromoteCommand.java b/src/main/java/com/massivecraft/factions/cmd/FPromoteCommand.java index 895d771f..88ed62f5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FPromoteCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FPromoteCommand.java @@ -33,18 +33,18 @@ public class FPromoteCommand extends FCommand { return; } - if (!target.getFaction().equals(myFaction)) { + if (! target.getFaction().equals(myFaction)) { msg(TL.COMMAND_PROMOTE_WRONGFACTION, target.getName()); return; } Role current = target.getRole(); - Role promotion = Role.getRelative(current, +relative); + Role promotion = Role.getRelative(current, + relative); // Now it ain't that messy - if (!fme.isAdminBypassing()) { + if (! fme.isAdminBypassing()) { Access access = myFaction.getAccess(fme, PermissableAction.PROMOTE); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { fme.msg(TL.GENERIC_NOPERMISSION, "manage ranks"); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java b/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java index d3688f1b..50afdc70 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java @@ -37,7 +37,7 @@ public abstract class FRelationCommand extends FCommand { return; } - if (!them.isNormal()) { + if (! them.isNormal()) { msg(TL.COMMAND_RELATIONS_ALLTHENOPE); return; } @@ -64,7 +64,7 @@ public abstract class FRelationCommand extends FCommand { } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay - if (!payForCommand(targetRelation.getRelationCost(), TL.COMMAND_RELATIONS_TOMARRY, TL.COMMAND_RELATIONS_FORMARRY)) { + if (! payForCommand(targetRelation.getRelationCost(), TL.COMMAND_RELATIONS_TOMARRY, TL.COMMAND_RELATIONS_FORMARRY)) { return; } @@ -88,12 +88,12 @@ public abstract class FRelationCommand extends FCommand { myFaction.msg(TL.COMMAND_RELATIONS_PROPOSAL_SENT, currentRelationColor + them.getTag(), "" + targetRelation.getColor() + targetRelation); } - if (!targetRelation.isNeutral() && them.isPeaceful()) { + if (! targetRelation.isNeutral() && them.isPeaceful()) { them.msg(TL.COMMAND_RELATIONS_PEACEFUL); myFaction.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER); } - if (!targetRelation.isNeutral() && myFaction.isPeaceful()) { + if (! targetRelation.isNeutral() && myFaction.isPeaceful()) { them.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER); myFaction.msg(TL.COMMAND_RELATIONS_PEACEFUL); } @@ -103,9 +103,9 @@ public abstract class FRelationCommand extends FCommand { } private boolean hasMaxRelations(Faction them, Relation targetRelation) { - int max = SavageFactions.plugin.getConfig().getInt("max-relations." + targetRelation.toString(), - 1); - if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", false)) { - if (max != -1) { + int max = SavageFactions.plugin.getConfig().getInt("max-relations." + targetRelation.toString(), - 1); + if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", false)) { + if (max != - 1) { if (myFaction.getRelationCount(targetRelation) >= max) { msg(TL.COMMAND_RELATIONS_EXCEEDS_ME, max, targetRelation.getPluralTranslation()); return true; diff --git a/src/main/java/com/massivecraft/factions/integration/Econ.java b/src/main/java/com/massivecraft/factions/integration/Econ.java index f8e1f297..07fe8509 100644 --- a/src/main/java/com/massivecraft/factions/integration/Econ.java +++ b/src/main/java/com/massivecraft/factions/integration/Econ.java @@ -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) { - SavageFactions.plugin.log(integrationFail + "is not installed."); + SavageFactions.plugin.log(integrationFail + "is not installed."); return; } RegisteredServiceProvider rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { - SavageFactions.plugin.log(integrationFail + "is not hooked into an economy plugin."); + SavageFactions.plugin.log(integrationFail + "is not hooked into an economy plugin."); return; } econ = rsp.getProvider(); - SavageFactions.plugin.log("Economy integration through Vault plugin successful."); + SavageFactions.plugin.log("Economy integration through Vault plugin successful."); - if (!Conf.econEnabled) { - SavageFactions.plugin.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true"); + if (! Conf.econEnabled) { + SavageFactions.plugin.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true"); } - SavageFactions.plugin.cmdBase.cmdHelp.updateHelp(); + SavageFactions.plugin.cmdBase.cmdHelp.updateHelp(); } public static boolean shouldBeUsed() { @@ -63,7 +63,7 @@ public class Econ { } public static void modifyUniverseMoney(double delta) { - if (!shouldBeUsed()) { + if (! shouldBeUsed()) { return; } @@ -73,7 +73,7 @@ public class Econ { if (Conf.econUniverseAccount.length() == 0) { return; } - if (!econ.hasAccount(Conf.econUniverseAccount)) { + if (! econ.hasAccount(Conf.econUniverseAccount)) { return; } @@ -81,8 +81,8 @@ public class Econ { } public static void sendBalanceInfo(FPlayer to, EconomyParticipator about) { - if (!shouldBeUsed()) { - SavageFactions.plugin.log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin."); + if (! shouldBeUsed()) { + SavageFactions.plugin.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()))); @@ -134,21 +134,21 @@ public class Econ { } public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify) { - if (!shouldBeUsed()) { + if (! shouldBeUsed()) { return false; } // The amount must be positive. // If the amount is negative we must flip and multiply amount with -1. if (amount < 0) { - amount *= -1; + amount *= - 1; EconomyParticipator temp = from; from = to; to = temp; } // Check the rights - if (!canIControllYou(invoker, from)) { + if (! canIControllYou(invoker, from)) { return false; } @@ -174,7 +174,7 @@ public class Econ { } // Is there enough money for the transaction to happen? - if (!econ.has(fromAcc, amount)) { + if (! econ.has(fromAcc, amount)) { // There was not enough money to pay if (invoker != null && notify) { invoker.msg("%s can't afford to transfer %s to %s.", from.describeTo(invoker, true), moneyString(amount), to.describeTo(invoker)); @@ -247,7 +247,7 @@ public class Econ { } public static boolean hasAtLeast(EconomyParticipator ep, double delta, String toDoThis) { - if (!shouldBeUsed()) { + if (! shouldBeUsed()) { return true; } @@ -270,8 +270,8 @@ public class Econ { affordable = true; } - if (!affordable) { - if (toDoThis != null && !toDoThis.isEmpty()) { + if (! affordable) { + if (toDoThis != null && ! toDoThis.isEmpty()) { ep.msg("%s can't afford %s %s.", ep.describeTo(ep, true), moneyString(delta), toDoThis); } return false; @@ -280,7 +280,7 @@ public class Econ { } public static boolean modifyMoney(EconomyParticipator ep, double delta, String toDoThis, String forDoingThis) { - if (!shouldBeUsed()) { + if (! shouldBeUsed()) { return false; } @@ -308,14 +308,14 @@ public class Econ { // The account might not have enough space EconomyResponse er = econ.depositPlayer(acc, delta); if (er.transactionSuccess()) { - modifyUniverseMoney(-delta); - if (forDoingThis != null && !forDoingThis.isEmpty()) { + modifyUniverseMoney(- delta); + if (forDoingThis != null && ! forDoingThis.isEmpty()) { ep.msg("%s gained %s %s.", You, moneyString(delta), forDoingThis); } return true; } else { // transfer to account failed - if (forDoingThis != null && !forDoingThis.isEmpty()) { + if (forDoingThis != null && ! forDoingThis.isEmpty()) { ep.msg("%s would have gained %s %s, but the deposit failed.", You, moneyString(delta), forDoingThis); } return false; @@ -324,17 +324,17 @@ public class Econ { // The player should loose money // The player might not have enough. - if (econ.has(acc, -delta) && econ.withdrawPlayer(acc, -delta).transactionSuccess()) { + if (econ.has(acc, - delta) && econ.withdrawPlayer(acc, - delta).transactionSuccess()) { // There is enough money to pay - modifyUniverseMoney(-delta); - if (forDoingThis != null && !forDoingThis.isEmpty()) { - ep.msg("%s lost %s %s.", You, moneyString(-delta), forDoingThis); + modifyUniverseMoney(- delta); + if (forDoingThis != null && ! forDoingThis.isEmpty()) { + ep.msg("%s lost %s %s.", You, moneyString(- delta), forDoingThis); } return true; } else { // There was not enough money to pay - if (toDoThis != null && !toDoThis.isEmpty()) { - ep.msg("%s can't afford %s %s.", You, moneyString(-delta), toDoThis); + if (toDoThis != null && ! toDoThis.isEmpty()) { + ep.msg("%s can't afford %s %s.", You, moneyString(- delta), toDoThis); } return false; } @@ -347,7 +347,7 @@ public class Econ { // calculate the cost for claiming land public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction) { - if (!shouldBeUsed()) { + if (! shouldBeUsed()) { return 0d; } @@ -410,7 +410,7 @@ public class Econ { public static boolean modifyBalance(String account, double amount) { if (amount < 0) { - return econ.withdrawPlayer(account, -amount).transactionSuccess(); + return econ.withdrawPlayer(account, - amount).transactionSuccess(); } else { return econ.depositPlayer(account, amount).transactionSuccess(); } diff --git a/src/main/java/com/massivecraft/factions/integration/Essentials.java b/src/main/java/com/massivecraft/factions/integration/Essentials.java index 0c9310ed..e1abc4d0 100644 --- a/src/main/java/com/massivecraft/factions/integration/Essentials.java +++ b/src/main/java/com/massivecraft/factions/integration/Essentials.java @@ -23,7 +23,7 @@ public class Essentials { // return false if feature is disabled or Essentials isn't available public static boolean handleTeleport(Player player, Location loc) { - if (!Conf.homesTeleportCommandEssentialsIntegration || essentials == null) { + if (! Conf.homesTeleportCommandEssentialsIntegration || essentials == null) { return false; } diff --git a/src/main/java/com/massivecraft/factions/integration/Worldguard.java b/src/main/java/com/massivecraft/factions/integration/Worldguard.java index 3af7afa4..73639c95 100644 --- a/src/main/java/com/massivecraft/factions/integration/Worldguard.java +++ b/src/main/java/com/massivecraft/factions/integration/Worldguard.java @@ -35,14 +35,14 @@ public class Worldguard { public static void init(Plugin plugin) { Plugin wgplug = plugin.getServer().getPluginManager().getPlugin("WorldGuard"); - if (wgplug == null || !(wgplug instanceof WorldGuardPlugin)) { + if (wgplug == null || ! (wgplug instanceof WorldGuardPlugin)) { enabled = false; wg = null; - SavageFactions.plugin.log("Could not hook to WorldGuard. WorldGuard checks are disabled."); + SavageFactions.plugin.log("Could not hook to WorldGuard. WorldGuard checks are disabled."); } else { wg = (WorldGuardPlugin) wgplug; enabled = true; - SavageFactions.plugin.log("Successfully hooked to WorldGuard."); + SavageFactions.plugin.log("Successfully hooked to WorldGuard."); } } @@ -55,7 +55,7 @@ public class Worldguard { // True: PVP is allowed // False: PVP is disallowed public static boolean isPVP(Player player) { - if (!enabled) { + if (! enabled) { // No WG hooks so we'll always bypass this check. return true; } @@ -74,7 +74,7 @@ public class Worldguard { // True: Player can build in the region. // False: Player can not build in the region. public static boolean playerCanBuild(Player player, Location loc) { - if (!enabled) { + if (! enabled) { // No WG hooks so we'll always bypass this check. return false; } @@ -103,7 +103,7 @@ public class Worldguard { } public static boolean checkForRegionsInChunk(Chunk chunk) { - if (!enabled) { + if (! enabled) { // No WG hooks so we'll always bypass this check. return false; } @@ -128,7 +128,7 @@ public class Worldguard { try { overlaps = region.getIntersectingRegions(allregionslist); - foundregions = overlaps != null && !overlaps.isEmpty(); + foundregions = overlaps != null && ! overlaps.isEmpty(); } catch (Exception e) { e.printStackTrace(); } 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 db7d4c17..02174449 100644 --- a/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java +++ b/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java @@ -44,6 +44,7 @@ public class EngineDynmap { public DynmapAPI dynmapApi; public MarkerAPI markerApi; public MarkerSet markerset; + private EngineDynmap() { } @@ -103,12 +104,12 @@ public class EngineDynmap { public void init() { Plugin dynmap = Bukkit.getServer().getPluginManager().getPlugin("dynmap"); - if (dynmap == null || !dynmap.isEnabled()) { + if (dynmap == null || ! dynmap.isEnabled()) { return; } // Should we even use dynmap? - if (!Conf.dynmapUse) { + if (! Conf.dynmapUse) { if (this.markerset != null) { this.markerset.deleteMarkerSet(); this.markerset = null; @@ -117,7 +118,7 @@ public class EngineDynmap { } // Shedule non thread safe sync at the end! - Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { + Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { @Override public void run() { @@ -125,12 +126,12 @@ public class EngineDynmap { final Map areas = createAreas(); final Map> playerSets = createPlayersets(); - if (!updateCore()) { + if (! updateCore()) { return; } // createLayer() is thread safe but it makes use of fields set in updateCore() so we must have it after. - if (!updateLayer(createLayer())) { + if (! updateLayer(createLayer())) { return; } @@ -170,7 +171,7 @@ public class EngineDynmap { ret.label = Conf.dynmapLayerName; ret.minimumZoom = Conf.dynmapLayerMinimumZoom; ret.priority = Conf.dynmapLayerPriority; - ret.hideByDefault = !Conf.dynmapLayerVisible; + ret.hideByDefault = ! Conf.dynmapLayerVisible; return ret; } @@ -322,7 +323,7 @@ public class EngineDynmap { Map ret = new HashMap<>(); // If the faction is visible ... - if (!isVisible(faction, world)) { + if (! isVisible(faction, world)) { return ret; } @@ -406,10 +407,10 @@ public class EngineDynmap { while ((currentX != initialX) || (currentZ != initialZ) || (direction != Direction.ZMINUS)) { switch (direction) { case XPLUS: // Segment in X+ direction - if (!ourChunkFlags.getFlag(currentX + 1, currentZ)) { // Right turn? + if (! ourChunkFlags.getFlag(currentX + 1, currentZ)) { // Right turn? linelist.add(new int[]{currentX + 1, currentZ}); // Finish line direction = Direction.ZPLUS; // Change direction - } else if (!ourChunkFlags.getFlag(currentX + 1, currentZ - 1)) { // Straight? + } else if (! ourChunkFlags.getFlag(currentX + 1, currentZ - 1)) { // Straight? currentX++; } else { // Left turn linelist.add(new int[]{currentX + 1, currentZ}); // Finish line @@ -419,10 +420,10 @@ public class EngineDynmap { } break; case ZPLUS: // Segment in Z+ direction - if (!ourChunkFlags.getFlag(currentX, currentZ + 1)) { // Right turn? + if (! ourChunkFlags.getFlag(currentX, currentZ + 1)) { // Right turn? linelist.add(new int[]{currentX + 1, currentZ + 1}); // Finish line direction = Direction.XMINUS; // Change direction - } else if (!ourChunkFlags.getFlag(currentX + 1, currentZ + 1)) { // Straight? + } else if (! ourChunkFlags.getFlag(currentX + 1, currentZ + 1)) { // Straight? currentZ++; } else { // Left turn linelist.add(new int[]{currentX + 1, currentZ + 1}); // Finish line @@ -432,10 +433,10 @@ public class EngineDynmap { } break; case XMINUS: // Segment in X- direction - if (!ourChunkFlags.getFlag(currentX - 1, currentZ)) { // Right turn? + if (! ourChunkFlags.getFlag(currentX - 1, currentZ)) { // Right turn? linelist.add(new int[]{currentX, currentZ + 1}); // Finish line direction = Direction.ZMINUS; // Change direction - } else if (!ourChunkFlags.getFlag(currentX - 1, currentZ + 1)) { // Straight? + } else if (! ourChunkFlags.getFlag(currentX - 1, currentZ + 1)) { // Straight? currentX--; } else { // Left turn linelist.add(new int[]{currentX, currentZ + 1}); // Finish line @@ -445,10 +446,10 @@ public class EngineDynmap { } break; case ZMINUS: // Segment in Z- direction - if (!ourChunkFlags.getFlag(currentX, currentZ - 1)) { // Right turn? + if (! ourChunkFlags.getFlag(currentX, currentZ - 1)) { // Right turn? linelist.add(new int[]{currentX, currentZ}); // Finish line direction = Direction.XPLUS; // Change direction - } else if (!ourChunkFlags.getFlag(currentX - 1, currentZ - 1)) { // Straight? + } else if (! ourChunkFlags.getFlag(currentX - 1, currentZ - 1)) { // Straight? currentZ--; } else { // Left turn linelist.add(new int[]{currentX, currentZ}); // Finish line @@ -570,7 +571,7 @@ public class EngineDynmap { // Thread Safe / Asynchronous: Yes public Map> createPlayersets() { - if (!Conf.dynmapVisibilityByFaction) { + if (! Conf.dynmapVisibilityByFaction) { return null; } @@ -599,7 +600,7 @@ public class EngineDynmap { // Remove for (PlayerSet set : this.markerApi.getPlayerSets()) { - if (!set.getSetID().startsWith(FACTIONS_PLAYERSET_)) { + if (! set.getSetID().startsWith(FACTIONS_PLAYERSET_)) { continue; } @@ -669,7 +670,7 @@ public class EngineDynmap { FPlayer playersLeaderObject = faction.getFPlayerAdmin(); String playersLeader = getHtmlPlayerName(playersLeaderObject); - ArrayList playersAdminsList = faction.getFPlayersWhereRole(Role.LEADER); + ArrayList playersAdminsList = faction.getFPlayersWhereRole(Role.LEADER); String playersAdminsCount = String.valueOf(playersAdminsList.size()); String playersAdmins = getHtmlPlayerString(playersAdminsList); @@ -713,11 +714,11 @@ public class EngineDynmap { Set visible = Conf.dynmapVisibleFactions; Set hidden = Conf.dynmapHiddenFactions; - if (!visible.isEmpty() && !visible.contains(factionId) && !visible.contains(factionName) && !visible.contains("world:" + world)) { + if (! visible.isEmpty() && ! visible.contains(factionId) && ! visible.contains(factionName) && ! visible.contains("world:" + world)) { return false; } - return !hidden.contains(factionId) && !hidden.contains(factionName) && !hidden.contains("world:" + world); + return ! hidden.contains(factionId) && ! hidden.contains(factionName) && ! hidden.contains("world:" + world); } // Thread Safe / Asynchronous: Yes @@ -743,7 +744,7 @@ public class EngineDynmap { ArrayDeque stack = new ArrayDeque<>(); stack.push(new int[]{x, y}); - while (!stack.isEmpty()) { + while (! stack.isEmpty()) { int[] nxt = stack.pop(); x = nxt[0]; y = nxt[1]; diff --git a/src/main/java/com/massivecraft/factions/integration/dynmap/TempAreaMarker.java b/src/main/java/com/massivecraft/factions/integration/dynmap/TempAreaMarker.java index 1346aad8..8179895d 100644 --- a/src/main/java/com/massivecraft/factions/integration/dynmap/TempAreaMarker.java +++ b/src/main/java/com/massivecraft/factions/integration/dynmap/TempAreaMarker.java @@ -82,17 +82,17 @@ public class TempAreaMarker { public void update(AreaMarker marker) { // Corner Locations - if (!equals(marker, this.x, this.z)) { + if (! equals(marker, this.x, this.z)) { marker.setCornerLocations(this.x, this.z); } // Label - if (!marker.getLabel().equals(this.label)) { + if (! marker.getLabel().equals(this.label)) { marker.setLabel(this.label); } // Description - if (!marker.getDescription().equals(this.description)) { + if (! marker.getDescription().equals(this.description)) { marker.setDescription(this.description); } diff --git a/src/main/java/com/massivecraft/factions/integration/dynmap/TempMarker.java b/src/main/java/com/massivecraft/factions/integration/dynmap/TempMarker.java index b8eefdbe..4427c5c9 100644 --- a/src/main/java/com/massivecraft/factions/integration/dynmap/TempMarker.java +++ b/src/main/java/com/massivecraft/factions/integration/dynmap/TempMarker.java @@ -53,11 +53,11 @@ public class TempMarker { // -------------------------------------------- // public void update(MarkerAPI markerApi, Marker marker) { - if (!this.world.equals(marker.getWorld()) || this.x != marker.getX() || this.y != marker.getY() || this.z != marker.getZ()) { + if (! this.world.equals(marker.getWorld()) || this.x != marker.getX() || this.y != marker.getY() || this.z != marker.getZ()) { marker.setLocation(this.world, this.x, this.y, this.z); } - if (!marker.getLabel().equals(this.label)) { + if (! marker.getLabel().equals(this.label)) { marker.setLabel(this.label); } @@ -66,7 +66,7 @@ public class TempMarker { marker.setMarkerIcon(icon); } - if (!marker.getDescription().equals(this.description)) { + if (! marker.getDescription().equals(this.description)) { marker.setDescription(this.description); } } diff --git a/src/main/java/com/massivecraft/factions/integration/dynmap/TempMarkerSet.java b/src/main/java/com/massivecraft/factions/integration/dynmap/TempMarkerSet.java index 553bbde6..efcd9c93 100644 --- a/src/main/java/com/massivecraft/factions/integration/dynmap/TempMarkerSet.java +++ b/src/main/java/com/massivecraft/factions/integration/dynmap/TempMarkerSet.java @@ -33,7 +33,7 @@ public class TempMarkerSet { public void update(MarkerSet markerset) { // Name - if (!markerset.getMarkerSetLabel().equals(this.label)) { + if (! markerset.getMarkerSetLabel().equals(this.label)) { markerset.setMarkerSetLabel(this.label); } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index eab34372..b22877a5 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -32,17 +32,138 @@ import java.util.List; public class FactionsBlockListener implements Listener { - public SavageFactions savageFactions; - public static HashMap bannerLocations = new HashMap<>(); - private HashMap bannerCooldownMap = new HashMap<>(); + public static HashMap bannerLocations = new HashMap<>(); + public SavageFactions savageFactions; + private HashMap bannerCooldownMap = new HashMap<>(); - public FactionsBlockListener(SavageFactions savageFactions) { - this.savageFactions = savageFactions; + public FactionsBlockListener(SavageFactions savageFactions) { + this.savageFactions = savageFactions; } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + public static boolean playerCanBuildDestroyBlock(Player player, Location location, String action, boolean justCheck) { + String name = player.getName(); + if (Conf.playersWhoBypassAllProtection.contains(name)) { + return true; + } + + FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString()); + if (me.isAdminBypassing()) { + return true; + } + + FLocation loc = new FLocation(location); + Faction otherFaction = Board.getInstance().getFactionAt(loc); + + if (otherFaction.isWilderness()) { + if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) { + return true; + } + + if (! Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName())) { + return true; // This is not faction territory. Use whatever you like here. + } + + if (! justCheck) { + me.msg("You can't " + action + " in the wilderness."); + } + + return false; + } else if (otherFaction.isSafeZone()) { + if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) { + return true; + } + + if (! Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player)) { + return true; + } + + if (! justCheck) { + me.msg("You can't " + action + " in a safe zone."); + } + + return false; + } else if (otherFaction.isWarZone()) { + if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) { + return true; + } + + if (! Conf.warZoneDenyBuild || Permission.MANAGE_WAR_ZONE.has(player)) { + return true; + } + + if (! justCheck) { + me.msg("You can't " + action + " in a war zone."); + } + + return false; + } + if (SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() >= otherFaction.getPowerRounded()) { + return true; + } + + Faction myFaction = me.getFaction(); + Relation rel = myFaction.getRelationTo(otherFaction); + boolean online = otherFaction.hasPlayersOnline(); + boolean pain = ! justCheck && rel.confPainBuild(online); + boolean deny = rel.confDenyBuild(online); + + Access access = otherFaction.getAccess(me, PermissableAction.fromString(action)); + if (access == Access.ALLOW && ((rel == Relation.ALLY) || (rel == Relation.ENEMY) || (rel == Relation.NEUTRAL) || (rel == Relation.TRUCE))) { + deny = false; + } + // hurt the player for building/destroying in other territory? + if (pain) { + player.damage(Conf.actionDeniedPainAmount); + + if (! deny) { + me.msg("It is painful to try to " + action + " in the territory of " + otherFaction.getTag(myFaction)); + } + } + + + // cancel building/destroying in other territory? + if (deny) { + if (! justCheck) { + me.msg("You can't " + action + " in the territory of " + otherFaction.getTag(myFaction)); + } + + return false; + } + + // Also cancel and/or cause pain if player doesn't have ownership rights for this claim + if (Conf.ownedAreasEnabled && (Conf.ownedAreaDenyBuild || Conf.ownedAreaPainBuild) && ! otherFaction.playerHasOwnershipRights(me, loc)) { + if (! pain && Conf.ownedAreaPainBuild && ! justCheck) { + player.damage(Conf.actionDeniedPainAmount); + if (! Conf.ownedAreaDenyBuild) { + me.msg("It is painful to try to " + action + " in this territory, it is owned by: " + otherFaction.getOwnerListString(loc)); + } + } + if (Conf.ownedAreaDenyBuild) { + if (! justCheck) { + me.msg("You can't " + action + " in this territory, it is owned by: " + otherFaction.getOwnerListString(loc)); + return false; + } + } + } + + // Check the permission just after making sure the land isn't owned by someone else to avoid bypass. + + if (access != Access.ALLOW && me.getRole() != Role.LEADER) { + // TODO: Update this once new access values are added other than just allow / deny. + if (access == Access.DENY) { + me.msg(TL.GENERIC_NOPERMISSION, action); + return false; + } else if (myFaction.getOwnerListString(loc) != null && ! myFaction.getOwnerListString(loc).isEmpty() && ! myFaction.getOwnerListString(loc).contains(player.getName())) { + me.msg("You can't " + action + " in this territory, it is owned by: " + myFaction.getOwnerListString(loc)); + return false; + } + } + return true; + } + + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockPlace(BlockPlaceEvent event) { - if (!event.canBuild()) { + if (! event.canBuild()) { return; } @@ -51,14 +172,14 @@ public class FactionsBlockListener implements Listener { return; } - if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) { + if (! playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) { event.setCancelled(true); } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockFromTo(BlockFromToEvent event) { - if (!Conf.handleExploitLiquidFlow) { + if (! Conf.handleExploitLiquidFlow) { return; } if (event.getBlock().isLiquid()) { @@ -80,137 +201,16 @@ public class FactionsBlockListener implements Listener { } } - public static boolean playerCanBuildDestroyBlock(Player player, Location location, String action, boolean justCheck) { - String name = player.getName(); - if (Conf.playersWhoBypassAllProtection.contains(name)) { - return true; - } - - FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString()); - if (me.isAdminBypassing()) { - return true; - } - - FLocation loc = new FLocation(location); - Faction otherFaction = Board.getInstance().getFactionAt(loc); - - if (otherFaction.isWilderness()) { - if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) { - return true; - } - - if (! Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName())) { - return true; // This is not faction territory. Use whatever you like here. - } - - if (! justCheck) { - me.msg("You can't " + action + " in the wilderness."); - } - - return false; - } else if (otherFaction.isSafeZone()) { - if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) { - return true; - } - - if (! Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player)) { - return true; - } - - if (! justCheck) { - me.msg("You can't " + action + " in a safe zone."); - } - - return false; - } else if (otherFaction.isWarZone()) { - if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) { - return true; - } - - if (! Conf.warZoneDenyBuild || Permission.MANAGE_WAR_ZONE.has(player)) { - return true; - } - - if (! justCheck) { - me.msg("You can't " + action + " in a war zone."); - } - - return false; - } - if (SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() >= otherFaction.getPowerRounded()) { - return true; - } - - Faction myFaction = me.getFaction(); - Relation rel = myFaction.getRelationTo(otherFaction); - boolean online = otherFaction.hasPlayersOnline(); - boolean pain = ! justCheck && rel.confPainBuild(online); - boolean deny = rel.confDenyBuild(online); - - Access access = otherFaction.getAccess(me, PermissableAction.fromString(action)); - if (access == Access.ALLOW && ((rel == Relation.ALLY) || (rel == Relation.ENEMY) || (rel == Relation.NEUTRAL) || (rel == Relation.TRUCE))) { - deny = false; - } - // hurt the player for building/destroying in other territory? - if (pain) { - player.damage(Conf.actionDeniedPainAmount); - - if (! deny) { - me.msg("It is painful to try to " + action + " in the territory of " + otherFaction.getTag(myFaction)); - } - } - - - // cancel building/destroying in other territory? - if (deny) { - if (! justCheck) { - me.msg("You can't " + action + " in the territory of " + otherFaction.getTag(myFaction)); - } - - return false; - } - - // Also cancel and/or cause pain if player doesn't have ownership rights for this claim - if (Conf.ownedAreasEnabled && (Conf.ownedAreaDenyBuild || Conf.ownedAreaPainBuild) && ! otherFaction.playerHasOwnershipRights(me, loc)) { - if (! pain && Conf.ownedAreaPainBuild && ! justCheck) { - player.damage(Conf.actionDeniedPainAmount); - if (! Conf.ownedAreaDenyBuild) { - me.msg("It is painful to try to " + action + " in this territory, it is owned by: " + otherFaction.getOwnerListString(loc)); - } - } - if (Conf.ownedAreaDenyBuild) { - if (! justCheck) { - me.msg("You can't " + action + " in this territory, it is owned by: " + otherFaction.getOwnerListString(loc)); - return false; - } - } - } - - // Check the permission just after making sure the land isn't owned by someone else to avoid bypass. - - if (access != Access.ALLOW && me.getRole() != Role.LEADER) { - // TODO: Update this once new access values are added other than just allow / deny. - if (access == Access.DENY) { - me.msg(TL.GENERIC_NOPERMISSION, action); - return false; - } else if (myFaction.getOwnerListString(loc) != null && ! myFaction.getOwnerListString(loc).isEmpty() && ! myFaction.getOwnerListString(loc).contains(player.getName())) { - me.msg("You can't " + action + " in this territory, it is owned by: " + myFaction.getOwnerListString(loc)); - return false; - } - } - return true; - } - - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockDamage(BlockDamageEvent event) { - if (event.getInstaBreak() && !playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) { + if (event.getInstaBreak() && ! playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) { event.setCancelled(true); } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockPistonExtend(BlockPistonExtendEvent event) { - if (!Conf.pistonProtectionThroughDenyBuild) { + if (! Conf.pistonProtectionThroughDenyBuild) { return; } @@ -220,7 +220,7 @@ public class FactionsBlockListener implements Listener { Block targetBlock = event.getBlock().getRelative(event.getDirection(), event.getLength() + 1); // if potentially pushing into air/water/lava in another territory, we need to check it out - if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && !canPistonMoveBlock(pistonFaction, targetBlock.getLocation())) { + if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && ! canPistonMoveBlock(pistonFaction, targetBlock.getLocation())) { event.setCancelled(true); } @@ -234,7 +234,7 @@ public class FactionsBlockListener implements Listener { @EventHandler public void onVaultPlace(BlockPlaceEvent e) { if (e.getItemInHand().getType() == Material.CHEST) { - ItemStack vault = SavageFactions.plugin.createItem(Material.CHEST, 1, (short) 0, SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fvault.Item.Name")), SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fvault.Item.Lore"))); + ItemStack vault = SavageFactions.plugin.createItem(Material.CHEST, 1, (short) 0, SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fvault.Item.Name")), SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fvault.Item.Lore"))); if (e.getItemInHand().isSimilar(vault)) { FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer()); if (fme.getFaction().getVault() != null) { @@ -260,7 +260,7 @@ public class FactionsBlockListener implements Listener { Material blockMaterial = blockLoc.getBlock().getType(); - if (blockMaterial == Material.CHEST || (SavageFactions.plugin.getConfig().getBoolean("fvault.No-Hoppers-near-vault") && blockMaterial == Material.HOPPER)) { + if (blockMaterial == Material.CHEST || (SavageFactions.plugin.getConfig().getBoolean("fvault.No-Hoppers-near-vault") && blockMaterial == Material.HOPPER)) { e.setCancelled(true); fme.msg(TL.COMMAND_GETVAULT_CHESTNEAR); return; @@ -279,7 +279,7 @@ public class FactionsBlockListener implements Listener { @EventHandler public void onHopperPlace(BlockPlaceEvent e) { - if (e.getItemInHand().getType() != Material.HOPPER && ! SavageFactions.plugin.getConfig().getBoolean("fvault.No-Hoppers-near-vault")) { + if (e.getItemInHand().getType() != Material.HOPPER && ! SavageFactions.plugin.getConfig().getBoolean("fvault.No-Hoppers-near-vault")) { return; } @@ -315,10 +315,10 @@ public class FactionsBlockListener implements Listener { } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockPistonRetract(BlockPistonRetractEvent event) { // if not a sticky piston, retraction should be fine - if (!event.isSticky() || !Conf.pistonProtectionThroughDenyBuild) { + if (! event.isSticky() || ! Conf.pistonProtectionThroughDenyBuild) { return; } @@ -326,7 +326,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() && SavageFactions.plugin.getConfig().getBoolean("disable-pistons-in-territory", false)) { + if (otherFaction.isNormal() && SavageFactions.plugin.getConfig().getBoolean("disable-pistons-in-territory", false)) { event.setCancelled(true); return; } @@ -338,119 +338,119 @@ public class FactionsBlockListener implements Listener { Faction pistonFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock())); - if (!canPistonMoveBlock(pistonFaction, targetLoc)) { + if (! canPistonMoveBlock(pistonFaction, targetLoc)) { event.setCancelled(true); } } - @EventHandler - public void onBannerPlace(BlockPlaceEvent e) { - if (SavageFactions.plugin.mc17) { - return; - } - - if (e.getItemInHand().getType() == SavageFactions.plugin.BANNER) { - ItemStack bannerInHand = e.getItemInHand(); - FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer()); - ItemStack warBanner = fme.getFaction().getBanner(); - if (warBanner != null) { - ItemMeta warmeta = warBanner.getItemMeta(); - warmeta.setDisplayName(SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"))); - warmeta.setLore(SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fbanners.Item.Lore"))); - warBanner.setItemMeta(warmeta); - } else { - warBanner = SavageFactions.plugin.createItem(SavageFactions.plugin.BANNER, 1, (short) 1, SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"), SavageFactions.plugin.getConfig().getStringList("fbanners.Item.Lore")); - } - if (warBanner.isSimilar(bannerInHand)) { - - if (fme.getFaction().isWilderness()) { - fme.msg(TL.WARBANNER_NOFACTION); - e.setCancelled(true); - return; - } - int bannerTime = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Time") * 20; - - Location placedLoc = e.getBlockPlaced().getLocation(); - FLocation fplacedLoc = new FLocation(placedLoc); - if ((Board.getInstance().getFactionAt(fplacedLoc).isWarZone() && SavageFactions.plugin.getConfig().getBoolean("fbanners.Placeable.Warzone")) - || (fme.getFaction().getRelationTo(Board.getInstance().getFactionAt(fplacedLoc)) == Relation.ENEMY) && SavageFactions.plugin.getConfig().getBoolean("fbanners.Placeable.Enemy")) { - if (bannerCooldownMap.containsKey(fme.getTag())) { - fme.msg(TL.WARBANNER_COOLDOWN); - e.setCancelled(true); + @EventHandler + public void onBannerPlace(BlockPlaceEvent e) { + if (SavageFactions.plugin.mc17) { return; - } - for (FPlayer fplayer : fme.getFaction().getFPlayers()) { - // if (fplayer == fme) { continue; } //Idk if I wanna not send the title to the player - fplayer.getPlayer().sendTitle(SavageFactions.plugin.color(fme.getTag() + " Placed A WarBanner!"), SavageFactions.plugin.color("&7use &c/f tpbanner&7 to tp to the banner!")); - - } - bannerCooldownMap.put(fme.getTag(), true); - bannerLocations.put(fme.getTag(), e.getBlockPlaced().getLocation()); - final int bannerCooldown = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Place-Cooldown"); - final 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(SavageFactions.plugin.color(SavageFactions.plugin.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 - final ArmorStand armorStand = as; - final String tag = fme.getTag(); - Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, new Runnable() { - @Override - public void run() { - bannerCooldownMap.remove(tag); - } - }, Long.parseLong(bannerCooldown + "")); - final Block banner = e.getBlockPlaced(); - final Material bannerType = banner.getType(); - final Faction bannerFaction = fme.getFaction(); - banner.getWorld().strikeLightningEffect(banner.getLocation()); - // e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_LIGHTNING_IMPACT,2.0F,0.5F); - final int radius = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Effect-Radius"); - final List effects = SavageFactions.plugin.getConfig().getStringList("fbanners.Effects"); - final int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { - @Override - public void run() { - - for (Entity e : banner.getLocation().getWorld().getNearbyEntities(banner.getLocation(), radius, 255, radius)) { - if (e instanceof Player) { - Player player = (Player) e; - FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); - if (fplayer.getFaction() == bannerFaction) { - for (String effect : effects) { - String[] components = effect.split(":"); - player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(components[0]), 100, Integer.parseInt(components[1]))); - } - ParticleEffect.LAVA.display(1, 1, 1, 1, 10, banner.getLocation(), 16); - ParticleEffect.FLAME.display(1, 1, 1, 1, 10, banner.getLocation(), 16); - - if (banner.getType() != bannerType) { - banner.setType(bannerType); - } - } - } - } - } - }, 0L, 20L); - Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, new Runnable() { - @Override - public void run() { - banner.setType(Material.AIR); - as.remove(); - banner.getWorld().strikeLightningEffect(banner.getLocation()); - Bukkit.getScheduler().cancelTask(affectorTask); - bannerLocations.remove(bannerFaction.getTag()); - } - }, Long.parseLong(bannerTime + "")); - } else { - fme.msg(TL.WARBANNER_INVALIDLOC); - e.setCancelled(true); } - } - } - } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + if (e.getItemInHand().getType() == SavageFactions.plugin.BANNER) { + ItemStack bannerInHand = e.getItemInHand(); + FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer()); + ItemStack warBanner = fme.getFaction().getBanner(); + if (warBanner != null) { + ItemMeta warmeta = warBanner.getItemMeta(); + warmeta.setDisplayName(SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"))); + warmeta.setLore(SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fbanners.Item.Lore"))); + warBanner.setItemMeta(warmeta); + } else { + warBanner = SavageFactions.plugin.createItem(SavageFactions.plugin.BANNER, 1, (short) 1, SavageFactions.plugin.getConfig().getString("fbanners.Item.Name"), SavageFactions.plugin.getConfig().getStringList("fbanners.Item.Lore")); + } + if (warBanner.isSimilar(bannerInHand)) { + + if (fme.getFaction().isWilderness()) { + fme.msg(TL.WARBANNER_NOFACTION); + e.setCancelled(true); + return; + } + int bannerTime = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Time") * 20; + + Location placedLoc = e.getBlockPlaced().getLocation(); + FLocation fplacedLoc = new FLocation(placedLoc); + if ((Board.getInstance().getFactionAt(fplacedLoc).isWarZone() && SavageFactions.plugin.getConfig().getBoolean("fbanners.Placeable.Warzone")) + || (fme.getFaction().getRelationTo(Board.getInstance().getFactionAt(fplacedLoc)) == Relation.ENEMY) && SavageFactions.plugin.getConfig().getBoolean("fbanners.Placeable.Enemy")) { + if (bannerCooldownMap.containsKey(fme.getTag())) { + fme.msg(TL.WARBANNER_COOLDOWN); + e.setCancelled(true); + return; + } + for (FPlayer fplayer : fme.getFaction().getFPlayers()) { + // if (fplayer == fme) { continue; } //Idk if I wanna not send the title to the player + fplayer.getPlayer().sendTitle(SavageFactions.plugin.color(fme.getTag() + " Placed A WarBanner!"), SavageFactions.plugin.color("&7use &c/f tpbanner&7 to tp to the banner!")); + + } + bannerCooldownMap.put(fme.getTag(), true); + bannerLocations.put(fme.getTag(), e.getBlockPlaced().getLocation()); + final int bannerCooldown = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Place-Cooldown"); + final 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(SavageFactions.plugin.color(SavageFactions.plugin.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 + final ArmorStand armorStand = as; + final String tag = fme.getTag(); + Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, new Runnable() { + @Override + public void run() { + bannerCooldownMap.remove(tag); + } + }, Long.parseLong(bannerCooldown + "")); + final Block banner = e.getBlockPlaced(); + final Material bannerType = banner.getType(); + final Faction bannerFaction = fme.getFaction(); + banner.getWorld().strikeLightningEffect(banner.getLocation()); + // e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_LIGHTNING_IMPACT,2.0F,0.5F); + final int radius = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Effect-Radius"); + final List effects = SavageFactions.plugin.getConfig().getStringList("fbanners.Effects"); + final int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { + @Override + public void run() { + + for (Entity e : banner.getLocation().getWorld().getNearbyEntities(banner.getLocation(), radius, 255, radius)) { + if (e instanceof Player) { + Player player = (Player) e; + FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); + if (fplayer.getFaction() == bannerFaction) { + for (String effect : effects) { + String[] components = effect.split(":"); + player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(components[0]), 100, Integer.parseInt(components[1]))); + } + ParticleEffect.LAVA.display(1, 1, 1, 1, 10, banner.getLocation(), 16); + ParticleEffect.FLAME.display(1, 1, 1, 1, 10, banner.getLocation(), 16); + + if (banner.getType() != bannerType) { + banner.setType(bannerType); + } + } + } + } + } + }, 0L, 20L); + Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, new Runnable() { + @Override + public void run() { + banner.setType(Material.AIR); + as.remove(); + banner.getWorld().strikeLightningEffect(banner.getLocation()); + Bukkit.getScheduler().cancelTask(affectorTask); + bannerLocations.remove(bannerFaction.getTag()); + } + }, Long.parseLong(bannerTime + "")); + } else { + fme.msg(TL.WARBANNER_INVALIDLOC); + e.setCancelled(true); + } + } + } + } + + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onFrostWalker(EntityBlockFormEvent event) { if (event.getEntity() == null || event.getEntity().getType() != EntityType.PLAYER || event.getBlock() == null) { return; @@ -462,12 +462,12 @@ public class FactionsBlockListener implements Listener { // only notify every 10 seconds FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); boolean justCheck = fPlayer.getLastFrostwalkerMessage() + 10000 > System.currentTimeMillis(); - if (!justCheck) { + if (! justCheck) { fPlayer.setLastFrostwalkerMessage(); } // Check if they have build permissions here. If not, block this from happening. - if (!playerCanBuildDestroyBlock(player, location, "frostwalk", justCheck)) { + if (! playerCanBuildDestroyBlock(player, location, "frostwalk", justCheck)) { event.setCancelled(true); } } @@ -481,39 +481,39 @@ public class FactionsBlockListener implements Listener { } if (otherFaction.isWilderness()) { - return !Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName()); + return ! Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName()); } else if (otherFaction.isSafeZone()) { - return !Conf.safeZoneDenyBuild; + return ! Conf.safeZoneDenyBuild; } else if (otherFaction.isWarZone()) { - return !Conf.warZoneDenyBuild; + return ! Conf.warZoneDenyBuild; } Relation rel = pistonFaction.getRelationTo(otherFaction); - return !rel.confDenyBuild(otherFaction.hasPlayersOnline()); + return ! rel.confDenyBuild(otherFaction.hasPlayersOnline()); } - @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) - public void onBlockBreak(BlockBreakEvent event) { - if (! playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) { - event.setCancelled(true); - return; - } - FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer()); - if (! fme.hasFaction()) { - return; + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) + public void onBlockBreak(BlockBreakEvent event) { + if (! playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) { + event.setCancelled(true); + return; } - if (event.getBlock().getType() == SavageFactions.plugin.MOB_SPANWER) { - if (! fme.isAdminBypassing()) { - Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER); - if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners"); - return; + FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer()); + if (! fme.hasFaction()) { + return; + } + if (event.getBlock().getType() == SavageFactions.plugin.MOB_SPANWER) { + if (! fme.isAdminBypassing()) { + Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER); + if (access != Access.ALLOW && fme.getRole() != Role.LEADER) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners"); + return; } } + } } - } } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java index 22cb0349..c49ca256 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java @@ -19,15 +19,15 @@ import java.util.logging.Level; public class FactionsChatListener implements Listener { - public SavageFactions savageFactions; + public SavageFactions savageFactions; - public FactionsChatListener(SavageFactions savageFactions) { - this.savageFactions = savageFactions; + public FactionsChatListener(SavageFactions savageFactions) { + this.savageFactions = savageFactions; } // this is for handling slashless command usage and faction/alliance chat, set at lowest priority so Factions gets to them first - @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + @EventHandler (priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerEarlyChat(AsyncPlayerChatEvent event) { Player talkingPlayer = event.getPlayer(); String msg = event.getMessage(); @@ -100,7 +100,7 @@ public class FactionsChatListener implements Listener { //Send to all our allies for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { - if (myFaction.getRelationTo(fplayer) == Relation.ALLY && !fplayer.isIgnoreAllianceChat()) { + if (myFaction.getRelationTo(fplayer) == Relation.ALLY && ! fplayer.isIgnoreAllianceChat()) { fplayer.sendMessage(message); } else if (fplayer.isSpyingChat() && me != fplayer) { fplayer.sendMessage("[ACspy]: " + message); @@ -134,11 +134,11 @@ public class FactionsChatListener implements Listener { // this is for handling insertion of the player's faction tag, set at highest priority to give other plugins a chance to modify chat first - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + @EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerChat(AsyncPlayerChatEvent event) { // Are we to insert the Faction tag into the format? // If we are not to insert it - we are done. - if (!Conf.chatTagEnabled || Conf.chatTagHandledByAnotherPlugin) { + if (! Conf.chatTagEnabled || Conf.chatTagHandledByAnotherPlugin) { return; } @@ -148,7 +148,7 @@ public class FactionsChatListener implements Listener { FPlayer me = FPlayers.getInstance().getByPlayer(talkingPlayer); int InsertIndex; - if (!Conf.chatTagReplaceString.isEmpty() && eventFormat.contains(Conf.chatTagReplaceString)) { + if (! Conf.chatTagReplaceString.isEmpty() && eventFormat.contains(Conf.chatTagReplaceString)) { // we're using the "replace" method of inserting the faction tags if (eventFormat.contains("[FACTION_TITLE]")) { eventFormat = eventFormat.replace("[FACTION_TITLE]", me.getTitle()); @@ -158,10 +158,10 @@ public class FactionsChatListener implements Listener { eventFormat = eventFormat.replace(Conf.chatTagReplaceString, ""); Conf.chatTagPadAfter = false; Conf.chatTagPadBefore = false; - } else if (!Conf.chatTagInsertAfterString.isEmpty() && eventFormat.contains(Conf.chatTagInsertAfterString)) { + } else if (! Conf.chatTagInsertAfterString.isEmpty() && eventFormat.contains(Conf.chatTagInsertAfterString)) { // we're using the "insert after string" method InsertIndex = eventFormat.indexOf(Conf.chatTagInsertAfterString) + Conf.chatTagInsertAfterString.length(); - } else if (!Conf.chatTagInsertBeforeString.isEmpty() && eventFormat.contains(Conf.chatTagInsertBeforeString)) { + } else if (! Conf.chatTagInsertBeforeString.isEmpty() && eventFormat.contains(Conf.chatTagInsertBeforeString)) { // we're using the "insert before string" method InsertIndex = eventFormat.indexOf(Conf.chatTagInsertBeforeString); } else { @@ -172,8 +172,8 @@ public class FactionsChatListener implements Listener { } } - String formatStart = eventFormat.substring(0, InsertIndex) + ((Conf.chatTagPadBefore && !me.getChatTag().isEmpty()) ? " " : ""); - String formatEnd = ((Conf.chatTagPadAfter && !me.getChatTag().isEmpty()) ? " " : "") + eventFormat.substring(InsertIndex); + String formatStart = eventFormat.substring(0, InsertIndex) + ((Conf.chatTagPadBefore && ! me.getChatTag().isEmpty()) ? " " : ""); + String formatEnd = ((Conf.chatTagPadAfter && ! me.getChatTag().isEmpty()) ? " " : "") + eventFormat.substring(InsertIndex); String nonColoredMsgFormat = formatStart + me.getChatTag().trim() + formatEnd; @@ -190,9 +190,9 @@ public class FactionsChatListener implements Listener { listeningPlayer.sendMessage(String.format(yourFormat, talkingPlayer.getDisplayName(), msg)); } catch (UnknownFormatConversionException ex) { Conf.chatTagInsertIndex = 0; - SavageFactions.plugin.log(Level.SEVERE, "Critical error in chat message formatting!"); - SavageFactions.plugin.log(Level.SEVERE, "NOTE: This has been automatically fixed right now by setting chatTagInsertIndex to 0."); - SavageFactions.plugin.log(Level.SEVERE, "For a more proper fix, please read this regarding chat configuration: http://massivecraft.com/plugins/factions/config#Chat_configuration"); + SavageFactions.plugin.log(Level.SEVERE, "Critical error in chat message formatting!"); + SavageFactions.plugin.log(Level.SEVERE, "NOTE: This has been automatically fixed right now by setting chatTagInsertIndex to 0."); + SavageFactions.plugin.log(Level.SEVERE, "For a more proper fix, please read this regarding chat configuration: http://massivecraft.com/plugins/factions/config#Chat_configuration"); return; } } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index f1165d07..12705009 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -32,16 +32,16 @@ import java.util.*; public class FactionsEntityListener implements Listener { private static final Set badPotionEffects = new LinkedHashSet<>(Arrays.asList(PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HARM, PotionEffectType.HUNGER, PotionEffectType.POISON, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS, PotionEffectType.WITHER)); - public SavageFactions savageFactions; + public SavageFactions savageFactions; - public FactionsEntityListener(SavageFactions savageFactions) { - this.savageFactions = savageFactions; + public FactionsEntityListener(SavageFactions savageFactions) { + this.savageFactions = savageFactions; } - @EventHandler(priority = EventPriority.NORMAL) + @EventHandler (priority = EventPriority.NORMAL) public void onEntityDeath(EntityDeathEvent event) { Entity entity = event.getEntity(); - if (!(entity instanceof Player)) { + if (! (entity instanceof Player)) { return; } @@ -53,14 +53,14 @@ public class FactionsEntityListener implements Listener { // Check for no power loss conditions if (faction.isWarZone()) { // war zones always override worldsNoPowerLoss either way, thus this layout - if (!Conf.warZonePowerLoss) { + if (! Conf.warZonePowerLoss) { powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_WARZONE.toString()); powerLossEvent.setCancelled(true); } if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { powerLossEvent.setMessage(TL.PLAYER_POWER_LOSS_WARZONE.toString()); } - } else if (faction.isWilderness() && !Conf.wildernessPowerLoss && !Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) { + } else if (faction.isWilderness() && ! Conf.wildernessPowerLoss && ! Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) { powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_WILDERNESS.toString()); powerLossEvent.setCancelled(true); } else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { @@ -77,12 +77,12 @@ public class FactionsEntityListener implements Listener { Bukkit.getPluginManager().callEvent(powerLossEvent); // Call player onDeath if the event is not cancelled - if (!powerLossEvent.isCancelled()) { + if (! powerLossEvent.isCancelled()) { fplayer.onDeath(); } // Send the message from the powerLossEvent final String msg = powerLossEvent.getMessage(); - if (msg != null && !msg.isEmpty()) { + if (msg != null && ! msg.isEmpty()) { fplayer.msg(msg, fplayer.getPowerRounded(), fplayer.getPowerMaxRounded()); } } @@ -91,11 +91,11 @@ public class FactionsEntityListener implements Listener { * Who can I hurt? I can never hurt members or allies. I can always hurt enemies. I can hurt neutrals as long as * they are outside their own territory. */ - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onEntityDamage(EntityDamageEvent event) { if (event instanceof EntityDamageByEntityEvent) { EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event; - if (!this.canDamagerHurtDamagee(sub, true)) { + if (! this.canDamagerHurtDamagee(sub, true)) { event.setCancelled(true); } // event is not cancelled by factions @@ -152,13 +152,13 @@ public class FactionsEntityListener implements Listener { entityAction = "armor stands"; } - if (!FactionsBlockListener.playerCanBuildDestroyBlock((Player) damager, damagee.getLocation(), "destroy " + entityAction, false)) { + if (! FactionsBlockListener.playerCanBuildDestroyBlock((Player) damager, damagee.getLocation(), "destroy " + entityAction, false)) { event.setCancelled(true); } } else { // we don't want to let mobs/arrows destroy item frames/armor stands // so we only have to run the check as if there had been an explosion at the damager location - if (!this.checkExplosionForBlock(damager, damagee.getLocation().getBlock())) { + if (! this.checkExplosionForBlock(damager, damagee.getLocation().getBlock())) { event.setCancelled(true); } } @@ -198,7 +198,7 @@ public class FactionsEntityListener implements Listener { } else if (event.getCause() == EntityDamageEvent.DamageCause.FALL && event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); - if (fPlayer != null && !fPlayer.shouldTakeFallDamage()) { + if (fPlayer != null && ! fPlayer.shouldTakeFallDamage()) { event.setCancelled(true); // Falling after /f fly } } @@ -232,18 +232,18 @@ public class FactionsEntityListener implements Listener { return; } UUID uuid = player.getUniqueId(); - if (SavageFactions.plugin.getStuckMap().containsKey(uuid)) { + if (SavageFactions.plugin.getStuckMap().containsKey(uuid)) { FPlayers.getInstance().getByPlayer(player).msg(TL.COMMAND_STUCK_CANCELLED); - SavageFactions.plugin.getStuckMap().remove(uuid); + SavageFactions.plugin.getStuckMap().remove(uuid); } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onEntityExplode(EntityExplodeEvent event) { Entity boomer = event.getEntity(); // Before we need to check the location where the block is placed - if (!this.checkExplosionForBlock(boomer, event.getLocation().getBlock())) { + if (! this.checkExplosionForBlock(boomer, event.getLocation().getBlock())) { event.setCancelled(true); return; } @@ -254,7 +254,7 @@ public class FactionsEntityListener implements Listener { while (blockList.hasNext()) { Block block = blockList.next(); - if (!this.checkExplosionForBlock(boomer, block)) { + if (! this.checkExplosionForBlock(boomer, block)) { // The block don't have to explode blockList.remove(); } @@ -275,11 +275,11 @@ public class FactionsEntityListener implements Listener { // a single surrounding block in all 6 directions is broken if the material is weak enough List targets = new ArrayList<>(); targets.add(center.getRelative(0, 0, 1)); - targets.add(center.getRelative(0, 0, -1)); + targets.add(center.getRelative(0, 0, - 1)); targets.add(center.getRelative(0, 1, 0)); - targets.add(center.getRelative(0, -1, 0)); + targets.add(center.getRelative(0, - 1, 0)); targets.add(center.getRelative(1, 0, 0)); - targets.add(center.getRelative(-1, 0, 0)); + targets.add(center.getRelative(- 1, 0, 0)); for (Block target : targets) { int id = target.getType().getId(); // ignore air, bedrock, water, lava, obsidian, enchanting table, etc.... too bad we can't get a blast resistance value through Bukkit yet @@ -301,7 +301,7 @@ public class FactionsEntityListener implements Listener { boolean online = faction.hasPlayersOnline(); - if (boomer instanceof Creeper && ((faction.isWilderness() && Conf.wildernessBlockCreepers && !Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) || + if (boomer instanceof Creeper && ((faction.isWilderness() && Conf.wildernessBlockCreepers && ! Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) || (faction.isNormal() && (online ? Conf.territoryBlockCreepers : Conf.territoryBlockCreepersWhenOffline)) || (faction.isWarZone() && Conf.warZoneBlockCreepers) || faction.isSafeZone())) { @@ -309,31 +309,31 @@ public class FactionsEntityListener implements Listener { return false; } else if ( // it's a bit crude just using fireball protection for Wither boss too, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever - (boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) || + (boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ((faction.isWilderness() && Conf.wildernessBlockFireballs && ! Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) || (faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) || (faction.isWarZone() && Conf.warZoneBlockFireballs) || faction.isSafeZone())) { // ghast fireball which needs prevention return false; } else - return (!(boomer instanceof TNTPrimed) && !(boomer instanceof ExplosiveMinecart)) || ((!faction.isWilderness() || !Conf.wildernessBlockTNT || Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) && - (!faction.isNormal() || (online ? !Conf.territoryBlockTNT : !Conf.territoryBlockTNTWhenOffline)) && - (!faction.isWarZone() || !Conf.warZoneBlockTNT) && - (!faction.isSafeZone() || !Conf.safeZoneBlockTNT)); + return (! (boomer instanceof TNTPrimed) && ! (boomer instanceof ExplosiveMinecart)) || ((! faction.isWilderness() || ! Conf.wildernessBlockTNT || Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) && + (! faction.isNormal() || (online ? ! Conf.territoryBlockTNT : ! Conf.territoryBlockTNTWhenOffline)) && + (! faction.isWarZone() || ! Conf.warZoneBlockTNT) && + (! faction.isSafeZone() || ! Conf.safeZoneBlockTNT)); // No condition retained, destroy the block! } // mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onEntityCombustByEntity(EntityCombustByEntityEvent event) { EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE, 0d); - if (!this.canDamagerHurtDamagee(sub, false)) { + if (! this.canDamagerHurtDamagee(sub, false)) { event.setCancelled(true); } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPotionSplashEvent(PotionSplashEvent event) { // see if the potion has a harmful effect boolean badjuju = false; @@ -343,12 +343,12 @@ public class FactionsEntityListener implements Listener { break; } } - if (!badjuju) { + if (! badjuju) { return; } ProjectileSource thrower = event.getPotion().getShooter(); - if (!(thrower instanceof Entity)) { + if (! (thrower instanceof Entity)) { return; } @@ -364,14 +364,14 @@ public class FactionsEntityListener implements Listener { // scan through affected entities to make sure they're all valid targets for (LivingEntity target : event.getAffectedEntities()) { EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent((Entity) thrower, target, EntityDamageEvent.DamageCause.CUSTOM, 0); - if (!this.canDamagerHurtDamagee(sub, true)) { + if (! this.canDamagerHurtDamagee(sub, true)) { event.setIntensity(target, 0.0); // affected entity list doesn't accept modification (so no iter.remove()), but this works } } } public boolean isPlayerInSafeZone(Entity damagee) { - if (!(damagee instanceof Player)) { + if (! (damagee instanceof Player)) { return false; } return Board.getInstance().getFactionAt(new FLocation(damagee.getLocation())).isSafeZone(); @@ -385,7 +385,7 @@ public class FactionsEntityListener implements Listener { Entity damager = sub.getDamager(); Entity damagee = sub.getEntity(); - if (!(damagee instanceof Player)) { + if (! (damagee instanceof Player)) { return true; } @@ -402,7 +402,7 @@ public class FactionsEntityListener implements Listener { if (damager instanceof Projectile) { Projectile projectile = (Projectile) damager; - if (!(projectile.getShooter() instanceof Entity)) { + if (! (projectile.getShooter() instanceof Entity)) { return true; } @@ -423,10 +423,10 @@ public class FactionsEntityListener implements Listener { } return false; } - return !defLocFaction.noMonstersInTerritory(); + return ! defLocFaction.noMonstersInTerritory(); } - if (!(damager instanceof Player)) { + if (! (damager instanceof Player)) { return true; } @@ -508,7 +508,7 @@ public class FactionsEntityListener implements Listener { } // Players without faction may be hurt anywhere - if (!defender.hasFaction()) { + if (! defender.hasFaction()) { return true; } @@ -547,7 +547,7 @@ public class FactionsEntityListener implements Listener { return true; } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onCreatureSpawn(CreatureSpawnEvent event) { if (event.getLocation() == null) { return; @@ -558,7 +558,7 @@ public class FactionsEntityListener implements Listener { } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onEntityTarget(EntityTargetEvent event) { // if there is a target Entity target = event.getTarget(); @@ -567,7 +567,7 @@ public class FactionsEntityListener implements Listener { } // We are interested in blocking targeting for certain mobs: - if (!Conf.safeZoneNerfedCreatureTypes.contains(MiscUtil.creatureTypeFromEntity(event.getEntity()))) { + if (! Conf.safeZoneNerfedCreatureTypes.contains(MiscUtil.creatureTypeFromEntity(event.getEntity()))) { return; } @@ -577,7 +577,7 @@ public class FactionsEntityListener implements Listener { } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPaintingBreak(HangingBreakEvent event) { if (event.getCause() == RemoveCause.EXPLOSION) { Location loc = event.getEntity().getLocation(); @@ -590,7 +590,7 @@ public class FactionsEntityListener implements Listener { boolean online = faction.hasPlayersOnline(); - if ((faction.isWilderness() && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()) && (Conf.wildernessBlockCreepers || Conf.wildernessBlockFireballs || Conf.wildernessBlockTNT)) || + if ((faction.isWilderness() && ! Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()) && (Conf.wildernessBlockCreepers || Conf.wildernessBlockFireballs || Conf.wildernessBlockTNT)) || (faction.isNormal() && (online ? (Conf.territoryBlockCreepers || Conf.territoryBlockFireballs || Conf.territoryBlockTNT) : (Conf.territoryBlockCreepersWhenOffline || Conf.territoryBlockFireballsWhenOffline || Conf.territoryBlockTNTWhenOffline))) || (faction.isWarZone() && (Conf.warZoneBlockCreepers || Conf.warZoneBlockFireballs || Conf.warZoneBlockTNT)) || faction.isSafeZone()) { @@ -599,35 +599,35 @@ public class FactionsEntityListener implements Listener { } } - if (!(event instanceof HangingBreakByEntityEvent)) { + if (! (event instanceof HangingBreakByEntityEvent)) { return; } Entity breaker = ((HangingBreakByEntityEvent) event).getRemover(); - if (!(breaker instanceof Player)) { + if (! (breaker instanceof Player)) { return; } - if (!FactionsBlockListener.playerCanBuildDestroyBlock((Player) breaker, event.getEntity().getLocation(), "remove paintings", false)) { + if (! FactionsBlockListener.playerCanBuildDestroyBlock((Player) breaker, event.getEntity().getLocation(), "remove paintings", false)) { event.setCancelled(true); } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPaintingPlace(HangingPlaceEvent event) { - if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) { + if (! FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) { event.setCancelled(true); // Fix: update player's inventory to avoid items glitches event.getPlayer().updateInventory(); } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onEntityChangeBlock(EntityChangeBlockEvent event) { Entity entity = event.getEntity(); // for now, only interested in Enderman and Wither boss tomfoolery - if (!(entity instanceof Enderman) && !(entity instanceof Wither)) { + if (! (entity instanceof Enderman) && ! (entity instanceof Wither)) { return; } @@ -640,7 +640,7 @@ public class FactionsEntityListener implements Listener { } else if (entity instanceof Wither) { Faction faction = Board.getInstance().getFactionAt(new FLocation(loc)); // it's a bit crude just using fireball protection, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever - if ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || + if ((faction.isWilderness() && Conf.wildernessBlockFireballs && ! Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || (faction.isNormal() && (faction.hasPlayersOnline() ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) || (faction.isWarZone() && Conf.warZoneBlockFireballs) || faction.isSafeZone()) { @@ -651,7 +651,7 @@ public class FactionsEntityListener implements Listener { @EventHandler public void onTravel(PlayerPortalEvent event) { - if (! SavageFactions.plugin.getConfig().getBoolean("portals.limit", false)) { + if (! SavageFactions.plugin.getConfig().getBoolean("portals.limit", false)) { return; // Don't do anything if they don't want us to. } @@ -663,15 +663,15 @@ public class FactionsEntityListener implements Listener { Faction faction = Board.getInstance().getFactionAt(loc); if (faction.isWilderness()) { return; // We don't care about wilderness. - } else if (!faction.isNormal() && !event.getPlayer().isOp()) { + } else if (! faction.isNormal() && ! event.getPlayer().isOp()) { // Don't let non ops make portals in safezone or warzone. event.setCancelled(true); return; } FPlayer fp = FPlayers.getInstance().getByPlayer(event.getPlayer()); - String mininumRelation = SavageFactions.plugin.getConfig().getString("portals.minimum-relation", "MEMBER"); // Defaults to Neutral if typed wrong. - if (!fp.getFaction().getRelationTo(faction).isAtLeast(Relation.fromString(mininumRelation))) { + String mininumRelation = SavageFactions.plugin.getConfig().getString("portals.minimum-relation", "MEMBER"); // Defaults to Neutral if typed wrong. + if (! fp.getFaction().getRelationTo(faction).isAtLeast(Relation.fromString(mininumRelation))) { event.setCancelled(true); } } @@ -718,7 +718,7 @@ public class FactionsEntityListener implements Listener { } // For disabling interactions with item frames in another faction's territory - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { // only need to check for item frames if (event.getRightClicked().getType() != EntityType.ITEM_FRAME) { @@ -728,13 +728,13 @@ public class FactionsEntityListener implements Listener { Player player = event.getPlayer(); Entity entity = event.getRightClicked(); - if (!FactionsBlockListener.playerCanBuildDestroyBlock(player, entity.getLocation(), "use item frames", false)) { + if (! FactionsBlockListener.playerCanBuildDestroyBlock(player, entity.getLocation(), "use item frames", false)) { event.setCancelled(true); } } // For disabling interactions with armor stands in another faction's territory - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) { Entity entity = event.getRightClicked(); @@ -743,7 +743,7 @@ public class FactionsEntityListener implements Listener { return; } - if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), entity.getLocation(), "use armor stands", false)) { + if (! FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), entity.getLocation(), "use armor stands", false)) { 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 3d4fe05f..b2703e4c 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java @@ -18,9 +18,9 @@ public class FactionsExploitListener implements Listener { return ((from.getX() > target.getX() && (from.getX() - target.getX() < thickness)) || (target.getX() > from.getX() && (target.getX() - from.getX() < thickness)) || (from.getZ() > target.getZ() && (from.getZ() - target.getZ() < thickness)) || (target.getZ() > from.getZ() && (target.getZ() - from.getZ() < thickness))); } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void obsidianGenerator(BlockFromToEvent event) { - if (!Conf.handleExploitObsidianGenerators) { + if (! Conf.handleExploitObsidianGenerators) { return; } @@ -33,9 +33,9 @@ public class FactionsExploitListener implements Listener { } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void enderPearlTeleport(PlayerTeleportEvent event) { - if (!Conf.handleExploitEnderPearlClipping) { + if (! Conf.handleExploitEnderPearlClipping) { return; } if (event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) { @@ -48,9 +48,9 @@ public class FactionsExploitListener implements Listener { // blocks who occupy less than 1 block width or length wise need to be handled differently Material mat = event.getTo().getBlock().getType(); - if (((mat == SavageFactions.plugin.THIN_GLASS - || mat == SavageFactions.plugin.IRON_FENCE) && clippingThrough(target, from, 0.65)) - || ((mat == SavageFactions.plugin.FENCE || mat == SavageFactions.plugin.NETHER_FENCE) && clippingThrough(target, from, 0.45))) { + if (((mat == SavageFactions.plugin.THIN_GLASS + || mat == SavageFactions.plugin.IRON_FENCE) && clippingThrough(target, from, 0.65)) + || ((mat == SavageFactions.plugin.FENCE || mat == SavageFactions.plugin.NETHER_FENCE) && clippingThrough(target, from, 0.45))) { event.setTo(from); return; } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 8871f3c2..d4f7e4fc 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -766,7 +766,6 @@ public class FactionsPlayerListener implements Listener { } - @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { /// Prevents the use of montster eggs in oned land. diff --git a/src/main/java/com/massivecraft/factions/scoreboards/BufferedObjective.java b/src/main/java/com/massivecraft/factions/scoreboards/BufferedObjective.java index d21d3898..853b3009 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/BufferedObjective.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/BufferedObjective.java @@ -62,7 +62,7 @@ public class BufferedObjective { } public void setTitle(String title) { - if (this.title == null || !this.title.equals(title)) { + if (this.title == null || ! this.title.equals(title)) { this.title = title; requiresUpdate = true; } @@ -88,7 +88,7 @@ public class BufferedObjective { } content = ChatColor.translateAlternateColorCodes('&', content); - if (contents.get(lineNumber) == null || !contents.get(lineNumber).equals(content)) { + if (contents.get(lineNumber) == null || ! contents.get(lineNumber).equals(content)) { contents.put(lineNumber, content); requiresUpdate = true; } @@ -102,7 +102,7 @@ public class BufferedObjective { } public void flip() { - if (!requiresUpdate) { + if (! requiresUpdate) { return; } requiresUpdate = false; diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java index 91b2c1e4..4be4f3ae 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java @@ -79,7 +79,7 @@ public class FScoreboard { } public void setSidebarVisibility(boolean visible) { - if (!isSupportedByServer()) { + if (! isSupportedByServer()) { return; } @@ -87,7 +87,7 @@ public class FScoreboard { } public void setDefaultSidebar(final FSidebarProvider provider, int updateInterval) { - if (!isSupportedByServer()) { + if (! isSupportedByServer()) { return; } @@ -113,7 +113,7 @@ public class FScoreboard { } public void setTemporarySidebar(final FSidebarProvider provider) { - if (!isSupportedByServer()) { + if (! isSupportedByServer()) { return; } diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java b/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java index 8975c25f..a40640f4 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java @@ -36,6 +36,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 SavageFactions.plugin.txt.parse(line); // finally add color :) + return SavageFactions.plugin.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 4bebea9d..8d0ba910 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java @@ -30,7 +30,7 @@ public class FTeamWrapper { } public static void applyUpdatesLater(final Faction faction) { - if (!FScoreboard.isSupportedByServer()) { + if (! FScoreboard.isSupportedByServer()) { return; } @@ -38,13 +38,13 @@ public class FTeamWrapper { return; } - if (! SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { + if (! SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { return; } if (updating.add(faction)) { - Bukkit.getScheduler().runTask(SavageFactions.plugin, new Runnable() { + Bukkit.getScheduler().runTask(SavageFactions.plugin, new Runnable() { @Override public void run() { updating.remove(faction); @@ -55,7 +55,7 @@ public class FTeamWrapper { } public static void applyUpdates(Faction faction) { - if (!FScoreboard.isSupportedByServer()) { + if (! FScoreboard.isSupportedByServer()) { return; } @@ -63,7 +63,7 @@ public class FTeamWrapper { return; } - if (! SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { + if (! SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { return; } @@ -88,14 +88,14 @@ public class FTeamWrapper { } for (OfflinePlayer player : wrapper.getPlayers()) { - if (!player.isOnline() || !factionMembers.contains(FPlayers.getInstance().getByOfflinePlayer(player))) { + if (! player.isOnline() || ! factionMembers.contains(FPlayers.getInstance().getByOfflinePlayer(player))) { // Player is offline or no longer in faction wrapper.removePlayer(player); } } for (FPlayer fmember : factionMembers) { - if (!fmember.isOnline()) { + if (! fmember.isOnline()) { continue; } @@ -107,11 +107,11 @@ public class FTeamWrapper { } public static void updatePrefixes(Faction faction) { - if (!FScoreboard.isSupportedByServer()) { + if (! FScoreboard.isSupportedByServer()) { return; } - if (!wrappers.containsKey(faction)) { + if (! wrappers.containsKey(faction)) { applyUpdates(faction); } else { wrappers.get(faction).updatePrefixes(); @@ -119,7 +119,7 @@ public class FTeamWrapper { } protected static void track(FScoreboard fboard) { - if (!FScoreboard.isSupportedByServer()) { + if (! FScoreboard.isSupportedByServer()) { return; } tracking.add(fboard); @@ -129,7 +129,7 @@ public class FTeamWrapper { } protected static void untrack(FScoreboard fboard) { - if (!FScoreboard.isSupportedByServer()) { + if (! FScoreboard.isSupportedByServer()) { return; } tracking.remove(fboard); @@ -155,7 +155,7 @@ public class FTeamWrapper { } private void updatePrefixes() { - if (SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { + if (SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { for (FScoreboard fboard : teams.keySet()) { updatePrefix(fboard); } @@ -163,18 +163,18 @@ public class FTeamWrapper { } private void updatePrefix(FScoreboard fboard) { - if (SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { + if (SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) { FPlayer fplayer = fboard.getFPlayer(); Team team = teams.get(fboard); String prefix = TL.DEFAULT_PREFIX.toString(); - if (SavageFactions.plugin.PlaceholderApi) { + if (SavageFactions.plugin.PlaceholderApi) { prefix = PlaceholderAPI.setPlaceholders(fplayer.getPlayer(), prefix); prefix = PlaceholderAPI.setBracketPlaceholders(fplayer.getPlayer(), prefix); } prefix = prefix.replace("{relationcolor}", faction.getRelationTo(fplayer).getColor().toString()); prefix = prefix.replace("{faction}", faction.getTag().substring(0, Math.min("{faction}".length() + 16 - prefix.length(), faction.getTag().length()))); - if (team.getPrefix() == null || !team.getPrefix().equals(prefix)) { + if (team.getPrefix() == null || ! team.getPrefix().equals(prefix)) { team.setPrefix(prefix); } } 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 5f62d2e0..5bdf32fa 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FDefaultSidebar.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FDefaultSidebar.java @@ -12,7 +12,7 @@ public class FDefaultSidebar extends FSidebarProvider { @Override public String getTitle(FPlayer fplayer) { - return replaceTags(fplayer, SavageFactions.plugin.getConfig().getString("scoreboard.default-title", "{name}")); + return replaceTags(fplayer, SavageFactions.plugin.getConfig().getString("scoreboard.default-title", "{name}")); } @Override @@ -26,7 +26,7 @@ public class FDefaultSidebar extends FSidebarProvider { } public List getOutput(FPlayer fplayer, String list) { - List lines = SavageFactions.plugin.getConfig().getStringList(list); + List lines = SavageFactions.plugin.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 82da69e0..93759678 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java @@ -22,7 +22,7 @@ public class FInfoSidebar extends FSidebarProvider { @Override public List getLines(FPlayer fplayer) { - List lines = SavageFactions.plugin.getConfig().getStringList("scoreboard.finfo"); + List lines = SavageFactions.plugin.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 7ba01724..f3c5c22e 100644 --- a/src/main/java/com/massivecraft/factions/struct/Permission.java +++ b/src/main/java/com/massivecraft/factions/struct/Permission.java @@ -114,7 +114,7 @@ public enum Permission { } public boolean has(CommandSender sender, boolean informSenderIfNot) { - return SavageFactions.plugin.perm.has(sender, this.node, informSenderIfNot); + return SavageFactions.plugin.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 e77a944c..5b01ebaf 100644 --- a/src/main/java/com/massivecraft/factions/struct/Relation.java +++ b/src/main/java/com/massivecraft/factions/struct/Relation.java @@ -196,7 +196,7 @@ public enum Relation implements Permissable { // Utility method to build items for F Perm GUI @Override public ItemStack buildItem() { - final ConfigurationSection RELATION_CONFIG = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.relation"); + final ConfigurationSection RELATION_CONFIG = SavageFactions.plugin.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/util/AutoLeaveProcessTask.java b/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java index 3c5d112d..1a9ebed4 100644 --- a/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java +++ b/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java @@ -29,7 +29,7 @@ public class AutoLeaveProcessTask extends BukkitRunnable { return; } - if (!readyToGo) { + if (! readyToGo) { return; } // this is set so it only does one iteration at a time, no matter how frequently the timer fires @@ -49,18 +49,18 @@ public class AutoLeaveProcessTask extends BukkitRunnable { FPlayer fplayer = iterator.next(); // Check if they should be exempt from this. - if (!fplayer.willAutoLeave()) { - SavageFactions.plugin.debug(Level.INFO, fplayer.getName() + " was going to be auto-removed but was set not to."); + if (! fplayer.willAutoLeave()) { + SavageFactions.plugin.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) { - SavageFactions.plugin.log("Player " + fplayer.getName() + " was auto-removed due to inactivity."); + SavageFactions.plugin.log("Player " + fplayer.getName() + " was auto-removed due to inactivity."); } // if player is faction admin, sort out the faction since he's going away - if (fplayer.getRole() == Role.LEADER) { + if (fplayer.getRole() == Role.LEADER) { Faction faction = fplayer.getFaction(); if (faction != null) { fplayer.getFaction().promoteNewLeader(); diff --git a/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java b/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java index 67634cf4..66b6d5c5 100644 --- a/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java +++ b/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java @@ -13,16 +13,16 @@ public class AutoLeaveTask implements Runnable { } public synchronized void run() { - if (task != null && !task.isFinished()) { + if (task != null && ! task.isFinished()) { return; } task = new AutoLeaveProcessTask(); - task.runTaskTimer(SavageFactions.plugin, 1, 1); + task.runTaskTimer(SavageFactions.plugin, 1, 1); // maybe setting has been changed? if so, restart this task at new rate if (this.rate != Conf.autoLeaveRoutineRunsEveryXMinutes) { - SavageFactions.plugin.startAutoLeaveTask(true); + SavageFactions.plugin.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 1d4661bd..c1099fb9 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 SavageFactions.plugin.getDescription().getVersion(); + return SavageFactions.plugin.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 SavageFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fPlayer.getId()))); + return SavageFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fPlayer.getId()))); case "player_balance": return Econ.isSetup() ? Econ.getFriendlyBalance(fPlayer) : TL.ECON_OFF.format("balance"); case "player_power": @@ -121,7 +121,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R case "faction_warps": return String.valueOf(faction.getWarps().size()); case "faction_raidable": - boolean raid = SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && faction.getLandRounded() >= faction.getPowerRounded(); + boolean raid = SavageFactions.plugin.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/EnumTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/EnumTypeAdapter.java index 08e0cbf5..8c65bc89 100644 --- a/src/main/java/com/massivecraft/factions/util/EnumTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/EnumTypeAdapter.java @@ -37,13 +37,13 @@ public final class EnumTypeAdapter> extends TypeAdapter { public static TypeAdapterFactory newEnumTypeHierarchyFactory() { return new TypeAdapterFactory() { - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings ({"rawtypes", "unchecked"}) public TypeAdapter create(Gson gson, TypeToken typeToken) { Class rawType = typeToken.getRawType(); - if (!Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) { + if (! Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) { return null; } - if (!rawType.isEnum()) { + if (! rawType.isEnum()) { rawType = rawType.getSuperclass(); // handle anonymous subclasses } return (TypeAdapter) new EnumTypeAdapter(rawType); diff --git a/src/main/java/com/massivecraft/factions/util/InventoryTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/InventoryTypeAdapter.java index 4cf36eb6..0b941b1d 100644 --- a/src/main/java/com/massivecraft/factions/util/InventoryTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/InventoryTypeAdapter.java @@ -17,7 +17,6 @@ public class InventoryTypeAdapter implements JsonSerializer, JsonDese } - @Override public Inventory deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) { JsonObject object = jsonElement.getAsJsonObject(); @@ -25,5 +24,4 @@ public class InventoryTypeAdapter implements JsonSerializer, JsonDese } - } diff --git a/src/main/java/com/massivecraft/factions/util/LazyLocation.java b/src/main/java/com/massivecraft/factions/util/LazyLocation.java index 985ce2db..898a700f 100644 --- a/src/main/java/com/massivecraft/factions/util/LazyLocation.java +++ b/src/main/java/com/massivecraft/factions/util/LazyLocation.java @@ -12,90 +12,90 @@ import java.io.Serializable; */ public class LazyLocation implements Serializable { - private static final long serialVersionUID = - 6049901271320963314L; - private transient Location location = null; - private String worldName; - private double x; - private double y; - private double z; - private float pitch; - private float yaw; + private static final long serialVersionUID = - 6049901271320963314L; + private transient Location location = null; + private String worldName; + private double x; + private double y; + private double z; + private float pitch; + private float yaw; - public LazyLocation(Location loc) { - setLocation(loc); - } - - public LazyLocation(final String worldName, final double x, final double y, final double z) { - this(worldName, x, y, z, 0, 0); - } - - public LazyLocation(final String worldName, final double x, final double y, final double z, final float yaw, final float pitch) { - this.worldName = worldName; - this.x = x; - this.y = y; - this.z = z; - this.yaw = yaw; - this.pitch = pitch; - } - - // This returns the actual Location - public final Location getLocation() { - // make sure Location is initialized before returning it - initLocation(); - return location; - } - - // change the Location - public final void setLocation(Location loc) { - this.location = loc; - this.worldName = loc.getWorld().getName(); - this.x = loc.getX(); - this.y = loc.getY(); - this.z = loc.getZ(); - this.yaw = loc.getYaw(); - this.pitch = loc.getPitch(); - } - - - // This initializes the Location - private void initLocation() { - // if location is already initialized, simply return - if (location != null) { - return; + public LazyLocation(Location loc) { + setLocation(loc); } - // get World; hopefully it's initialized at this point - World world = Bukkit.getWorld(worldName); - if (world == null) { - return; + public LazyLocation(final String worldName, final double x, final double y, final double z) { + this(worldName, x, y, z, 0, 0); } - // store the Location for future calls, and pass it on - location = new Location(world, x, y, z, yaw, pitch); - } + public LazyLocation(final String worldName, final double x, final double y, final double z, final float yaw, final float pitch) { + this.worldName = worldName; + this.x = x; + this.y = y; + this.z = z; + this.yaw = yaw; + this.pitch = pitch; + } + + // This returns the actual Location + public final Location getLocation() { + // make sure Location is initialized before returning it + initLocation(); + return location; + } + + // change the Location + public final void setLocation(Location loc) { + this.location = loc; + this.worldName = loc.getWorld().getName(); + this.x = loc.getX(); + this.y = loc.getY(); + this.z = loc.getZ(); + this.yaw = loc.getYaw(); + this.pitch = loc.getPitch(); + } - public final String getWorldName() { - return worldName; - } + // This initializes the Location + private void initLocation() { + // if location is already initialized, simply return + if (location != null) { + return; + } - public final double getX() { - return x; - } + // get World; hopefully it's initialized at this point + World world = Bukkit.getWorld(worldName); + if (world == null) { + return; + } - public final double getY() { - return y; - } + // store the Location for future calls, and pass it on + location = new Location(world, x, y, z, yaw, pitch); + } - public final double getZ() { - return z; - } - public final double getPitch() { - return pitch; - } + public final String getWorldName() { + return worldName; + } - public final double getYaw() { - return yaw; - } + public final double getX() { + return x; + } + + public final double getY() { + return y; + } + + public final double getZ() { + return z; + } + + public final double getPitch() { + return pitch; + } + + public final double getYaw() { + return yaw; + } } diff --git a/src/main/java/com/massivecraft/factions/util/LocationTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/LocationTypeAdapter.java index 62c297e5..6c5880a7 100644 --- a/src/main/java/com/massivecraft/factions/util/LocationTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/LocationTypeAdapter.java @@ -13,35 +13,35 @@ public class LocationTypeAdapter implements JsonSerializer, JsonDeseri @Override public JsonElement serialize(Location location, Type type, JsonSerializationContext jsonSerializationContext) { JsonObject object = new JsonObject(); - try { - object.add("x", new JsonPrimitive(location.getX())); - object.add("y", new JsonPrimitive(location.getY())); - object.add("z", new JsonPrimitive(location.getZ())); - object.add("world", new JsonPrimitive(location.getWorld().toString())); - return object; - } catch (Exception ex) { - ex.printStackTrace(); - SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Location."); - return object; - } + try { + object.add("x", new JsonPrimitive(location.getX())); + object.add("y", new JsonPrimitive(location.getY())); + object.add("z", new JsonPrimitive(location.getZ())); + object.add("world", new JsonPrimitive(location.getWorld().toString())); + return object; + } catch (Exception ex) { + ex.printStackTrace(); + SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Location."); + return object; + } } @Override public Location deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) { JsonObject object = jsonElement.getAsJsonObject(); - try { + try { - return new Location(Bukkit.getWorld(object.get("world").getAsString()), - object.get("x").getAsDouble(), - object.get("y").getAsDouble(), - object.get("z").getAsDouble()); - } catch (Exception ex) { - ex.printStackTrace(); - SavageFactions.plugin.log(Level.WARNING, "Error encountered while" + - " deserializing a Location."); - return null; - } + return new Location(Bukkit.getWorld(object.get("world").getAsString()), + object.get("x").getAsDouble(), + object.get("y").getAsDouble(), + object.get("z").getAsDouble()); + } catch (Exception ex) { + ex.printStackTrace(); + SavageFactions.plugin.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 c915ab69..7d506591 100644 --- a/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java @@ -52,7 +52,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")); public static EntityType creatureTypeFromEntity(Entity entity) { - if (!(entity instanceof Creature)) { + if (! (entity instanceof Creature)) { return null; } @@ -76,7 +76,7 @@ public class MiscUtil { } for (char c : str.toCharArray()) { - if (!substanceChars.contains(String.valueOf(c))) { + if (! substanceChars.contains(String.valueOf(c))) { errors.add(SavageFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c)); } } diff --git a/src/main/java/com/massivecraft/factions/util/MultiversionMaterials.java b/src/main/java/com/massivecraft/factions/util/MultiversionMaterials.java index fec95e36..b2df5ded 100644 --- a/src/main/java/com/massivecraft/factions/util/MultiversionMaterials.java +++ b/src/main/java/com/massivecraft/factions/util/MultiversionMaterials.java @@ -1,10 +1,10 @@ package com.massivecraft.factions.util; -import java.util.HashMap; - import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import java.util.HashMap; + public enum MultiversionMaterials { ACACIA_BOAT("BOAT_ACACIA", 0), @@ -858,27 +858,21 @@ public enum MultiversionMaterials { ZOMBIE_VILLAGER_SPAWN_EGG("MONSTER_EGG", 0), ZOMBIE_WALL_HEAD("SKULL", 0), ; + static int newV = - 1; + private static HashMap cachedSearch = new HashMap<>(); String m; int data; - MultiversionMaterials(String m, int data ){ + MultiversionMaterials(String m, int data) { this.m = m; this.data = data; } - public ItemStack parseItem(){ - Material mat = parseMaterial(); - if(isNewVersion()){ - return new ItemStack(mat); - } - return new ItemStack(mat,1,(byte) data); - } - static int newV = -1; - public static boolean isNewVersion(){ - if(newV == 0) return false; - if(newV == 1) return true; + public static boolean isNewVersion() { + if (newV == 0) return false; + if (newV == 1) return true; Material mat = Material.matchMaterial("RED_WOOL"); - if(mat != null){ + if (mat != null) { newV = 1; return true; } @@ -886,43 +880,65 @@ public enum MultiversionMaterials { return false; } - private static HashMap cachedSearch = new HashMap<>(); - public static MultiversionMaterials requestXMaterial(String name, byte data){ - if(cachedSearch.containsKey(name.toUpperCase()+","+data)){ - return cachedSearch.get(name.toUpperCase()+","+data); + public static MultiversionMaterials requestXMaterial(String name, byte data) { + if (cachedSearch.containsKey(name.toUpperCase() + "," + data)) { + return cachedSearch.get(name.toUpperCase() + "," + data); } - for(MultiversionMaterials mat:MultiversionMaterials.values()){ - if(name.toUpperCase().equals(mat.m) && ((byte)mat.data) == data){ - cachedSearch.put(mat.m+","+data,mat); + for (MultiversionMaterials mat : MultiversionMaterials.values()) { + if (name.toUpperCase().equals(mat.m) && ((byte) mat.data) == data) { + cachedSearch.put(mat.m + "," + data, mat); return mat; } } return null; } - public boolean isSameMaterial(ItemStack comp){ - if(isNewVersion()){ + public static MultiversionMaterials fromString(String key) { + MultiversionMaterials xmat = null; + try { + xmat = MultiversionMaterials.valueOf(key); + return xmat; + } catch (IllegalArgumentException e) { + String[] split = key.split(":"); + if (split.length == 1) { + xmat = requestXMaterial(key, (byte) 0); + } else { + xmat = requestXMaterial(split[0], (byte) Integer.parseInt(split[1])); + } + return xmat; + } + + } + + public ItemStack parseItem() { + Material mat = parseMaterial(); + if (isNewVersion()) { + return new ItemStack(mat); + } + return new ItemStack(mat, 1, (byte) data); + } + + public boolean isSameMaterial(ItemStack comp) { + if (isNewVersion()) { return comp.getType() == this.parseMaterial(); } - if(comp.getType() == this.parseMaterial() && - (int) comp.getData().getData() == (int) this.data){ + if (comp.getType() == this.parseMaterial() && + (int) comp.getData().getData() == this.data) { return true; } MultiversionMaterials xmat = fromMaterial(comp.getType()); - if(isDamageable(xmat)){ - if(this.parseMaterial() == comp.getType()){ - return true; - } + if (isDamageable(xmat)) { + return this.parseMaterial() == comp.getType(); } return false; } - public MultiversionMaterials fromMaterial(Material mat){ - try{ + public MultiversionMaterials fromMaterial(Material mat) { + try { return MultiversionMaterials.valueOf(mat.toString()); - }catch(IllegalArgumentException e){ - for(MultiversionMaterials xmat:MultiversionMaterials.values()){ - if(xmat.m.equals(mat.toString())){ + } catch (IllegalArgumentException e) { + for (MultiversionMaterials xmat : MultiversionMaterials.values()) { + if (xmat.m.equals(mat.toString())) { return xmat; } } @@ -930,27 +946,10 @@ public enum MultiversionMaterials { return null; } - public static MultiversionMaterials fromString(String key){ - MultiversionMaterials xmat = null; - try{ - xmat = MultiversionMaterials.valueOf(key); - return xmat; - }catch(IllegalArgumentException e){ - String[] split = key.split(":"); - if(split.length == 1){ - xmat = requestXMaterial(key,(byte) 0); - }else{ - xmat = requestXMaterial(split[0],(byte) Integer.parseInt(split[1])); - } - return xmat; - } - - } - - public boolean isDamageable(MultiversionMaterials type){ + public boolean isDamageable(MultiversionMaterials type) { String[] split = type.toString().split("_"); int length = split.length; - switch(split[length-1]){ + switch (split[length - 1]) { case "HELMET": return true; case "CHESTPLATE": @@ -984,9 +983,9 @@ public enum MultiversionMaterials { } } - public Material parseMaterial(){ + public Material parseMaterial() { Material mat = Material.matchMaterial(this.toString()); - if(mat != null){ + if (mat != null) { return mat; } return Material.matchMaterial(m); diff --git a/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java index fd4468de..72f5376d 100644 --- a/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java @@ -32,7 +32,7 @@ public class MyLocationTypeAdapter implements JsonDeserializer, Js } catch (Exception ex) { ex.printStackTrace(); - SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a LazyLocation."); + SavageFactions.plugin.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(); - SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a LazyLocation."); + SavageFactions.plugin.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 e555ca7e..fbeffb63 100644 --- a/src/main/java/com/massivecraft/factions/util/Particles/ParticleEffect.java +++ b/src/main/java/com/massivecraft/factions/util/Particles/ParticleEffect.java @@ -50,7 +50,7 @@ public enum ParticleEffect { *
  • The speed value influences the velocity at which the particle flies off * */ - EXPLOSION_NORMAL("explode", 0, -1, ParticleProperty.DIRECTIONAL), + EXPLOSION_NORMAL("explode", 0, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by exploding ghast fireballs and wither skulls: *
      @@ -58,7 +58,7 @@ public enum ParticleEffect { *
    • The speed value slightly influences the size of this particle effect *
    */ - EXPLOSION_LARGE("largeexplode", 1, -1), + EXPLOSION_LARGE("largeexplode", 1, - 1), /** * A particle effect which is displayed by exploding tnt and creepers: *
      @@ -66,7 +66,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - EXPLOSION_HUGE("hugeexplosion", 2, -1), + EXPLOSION_HUGE("hugeexplosion", 2, - 1), /** * A particle effect which is displayed by launching fireworks: *
      @@ -74,7 +74,7 @@ public enum ParticleEffect { *
    • The speed value influences the velocity at which the particle flies off *
    */ - FIREWORKS_SPARK("fireworksSpark", 3, -1, ParticleProperty.DIRECTIONAL), + FIREWORKS_SPARK("fireworksSpark", 3, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by swimming entities and arrows in water: *
      @@ -82,7 +82,7 @@ public enum ParticleEffect { *
    • The speed value influences the velocity at which the particle flies off *
    */ - WATER_BUBBLE("bubble", 4, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER), + WATER_BUBBLE("bubble", 4, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER), /** * A particle effect which is displayed by swimming entities and shaking wolves: *
      @@ -90,7 +90,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - WATER_SPLASH("splash", 5, -1, ParticleProperty.DIRECTIONAL), + WATER_SPLASH("splash", 5, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed on water when fishing: *
      @@ -106,7 +106,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - SUSPENDED("suspended", 7, -1, ParticleProperty.REQUIRES_WATER), + SUSPENDED("suspended", 7, - 1, ParticleProperty.REQUIRES_WATER), /** * A particle effect which is displayed by air when close to bedrock and the in the void: *
      @@ -114,7 +114,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - SUSPENDED_DEPTH("depthSuspend", 8, -1, ParticleProperty.DIRECTIONAL), + SUSPENDED_DEPTH("depthSuspend", 8, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed when landing a critical hit and by arrows: *
      @@ -122,7 +122,7 @@ public enum ParticleEffect { *
    • The speed value influences the velocity at which the particle flies off *
    */ - CRIT("crit", 9, -1, ParticleProperty.DIRECTIONAL), + CRIT("crit", 9, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed when landing a hit with an enchanted weapon: *
      @@ -130,7 +130,7 @@ public enum ParticleEffect { *
    • The speed value influences the velocity at which the particle flies off *
    */ - CRIT_MAGIC("magicCrit", 10, -1, ParticleProperty.DIRECTIONAL), + CRIT_MAGIC("magicCrit", 10, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by primed tnt, torches, droppers, dispensers, end portals, brewing stands and monster spawners: *
      @@ -138,7 +138,7 @@ public enum ParticleEffect { *
    • The speed value influences the velocity at which the particle flies off *
    */ - SMOKE_NORMAL("smoke", 11, -1, ParticleProperty.DIRECTIONAL), + SMOKE_NORMAL("smoke", 11, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by fire, minecarts with furnace and blazes: *
      @@ -146,7 +146,7 @@ public enum ParticleEffect { *
    • The speed value influences the velocity at which the particle flies off *
    */ - SMOKE_LARGE("largesmoke", 12, -1, ParticleProperty.DIRECTIONAL), + SMOKE_LARGE("largesmoke", 12, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed when splash potions or bottles o' enchanting hit something: *
      @@ -155,7 +155,7 @@ public enum ParticleEffect { *
    • Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0 *
    */ - SPELL("spell", 13, -1), + SPELL("spell", 13, - 1), /** * A particle effect which is displayed when instant splash potions hit something: *
      @@ -164,7 +164,7 @@ public enum ParticleEffect { *
    • Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0 *
    */ - SPELL_INSTANT("instantSpell", 14, -1), + SPELL_INSTANT("instantSpell", 14, - 1), /** * A particle effect which is displayed by entities with active potion effects: *
      @@ -173,7 +173,7 @@ public enum ParticleEffect { *
    • The particle color gets lighter when increasing the speed and darker when decreasing the speed *
    */ - SPELL_MOB("mobSpell", 15, -1, ParticleProperty.COLORABLE), + SPELL_MOB("mobSpell", 15, - 1, ParticleProperty.COLORABLE), /** * A particle effect which is displayed by entities with active potion effects applied through a beacon: *
      @@ -182,7 +182,7 @@ public enum ParticleEffect { *
    • The particle color gets lighter when increasing the speed and darker when decreasing the speed *
    */ - SPELL_MOB_AMBIENT("mobSpellAmbient", 16, -1, ParticleProperty.COLORABLE), + SPELL_MOB_AMBIENT("mobSpellAmbient", 16, - 1, ParticleProperty.COLORABLE), /** * A particle effect which is displayed by witches: *
      @@ -191,7 +191,7 @@ public enum ParticleEffect { *
    • Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0 *
    */ - SPELL_WITCH("witchMagic", 17, -1), + SPELL_WITCH("witchMagic", 17, - 1), /** * A particle effect which is displayed by blocks beneath a water source: *
      @@ -199,7 +199,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - DRIP_WATER("dripWater", 18, -1), + DRIP_WATER("dripWater", 18, - 1), /** * A particle effect which is displayed by blocks beneath a lava source: *
      @@ -207,7 +207,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - DRIP_LAVA("dripLava", 19, -1), + DRIP_LAVA("dripLava", 19, - 1), /** * A particle effect which is displayed when attacking a villager in a village: *
      @@ -215,7 +215,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - VILLAGER_ANGRY("angryVillager", 20, -1), + VILLAGER_ANGRY("angryVillager", 20, - 1), /** * A particle effect which is displayed when using bone meal and trading with a villager in a village: *
      @@ -223,7 +223,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - VILLAGER_HAPPY("happyVillager", 21, -1, ParticleProperty.DIRECTIONAL), + VILLAGER_HAPPY("happyVillager", 21, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by mycelium: *
      @@ -231,7 +231,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - TOWN_AURA("townaura", 22, -1, ParticleProperty.DIRECTIONAL), + TOWN_AURA("townaura", 22, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by note blocks: *
      @@ -239,7 +239,7 @@ public enum ParticleEffect { *
    • The speed value causes the particle to be colored green when set to 0 *
    */ - NOTE("note", 23, -1, ParticleProperty.COLORABLE), + NOTE("note", 23, - 1, ParticleProperty.COLORABLE), /** * A particle effect which is displayed by nether portals, endermen, ender pearls, eyes of ender, ender chests and dragon eggs: *
      @@ -247,7 +247,7 @@ public enum ParticleEffect { *
    • The speed value influences the spread of this particle effect *
    */ - PORTAL("portal", 24, -1, ParticleProperty.DIRECTIONAL), + PORTAL("portal", 24, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by enchantment tables which are nearby bookshelves: *
      @@ -255,7 +255,7 @@ public enum ParticleEffect { *
    • The speed value influences the spread of this particle effect *
    */ - ENCHANTMENT_TABLE("enchantmenttable", 25, -1, ParticleProperty.DIRECTIONAL), + ENCHANTMENT_TABLE("enchantmenttable", 25, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by torches, active furnaces, magma cubes and monster spawners: *
      @@ -263,7 +263,7 @@ public enum ParticleEffect { *
    • The speed value influences the velocity at which the particle flies off *
    */ - FLAME("flame", 26, -1, ParticleProperty.DIRECTIONAL), + FLAME("flame", 26, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by lava: *
      @@ -271,7 +271,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - LAVA("lava", 27, -1), + LAVA("lava", 27, - 1), /** * A particle effect which is currently unused: *
      @@ -279,7 +279,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - FOOTSTEP("footstep", 28, -1), + FOOTSTEP("footstep", 28, - 1), /** * A particle effect which is displayed when a mob dies: *
      @@ -287,7 +287,7 @@ public enum ParticleEffect { *
    • The speed value influences the velocity at which the particle flies off *
    */ - CLOUD("cloud", 29, -1, ParticleProperty.DIRECTIONAL), + CLOUD("cloud", 29, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by redstone ore, powered redstone, redstone torches and redstone repeaters: *
      @@ -295,7 +295,7 @@ public enum ParticleEffect { *
    • The speed value causes the particle to be colored red when set to 0 *
    */ - REDSTONE("reddust", 30, -1, ParticleProperty.COLORABLE), + REDSTONE("reddust", 30, - 1, ParticleProperty.COLORABLE), /** * A particle effect which is displayed when snowballs hit a block: *
      @@ -303,7 +303,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - SNOWBALL("snowballpoof", 31, -1), + SNOWBALL("snowballpoof", 31, - 1), /** * A particle effect which is currently unused: *
      @@ -311,7 +311,7 @@ public enum ParticleEffect { *
    • The speed value influences the velocity at which the particle flies off *
    */ - SNOW_SHOVEL("snowshovel", 32, -1, ParticleProperty.DIRECTIONAL), + SNOW_SHOVEL("snowshovel", 32, - 1, ParticleProperty.DIRECTIONAL), /** * A particle effect which is displayed by slimes: *
      @@ -319,7 +319,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - SLIME("slime", 33, -1), + SLIME("slime", 33, - 1), /** * A particle effect which is displayed when breeding and taming animals: *
      @@ -327,7 +327,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - HEART("heart", 34, -1), + HEART("heart", 34, - 1), /** * A particle effect which is displayed by barriers: *
      @@ -342,7 +342,7 @@ public enum ParticleEffect { *
    • It looks like a little piece with an item texture *
    */ - ITEM_CRACK("iconcrack", 36, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA), + ITEM_CRACK("iconcrack", 36, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA), /** * A particle effect which is displayed when breaking blocks or sprinting: *
      @@ -350,7 +350,7 @@ public enum ParticleEffect { *
    • The speed value has no influence on this particle effect *
    */ - BLOCK_CRACK("blockcrack", 37, -1, ParticleProperty.REQUIRES_DATA), + BLOCK_CRACK("blockcrack", 37, - 1, ParticleProperty.REQUIRES_DATA), /** * A particle effect which is displayed when falling: *
      @@ -422,7 +422,7 @@ public enum ParticleEffect { */ public static ParticleEffect fromName(String name) { for (Entry entry : NAME_MAP.entrySet()) { - if (!entry.getKey().equalsIgnoreCase(name)) { + if (! entry.getKey().equalsIgnoreCase(name)) { continue; } return entry.getValue(); @@ -467,7 +467,7 @@ public enum ParticleEffect { String world = location.getWorld().getName(); for (Player player : players) { Location playerLocation = player.getLocation(); - if (!world.equals(playerLocation.getWorld().getName()) || playerLocation.distanceSquared(location) < 65536) { + if (! world.equals(playerLocation.getWorld().getName()) || playerLocation.distanceSquared(location) < 65536) { continue; } return true; @@ -539,7 +539,7 @@ public enum ParticleEffect { * @return Whether the particle effect is supported or not */ public boolean isSupported() { - if (requiredVersion == -1) { + if (requiredVersion == - 1) { return true; } return ParticlePacket.getVersion() >= requiredVersion; @@ -562,13 +562,13 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, double) */ public void display(float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } if (hasProperty(ParticleProperty.REQUIRES_DATA)) { throw new ParticleDataException("This particle effect requires additional data"); } - if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) { throw new IllegalArgumentException("There is no water at the center location"); } new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256, null).sendTo(center, range); @@ -591,13 +591,13 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, List) */ public void display(float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, List players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } if (hasProperty(ParticleProperty.REQUIRES_DATA)) { throw new ParticleDataException("This particle effect requires additional data"); } - if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) { throw new IllegalArgumentException("There is no water at the center location"); } new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), null).sendTo(center, players); @@ -636,16 +636,16 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, double) */ public void display(Vector direction, float speed, Location center, double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } if (hasProperty(ParticleProperty.REQUIRES_DATA)) { throw new ParticleDataException("This particle effect requires additional data"); } - if (!hasProperty(ParticleProperty.DIRECTIONAL)) { + if (! hasProperty(ParticleProperty.DIRECTIONAL)) { throw new IllegalArgumentException("This particle effect is not directional"); } - if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) { throw new IllegalArgumentException("There is no water at the center location"); } new ParticlePacket(this, direction, speed, range > 256, null).sendTo(center, range); @@ -665,16 +665,16 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, List) */ public void display(Vector direction, float speed, Location center, List players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } if (hasProperty(ParticleProperty.REQUIRES_DATA)) { throw new ParticleDataException("This particle effect requires additional data"); } - if (!hasProperty(ParticleProperty.DIRECTIONAL)) { + if (! hasProperty(ParticleProperty.DIRECTIONAL)) { throw new IllegalArgumentException("This particle effect is not directional"); } - if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) { throw new IllegalArgumentException("There is no water at the center location"); } new ParticlePacket(this, direction, speed, isLongDistance(center, players), null).sendTo(center, players); @@ -708,13 +708,13 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, double) */ public void display(ParticleColor color, Location center, double range) throws ParticleVersionException, ParticleColorException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } - if (!hasProperty(ParticleProperty.COLORABLE)) { + if (! hasProperty(ParticleProperty.COLORABLE)) { throw new ParticleColorException("This particle effect is not colorable"); } - if (!isColorCorrect(this, color)) { + if (! isColorCorrect(this, color)) { throw new ParticleColorException("The particle color type is incorrect"); } new ParticlePacket(this, color, range > 256).sendTo(center, range); @@ -732,13 +732,13 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, List) */ public void display(ParticleColor color, Location center, List players) throws ParticleVersionException, ParticleColorException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } - if (!hasProperty(ParticleProperty.COLORABLE)) { + if (! hasProperty(ParticleProperty.COLORABLE)) { throw new ParticleColorException("This particle effect is not colorable"); } - if (!isColorCorrect(this, color)) { + if (! isColorCorrect(this, color)) { throw new ParticleColorException("The particle color type is incorrect"); } new ParticlePacket(this, color, isLongDistance(center, players)).sendTo(center, players); @@ -775,13 +775,13 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, double) */ public void display(ParticleData data, float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, double range) throws ParticleVersionException, ParticleDataException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } - if (!hasProperty(ParticleProperty.REQUIRES_DATA)) { + if (! hasProperty(ParticleProperty.REQUIRES_DATA)) { throw new ParticleDataException("This particle effect does not require additional data"); } - if (!isDataCorrect(this, data)) { + if (! isDataCorrect(this, data)) { throw new ParticleDataException("The particle data type is incorrect"); } new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256, data).sendTo(center, range); @@ -804,13 +804,13 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, List) */ public void display(ParticleData data, float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, List players) throws ParticleVersionException, ParticleDataException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } - if (!hasProperty(ParticleProperty.REQUIRES_DATA)) { + if (! hasProperty(ParticleProperty.REQUIRES_DATA)) { throw new ParticleDataException("This particle effect does not require additional data"); } - if (!isDataCorrect(this, data)) { + if (! isDataCorrect(this, data)) { throw new ParticleDataException("The particle data type is incorrect"); } new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), data).sendTo(center, players); @@ -849,13 +849,13 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, double) */ public void display(ParticleData data, Vector direction, float speed, Location center, double range) throws ParticleVersionException, ParticleDataException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } - if (!hasProperty(ParticleProperty.REQUIRES_DATA)) { + if (! hasProperty(ParticleProperty.REQUIRES_DATA)) { throw new ParticleDataException("This particle effect does not require additional data"); } - if (!isDataCorrect(this, data)) { + if (! isDataCorrect(this, data)) { throw new ParticleDataException("The particle data type is incorrect"); } new ParticlePacket(this, direction, speed, range > 256, data).sendTo(center, range); @@ -875,13 +875,13 @@ public enum ParticleEffect { * @see ParticlePacket#sendTo(Location, List) */ public void display(ParticleData data, Vector direction, float speed, Location center, List players) throws ParticleVersionException, ParticleDataException { - if (!isSupported()) { + if (! isSupported()) { throw new ParticleVersionException("This particle effect is not supported by your server version"); } - if (!hasProperty(ParticleProperty.REQUIRES_DATA)) { + if (! hasProperty(ParticleProperty.REQUIRES_DATA)) { throw new ParticleDataException("This particle effect does not require additional data"); } - if (!isDataCorrect(this, data)) { + if (! isDataCorrect(this, data)) { throw new ParticleDataException("The particle data type is incorrect"); } new ParticlePacket(this, direction, speed, isLongDistance(center, players), data).sendTo(center, players); @@ -949,7 +949,7 @@ public enum ParticleEffect { * @param material Material of the item/block * @param data Data value of the item/block */ - @SuppressWarnings("deprecation") + @SuppressWarnings ("deprecation") public ParticleData(Material material, byte data) { this.material = material; this.data = data; @@ -1033,7 +1033,7 @@ public enum ParticleEffect { */ public BlockData(Material material, byte data) throws IllegalArgumentException { super(material, data); - if (!material.isBlock()) { + if (! material.isBlock()) { throw new IllegalArgumentException("The material is not a block"); } } @@ -1425,7 +1425,7 @@ public enum ParticleEffect { * @return The version number */ public static int getVersion() { - if (!initialized) { + if (! initialized) { initialize(); } return version; @@ -1530,7 +1530,7 @@ public enum ParticleEffect { String worldName = center.getWorld().getName(); double squared = range * range; for (Player player : Bukkit.getOnlinePlayers()) { - if (!player.getWorld().getName().equals(worldName) || player.getLocation().distanceSquared(center) > squared) { + if (! player.getWorld().getName().equals(worldName) || player.getLocation().distanceSquared(center) > squared) { continue; } sendTo(center, player); diff --git a/src/main/java/com/massivecraft/factions/util/Particles/ReflectionUtils.java b/src/main/java/com/massivecraft/factions/util/Particles/ReflectionUtils.java index 4758b937..108c5323 100644 --- a/src/main/java/com/massivecraft/factions/util/Particles/ReflectionUtils.java +++ b/src/main/java/com/massivecraft/factions/util/Particles/ReflectionUtils.java @@ -44,7 +44,7 @@ public final class ReflectionUtils { public static Constructor getConstructor(Class clazz, Class... parameterTypes) throws NoSuchMethodException { Class[] primitiveTypes = DataType.getPrimitive(parameterTypes); for (Constructor constructor : clazz.getConstructors()) { - if (!DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) { + if (! DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) { continue; } return constructor; @@ -118,7 +118,7 @@ public final class ReflectionUtils { public static Method getMethod(Class clazz, String methodName, Class... parameterTypes) throws NoSuchMethodException { Class[] primitiveTypes = DataType.getPrimitive(parameterTypes); for (Method method : clazz.getMethods()) { - if (!method.getName().equals(methodName) || !DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) { + if (! method.getName().equals(methodName) || ! DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) { continue; } return method; diff --git a/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java index 60b355dc..aeb8de97 100644 --- a/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java @@ -62,7 +62,7 @@ public class PermissionsMapTypeAdapter implements JsonDeserializer locations, Material material) { Set ploc = getPlayerLocations(player); for (Location location : locations) { @@ -47,7 +46,7 @@ public class VisualizeUtil { } } - @SuppressWarnings("deprecation") + @SuppressWarnings ("deprecation") public static void addBlocks(Player player, Collection blocks, Material material) { Set ploc = getPlayerLocations(player); for (Block block : blocks) { @@ -57,7 +56,7 @@ public class VisualizeUtil { } } - @SuppressWarnings("deprecation") + @SuppressWarnings ("deprecation") public static void clear(Player player) { Set locations = getPlayerLocations(player); if (locations == null) { diff --git a/src/main/java/com/massivecraft/factions/util/WarmUpUtil.java b/src/main/java/com/massivecraft/factions/util/WarmUpUtil.java index deef5c5e..7897f545 100644 --- a/src/main/java/com/massivecraft/factions/util/WarmUpUtil.java +++ b/src/main/java/com/massivecraft/factions/util/WarmUpUtil.java @@ -21,7 +21,7 @@ public class WarmUpUtil { player.msg(TL.WARMUPS_ALREADY); } else { player.msg(translationKey.format(action, delay)); - int id = SavageFactions.plugin.getServer().getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() { + int id = SavageFactions.plugin.getServer().getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() { @Override public void run() { player.stopWarmup(); @@ -36,7 +36,7 @@ public class WarmUpUtil { } public enum Warmup { - HOME, WARP, FLIGHT, BANNER, CHECKPOINT + HOME, WARP, FLIGHT, BANNER, CHECKPOINT } } diff --git a/src/main/java/com/massivecraft/factions/util/WarpGUI.java b/src/main/java/com/massivecraft/factions/util/WarpGUI.java index a6147e91..31e635b2 100644 --- a/src/main/java/com/massivecraft/factions/util/WarpGUI.java +++ b/src/main/java/com/massivecraft/factions/util/WarpGUI.java @@ -34,14 +34,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI { public WarpGUI(FPlayer fme) { this.fme = fme; - this.section = SavageFactions.plugin.getConfig().getConfigurationSection("fwarp-gui"); + this.section = SavageFactions.plugin.getConfig().getConfigurationSection("fwarp-gui"); } @Override public void build() { if (section == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); + SavageFactions.plugin.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; - SavageFactions.plugin.log(Level.INFO, "Warp GUI size out of bounds, defaulting to 6"); + SavageFactions.plugin.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 = SavageFactions.plugin.getConfig().getInt("max-warps", 5); + maxWarps = SavageFactions.plugin.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()) { - SavageFactions.plugin.log(Level.SEVERE, "Invalid warp slots for GUI, Please use same value as max warps"); + SavageFactions.plugin.log(Level.SEVERE, "Invalid warp slots for GUI, Please use same value as max warps"); return; } @@ -95,14 +95,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI { // All clear lets TP them or ask for password String warp = warpSlots.get(slot); - if (!fme.getFaction().hasWarpPassword(warp)) { + if (! fme.getFaction().hasWarpPassword(warp)) { if (transact(fme)) { doWarmup(warp); } } else { fme.setEnteringPassword(true, warp); fme.msg(TL.COMMAND_FWARP_PASSWORD_REQUIRED); - Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() { + Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() { @Override public void run() { if (fme.isEnteringPassword()) { @@ -110,7 +110,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI { fme.setEnteringPassword(false, ""); } } - }, SavageFactions.plugin.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20); + }, SavageFactions.plugin.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20); } } } @@ -129,28 +129,28 @@ public class WarpGUI implements InventoryHolder, FactionGUI { } private boolean transact(FPlayer player) { - if (! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing()) { + if (! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing()) { return true; } - double cost = SavageFactions.plugin.getConfig().getDouble("warp-cost.warp", 5); + double cost = SavageFactions.plugin.getConfig().getDouble("warp-cost.warp", 5); - if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) { + if (! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) { return true; } if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) { - return Econ.modifyMoney(fme.getFaction(), -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString()); + return Econ.modifyMoney(fme.getFaction(), - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString()); } else { - return Econ.modifyMoney(fme, -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString()); + return Econ.modifyMoney(fme, - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString()); } } private ItemStack buildItem(String warp) { ConfigurationSection warpItemSection = section.getConfigurationSection("warp-item"); if (warpItemSection == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); + SavageFactions.plugin.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 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}", ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) ? "Disabled" : Integer.toString(SavageFactions.plugin.getConfig().getInt("warp-cost.warp", 5))); + string = string.replace("{warp-cost}", ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) ? "Disabled" : Integer.toString(SavageFactions.plugin.getConfig().getInt("warp-cost.warp", 5))); return string; } @@ -193,7 +193,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI { try { dummyId = Integer.parseInt(key); } catch (NumberFormatException exception) { - SavageFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); + SavageFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); continue; } @@ -205,7 +205,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI { List dummyIdSlots = section.getIntegerList("dummy-slots." + key); for (Integer slot : dummyIdSlots) { if (slot + 1 > guiSize || slot < 0) { - SavageFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); + SavageFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); continue; } dummySlots.add(slot); @@ -218,14 +218,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI { final ConfigurationSection dummySection = section.getConfigurationSection("dummy-items." + id); if (dummySection == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present."); + SavageFactions.plugin.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) { - SavageFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id); + SavageFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id); return null; } @@ -243,7 +243,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI { ItemMeta itemMeta = itemStack.getItemMeta(); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.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 6d4c035c..3a778cb1 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MCommand.java +++ b/src/main/java/com/massivecraft/factions/zcore/MCommand.java @@ -48,6 +48,7 @@ public abstract class MCommand { // This field may be left blank and will in such case be loaded from the permissions node instead. // Thus make sure the permissions node description is an action description like "eat hamburgers" or "do admin stuff". private String helpShort; + public MCommand(T p) { this.p = p; @@ -112,11 +113,11 @@ public abstract class MCommand { } } - if (!validCall(this.sender, this.args)) { + if (! validCall(this.sender, this.args)) { return; } - if (!this.isEnabled()) { + if (! this.isEnabled()) { return; } @@ -139,7 +140,7 @@ public abstract class MCommand { * In this method we validate that all prerequisites to perform this command has been met. * * @param sender of the command - * @param args of the command + * @param args of the command * @return true if valid, false if not. */ // TODO: There should be a boolean for silence @@ -152,7 +153,7 @@ public abstract class MCommand { } public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) { - if (this.senderMustBePlayer && !(sender instanceof Player)) { + if (this.senderMustBePlayer && ! (sender instanceof Player)) { if (informSenderIfNot) { msg(TL.GENERIC_PLAYERONLY); } @@ -223,7 +224,7 @@ public abstract class MCommand { } if (args.size() > 0) { - ret.append(p.txt.parseTags(" ")); + ret.append(p.txt.parseTags(" ")); ret.append(TextUtil.implode(args, " ")); } @@ -306,7 +307,7 @@ public abstract class MCommand { s = s.replace("{power}", power); } if (s.contains("{group}")) { - String group = SavageFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(player.getId()))); + String group = SavageFactions.plugin.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 fac24a23..8dbdec51 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java +++ b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java @@ -84,7 +84,7 @@ public abstract class MPlugin extends JavaPlugin { // reference command will be used to prevent "unknown command" console messages try { Map> refCmd = this.getDescription().getCommands(); - if (refCmd != null && !refCmd.isEmpty()) { + if (refCmd != null && ! refCmd.isEmpty()) { this.refCommand = (String) (refCmd.keySet().toArray()[0]); } } catch (ClassCastException ex) { @@ -114,7 +114,7 @@ public abstract class MPlugin extends JavaPlugin { File lang = new File(getDataFolder(), "lang.yml"); OutputStream out = null; InputStream defLangStream = this.getResource("lang.yml"); - if (!lang.exists()) { + if (! lang.exists()) { try { getDataFolder().mkdir(); lang.createNewFile(); @@ -123,7 +123,7 @@ public abstract class MPlugin extends JavaPlugin { int read; byte[] bytes = new byte[1024]; - while ((read = defLangStream.read(bytes)) != -1) { + while ((read = defLangStream.read(bytes)) != - 1) { out.write(bytes, 0, read); } YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(new BufferedReader(new InputStreamReader(defLangStream))); @@ -218,7 +218,7 @@ public abstract class MPlugin extends JavaPlugin { this.rawTags.put("b", ""); // bad this.rawTags.put("h", ""); // highligh this.rawTags.put("c", ""); // command - this.rawTags.put("plugin", ""); // parameter + this.rawTags.put("plugin", ""); // parameter } public void initTXT() { @@ -242,7 +242,7 @@ public abstract class MPlugin extends JavaPlugin { // COMMAND HANDLING // -------------------------------------------- // - // can be overridden by SavageFactions method, to provide option + // can be overridden by SavageFactions method, to provide option public boolean logPlayerCommands() { return true; } @@ -259,7 +259,7 @@ public abstract class MPlugin extends JavaPlugin { } for (final MCommand command : this.getBaseCommands()) { - if (noSlash && !command.allowNoSlashAccess) { + if (noSlash && ! command.allowNoSlashAccess) { continue; } diff --git a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java b/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java index 8d7c92cc..efb3fb7e 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java @@ -18,7 +18,7 @@ public class MPluginSecretPlayerListener implements Listener { this.p = p; } - @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + @EventHandler (priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { if (FactionsPlayerListener.preventCommand(event.getMessage(), event.getPlayer())) { if (p.logPlayerCommands()) { @@ -28,7 +28,7 @@ public class MPluginSecretPlayerListener implements Listener { } } - @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + @EventHandler (priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerChat(AsyncPlayerChatEvent event) { if (p.handleCommand(event.getPlayer(), event.getMessage(), false, true)) { if (p.logPlayerCommands()) { @@ -45,7 +45,7 @@ public class MPluginSecretPlayerListener implements Listener { */ } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler (priority = EventPriority.LOWEST) public void onPlayerPreLogin(PlayerLoginEvent event) { FPlayers.getInstance().getByPlayer(event.getPlayer()); } 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 be36ce6f..1f203a16 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java @@ -80,11 +80,11 @@ public enum PermissableAction { // Utility method to build items for F Perm GUI public ItemStack buildItem(FPlayer fme, Permissable permissable) { - final ConfigurationSection section = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.action"); + final ConfigurationSection section = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.action"); if (section == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return new ItemStack(Material.AIR); } @@ -96,7 +96,7 @@ public enum PermissableAction { } Material material = Material.matchMaterial(section.getString("materials." + name().toLowerCase().replace('_', '-'))); if (material == null) { - material = SavageFactions.plugin.STAINED_CLAY; + material = SavageFactions.plugin.STAINED_CLAY; } Access access = fme.getFaction().getAccess(permissable, this); @@ -120,7 +120,7 @@ public enum PermissableAction { // If under the 1.13 version we will use the colorable option. - if (! SavageFactions.plugin.mc113) { + if (! SavageFactions.plugin.mc113) { DyeColor dyeColor = null; try { @@ -133,14 +133,14 @@ public enum PermissableAction { } } else { // so this is in 1.13 mode, our config will automatically be updated to a material instead of color because of it being removed in the new api - item.setType(Material.valueOf(SavageFactions.plugin.getConfig().getString("fperm-gui.action.access." + accessValue))); + item.setType(Material.valueOf(SavageFactions.plugin.getConfig().getString("fperm-gui.action.access." + accessValue))); } for (String loreLine : section.getStringList("placeholder-item.lore")) { lore.add(replacePlaceholders(loreLine, fme, permissable)); } - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); } 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 be228598..c63fd550 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 @@ -36,20 +36,20 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { public PermissableActionGUI(FPlayer fme, Permissable permissable) { this.fme = fme; this.permissable = permissable; - this.section = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.action"); + this.section = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.action"); } public void build() { if (section == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + SavageFactions.plugin.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; - SavageFactions.plugin.log(Level.INFO, "Action GUI size out of bounds, defaulting to 6"); + SavageFactions.plugin.log(Level.INFO, "Action GUI size out of bounds, defaulting to 6"); } guiSize *= 9; @@ -58,12 +58,12 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { boolean disabled = false; for (String key : section.getConfigurationSection("slots").getKeys(false)) { int slot = section.getInt("slots." + key); - if (slot == -1) { + if (slot == - 1) { disabled = true; continue; } if (slot + 1 > guiSize || slot < 0) { - SavageFactions.plugin.log(Level.WARNING, "Invalid slot for: " + key.toUpperCase()); + SavageFactions.plugin.log(Level.WARNING, "Invalid slot for: " + key.toUpperCase()); continue; } @@ -74,7 +74,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { PermissableAction permissableAction = PermissableAction.fromString(key.toUpperCase().replace('-', '_')); if (permissableAction == null) { - SavageFactions.plugin.log(Level.WARNING, "Invalid permissable action: " + key.toUpperCase()); + SavageFactions.plugin.log(Level.WARNING, "Invalid permissable action: " + key.toUpperCase()); continue; } @@ -92,16 +92,16 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { if (disabled) { break; } - if (!usedDummySlots.isEmpty()) { + if (! usedDummySlots.isEmpty()) { int slot = usedDummySlots.get(0); actionSlots.put(slot, action); } else { int slot = actionGUI.firstEmpty(); - if (slot != -1) { + if (slot != - 1) { actionSlots.put(slot, action); } } - SavageFactions.plugin.log(Level.WARNING, "Missing action: " + action.name()); + SavageFactions.plugin.log(Level.WARNING, "Missing action: " + action.name()); } } @@ -126,7 +126,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } return; } - if (!actionSlots.containsKey(slot)) { + if (! actionSlots.containsKey(slot)) { return; } @@ -147,7 +147,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()); - SavageFactions.plugin.log(String.format(TL.COMMAND_PERM_SET.toString(), action.name(), access.name(), permissable.name()) + " for faction " + fme.getTag()); + SavageFactions.plugin.log(String.format(TL.COMMAND_PERM_SET.toString(), action.name(), access.name(), permissable.name()) + " for faction " + fme.getTag()); } private void buildItems() { @@ -157,7 +157,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { ItemStack item = permissableAction.buildItem(fme, permissable); if (item == null) { - SavageFactions.plugin.log(Level.WARNING, "Invalid item for: " + permissableAction.toString().toUpperCase()); + SavageFactions.plugin.log(Level.WARNING, "Invalid item for: " + permissableAction.toString().toUpperCase()); continue; } @@ -173,8 +173,8 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { private ItemStack getSpecialItem(SpecialItem specialItem) { if (section == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return new ItemStack(Material.AIR); } @@ -182,7 +182,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { case RELATION: return permissable.buildItem(); case BACK: - ConfigurationSection backButtonConfig = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.back-item"); + ConfigurationSection backButtonConfig = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.back-item"); ItemStack backButton = new ItemStack(Material.matchMaterial(backButtonConfig.getString("material"))); ItemMeta backButtonMeta = backButton.getItemMeta(); @@ -194,7 +194,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } backButtonMeta.setLore(lore); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { backButtonMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); } @@ -208,8 +208,8 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { private void buildDummyItems() { if (section == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); return; } @@ -218,7 +218,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { try { dummyId = Integer.parseInt(key); } catch (NumberFormatException exception) { - SavageFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); + SavageFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); continue; } @@ -228,7 +228,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } ItemMeta meta = dummyItem.getItemMeta(); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { meta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); } @@ -237,7 +237,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { List dummySlots = section.getIntegerList("dummy-items." + key); for (Integer slot : dummySlots) { if (slot + 1 > guiSize || slot < 0) { - SavageFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); + SavageFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); continue; } usedDummySlots.add(slot); @@ -247,17 +247,17 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } private ItemStack buildDummyItem(int id) { - final ConfigurationSection dummySection = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.dummy-items." + id); + final ConfigurationSection dummySection = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.dummy-items." + id); if (dummySection == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build dummy items for F PERM GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build dummy items for F PERM GUI but config section not present."); + SavageFactions.plugin.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) { - SavageFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id); + SavageFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id); return null; } @@ -283,7 +283,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } itemMeta.setLore(lore); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.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 b01b78d7..d6b4f076 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 @@ -35,13 +35,13 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { public PermissableRelationGUI(FPlayer fme) { this.fme = fme; - this.section = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.relation"); + this.section = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.relation"); } public void build() { if (section == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + SavageFactions.plugin.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; - SavageFactions.plugin.log(Level.INFO, "Relation GUI size out of bounds, defaulting to 5"); + SavageFactions.plugin.log(Level.INFO, "Relation GUI size out of bounds, defaulting to 5"); } guiSize *= 9; @@ -58,16 +58,16 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { for (String key : section.getConfigurationSection("slots").getKeys(false)) { int slot = section.getInt("slots." + key); - if (slot == -1) { + if (slot == - 1) { continue; } if (slot + 1 > guiSize && slot > 0) { - SavageFactions.plugin.log(Level.WARNING, "Invalid slot of " + key.toUpperCase() + " in relation GUI skipping it"); + SavageFactions.plugin.log(Level.WARNING, "Invalid slot of " + key.toUpperCase() + " in relation GUI skipping it"); continue; } if (getPermissable(key) == null) { - SavageFactions.plugin.log(Level.WARNING, "Invalid permissable " + key.toUpperCase() + " skipping it"); + SavageFactions.plugin.log(Level.WARNING, "Invalid permissable " + key.toUpperCase() + " skipping it"); continue; } @@ -85,7 +85,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { @Override public void onClick(int slot, ClickType clickType) { - if (!relationSlots.containsKey(slot)) { + if (! relationSlots.containsKey(slot)) { return; } @@ -112,7 +112,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI { ItemStack item = permissable.buildItem(); if (item == null) { - SavageFactions.plugin.log(Level.WARNING, "Invalid material for " + permissable.toString().toUpperCase() + " skipping it"); + SavageFactions.plugin.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) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + SavageFactions.plugin.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) { - SavageFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase()); + SavageFactions.plugin.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 (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.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) { - SavageFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key); + SavageFactions.plugin.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 = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.dummy-items." + id); + final ConfigurationSection dummySection = SavageFactions.plugin.getConfig().getConfigurationSection("fperm-gui.dummy-items." + id); if (dummySection == null) { - SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); - SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config."); + SavageFactions.plugin.log(Level.WARNING, "Attempted to build f perm GUI but config section not present."); + SavageFactions.plugin.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) { - SavageFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id); + SavageFactions.plugin.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 (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.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 d6f4cc19..8829c5a9 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/CropUpgrades.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/CropUpgrades.java @@ -19,21 +19,21 @@ public class CropUpgrades implements Listener { int level = factionAtLoc.getUpgrade("Crop"); if (level != 0) { if (level == 1) { - int chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-1"); + int chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-1"); int randomNum = ThreadLocalRandom.current().nextInt(1, 100 + 1); if (randomNum <= chance) { growCrop(e); } } if (level == 2) { - int chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-2"); + int chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-2"); int randomNum = ThreadLocalRandom.current().nextInt(1, 100 + 1); if (randomNum <= chance) { growCrop(e); } } if (level == 3) { - int chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-3"); + int chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-3"); int randomNum = ThreadLocalRandom.current().nextInt(1, 100 + 1); if (randomNum <= chance) { growCrop(e); @@ -49,7 +49,7 @@ public class CropUpgrades implements Listener { Material CROPS; - if (e.getBlock().getType().equals(SavageFactions.plugin.CROPS)) { + if (e.getBlock().getType().equals(SavageFactions.plugin.CROPS)) { e.setCancelled(true); Crops c = new Crops(CropState.RIPE); org.bukkit.block.BlockState bs = e.getBlock().getState(); @@ -59,11 +59,11 @@ public class CropUpgrades implements Listener { org.bukkit.block.Block below = e.getBlock().getLocation().subtract(0, 1, 0).getBlock(); - if (below.getType() == SavageFactions.plugin.SUGAR_CANE_BLOCK) { + if (below.getType() == SavageFactions.plugin.SUGAR_CANE_BLOCK) { org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock(); - if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) { - above.setType(SavageFactions.plugin.SUGAR_CANE_BLOCK); + if (above.getType() == Material.AIR && above.getLocation().add(0, - 2, 0).getBlock().getType() != Material.AIR) { + above.setType(SavageFactions.plugin.SUGAR_CANE_BLOCK); } } @@ -72,7 +72,7 @@ public class CropUpgrades implements Listener { org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock(); - if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) { + if (above.getType() == Material.AIR && above.getLocation().add(0, - 2, 0).getBlock().getType() != Material.AIR) { above.setType(Material.CACTUS); } } 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 a552d989..4e00e33d 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/EXPUpgrade.java @@ -24,15 +24,15 @@ public class EXPUpgrade implements Listener { int level = faction.getUpgrade("Exp"); if (level != 0) { if (level == 1) { - double multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-1"); + double multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-1"); spawnMoreExp(e, multiplier); } if (level == 2) { - double multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-2"); + double multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-2"); spawnMoreExp(e, multiplier); } if (level == 3) { - double multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-3"); + double multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-3"); spawnMoreExp(e, multiplier); } } 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 266e8422..7102b8b7 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java @@ -21,24 +21,24 @@ import java.util.List; public class FUpgradesGUI implements Listener { public void openMainMenu(FPlayer fme) { - Inventory inventory = Bukkit.createInventory(null, 27, SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", fme.getFaction().getTag()))); - List dummySlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.DummyItem.slots"); - Material dummyMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.DummyItem.Type")); - int dummyAmount = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.DummyItem.Amount"); - short dummyData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.DummyItem.Damage") + ""); - ItemStack dummyItem = SavageFactions.plugin.createItem(dummyMaterial, + Inventory inventory = Bukkit.createInventory(null, 27, SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", fme.getFaction().getTag()))); + List dummySlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.DummyItem.slots"); + Material dummyMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.DummyItem.Type")); + int dummyAmount = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.DummyItem.Amount"); + short dummyData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.DummyItem.Damage") + ""); + ItemStack dummyItem = SavageFactions.plugin.createItem(dummyMaterial, dummyAmount, dummyData, - SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.DummyItem.Name")), - SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.DummyItem.Lore"))); + SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.DummyItem.Name")), + SavageFactions.plugin.colorList(SavageFactions.plugin.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 = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Crops.CropItem.slots"); - List spawnerSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); - List expSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots"); - List chestSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots"); + List cropSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Crops.CropItem.slots"); + List spawnerSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); + List expSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots"); + List chestSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots"); for (int i = 0; i <= cropSlots.size() - 1; i++) { inventory.setItem(cropSlots.get(i), items[2]); } @@ -66,7 +66,7 @@ public class FUpgradesGUI implements Listener { return; } FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getWhoClicked()); - if (e.getClickedInventory().getTitle().equalsIgnoreCase(SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", fme.getFaction().getTag())))) { + if (e.getClickedInventory().getTitle().equalsIgnoreCase(SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", fme.getFaction().getTag())))) { e.setCancelled(true); ItemStack[] items = buildItems(fme); ItemStack cropItem = items[2]; @@ -79,7 +79,7 @@ public class FUpgradesGUI implements Listener { return; } if (cropLevel == 2) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-3"); + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-3"); if (hasMoney(fme, cost)) { fme.getFaction().setUpgrades("Crop", 3); @@ -89,7 +89,7 @@ public class FUpgradesGUI implements Listener { } if (cropLevel == 1) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-2"); + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-2"); if (hasMoney(fme, cost)) { takeMoney(fme, cost); fme.getFaction().setUpgrades("Crop", 2); @@ -98,7 +98,7 @@ public class FUpgradesGUI implements Listener { } if (cropLevel == 0) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-1"); + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-1"); if (hasMoney(fme, cost)) { takeMoney(fme, cost); fme.getFaction().setUpgrades("Crop", 1); @@ -113,8 +113,8 @@ public class FUpgradesGUI implements Listener { return; } if (spawnerLevel == 2) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-3"); - if (!hasMoney(fme, cost)) { + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-3"); + if (! hasMoney(fme, cost)) { return; } takeMoney(fme, cost); @@ -122,8 +122,8 @@ public class FUpgradesGUI implements Listener { fme.getPlayer().closeInventory(); } if (spawnerLevel == 1) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-2"); - if (!hasMoney(fme, cost)) { + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-2"); + if (! hasMoney(fme, cost)) { return; } takeMoney(fme, cost); @@ -131,8 +131,8 @@ public class FUpgradesGUI implements Listener { fme.getPlayer().closeInventory(); } if (spawnerLevel == 0) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-1"); - if (!hasMoney(fme, cost)) { + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-1"); + if (! hasMoney(fme, cost)) { return; } takeMoney(fme, cost); @@ -146,8 +146,8 @@ public class FUpgradesGUI implements Listener { return; } if (expLevel == 2) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-3"); - if (!hasMoney(fme, cost)) { + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-3"); + if (! hasMoney(fme, cost)) { return; } takeMoney(fme, cost); @@ -155,8 +155,8 @@ public class FUpgradesGUI implements Listener { fme.getPlayer().closeInventory(); } if (expLevel == 1) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-2"); - if (!hasMoney(fme, cost)) { + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-2"); + if (! hasMoney(fme, cost)) { return; } takeMoney(fme, cost); @@ -164,8 +164,8 @@ public class FUpgradesGUI implements Listener { fme.getPlayer().closeInventory(); } if (expLevel == 0) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-1"); - if (!hasMoney(fme, cost)) { + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-1"); + if (! hasMoney(fme, cost)) { return; } takeMoney(fme, cost); @@ -179,8 +179,8 @@ public class FUpgradesGUI implements Listener { return; } if (chestLevel == 2) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-3"); - if (!hasMoney(fme, cost)) { + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-3"); + if (! hasMoney(fme, cost)) { return; } takeMoney(fme, cost); @@ -189,8 +189,8 @@ public class FUpgradesGUI implements Listener { fme.getPlayer().closeInventory(); } if (chestLevel == 1) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-2"); - if (!hasMoney(fme, cost)) { + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-2"); + if (! hasMoney(fme, cost)) { return; } takeMoney(fme, cost); @@ -199,8 +199,8 @@ public class FUpgradesGUI implements Listener { fme.getPlayer().closeInventory(); } if (chestLevel == 0) { - int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-1"); - if (!hasMoney(fme, cost)) { + int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-1"); + if (! hasMoney(fme, cost)) { return; } takeMoney(fme, cost); @@ -219,7 +219,7 @@ public class FUpgradesGUI implements Listener { if (player.getInventory().getTitle() == null) { return; } - String invName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fchest.Inventory-Title")); + String invName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fchest.Inventory-Title")); if (player.getInventory().getTitle().equalsIgnoreCase(invName)) { player.closeInventory(); } @@ -228,11 +228,11 @@ public class FUpgradesGUI implements Listener { int level = faction.getUpgrade("Chest"); int size = 9; if (level == 1) { - size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1") * 9; + size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1") * 9; } else if (level == 2) { - size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2") * 9; + size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2") * 9; } else if (level == 3) { - size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3") * 9; + size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3") * 9; } faction.setChestSize(size); @@ -240,34 +240,34 @@ public class FUpgradesGUI implements Listener { } private ItemStack[] buildItems(FPlayer fme) { - Material expMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Type")); - int expAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Amount"); - short expData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Damage") + ""); - String expName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Name")); - List expLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.EXP.EXPItem.Lore")); + Material expMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Type")); + int expAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Amount"); + short expData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Damage") + ""); + String expName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Name")); + List expLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.EXP.EXPItem.Lore")); int expLevel = fme.getFaction().getUpgrade("Exp"); for (int i = 0; i <= expLore.size() - 1; i++) { expLore.set(i, expLore.get(i).replace("{level}", expLevel + "")); } - ItemStack expItem = SavageFactions.plugin.createItem(expMaterial, expAmt, expData, expName, expLore); + ItemStack expItem = SavageFactions.plugin.createItem(expMaterial, expAmt, expData, expName, expLore); if (expLevel >= 1) { ItemMeta itemMeta = expItem.getItemMeta(); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); expItem.setItemMeta(itemMeta); } - Material spawnerMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Type")); - int spawnerAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Amount"); - short spawnerData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Damage") + ""); - String spawnerName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Name")); - List spawnerLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Spawners.SpawnerItem.Lore")); + Material spawnerMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Type")); + int spawnerAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Amount"); + short spawnerData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Damage") + ""); + String spawnerName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Name")); + List spawnerLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Spawners.SpawnerItem.Lore")); - List spawnerSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); + List spawnerSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); int spawnerLevel = fme.getFaction().getUpgrade("Spawner"); for (int i = 0; i <= spawnerLore.size() - 1; i++) { @@ -278,11 +278,11 @@ public class FUpgradesGUI implements Listener { } else if (expLevel == 3) { expItem.setAmount(3); } - Material cropMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Type")); - int cropAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Amount"); - short cropData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Damage") + ""); - String cropName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Name")); - List cropLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Crops.CropItem.Lore")); + Material cropMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Type")); + int cropAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Amount"); + short cropData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Damage") + ""); + String cropName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Name")); + List cropLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Crops.CropItem.Lore")); int cropLevel = fme.getFaction().getUpgrade("Crop"); for (int i = 0; i <= cropLore.size() - 1; i++) { String line = cropLore.get(i); @@ -290,11 +290,11 @@ public class FUpgradesGUI implements Listener { cropLore.set(i, line); } - ItemStack cropItem = SavageFactions.plugin.createItem(cropMaterial, cropAmt, cropData, cropName, cropLore); + ItemStack cropItem = SavageFactions.plugin.createItem(cropMaterial, cropAmt, cropData, cropName, cropLore); cropItem.getItemMeta().setLore(cropLore); if (cropLevel >= 1) { ItemMeta itemMeta = cropItem.getItemMeta(); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); @@ -305,11 +305,11 @@ public class FUpgradesGUI implements Listener { } else if (cropLevel == 3) { cropItem.setAmount(3); } - ItemStack spawnerItem = SavageFactions.plugin.createItem(spawnerMaterial, spawnerAmt, spawnerData, spawnerName, spawnerLore); + ItemStack spawnerItem = SavageFactions.plugin.createItem(spawnerMaterial, spawnerAmt, spawnerData, spawnerName, spawnerLore); spawnerItem.getItemMeta().setLore(spawnerLore); if (spawnerLevel >= 1) { ItemMeta itemMeta = spawnerItem.getItemMeta(); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); @@ -320,11 +320,11 @@ public class FUpgradesGUI implements Listener { } else if (spawnerLevel == 3) { spawnerItem.setAmount(3); } - Material chestMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Type")); - int chesttAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Amount"); - short chestData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Damage") + ""); - String chestName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Name", "&e&lUpgrade Chest Size")); - List chestLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Chest.ChestItem.Lore")); + Material chestMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Type")); + int chesttAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Amount"); + short chestData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Damage") + ""); + String chestName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Name", "&e&lUpgrade Chest Size")); + List chestLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Chest.ChestItem.Lore")); int chestlevel = fme.getFaction().getUpgrade("Chest"); for (int i = 0; i <= chestLore.size() - 1; i++) { String line = chestLore.get(i); @@ -333,11 +333,11 @@ public class FUpgradesGUI implements Listener { } - ItemStack chestItem = SavageFactions.plugin.createItem(chestMaterial, chesttAmt, chestData, chestName, chestLore); + ItemStack chestItem = SavageFactions.plugin.createItem(chestMaterial, chesttAmt, chestData, chestName, chestLore); if (chestlevel >= 1) { ItemMeta itemMeta = chestItem.getItemMeta(); - if (! SavageFactions.plugin.mc17) { + if (! SavageFactions.plugin.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } itemMeta.addEnchant(Enchantment.DURABILITY, 3, 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 e017ee43..45c5947a 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/SpawnerUpgrades.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/SpawnerUpgrades.java @@ -14,15 +14,15 @@ public class SpawnerUpgrades implements Listener { int level = factionAtLoc.getUpgrade("Spawner"); if (level != 0) { if (level == 1) { - int rate = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-1"); + int rate = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-1"); lowerSpawnerDelay(e, rate); } if (level == 2) { - int rate = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-2"); + int rate = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-2"); lowerSpawnerDelay(e, rate); } if (level == 3) { - int rate = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-3"); + int rate = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-3"); lowerSpawnerDelay(e, rate); } diff --git a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTCompound.java b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTCompound.java index fd23b971..0ca3d6d1 100644 --- a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTCompound.java +++ b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTCompound.java @@ -159,7 +159,8 @@ public class NBTCompound { } public NBTType getType(String name) { - if (MinecraftVersion.getVersion() == MinecraftVersion.MC1_7_R4) return NBTType.NBTTagEnd; + if (MinecraftVersion.getVersion() == MinecraftVersion.MC1_7_R4) + return NBTType.NBTTagEnd; return NBTType.valueOf(NBTReflectionUtil.getType(this, name)); } diff --git a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTFile.java b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTFile.java index cfcda445..bf92af73 100644 --- a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTFile.java +++ b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTFile.java @@ -23,7 +23,7 @@ public class NBTFile extends NBTCompound { } public void save() throws IOException { - if (!file.exists()) { + if (! file.exists()) { file.getParentFile().mkdirs(); file.createNewFile(); } diff --git a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTList.java b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTList.java index 4cb21833..161bc900 100644 --- a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTList.java +++ b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTList.java @@ -16,7 +16,7 @@ public class NBTList { listName = name; this.type = type; this.listObject = list; - if (!(type == NBTType.NBTTagString || type == NBTType.NBTTagCompound)) { + if (! (type == NBTType.NBTTagString || type == NBTType.NBTTagCompound)) { System.err.println("List types != String/Compound are currently not implemented!"); } } @@ -70,7 +70,7 @@ public class NBTList { return null; } - @SuppressWarnings("unchecked") + @SuppressWarnings ("unchecked") public void addString(String s) { if (type != NBTType.NBTTagString) { new Throwable("Using String method on a non String list!").printStackTrace(); @@ -85,7 +85,7 @@ public class NBTList { } } - @SuppressWarnings("unchecked") + @SuppressWarnings ("unchecked") public void setString(int i, String s) { if (type != NBTType.NBTTagString) { new Throwable("Using String method on a non String list!").printStackTrace(); @@ -117,7 +117,7 @@ public class NBTList { } catch (Exception ex) { ex.printStackTrace(); } - return -1; + return - 1; } public NBTType getType() { diff --git a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTListCompound.java b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTListCompound.java index e3d92716..f7c52a2b 100644 --- a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTListCompound.java +++ b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTListCompound.java @@ -81,7 +81,7 @@ public class NBTListCompound { return false; } - @SuppressWarnings("unchecked") + @SuppressWarnings ("unchecked") public Set getKeys() { try { return (Set) compound.getClass().getMethod("c").invoke(compound); diff --git a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTReflectionUtil.java b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTReflectionUtil.java index 497f5808..cf57b218 100644 --- a/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTReflectionUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/nbtapi/NBTReflectionUtil.java @@ -21,7 +21,7 @@ public class NBTReflectionUtil { private static final String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") private static Class getCraftItemStack() { try { @@ -34,7 +34,7 @@ public class NBTReflectionUtil { } } - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") private static Class getCraftEntity() { try { Class clazz = Class.forName("org.bukkit.craftbukkit." + version + ".entity.CraftEntity"); @@ -46,7 +46,7 @@ public class NBTReflectionUtil { } } - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") protected static Class getNBTBase() { try { Class clazz = Class.forName("net.minecraft.server." + version + ".NBTBase"); @@ -58,7 +58,7 @@ public class NBTReflectionUtil { } } - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") protected static Class getNBTTagString() { try { Class clazz = Class.forName("net.minecraft.server." + version + ".NBTTagString"); @@ -70,7 +70,7 @@ public class NBTReflectionUtil { } } - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") protected static Class getNMSItemStack() { try { Class clazz = Class.forName("net.minecraft.server." + version + ".ItemStack"); @@ -82,7 +82,7 @@ public class NBTReflectionUtil { } } - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") protected static Class getNBTTagCompound() { try { Class clazz = Class.forName("net.minecraft.server." + version + ".NBTTagCompound"); @@ -94,7 +94,7 @@ public class NBTReflectionUtil { } } - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") protected static Class getNBTCompressedStreamTools() { try { Class clazz = Class.forName("net.minecraft.server." + version + ".NBTCompressedStreamTools"); @@ -106,7 +106,7 @@ public class NBTReflectionUtil { } } - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") protected static Class getMojangsonParser() { try { Class c = Class.forName("net.minecraft.server." + version + ".MojangsonParser"); @@ -118,7 +118,7 @@ public class NBTReflectionUtil { } } - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") protected static Class getTileEntity() { try { Class clazz = Class.forName("net.minecraft.server." + version + ".TileEntity"); @@ -130,7 +130,7 @@ public class NBTReflectionUtil { } } - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") protected static Class getCraftWorld() { try { Class clazz = Class.forName("org.bukkit.craftbukkit." + version + ".CraftWorld"); @@ -145,7 +145,7 @@ public class NBTReflectionUtil { public static Object getNewNBTTag() { String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; try { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class c = Class.forName("net.minecraft.server." + version + ".NBTTagCompound"); return c.newInstance(); } catch (Exception ex) { @@ -158,7 +158,7 @@ public class NBTReflectionUtil { private static Object getNewBlockPosition(int x, int y, int z) { String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; try { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class clazz = Class.forName("net.minecraft.server." + version + ".BlockPosition"); return clazz.getConstructor(int.class, int.class, int.class).newInstance(x, y, z); } catch (Exception ex) { @@ -180,9 +180,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings("unchecked") + @SuppressWarnings ("unchecked") public static Object getNMSItemStack(ItemStack item) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class clazz = getCraftItemStack(); Method method; try { @@ -195,9 +195,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings("unchecked") + @SuppressWarnings ("unchecked") public static Object getNMSEntity(Entity entity) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class clazz = getCraftEntity(); Method method; try { @@ -209,9 +209,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings ({"unchecked"}) public static Object parseNBT(String json) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class cis = getMojangsonParser(); Method method; try { @@ -223,9 +223,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings ({"unchecked"}) public static Object readNBTFile(FileInputStream stream) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class clazz = getNBTCompressedStreamTools(); Method method; try { @@ -237,9 +237,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings ({"unchecked"}) public static Object saveNBTFile(Object nbt, FileOutputStream stream) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class clazz = getNBTCompressedStreamTools(); Method method; try { @@ -251,9 +251,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings ({"unchecked"}) public static ItemStack getBukkitItemStack(Object item) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class clazz = getCraftItemStack(); Method method; try { @@ -266,9 +266,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings ({"unchecked"}) public static Object getItemRootNBTTagCompound(Object nmsitem) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class clazz = nmsitem.getClass(); Method method; try { @@ -281,9 +281,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings ({"unchecked"}) public static Object convertNBTCompoundtoNMSItem(NBTCompound nbtcompound) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class clazz = getNMSItemStack(); try { Object nmsstack = clazz.getConstructor(getNBTTagCompound()).newInstance(gettoCompount(nbtcompound.getCompound(), nbtcompound)); @@ -294,9 +294,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings ({"unchecked"}) public static NBTContainer convertNMSItemtoNBTCompound(Object nmsitem) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class clazz = nmsitem.getClass(); Method method; try { @@ -309,9 +309,9 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings ({"unchecked"}) public static Object getEntityNBTTagCompound(Object nmsitem) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class c = nmsitem.getClass(); Method method; try { @@ -373,9 +373,9 @@ public class NBTReflectionUtil { } - @SuppressWarnings("unchecked") + @SuppressWarnings ("unchecked") public static Object getSubNBTTagCompound(Object compound, String name) { - @SuppressWarnings("rawtypes") + @SuppressWarnings ("rawtypes") Class c = compound.getClass(); Method method; try { @@ -397,7 +397,7 @@ public class NBTReflectionUtil { if (nbttag == null) { nbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(nbttag, comp); Method method; try { @@ -425,7 +425,7 @@ public class NBTReflectionUtil { structure.add(comp.getName()); comp = comp.getParent(); } - while (!structure.isEmpty()) { + while (! structure.isEmpty()) { nbttag = getSubNBTTagCompound(nbttag, structure.pop()); if (nbttag == null) { return null; @@ -439,7 +439,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -460,7 +460,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -477,7 +477,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -494,7 +494,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -515,7 +515,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -532,7 +532,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -553,7 +553,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -571,7 +571,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -592,7 +592,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -609,7 +609,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -630,12 +630,12 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { method = workingtag.getClass().getMethod("setFloat", String.class, float.class); - method.invoke(workingtag, key, (float) f); + method.invoke(workingtag, key, f); comp.setCompound(rootnbttag); } catch (Exception ex) { ex.printStackTrace(); @@ -647,7 +647,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -668,12 +668,12 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { method = workingtag.getClass().getMethod("setLong", String.class, long.class); - method.invoke(workingtag, key, (long) f); + method.invoke(workingtag, key, f); comp.setCompound(rootnbttag); } catch (Exception ex) { ex.printStackTrace(); @@ -685,7 +685,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -706,12 +706,12 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { method = workingtag.getClass().getMethod("setShort", String.class, short.class); - method.invoke(workingtag, key, (short) f); + method.invoke(workingtag, key, f); comp.setCompound(rootnbttag); } catch (Exception ex) { ex.printStackTrace(); @@ -723,7 +723,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -744,12 +744,12 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { method = workingtag.getClass().getMethod("setByte", String.class, byte.class); - method.invoke(workingtag, key, (byte) f); + method.invoke(workingtag, key, f); comp.setCompound(rootnbttag); } catch (Exception ex) { ex.printStackTrace(); @@ -761,7 +761,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -782,7 +782,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -799,7 +799,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -816,7 +816,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return 0; + if (! valideCompound(comp)) return 0; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -837,7 +837,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -854,7 +854,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -875,7 +875,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) { + if (! valideCompound(comp)) { new Throwable("InvalideCompound").printStackTrace(); return; } @@ -895,7 +895,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -908,7 +908,7 @@ public class NBTReflectionUtil { } public static void setObject(NBTCompound comp, String key, Object value) { - if (!MinecraftVersion.hasGsonSupport()) return; + if (! MinecraftVersion.hasGsonSupport()) return; try { String json = GsonWrapper.getString(value); setString(comp, key, json); @@ -918,7 +918,7 @@ public class NBTReflectionUtil { } public static T getObject(NBTCompound comp, String key, Class type) { - if (!MinecraftVersion.hasGsonSupport()) return null; + if (! MinecraftVersion.hasGsonSupport()) return null; String json = getString(comp, key); if (json == null) { return null; @@ -931,7 +931,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return; + if (! valideCompound(comp)) return; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -948,7 +948,7 @@ public class NBTReflectionUtil { if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { @@ -960,13 +960,13 @@ public class NBTReflectionUtil { return null; } - @SuppressWarnings("unchecked") + @SuppressWarnings ("unchecked") public static Set getKeys(NBTCompound comp) { Object rootnbttag = comp.getCompound(); if (rootnbttag == null) { rootnbttag = getNewNBTTag(); } - if (!valideCompound(comp)) return null; + if (! valideCompound(comp)) return null; Object workingtag = gettoCompount(rootnbttag, comp); Method method; try { 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 df1cb518..7de9818b 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java @@ -26,7 +26,7 @@ public abstract class MemoryBoard extends Board { // Get and Set //----------------------------------------------// public String getIdAt(FLocation flocation) { - if (!flocationIds.containsKey(flocation)) { + if (! flocationIds.containsKey(flocation)) { return "0"; } @@ -111,18 +111,18 @@ public abstract class MemoryBoard extends Board { public boolean isBorderLocation(FLocation flocation) { Faction faction = getFactionAt(flocation); FLocation a = flocation.getRelative(1, 0); - FLocation b = flocation.getRelative(-1, 0); + FLocation b = flocation.getRelative(- 1, 0); FLocation c = flocation.getRelative(0, 1); - FLocation d = flocation.getRelative(0, -1); + FLocation d = flocation.getRelative(0, - 1); return faction != getFactionAt(a) || faction != getFactionAt(b) || faction != getFactionAt(c) || faction != getFactionAt(d); } // Is this coord connected to any coord claimed by the specified faction? public boolean isConnectedLocation(FLocation flocation, Faction faction) { FLocation a = flocation.getRelative(1, 0); - FLocation b = flocation.getRelative(-1, 0); + FLocation b = flocation.getRelative(- 1, 0); FLocation c = flocation.getRelative(0, 1); - FLocation d = flocation.getRelative(0, -1); + FLocation d = flocation.getRelative(0, - 1); return faction == getFactionAt(a) || faction == getFactionAt(b) || faction == getFactionAt(c) || faction == getFactionAt(d); } @@ -136,8 +136,8 @@ public abstract class MemoryBoard extends Board { * @return true if another Faction is within the radius, otherwise false. */ public boolean hasFactionWithin(FLocation flocation, Faction faction, int radius) { - for (int x = -radius; x <= radius; x++) { - for (int z = -radius; z <= radius; z++) { + for (int x = - radius; x <= radius; x++) { + for (int z = - radius; z <= radius; z++) { if (x == 0 && z == 0) { continue; } @@ -157,8 +157,8 @@ public abstract class MemoryBoard extends Board { Iterator> iter = flocationIds.entrySet().iterator(); while (iter.hasNext()) { Entry entry = iter.next(); - if (!Factions.getInstance().isValidFactionId(entry.getValue())) { - SavageFactions.plugin.log("Board cleaner removed " + entry.getValue() + " from " + entry.getKey()); + if (! Factions.getInstance().isValidFactionId(entry.getValue())) { + SavageFactions.plugin.log("Board cleaner removed " + entry.getValue() + " from " + entry.getKey()); iter.remove(); } } @@ -200,17 +200,17 @@ 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 + SavageFactions.plugin.txt.titleize("(" + flocation.getCoordString() + ") " + factionLoc.getTag(fplayer)))); - int buffer = SavageFactions.plugin.getConfig().getInt("world-border.buffer", 0); + ret.add(new FancyMessage(ChatColor.DARK_GRAY + SavageFactions.plugin.txt.titleize("(" + flocation.getCoordString() + ") " + factionLoc.getTag(fplayer)))); + int buffer = SavageFactions.plugin.getConfig().getInt("world-border.buffer", 0); // Get the compass - ArrayList asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.DARK_GREEN, SavageFactions.plugin.txt.parse("")); + ArrayList asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.DARK_GREEN, SavageFactions.plugin.txt.parse("")); int halfWidth = Conf.mapWidth / 2; // Use player's value for height int halfHeight = fplayer.getMapHeight() / 2; - FLocation topLeft = flocation.getRelative(-halfWidth, -halfHeight); + FLocation topLeft = flocation.getRelative(- halfWidth, - halfHeight); int width = halfWidth * 2 + 1; int height = halfHeight * 2 + 1; @@ -253,7 +253,7 @@ public abstract class MemoryBoard extends Board { (Conf.showNeutralFactionsOnMap && relation.equals(Relation.NEUTRAL)) || (Conf.showEnemyFactionsOnMap && relation.equals(Relation.ENEMY)) || (Conf.showTrucesFactionsOnMap && relation.equals(Relation.TRUCE))) { - if (!fList.containsKey(factionHere.getTag())) { + if (! fList.containsKey(factionHere.getTag())) { fList.put(factionHere.getTag(), Conf.mapKeyChrs[Math.min(chrIdx++, Conf.mapKeyChrs.length - 1)]); } char tag = fList.get(factionHere.getTag()); @@ -291,16 +291,16 @@ public abstract class MemoryBoard extends Board { private List getToolTip(Faction faction, FPlayer to) { List ret = new ArrayList<>(); - List show = SavageFactions.plugin.getConfig().getStringList("map"); + List show = SavageFactions.plugin.getConfig().getStringList("map"); - if (!faction.isNormal()) { + 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(SavageFactions.plugin.txt.titleize(tag)); + ret.add(SavageFactions.plugin.txt.titleize(tag)); } else { - ret.add(SavageFactions.plugin.txt.parse(TagReplacer.FACTION.replace(header, tag))); + ret.add(SavageFactions.plugin.txt.parse(TagReplacer.FACTION.replace(header, tag))); } return ret; // we only show header for non-normal factions } @@ -320,13 +320,13 @@ public abstract class MemoryBoard extends Board { List fancy = TagUtil.parseFancy(faction, to, parsed); if (fancy != null) { for (FancyMessage msg : fancy) { - ret.add((SavageFactions.plugin.txt.parse(msg.toOldMessageFormat()))); + ret.add((SavageFactions.plugin.txt.parse(msg.toOldMessageFormat()))); } } continue; } - if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) { + if (! parsed.contains("{notFrozen}") && ! parsed.contains("{notPermanent}")) { if (parsed.contains("{ig}")) { // replaces all variables with no home TL parsed = parsed.substring(0, parsed.indexOf("{ig}")) + TL.COMMAND_SHOW_NOHOME.toString(); @@ -334,7 +334,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(SavageFactions.plugin.txt.parse(parsed)); + ret.add(SavageFactions.plugin.txt.parse(parsed)); } } @@ -344,7 +344,7 @@ public abstract class MemoryBoard extends Board { public abstract void convertFrom(MemoryBoard old); public class MemoryBoardMap extends HashMap { - private static final long serialVersionUID = -6689617828610585368L; + private static final long serialVersionUID = - 6689617828610585368L; Multimap factionToLandMap = HashMultimap.create(); 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 0cc95ed6..d1d114c9 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -85,13 +85,6 @@ public abstract class MemoryFPlayer implements FPlayer { public MemoryFPlayer() { } - public boolean isStealthEnabled() { - return this.isStealthEnabled; - } - - public void setStealth(boolean stealth) { - this.isStealthEnabled = stealth; - } public MemoryFPlayer(String id) { this.id = id; @@ -105,12 +98,12 @@ public abstract class MemoryFPlayer implements FPlayer { this.autoWarZoneEnabled = false; this.loginPvpDisabled = Conf.noPVPDamageToOthersForXSecondsAfterLogin > 0; this.powerBoost = 0.0; - this.showScoreboard = SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", false); + this.showScoreboard = SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", false); this.kills = 0; this.deaths = 0; this.mapHeight = Conf.mapHeight; - if (!Conf.newPlayerStartingFactionID.equals("0") && Factions.getInstance().isValidFactionId(Conf.newPlayerStartingFactionID)) { + if (! Conf.newPlayerStartingFactionID.equals("0") && Factions.getInstance().isValidFactionId(Conf.newPlayerStartingFactionID)) { this.factionId = Conf.newPlayerStartingFactionID; } } @@ -132,12 +125,20 @@ public abstract class MemoryFPlayer implements FPlayer { this.spyingChat = other.spyingChat; this.lastStoodAt = other.lastStoodAt; this.isAdminBypassing = other.isAdminBypassing; - this.showScoreboard = SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", true); + this.showScoreboard = SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", true); this.kills = other.kills; this.deaths = other.deaths; this.mapHeight = Conf.mapHeight; } + public boolean isStealthEnabled() { + return this.isStealthEnabled; + } + + public void setStealth(boolean stealth) { + this.isStealthEnabled = stealth; + } + public void login() { this.kills = getPlayer().getStatistic(Statistic.PLAYER_KILLS); this.deaths = getPlayer().getStatistic(Statistic.DEATHS); @@ -169,7 +170,7 @@ public abstract class MemoryFPlayer implements FPlayer { } public boolean hasFaction() { - return !factionId.equals("0"); + return ! factionId.equals("0"); } public void setMonitorJoins(boolean monitor) { @@ -207,7 +208,7 @@ public abstract class MemoryFPlayer implements FPlayer { public void setAutoLeave(boolean willLeave) { this.willAutoLeave = willLeave; - SavageFactions.plugin.debug(name + " set autoLeave to " + willLeave); + SavageFactions.plugin.debug(name + " set autoLeave to " + willLeave); } public long getLastFrostwalkerMessage() { @@ -268,7 +269,7 @@ public abstract class MemoryFPlayer implements FPlayer { } public ChatMode getChatMode() { - if (this.factionId.equals("0") || !Conf.factionOnlyChat) { + if (this.factionId.equals("0") || ! Conf.factionOnlyChat) { this.chatMode = ChatMode.PUBLIC; } return chatMode; @@ -352,7 +353,7 @@ public abstract class MemoryFPlayer implements FPlayer { // Base: public boolean hasLoginPvpDisabled() { - if (!loginPvpDisabled) { + if (! loginPvpDisabled) { return false; } if (this.lastLoginTime + (Conf.noPVPDamageToOthersForXSecondsAfterLogin * 1000) < System.currentTimeMillis()) { @@ -541,7 +542,7 @@ public abstract class MemoryFPlayer implements FPlayer { public void updatePower() { if (this.isOffline()) { losePowerFromBeingOffline(); - if (!Conf.powerRegenOffline) { + if (! Conf.powerRegenOffline) { return; } } else if (hasFaction() && getFaction().isPowerFrozen()) { @@ -570,13 +571,13 @@ public abstract class MemoryFPlayer implements FPlayer { if (this.power - loss < Conf.powerOfflineLossLimit) { loss = this.power; } - this.alterPower(-loss); + this.alterPower(- loss); } } public void onDeath() { this.updatePower(); - this.alterPower(-Conf.powerPerDeath); + this.alterPower(- Conf.powerPerDeath); if (hasFaction()) { getFaction().setLastDeath(System.currentTimeMillis()); } @@ -611,10 +612,10 @@ public abstract class MemoryFPlayer implements FPlayer { boolean showChat = true; if (showInfoBoard(toShow)) { FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow)); - showChat = SavageFactions.plugin.getConfig().getBoolean("scoreboard.also-send-chat", true); + showChat = SavageFactions.plugin.getConfig().getBoolean("scoreboard.also-send-chat", true); } if (showChat) { - this.sendMessage(SavageFactions.plugin.txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this)))); + this.sendMessage(SavageFactions.plugin.txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this)))); } } @@ -629,7 +630,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() && SavageFactions.plugin.getConfig().contains("scoreboard.finfo") && SavageFactions.plugin.getConfig().getBoolean("scoreboard.finfo-enabled", false) && FScoreboard.get(this) != null; + return showScoreboard && ! toShow.isWarZone() && ! toShow.isWilderness() && ! toShow.isSafeZone() && SavageFactions.plugin.getConfig().contains("scoreboard.finfo") && SavageFactions.plugin.getConfig().getBoolean("scoreboard.finfo-enabled", false) && FScoreboard.get(this) != null; } @Override @@ -644,7 +645,7 @@ public abstract class MemoryFPlayer implements FPlayer { public void leave(boolean makePay) { Faction myFaction = this.getFaction(); - makePay = makePay && Econ.shouldBeUsed() && !this.isAdminBypassing(); + makePay = makePay && Econ.shouldBeUsed() && ! this.isAdminBypassing(); if (myFaction == null) { resetFactionData(); @@ -653,18 +654,18 @@ public abstract class MemoryFPlayer implements FPlayer { boolean perm = myFaction.isPermanent(); - if (! perm && this.getRole() == Role.LEADER && myFaction.getFPlayers().size() > 1) { + if (! perm && this.getRole() == Role.LEADER && myFaction.getFPlayers().size() > 1) { msg(TL.LEAVE_PASSADMIN); return; } - if (!Conf.canLeaveWithNegativePower && this.getPower() < 0) { + if (! Conf.canLeaveWithNegativePower && this.getPower() < 0) { msg(TL.LEAVE_NEGATIVEPOWER); return; } // if economy is enabled and they're not on the bypass list, make sure they can pay - if (makePay && !Econ.hasAtLeast(this, Conf.econCostLeave, TL.LEAVE_TOLEAVE.toString())) { + if (makePay && ! Econ.hasAtLeast(this, Conf.econCostLeave, TL.LEAVE_TOLEAVE.toString())) { return; } @@ -675,7 +676,7 @@ public abstract class MemoryFPlayer implements FPlayer { } // then make 'em pay (if applicable) - if (makePay && !Econ.modifyMoney(this, -Conf.econCostLeave, TL.LEAVE_TOLEAVE.toString(), TL.LEAVE_FORLEAVE.toString())) { + if (makePay && ! Econ.modifyMoney(this, - Conf.econCostLeave, TL.LEAVE_TOLEAVE.toString(), TL.LEAVE_FORLEAVE.toString())) { return; } @@ -693,14 +694,14 @@ public abstract class MemoryFPlayer implements FPlayer { } if (Conf.logFactionLeave) { - SavageFactions.plugin.log(TL.LEAVE_LEFT.format(this.getName(), myFaction.getTag())); + SavageFactions.plugin.log(TL.LEAVE_LEFT.format(this.getName(), myFaction.getTag())); } } myFaction.removeAnnouncements(this); this.resetFactionData(); - if (myFaction.isNormal() && !perm && myFaction.getFPlayers().isEmpty()) { + if (myFaction.isNormal() && ! perm && myFaction.getFPlayers().isEmpty()) { // Remove this faction for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { fplayer.msg(TL.LEAVE_DISBANDED, myFaction.describeTo(fplayer, true)); @@ -708,13 +709,13 @@ public abstract class MemoryFPlayer implements FPlayer { Factions.getInstance().removeFaction(myFaction.getId()); if (Conf.logFactionDisband) { - SavageFactions.plugin.log(TL.LEAVE_DISBANDEDLOG.format(myFaction.getTag(), myFaction.getId(), this.getName())); + SavageFactions.plugin.log(TL.LEAVE_DISBANDEDLOG.format(myFaction.getTag(), myFaction.getId(), this.getName())); } } } public boolean canClaimForFaction(Faction forFaction) { - return this.isAdminBypassing() || !forFaction.isWilderness() && (forFaction == this.getFaction() && this.getRole().isAtLeast(Role.MODERATOR)) || (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer())) || (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())); + return this.isAdminBypassing() || ! forFaction.isWilderness() && (forFaction == this.getFaction() && this.getRole().isAtLeast(Role.MODERATOR)) || (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer())) || (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())); } public boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure) { @@ -726,16 +727,16 @@ public abstract class MemoryFPlayer implements FPlayer { Faction myFaction = getFaction(); Faction currentFaction = Board.getInstance().getFactionAt(flocation); int ownedLand = forFaction.getLandRounded(); - int factionBuffer = SavageFactions.plugin.getConfig().getInt("hcf.buffer-zone", 0); - int worldBuffer = SavageFactions.plugin.getConfig().getInt("world-border.buffer", 0); + int factionBuffer = SavageFactions.plugin.getConfig().getInt("hcf.buffer-zone", 0); + int worldBuffer = SavageFactions.plugin.getConfig().getInt("world-border.buffer", 0); if (Conf.worldGuardChecking && Worldguard.checkForRegionsInChunk(flocation)) { // Checks for WorldGuard regions in the chunk attempting to be claimed - error = SavageFactions.plugin.txt.parse(TL.CLAIM_PROTECTED.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_PROTECTED.toString()); } else if (flocation.isOutsideWorldBorder(SavageFactions.plugin.getConfig().getInt("world-border.buffer", 0))) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString()); } else if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_DISABLED.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_DISABLED.toString()); } else if (this.isAdminBypassing()) { return true; } else if (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer())) { @@ -745,50 +746,50 @@ public abstract class MemoryFPlayer implements FPlayer { } else if (currentFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW) { return true; } else if (myFaction != forFaction) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this)); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this)); } else if (forFaction == currentFaction) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_ALREADYOWN.toString(), forFaction.describeTo(this, true)); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_ALREADYOWN.toString(), forFaction.describeTo(this, true)); } else if (this.getRole().value < Role.MODERATOR.value) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_MUSTBE.toString(), Role.MODERATOR.getTranslation()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_MUSTBE.toString(), Role.MODERATOR.getTranslation()); } else if (forFaction.getFPlayers().size() < Conf.claimsRequireMinFactionMembers) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_MEMBERS.toString(), Conf.claimsRequireMinFactionMembers); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_MEMBERS.toString(), Conf.claimsRequireMinFactionMembers); } else if (currentFaction.isSafeZone()) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_SAFEZONE.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_SAFEZONE.toString()); } else if (currentFaction.isWarZone()) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_WARZONE.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_WARZONE.toString()); } else if (SavageFactions.plugin.getConfig().getBoolean("hcf.allow-overclaim", true) && ownedLand >= forFaction.getPowerRounded()) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_POWER.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_POWER.toString()); } else if (Conf.claimedLandsMax != 0 && ownedLand >= Conf.claimedLandsMax && forFaction.isNormal()) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_LIMIT.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_LIMIT.toString()); } else if (currentFaction.getRelationTo(forFaction) == Relation.ALLY) { - error = SavageFactions.plugin.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())) { + error = SavageFactions.plugin.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 = SavageFactions.plugin.txt.parse(TL.CLAIM_CONTIGIOUS.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_CONTIGIOUS.toString()); } else { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_FACTIONCONTIGUOUS.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_FACTIONCONTIGUOUS.toString()); } } else if (factionBuffer > 0 && Board.getInstance().hasFactionWithin(flocation, myFaction, factionBuffer)) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_TOOCLOSETOOTHERFACTION.format(factionBuffer)); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_TOOCLOSETOOTHERFACTION.format(factionBuffer)); } else if (flocation.isOutsideWorldBorder(worldBuffer)) { if (worldBuffer > 0) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer)); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer)); } else { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString()); } } else if (currentFaction.isNormal()) { if (myFaction.isPeaceful()) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_PEACEFUL.toString(), currentFaction.getTag(this)); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_PEACEFUL.toString(), currentFaction.getTag(this)); } else if (currentFaction.isPeaceful()) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_PEACEFULTARGET.toString(), currentFaction.getTag(this)); - } else if (!currentFaction.hasLandInflation()) { + error = SavageFactions.plugin.txt.parse(TL.CLAIM_PEACEFULTARGET.toString(), currentFaction.getTag(this)); + } else if (! currentFaction.hasLandInflation()) { // TODO more messages WARN current faction most importantly - error = SavageFactions.plugin.txt.parse(TL.CLAIM_THISISSPARTA.toString(), currentFaction.getTag(this)); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_THISISSPARTA.toString(), currentFaction.getTag(this)); } else if (currentFaction.hasLandInflation() && ! SavageFactions.plugin.getConfig().getBoolean("hcf.allow-overclaim", true)) { // deny over claim when it normally would be allowed. - error = SavageFactions.plugin.txt.parse(TL.CLAIM_OVERCLAIM_DISABLED.toString()); - } else if (!Board.getInstance().isBorderLocation(flocation)) { - error = SavageFactions.plugin.txt.parse(TL.CLAIM_BORDER.toString()); + error = SavageFactions.plugin.txt.parse(TL.CLAIM_OVERCLAIM_DISABLED.toString()); + } else if (! Board.getInstance().isBorderLocation(flocation)) { + error = SavageFactions.plugin.txt.parse(TL.CLAIM_BORDER.toString()); } } // TODO: Add more else if statements. @@ -808,7 +809,7 @@ public abstract class MemoryFPlayer implements FPlayer { } public void msg(String str, Object... args) { - this.sendMessage(SavageFactions.plugin.txt.parse(str, args)); + this.sendMessage(SavageFactions.plugin.txt.parse(str, args)); } public void msg(TL translation, Object... args) { @@ -830,7 +831,7 @@ public abstract class MemoryFPlayer implements FPlayer { } public boolean isOffline() { - return !isOnline(); + return ! isOnline(); } public boolean isFlying() { @@ -848,10 +849,10 @@ public abstract class MemoryFPlayer implements FPlayer { player.setFlying(fly); } - if (!damage) { + if (! damage) { msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled"); - if (!fly) { - sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3) + "")); + if (! fly) { + sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3) + "")); } } else { @@ -859,8 +860,8 @@ public abstract class MemoryFPlayer implements FPlayer { } // If leaving fly mode, don't let them take fall damage for x seconds. - if (!fly) { - int cooldown = SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3); + if (! fly) { + int cooldown = SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3); CmdFly.flyMap.remove(player.getName()); // If the value is 0 or lower, make them take fall damage. @@ -868,7 +869,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(SavageFactions.plugin, new Runnable() { + Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() { @Override public void run() { setTakeFallDamage(true); @@ -894,7 +895,7 @@ public abstract class MemoryFPlayer implements FPlayer { public boolean canFlyAtLocation(FLocation location) { Faction faction = Board.getInstance().getFactionAt(location); - if ((faction == getFaction() && getRole() == Role.LEADER) || isAdminBypassing) { + if ((faction == getFaction() && getRole() == Role.LEADER) || isAdminBypassing) { return true; } @@ -952,7 +953,7 @@ public abstract class MemoryFPlayer implements FPlayer { public void sendFancyMessage(FancyMessage message) { Player player = getPlayer(); - if (player == null || !player.isOnGround()) { + if (player == null || ! player.isOnGround()) { return; } @@ -1036,17 +1037,23 @@ public abstract class MemoryFPlayer implements FPlayer { } @Override - public boolean checkIfNearbyEnemies(){ + public boolean checkIfNearbyEnemies() { Player me = this.getPlayer(); int radius = Conf.stealthFlyCheckRadius; for (Entity e : me.getNearbyEntities(radius, 255, radius)) { - if (e == null) { continue; } + if (e == null) { + continue; + } if (e instanceof Player) { Player eplayer = (((Player) e).getPlayer()); - if (eplayer == null) { continue; } + if (eplayer == null) { + continue; + } FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer); - if (efplayer == null) { continue; } - if (efplayer != null && this.getRelationTo(efplayer).equals(Relation.ENEMY) && !efplayer.isStealthEnabled()) { + if (efplayer == null) { + continue; + } + if (efplayer != null && this.getRelationTo(efplayer).equals(Relation.ENEMY) && ! efplayer.isStealthEnabled()) { setFlying(false); msg(TL.COMMAND_FLY_ENEMY_NEAR); Bukkit.getServer().getPluginManager().callEvent(new FPlayerStoppedFlying(this)); @@ -1118,21 +1125,21 @@ public abstract class MemoryFPlayer implements FPlayer { int ownedLand = forFaction.getLandRounded(); - if (!this.canClaimForFactionAtLocation(forFaction, flocation, notifyFailure)) { + if (! this.canClaimForFactionAtLocation(forFaction, flocation, notifyFailure)) { return false; } // if economy is enabled and they're not on the bypass list, make sure they can pay - boolean mustPay = Econ.shouldBeUsed() && !this.isAdminBypassing() && !forFaction.isSafeZone() && !forFaction.isWarZone(); + boolean mustPay = Econ.shouldBeUsed() && ! this.isAdminBypassing() && ! forFaction.isSafeZone() && ! forFaction.isWarZone(); double cost = 0.0; EconomyParticipator payee = null; if (mustPay) { cost = Econ.calculateClaimCost(ownedLand, currentFaction.isNormal()); - if (Conf.econClaimUnconnectedFee != 0.0 && forFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !Board.getInstance().isConnectedLocation(flocation, forFaction)) { + if (Conf.econClaimUnconnectedFee != 0.0 && forFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && ! Board.getInstance().isConnectedLocation(flocation, forFaction)) { cost += Conf.econClaimUnconnectedFee; } @@ -1142,7 +1149,7 @@ public abstract class MemoryFPlayer implements FPlayer { payee = this; } - if (!Econ.hasAtLeast(payee, cost, TL.CLAIM_TOCLAIM.toString())) { + if (! Econ.hasAtLeast(payee, cost, TL.CLAIM_TOCLAIM.toString())) { return false; } } @@ -1154,7 +1161,7 @@ public abstract class MemoryFPlayer implements FPlayer { } // then make 'em pay (if applicable) - if (mustPay && !Econ.modifyMoney(payee, -cost, TL.CLAIM_TOCLAIM.toString(), TL.CLAIM_FORCLAIM.toString())) { + if (mustPay && ! Econ.modifyMoney(payee, - cost, TL.CLAIM_TOCLAIM.toString(), TL.CLAIM_FORCLAIM.toString())) { return false; } @@ -1175,7 +1182,7 @@ public abstract class MemoryFPlayer implements FPlayer { Board.getInstance().setFactionAt(forFaction, flocation); if (Conf.logLandClaims) { - SavageFactions.plugin.log(TL.CLAIM_CLAIMEDLOG.toString(), this.getName(), flocation.getCoordString(), forFaction.getTag()); + SavageFactions.plugin.log(TL.CLAIM_CLAIMEDLOG.toString(), this.getName(), flocation.getCoordString(), forFaction.getTag()); } return true; @@ -1196,15 +1203,15 @@ public abstract class MemoryFPlayer implements FPlayer { if (getRole() == Role.COLEADER) { return Conf.prefixCoLeader; } - if (getRole() == Role.LEADER) { - return Conf.prefixLeader; + if (getRole() == Role.LEADER) { + return Conf.prefixLeader; } return null; } @Override public boolean hasMoney(int amt) { - Economy econ = SavageFactions.plugin.getEcon(); + Economy econ = SavageFactions.plugin.getEcon(); if (econ.getBalance(getPlayer()) >= amt) { return true; } else { @@ -1217,7 +1224,7 @@ public abstract class MemoryFPlayer implements FPlayer { @Override public void takeMoney(int amt) { if (hasMoney(amt)) { - Economy econ = SavageFactions.plugin.getEcon(); + Economy econ = SavageFactions.plugin.getEcon(); econ.withdrawPlayer(getPlayer(), amt); sendMessage(TL.GENERIC_MONEYTAKE.toString().replace("{amount}", 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 f4f6c239..8f1adeb3 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayers.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayers.java @@ -16,8 +16,8 @@ public abstract class MemoryFPlayers extends FPlayers { public void clean() { for (FPlayer fplayer : this.fPlayers.values()) { - if (!Factions.getInstance().isValidFactionId(fplayer.getFactionId())) { - SavageFactions.plugin.log("Reset faction data (invalid faction:" + fplayer.getFactionId() + ") for player " + fplayer.getName()); + if (! Factions.getInstance().isValidFactionId(fplayer.getFactionId())) { + SavageFactions.plugin.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 16a37dee..9113eea0 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -125,7 +125,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public void sendUnreadAnnouncements(FPlayer fPlayer) { - if (!announcements.containsKey(fPlayer.getId())) { + if (! announcements.containsKey(fPlayer.getId())) { return; } fPlayer.msg(TL.FACTIONS_ANNOUNCEMENT_TOP); @@ -164,6 +164,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { public boolean isWarpPassword(String warp, String password) { return hasWarpPassword(warp) && warpPasswords.get(warp.toLowerCase()).equals(password); } + public String getPaypal() { return this.paypal; } @@ -258,10 +259,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } if (Conf.logFactionDisband) { //TODO: Format this correctly and translate. - SavageFactions.plugin.log("The faction " + this.getTag() + " (" + this.getId() + ") was disbanded by " + (disbanderIsConsole ? "console command" : fdisbander.getName()) + "."); + SavageFactions.plugin.log("The faction " + this.getTag() + " (" + this.getId() + ") was disbanded by " + (disbanderIsConsole ? "console command" : fdisbander.getName()) + "."); } - if (Econ.shouldBeUsed() && !disbanderIsConsole) { + if (Econ.shouldBeUsed() && ! disbanderIsConsole) { //Give all the faction's money to the disbander double amount = Econ.getBalance(this.getAccountId()); Econ.transferMoney(fdisbander, this, fdisbander, amount, false); @@ -270,7 +271,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 - SavageFactions.plugin.log(fdisbander.getName() + " has been given bank holdings of " + amountString + " from disbanding " + this.getTag() + "."); + SavageFactions.plugin.log(fdisbander.getName() + " has been given bank holdings of " + amountString + " from disbanding " + this.getTag() + "."); } } @@ -354,11 +355,11 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { int level = getUpgrade("Chest"); int size = 9; if (level == 1) { - size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1") * 9; + size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1") * 9; } else if (level == 2) { - size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2") * 9; + size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2") * 9; } else if (level == 3) { - size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3") * 9; + size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3") * 9; } chest = Bukkit.createInventory(null, size); @@ -434,11 +435,11 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public boolean noExplosionsInTerritory() { - return this.peaceful && !peacefulExplosionsEnabled; + return this.peaceful && ! peacefulExplosionsEnabled; } public boolean isPermanent() { - return permanent || !this.isNormal(); + return permanent || ! this.isNormal(); } public void setPermanent(boolean isPermanent) { @@ -511,7 +512,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public void confirmValidHome() { - if (!Conf.homesMustBeInClaimedTerritory || this.home == null || (this.home.getLocation() != null && Board.getInstance().getFactionAt(new FLocation(this.home.getLocation())) == this)) { + if (! Conf.homesMustBeInClaimedTerritory || this.home == null || (this.home.getLocation() != null && Board.getInstance().getFactionAt(new FLocation(this.home.getLocation())) == this)) { return; } @@ -523,7 +524,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { String aid = "faction-" + this.getId(); // We need to override the default money given to players. - if (!Econ.hasAccount(aid)) { + if (! Econ.hasAccount(aid)) { Econ.setBalance(aid, 0); } @@ -551,7 +552,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public boolean isPowerFrozen() { - int freezeSeconds = SavageFactions.plugin.getConfig().getInt("hcf.powerfreeze", 0); + int freezeSeconds = SavageFactions.plugin.getConfig().getInt("hcf.powerfreeze", 0); return freezeSeconds != 0 && System.currentTimeMillis() - lastDeath < freezeSeconds * 1000; } @@ -637,7 +638,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public void resetPerms() { - SavageFactions.plugin.log(Level.WARNING, "Resetting permissions for Faction: " + tag); + SavageFactions.plugin.log(Level.WARNING, "Resetting permissions for Faction: " + tag); permissions.clear(); @@ -656,7 +657,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { // And each role. for (Role role : Role.values()) { - if (role != Role.LEADER) { + if (role != Role.LEADER) { permissions.put(role, new HashMap<>(freshMap)); } } @@ -695,7 +696,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { // ------------------------------- public boolean isNormal() { - return !(this.isWilderness() || this.isSafeZone() || this.isWarZone()); + return ! (this.isWilderness() || this.isSafeZone() || this.isWarZone()); } public boolean isNone() { @@ -751,7 +752,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { if (this.relationWish.containsKey(otherFaction.getId())) { return this.relationWish.get(otherFaction.getId()); } - return Relation.fromString(SavageFactions.plugin.getConfig().getString("default-relation", "neutral")); // Always default to old behavior. + return Relation.fromString(SavageFactions.plugin.getConfig().getString("default-relation", "neutral")); // Always default to old behavior. } public void setRelationWish(Faction otherFaction, Relation relation) { @@ -844,11 +845,11 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public boolean addFPlayer(FPlayer fplayer) { - return !this.isPlayerFreeType() && fplayers.add(fplayer); + return ! this.isPlayerFreeType() && fplayers.add(fplayer); } public boolean removeFPlayer(FPlayer fplayer) { - return !this.isPlayerFreeType() && fplayers.remove(fplayer); + return ! this.isPlayerFreeType() && fplayers.remove(fplayer); } public int getSize() { @@ -863,7 +864,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { public Set getFPlayersWhereOnline(boolean online) { Set ret = new HashSet<>(); - if (!this.isNormal()) { + if (! this.isNormal()) { return ret; } @@ -878,7 +879,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { public Set getFPlayersWhereOnline(boolean online, FPlayer viewer) { Set ret = new HashSet<>(); - if (!this.isNormal()) { + if (! this.isNormal()) { return ret; } @@ -894,7 +895,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { ret.add(viewed); // If we want offline, just add them. // Prob a better way to do this but idk. - } else if (!online) { + } else if (! online) { ret.add(viewed); } } @@ -904,12 +905,12 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public FPlayer getFPlayerAdmin() { - if (!this.isNormal()) { + if (! this.isNormal()) { return null; } for (FPlayer fplayer : fplayers) { - if (fplayer.getRole() == Role.LEADER) { + if (fplayer.getRole() == Role.LEADER) { return fplayer; } } @@ -918,7 +919,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { public ArrayList getFPlayersWhereRole(Role role) { ArrayList ret = new ArrayList<>(); - if (!this.isNormal()) { + if (! this.isNormal()) { return ret; } @@ -937,7 +938,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { return ret; } - for (Player player : SavageFactions.plugin.getServer().getOnlinePlayers()) { + for (Player player : SavageFactions.plugin.getServer().getOnlinePlayers()) { FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); if (fplayer.getFaction() == this) { ret.add(player); @@ -955,7 +956,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { return false; } - for (Player player : SavageFactions.plugin.getServer().getOnlinePlayers()) { + for (Player player : SavageFactions.plugin.getServer().getOnlinePlayers()) { FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); if (fplayer != null && fplayer.getFaction() == this) { return true; @@ -976,7 +977,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { // used when current leader is about to be removed from the faction; // promotes new leader, or disbands faction if no other members left public void promoteNewLeader() { - if (!this.isNormal()) { + if (! this.isNormal()) { return; } if (this.isPermanent() && Conf.permanentFactionsDisableLeaderPromotion) { @@ -1001,7 +1002,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { // no members left and faction isn't permanent, so disband it if (Conf.logFactionDisband) { - SavageFactions.plugin.log("The faction " + this.getTag() + " (" + this.getId() + ") has been disbanded since it has no members left."); + SavageFactions.plugin.log("The faction " + this.getTag() + " (" + this.getId() + ") has been disbanded since it has no members left."); } for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { @@ -1013,10 +1014,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { if (oldLeader != null) { oldLeader.setRole(Role.NORMAL); } - replacements.get(0).setRole(Role.LEADER); + 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()); - SavageFactions.plugin.log("Faction " + this.getTag() + " (" + this.getId() + ") admin was removed. Replacement admin: " + replacements.get(0).getName()); + SavageFactions.plugin.log("Faction " + this.getTag() + " (" + this.getId() + ") admin was removed. Replacement admin: " + replacements.get(0).getName()); } } @@ -1024,7 +1025,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { // Messages // ----------------------------------------------// public void msg(String message, Object... args) { - message = SavageFactions.plugin.txt.parse(message, args); + message = SavageFactions.plugin.txt.parse(message, args); for (FPlayer fplayer : this.getFPlayersWhereOnline(true)) { fplayer.sendMessage(message); @@ -1095,12 +1096,12 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public boolean doesLocationHaveOwnersSet(FLocation loc) { - if (claimOwnership.isEmpty() || !claimOwnership.containsKey(loc)) { + if (claimOwnership.isEmpty() || ! claimOwnership.containsKey(loc)) { return false; } Set ownerData = claimOwnership.get(loc); - return ownerData != null && !ownerData.isEmpty(); + return ownerData != null && ! ownerData.isEmpty(); } public boolean isPlayerInOwnerList(FPlayer player, FLocation loc) { @@ -1155,7 +1156,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { public boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc) { // in own faction, with sufficient role or permission to bypass // ownership? - if (fplayer.getFaction() == this && (fplayer.getRole().isAtLeast(Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.LEADER) || Permission.OWNERSHIP_BYPASS.has(fplayer.getPlayer()))) { + if (fplayer.getFaction() == this && (fplayer.getRole().isAtLeast(Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.LEADER) || Permission.OWNERSHIP_BYPASS.has(fplayer.getPlayer()))) { return true; } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFactions.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFactions.java index 76d1caee..ac832f91 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFactions.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFactions.java @@ -18,33 +18,33 @@ public abstract class MemoryFactions extends Factions { public void load() { // Make sure the default neutral faction exists - if (!factions.containsKey("0")) { + if (! factions.containsKey("0")) { Faction faction = generateFactionObject("0"); factions.put("0", faction); faction.setTag(TL.WILDERNESS.toString()); faction.setDescription(TL.WILDERNESS_DESCRIPTION.toString()); } else { Faction faction = factions.get("0"); - if (!faction.getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) { + if (! faction.getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) { faction.setTag(TL.WILDERNESS.toString()); } - if (!faction.getDescription().equalsIgnoreCase(TL.WILDERNESS_DESCRIPTION.toString())) { + if (! faction.getDescription().equalsIgnoreCase(TL.WILDERNESS_DESCRIPTION.toString())) { faction.setDescription(TL.WILDERNESS_DESCRIPTION.toString()); } } // Make sure the safe zone faction exists - if (!factions.containsKey("-1")) { + if (! factions.containsKey("-1")) { Faction faction = generateFactionObject("-1"); factions.put("-1", faction); faction.setTag(TL.SAFEZONE.toString()); faction.setDescription(TL.SAFEZONE_DESCRIPTION.toString()); } else { Faction faction = factions.get("-1"); - if (!faction.getTag().equalsIgnoreCase(TL.SAFEZONE.toString())) { + if (! faction.getTag().equalsIgnoreCase(TL.SAFEZONE.toString())) { faction.setTag(TL.SAFEZONE.toString()); } - if (!faction.getDescription().equalsIgnoreCase(TL.SAFEZONE_DESCRIPTION.toString())) { + if (! faction.getDescription().equalsIgnoreCase(TL.SAFEZONE_DESCRIPTION.toString())) { faction.setDescription(TL.SAFEZONE_DESCRIPTION.toString()); } // if SafeZone has old pre-1.6.0 name, rename it to remove troublesome " " @@ -54,17 +54,17 @@ public abstract class MemoryFactions extends Factions { } // Make sure the war zone faction exists - if (!factions.containsKey("-2")) { + if (! factions.containsKey("-2")) { Faction faction = generateFactionObject("-2"); factions.put("-2", faction); faction.setTag(TL.WARZONE.toString()); faction.setDescription(TL.WARZONE_DESCRIPTION.toString()); } else { Faction faction = factions.get("-2"); - if (!faction.getTag().equalsIgnoreCase(TL.WARZONE.toString())) { + if (! faction.getTag().equalsIgnoreCase(TL.WARZONE.toString())) { faction.setTag(TL.WARZONE.toString()); } - if (!faction.getDescription().equalsIgnoreCase(TL.WARZONE_DESCRIPTION.toString())) { + if (! faction.getDescription().equalsIgnoreCase(TL.WARZONE_DESCRIPTION.toString())) { faction.setDescription(TL.WARZONE_DESCRIPTION.toString()); } // if WarZone has old pre-1.6.0 name, rename it to remove troublesome " " @@ -101,7 +101,7 @@ public abstract class MemoryFactions extends Factions { if (candidate.length() < minlength) { continue; } - if (!candidate.toLowerCase().startsWith(start)) { + if (! candidate.toLowerCase().startsWith(start)) { continue; } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/SaveTask.java b/src/main/java/com/massivecraft/factions/zcore/persist/SaveTask.java index 232c9d21..4ed33d05 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/SaveTask.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/SaveTask.java @@ -16,7 +16,7 @@ public class SaveTask implements Runnable { } public void run() { - if (!p.getAutoSave() || running) { + if (! p.getAutoSave() || running) { return; } running = true; 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 c0f145e8..de25f9c0 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 @@ -11,19 +11,19 @@ import java.util.logging.Logger; public class FactionsJSON { public static void convertTo() { - if (!(Factions.getInstance() instanceof MemoryFactions)) { + if (! (Factions.getInstance() instanceof MemoryFactions)) { return; } - if (!(FPlayers.getInstance() instanceof MemoryFPlayers)) { + if (! (FPlayers.getInstance() instanceof MemoryFPlayers)) { return; } - if (!(Board.getInstance() instanceof MemoryBoard)) { + if (! (Board.getInstance() instanceof MemoryBoard)) { return; } new BukkitRunnable() { @Override public void run() { - Logger logger = SavageFactions.plugin.getLogger(); + Logger logger = SavageFactions.plugin.getLogger(); logger.info("Beginning Board conversion to JSON"); new JSONBoard().convertFrom((MemoryBoard) Board.getInstance()); logger.info("Board Converted"); 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 31dbf8b5..94c06f96 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 @@ -16,7 +16,7 @@ import java.util.TreeMap; public class JSONBoard extends MemoryBoard { - private static transient File file = new File(SavageFactions.plugin.getDataFolder(), "board.json"); + private static transient File file = new File(SavageFactions.plugin.getDataFolder(), "board.json"); // -------------------------------------------- // // Persistance @@ -32,7 +32,7 @@ public class JSONBoard extends MemoryBoard { worldName = entry.getKey().getWorldName(); coords = entry.getKey().getCoordString(); id = entry.getValue(); - if (!worldCoordIds.containsKey(worldName)) { + if (! worldCoordIds.containsKey(worldName)) { worldCoordIds.put(worldName, new TreeMap()); } @@ -67,14 +67,14 @@ public class JSONBoard extends MemoryBoard { } public void forceSave(boolean sync) { - DiscUtil.writeCatch(file, SavageFactions.plugin.gson.toJson(dumpAsSaveFormat()), sync); + DiscUtil.writeCatch(file, SavageFactions.plugin.gson.toJson(dumpAsSaveFormat()), sync); } public boolean load() { - SavageFactions.plugin.log("Loading board from disk"); + SavageFactions.plugin.log("Loading board from disk"); - if (!file.exists()) { - SavageFactions.plugin.log("No board to load from disk. Creating new file."); + if (! file.exists()) { + SavageFactions.plugin.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 = SavageFactions.plugin.gson.fromJson(DiscUtil.read(file), type); + Map> worldCoordIds = SavageFactions.plugin.gson.fromJson(DiscUtil.read(file), type); loadFromSaveFormat(worldCoordIds); - SavageFactions.plugin.log("Loaded " + flocationIds.size() + " board locations"); + SavageFactions.plugin.log("Loaded " + flocationIds.size() + " board locations"); } catch (Exception e) { e.printStackTrace(); - SavageFactions.plugin.log("Failed to load the board from disk."); + SavageFactions.plugin.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 6bc9e3a4..199301e3 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 @@ -26,8 +26,8 @@ public class JSONFPlayers extends MemoryFPlayers { private File file; public JSONFPlayers() { - file = new File(SavageFactions.plugin.getDataFolder(), "players.json"); - gson = SavageFactions.plugin.gson; + file = new File(SavageFactions.plugin.getDataFolder(), "players.json"); + gson = SavageFactions.plugin.gson; } public Gson getGson() { @@ -75,11 +75,11 @@ public class JSONFPlayers extends MemoryFPlayers { } this.fPlayers.clear(); this.fPlayers.putAll(fplayers); - SavageFactions.plugin.log("Loaded " + fPlayers.size() + " players"); + SavageFactions.plugin.log("Loaded " + fPlayers.size() + " players"); } private Map loadCore() { - if (!this.file.exists()) { + if (! this.file.exists()) { return new HashMap<>(); } @@ -96,7 +96,7 @@ public class JSONFPlayers extends MemoryFPlayers { String key = entry.getKey(); entry.getValue().setId(key); if (doesKeyNeedMigration(key)) { - if (!isKeyInvalid(key)) { + if (! isKeyInvalid(key)) { list.add(key); } else { invalidList.add(key); @@ -126,7 +126,7 @@ public class JSONFPlayers extends MemoryFPlayers { Map response = fetcher.call(); for (String s : list) { // Are we missing any responses? - if (!response.containsKey(s)) { + if (! response.containsKey(s)) { // They don't have a UUID so they should just be removed invalidList.add(s); } @@ -168,17 +168,17 @@ public class JSONFPlayers extends MemoryFPlayers { } private boolean doesKeyNeedMigration(String key) { - if (!key.matches("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")) { + if (! key.matches("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")) { // Not a valid UUID.. - // Valid playername, we'll mark this as one for conversion - // to UUID - return key.matches("[a-zA-Z0-9_]{2,16}"); + // Valid playername, we'll mark this as one for conversion + // to UUID + return key.matches("[a-zA-Z0-9_]{2,16}"); } return false; } private boolean isKeyInvalid(String key) { - return !key.matches("[a-zA-Z0-9_]{2,16}"); + return ! key.matches("[a-zA-Z0-9_]{2,16}"); } @Override 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 f00a8c4b..3ad80eb5 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 @@ -26,8 +26,8 @@ public class JSONFactions extends MemoryFactions { private final File file; public JSONFactions() { - this.file = new File(SavageFactions.plugin.getDataFolder(), "factions.json"); - this.gson = SavageFactions.plugin.gson; + this.file = new File(SavageFactions.plugin.getDataFolder(), "factions.json"); + this.gson = SavageFactions.plugin.gson; this.nextId = 1; } @@ -68,11 +68,11 @@ public class JSONFactions extends MemoryFactions { this.factions.putAll(factions); super.load(); - SavageFactions.plugin.log("Loaded " + factions.size() + " Factions"); + SavageFactions.plugin.log("Loaded " + factions.size() + " Factions"); } private Map loadCore() { - if (!this.file.exists()) { + if (! this.file.exists()) { return new HashMap<>(); } @@ -180,7 +180,7 @@ public class JSONFactions extends MemoryFactions { private Set whichKeysNeedMigration(Set keys) { HashSet list = new HashSet<>(); for (String value : keys) { - if (!value.matches("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")) { + if (! value.matches("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")) { // Not a valid UUID.. if (value.matches("[a-zA-Z0-9_]{2,16}")) { // Valid playername, we'll mark this as one for conversion @@ -197,14 +197,14 @@ public class JSONFactions extends MemoryFactions { // -------------------------------------------- // public String getNextId() { - while (!isIdFree(this.nextId)) { + while (! isIdFree(this.nextId)) { this.nextId += 1; } return Integer.toString(this.nextId); } public boolean isIdFree(String id) { - return !this.factions.containsKey(id); + return ! this.factions.containsKey(id); } public boolean isIdFree(int id) { 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 4896f5b6..eaf37257 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java @@ -80,7 +80,7 @@ public class DiscUtil { lock.unlock(); } } else { - Bukkit.getScheduler().runTaskAsynchronously(SavageFactions.plugin, new Runnable() { + Bukkit.getScheduler().runTaskAsynchronously(SavageFactions.plugin, new Runnable() { @Override public void run() { lock.lock(); @@ -111,11 +111,11 @@ public class DiscUtil { // -------------------------------------------- // public static byte[] utf8(String string) { - return string.getBytes(StandardCharsets.UTF_8); + return string.getBytes(StandardCharsets.UTF_8); } public static String utf8(byte[] bytes) { - return new String(bytes, StandardCharsets.UTF_8); + return new String(bytes, StandardCharsets.UTF_8); } } \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/zcore/util/PermUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/PermUtil.java index df711541..fb68659d 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/PermUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/PermUtil.java @@ -30,7 +30,7 @@ public class PermUtil { */ public final void setup() { for (Permission permission : p.getDescription().getPermissions()) { - //plugin.log("\""+permission.getName()+"\" = \""+permission.getDescription()+"\""); + //plugin.log("\""+permission.getName()+"\" = \""+permission.getDescription()+"\""); this.permissionDescriptions.put(permission.getName(), permission.getDescription()); } } @@ -51,7 +51,7 @@ public class PermUtil { return false; } - if (!(me instanceof Player)) { + if (! (me instanceof Player)) { return me.hasPermission(perm); } diff --git a/src/main/java/com/massivecraft/factions/zcore/util/Persist.java b/src/main/java/com/massivecraft/factions/zcore/util/Persist.java index 9513b2d8..9b597db0 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/Persist.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/Persist.java @@ -64,7 +64,7 @@ public class Persist { } public T loadOrSaveDefault(T def, Class clazz, File file) { - if (!file.exists()) { + if (! file.exists()) { p.log("Creating default: " + file); this.save(def, file); return def; @@ -130,12 +130,12 @@ public class Persist { // LOAD BY TYPE - @SuppressWarnings("unchecked") + @SuppressWarnings ("unchecked") public T load(Type typeOfT, String name) { return (T) load(typeOfT, getFile(name)); } - @SuppressWarnings("unchecked") + @SuppressWarnings ("unchecked") public T load(Type typeOfT, File file) { String content = DiscUtil.readCatch(file); if (content == null) { diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 401af642..2e1c8d0c 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -106,8 +106,6 @@ public enum TL { COMMAND_UPGRADES_DESCRIPTION("&cOpen the Upgrades Menu"), - - COMMAND_ADMIN_NOTMEMBER("&c&l[!] &7%1$s &cis not a member in your faction."), COMMAND_ADMIN_NOTADMIN("&c&l[!] &cYou are not the faction admin."), @@ -432,10 +430,10 @@ public enum TL { COMMAND_MONEYTRANSFERFF_DESCRIPTION("Transfer f -> f"), COMMAND_MONEYTRANSFERFF_TRANSFER("&c&l[!]&7 &c%1$s&7 transferred&c %2$s &7from the faction &c\"%3$s\"&7 to the faction&c \"%4$s\"&7"), - COMMAND_MONEYTRANSFERFP_DESCRIPTION("Transfer f -> plugin"), + COMMAND_MONEYTRANSFERFP_DESCRIPTION("Transfer f -> plugin"), COMMAND_MONEYTRANSFERFP_TRANSFER("&c&l[!]&7 &c%1$s &7transferred&c %2$s &7from the faction&c \"%3$s\" &7to the player &c\"%4$s\""), - COMMAND_MONEYTRANSFERPF_DESCRIPTION("Transfer plugin -> f"), + COMMAND_MONEYTRANSFERPF_DESCRIPTION("Transfer plugin -> f"), COMMAND_MONEYTRANSFERPF_TRANSFER("&c&l[!]&7 &c%1$s&7 transferred &c%2$s&7 from the player &c\"%3$s\" &7to the faction&c \"%4$s\""), COMMAND_MONEYWITHDRAW_DESCRIPTION("Withdraw money"), @@ -524,8 +522,8 @@ public enum TL { COMMAND_POWER_PENALTY(" (penalty: "), COMMAND_POWER_DESCRIPTION("&a&l» &7Show player &apower &7info"), - COMMAND_POWERBOOST_HELP_1("&c&l[!]&7 You must specify \"plugin\" or \"player\" to target a player or \"f\" or \"faction\" to target a faction."), - COMMAND_POWERBOOST_HELP_2("&c&l[!]&7 ex. /f powerboost plugin SomePlayer 0.5 -or- /f powerboost f SomeFaction -5"), + COMMAND_POWERBOOST_HELP_1("&c&l[!]&7 You must specify \"plugin\" or \"player\" to target a player or \"f\" or \"faction\" to target a faction."), + COMMAND_POWERBOOST_HELP_2("&c&l[!]&7 ex. /f powerboost plugin SomePlayer 0.5 -or- /f powerboost f SomeFaction -5"), COMMAND_POWERBOOST_INVALIDNUM("You must specify a valid numeric value for the power bonus/penalty amount."), COMMAND_POWERBOOST_PLAYER("Player \"%1$s\""), COMMAND_POWERBOOST_FACTION("Faction \"%1$s\""), @@ -645,7 +643,7 @@ public enum TL { COMMAND_STATUS_DESCRIPTION("Show the status of a player"), COMMAND_STEALTH_DESCRIPTION("Enable and Disable Stealth Mode"), - COMMAND_STEALTH_ENABLE( "&cStealth &7» &7You will no longer disable nearby players in /f fly for {timeout} seconds."), + COMMAND_STEALTH_ENABLE("&cStealth &7» &7You will no longer disable nearby players in /f fly for {timeout} seconds."), COMMAND_STEALTH_DISABLE("&2Stealth &8» &7You will now disable other nearby players in /f fly."), COMMAND_STEALTH_MUSTBEMEMBER("&2Stealth &8» &4You must be in a faction to use this command"), @@ -808,10 +806,10 @@ public enum TL { GENERIC_NOPERMISSION("You don't have permission to %1$s."), GENERIC_FPERM_NOPERMISSION("&7The faction leader does not allow you to &c%1$s."), GENERIC_DOTHAT("do that"), //Ugh nuke this from high orbit - GENERIC_NOPLAYERMATCH("No player match found for \"%1$s\"."), - GENERIC_NOPLAYERFOUND("No player \"%1$s\" could not be found."), + GENERIC_NOPLAYERMATCH("No player match found for \"%1$s\"."), + GENERIC_NOPLAYERFOUND("No player \"%1$s\" could not be found."), GENERIC_ARGS_TOOFEW("Too few arguments. Use like this:"), - GENERIC_ARGS_TOOMANY("Strange argument \"%1$s\". Use the command like this:"), + GENERIC_ARGS_TOOMANY("Strange argument \"%1$s\". Use the command like this:"), GENERIC_DEFAULTDESCRIPTION("Default faction description :("), GENERIC_OWNERS("Owner(s): %1$s"), GENERIC_PUBLICLAND("Public faction land."), 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 7209f774..38d5a45d 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java @@ -123,22 +123,22 @@ public enum TagReplacer { case FACTIONLESS: return String.valueOf(Factions.getInstance().getNone().getFPlayersWhereOnline(true).size()); case MAX_ALLIES: - if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", true)) { - return String.valueOf(SavageFactions.plugin.getConfig().getInt("max-relations.ally", 10)); + if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", true)) { + return String.valueOf(SavageFactions.plugin.getConfig().getInt("max-relations.ally", 10)); } return TL.GENERIC_INFINITY.toString(); case MAX_ENEMIES: - if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", true)) { - return String.valueOf(SavageFactions.plugin.getConfig().getInt("max-relations.enemy", 10)); + if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", true)) { + return String.valueOf(SavageFactions.plugin.getConfig().getInt("max-relations.enemy", 10)); } return TL.GENERIC_INFINITY.toString(); case MAX_TRUCES: - if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", true)) { - return String.valueOf(SavageFactions.plugin.getConfig().getInt("max-relations.truce", 10)); + if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", true)) { + return String.valueOf(SavageFactions.plugin.getConfig().getInt("max-relations.truce", 10)); } return TL.GENERIC_INFINITY.toString(); case MAX_WARPS: - return String.valueOf(SavageFactions.plugin.getConfig().getInt("max-warps", 5)); + return String.valueOf(SavageFactions.plugin.getConfig().getInt("max-warps", 5)); } return null; } @@ -155,21 +155,21 @@ public enum TagReplacer { return getValue(); } - boolean minimal = SavageFactions.plugin.getConfig().getBoolean("minimal-show", false); + boolean minimal = SavageFactions.plugin.getConfig().getBoolean("minimal-show", false); if (fp != null) { switch (this) { case HEADER: - return SavageFactions.plugin.txt.titleize(fac.getTag(fp)); + return SavageFactions.plugin.txt.titleize(fac.getTag(fp)); case PLAYER_NAME: return fp.getName(); case FACTION: - return !fac.isWilderness() ? fac.getTag(fp) : TL.GENERIC_FACTIONLESS.toString(); + return ! fac.isWilderness() ? fac.getTag(fp) : TL.GENERIC_FACTIONLESS.toString(); case LAST_SEEN: 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 SavageFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fp.getId()))); + return SavageFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fp.getId()))); case PLAYER_BALANCE: return Econ.isSetup() ? Econ.getFriendlyBalance(fp) : TL.ECON_OFF.format("balance"); case PLAYER_POWER: @@ -210,7 +210,7 @@ public enum TagReplacer { case CREATE_DATE: return TL.sdf.format(fac.getFoundedDate()); case RAIDABLE: - boolean raid = SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && fac.getLandRounded() >= fac.getPowerRounded(); + boolean raid = SavageFactions.plugin.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 619026b6..d103d734 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java @@ -97,11 +97,11 @@ public class TagUtil { } public static String parsePlaceholders(Player player, String line) { - if (SavageFactions.plugin.isClipPlaceholderAPIHooked() && player.isOnline()) { + if (SavageFactions.plugin.isClipPlaceholderAPIHooked() && player.isOnline()) { line = PlaceholderAPI.setPlaceholders(player, line); } - if (SavageFactions.plugin.isMVdWPlaceholderAPIHooked() && player.isOnline()) { + if (SavageFactions.plugin.isMVdWPlaceholderAPIHooked() && player.isOnline()) { line = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(player, line); } @@ -133,11 +133,11 @@ public class TagUtil { */ protected static List getFancy(Faction target, FPlayer fme, TagReplacer type, String prefix) { List fancyMessages = new ArrayList<>(); - boolean minimal = SavageFactions.plugin.getConfig().getBoolean("minimal-show", false); + boolean minimal = SavageFactions.plugin.getConfig().getBoolean("minimal-show", false); switch (type) { case ALLIES_LIST: - FancyMessage currentAllies = SavageFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentAllies = SavageFactions.plugin.txt.parseFancy(prefix); boolean firstAlly = true; for (Faction otherFaction : Factions.getInstance().getAllFactions()) { if (otherFaction == target) { @@ -157,7 +157,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 = SavageFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentEnemies = SavageFactions.plugin.txt.parseFancy(prefix); boolean firstEnemy = true; for (Faction otherFaction : Factions.getInstance().getAllFactions()) { if (otherFaction == target) { @@ -177,7 +177,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 = SavageFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentTruces = SavageFactions.plugin.txt.parseFancy(prefix); boolean firstTruce = true; for (Faction otherFaction : Factions.getInstance().getAllFactions()) { if (otherFaction == target) { @@ -197,10 +197,10 @@ 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 = SavageFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentOnline = SavageFactions.plugin.txt.parseFancy(prefix); boolean firstOnline = true; for (FPlayer p : MiscUtil.rankOrder(target.getFPlayersWhereOnline(true, fme))) { - if (fme.getPlayer() != null && !fme.getPlayer().canSee(p.getPlayer())) { + if (fme.getPlayer() != null && ! fme.getPlayer().canSee(p.getPlayer())) { continue; // skip } String name = p.getNameAndTitle(); @@ -215,12 +215,12 @@ 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 = SavageFactions.plugin.txt.parseFancy(prefix); + FancyMessage currentOffline = SavageFactions.plugin.txt.parseFancy(prefix); boolean firstOffline = true; for (FPlayer p : MiscUtil.rankOrder(target.getFPlayers())) { String name = p.getNameAndTitle(); // Also make sure to add players that are online BUT can't be seen. - if (!p.isOnline() || (fme.getPlayer() != null && p.isOnline() && !fme.getPlayer().canSee(p.getPlayer()))) { + if (! p.isOnline() || (fme.getPlayer() != null && p.isOnline() && ! fme.getPlayer().canSee(p.getPlayer()))) { currentOffline.then(firstOffline ? name : ", " + name); currentOffline.tooltip(tipPlayer(p)).color(fme.getColorTo(p)); firstOffline = false; @@ -244,7 +244,7 @@ public class TagUtil { */ private static List tipFaction(Faction faction) { List lines = new ArrayList<>(); - for (String line : SavageFactions.plugin.getConfig().getStringList("tooltips.list")) { + for (String line : SavageFactions.plugin.getConfig().getStringList("tooltips.list")) { lines.add(ChatColor.translateAlternateColorCodes('&', TagUtil.parsePlain(faction, line))); } return lines; @@ -258,7 +258,7 @@ public class TagUtil { */ private static List tipPlayer(FPlayer fplayer) { List lines = new ArrayList<>(); - for (String line : SavageFactions.plugin.getConfig().getStringList("tooltips.show")) { + for (String line : SavageFactions.plugin.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 d7f9e996..fbf11cf2 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java @@ -16,7 +16,7 @@ public class TextUtil { // -------------------------------------------- // // Top-level parsing functions. // -------------------------------------------- // - private final static int titleizeBalance = -1; + private final static int titleizeBalance = - 1; public Map tags; // -------------------------------------------- // @@ -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("`SavageFactions", 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("`SavageFactions", 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) { @@ -159,7 +159,7 @@ public class TextUtil { if (candidate.length() < minlength) { continue; } - if (!candidate.toLowerCase().startsWith(start)) { + if (! candidate.toLowerCase().startsWith(start)) { continue; }