diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIReflections.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIReflections.java index 54e79bc9..c9c75f3e 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIReflections.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/CMIReflections.java @@ -9,8 +9,6 @@ import java.lang.reflect.Method; import org.bukkit.inventory.ItemStack; -import com.gamingmesh.jobs.Jobs; - public class CMIReflections { //private Class CraftServerClass; @@ -65,11 +63,11 @@ public class CMIReflections { } private static Class getBukkitClass(String nmsClassString) throws ClassNotFoundException { - return Class.forName("org.bukkit.craftbukkit." + Jobs.getVersionCheckManager().getVersion() + "." + nmsClassString); + return Class.forName("org.bukkit.craftbukkit." + Version.getCurrent() + "." + nmsClassString); } public static Class getMinecraftClass(String nmsClassString) throws ClassNotFoundException { - return Class.forName("net.minecraft.server." + Jobs.getVersionCheckManager().getVersion() + "." + nmsClassString); + return Class.forName("net.minecraft.server." + Version.getCurrent() + "." + nmsClassString); } public ItemStack removeNbt(ItemStack item, String base, String path) { @@ -289,8 +287,6 @@ public class CMIReflections { } public static ItemStack getItemInOffHand(org.bukkit.entity.Player player) { - if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) - return null; - return player.getInventory().getItemInOffHand(); + return Version.getCurrent().isLower(Version.v1_9_R1) ? null : player.getInventory().getItemInOffHand(); } } diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java b/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java index 5cde12f5..4552dd9e 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java @@ -11,8 +11,6 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Entity; import org.bukkit.inventory.ItemStack; -import com.gamingmesh.jobs.Jobs; - public class ItemReflection { private static Class CraftServerClass; @@ -38,11 +36,11 @@ public class ItemReflection { } private static Class getBukkitClass(String nmsClassString) throws ClassNotFoundException { - return Class.forName("org.bukkit.craftbukkit." + Jobs.getVersionCheckManager().getVersion() + "." + nmsClassString); + return Class.forName("org.bukkit.craftbukkit." + Version.getCurrent() + "." + nmsClassString); } public static Class getMinecraftClass(String nmsClassString) throws ClassNotFoundException { - return Class.forName("net.minecraft.server." + Jobs.getVersionCheckManager().getVersion() + "." + nmsClassString); + return Class.forName("net.minecraft.server." + Version.getCurrent() + "." + nmsClassString); } public static String getItemMinecraftName(ItemStack item) { @@ -98,9 +96,7 @@ public class ItemReflection { } public static ItemStack getItemInOffHand(org.bukkit.entity.Player player) { - if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) - return null; - return player.getInventory().getItemInOffHand(); + return Version.getCurrent().isLower(Version.v1_9_R1) ? null : player.getInventory().getItemInOffHand(); } public void setEndermiteActive(Entity ent, boolean state) { diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/VersionChecker.java b/src/main/java/com/gamingmesh/jobs/CMILib/VersionChecker.java index 6e7fd3fd..0f77a102 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/VersionChecker.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/VersionChecker.java @@ -21,6 +21,7 @@ public class VersionChecker { this.plugin = plugin; } + @Deprecated public Version getVersion() { return Version.getCurrent(); } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java index 41d3b877..1e4fc113 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java @@ -509,12 +509,10 @@ public class editquests implements Cmd { } else if (actionT == ActionType.ENCHANT) { Enchantment enchant = Enchantment.getByName(myKey); - if (enchant != null) { - if (Jobs.getVersionCheckManager().getVersion().isEqualOrLower(Version.v1_12_R1)) { - try { - id = (int) enchant.getClass().getMethod("getId").invoke(enchant); - } catch (Exception e) { - } + if (enchant != null && Version.getCurrent().isEqualOrLower(Version.v1_12_R1)) { + try { + id = (int) enchant.getClass().getMethod("getId").invoke(enchant); + } catch (Exception e) { } } type = myKey; diff --git a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java index ceef73e4..8e48d4e8 100644 --- a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java @@ -25,7 +25,7 @@ public class BossBarManager { } public synchronized void ShowJobProgression(final JobsPlayer player) { - if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) + if (Version.getCurrent().isLower(Version.v1_9_R1)) return; if (player == null) @@ -39,7 +39,7 @@ public class BossBarManager { } public synchronized void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) { - if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) + if (Version.getCurrent().isLower(Version.v1_9_R1)) return; String playerUUID = player.getPlayer().getUniqueId().toString(); diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index 63dd8605..e13f6b9b 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -46,7 +46,7 @@ import java.util.List; public class ConfigManager { - private File jobFile = null; + private File jobFile; public ConfigManager() { this.jobFile = new File(Jobs.getFolder(), "jobConfig.yml"); diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index c01a519f..2ee4d570 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -441,7 +441,7 @@ public class GeneralConfigManager { c.addComment("enable-pay-near-spawner", "Option to allow payment to be made when killing mobs from a spawner.", "Use jobs.nearspawner.[amount] to define multiplayer. Example jobs.nearspawner.-0.5 will pay half of payment, jobs.nearspawner.-1 will not pay at all"); - payNearSpawner = c.get("enable-pay-near-spawner", false); + payNearSpawner = c.get("enable-pay-near-spawner", true); c.addComment("enable-pay-creative", "Option to allow payment to be made in creative mode. This ignoring when a group has 'jobs.paycreative' permission."); payInCreative = c.get("enable-pay-creative", false); @@ -449,7 +449,7 @@ public class GeneralConfigManager { c.addComment("enable-pay-for-exploring-when-flying", "Option to allow payment to be made for exploring when player flies"); payExploringWhenFlying = c.get("enable-pay-for-exploring-when-flying", false); - if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R1)) { + if (Version.isCurrentEqualOrHigher(Version.v1_9_R1)) { c.addComment("enable-pay-for-exploring-when-gliding", "Option to allow payment to be made for exploring when player gliding."); payExploringWhenGliding = c.get("enable-pay-for-exploring-when-gliding", false); } @@ -837,7 +837,7 @@ public class GeneralConfigManager { c.addComment("ActionBars.Messages.EnabledByDefault", "When this set to true player will see action bar messages by default"); ActionBarsMessageByDefault = c.get("ActionBars.Messages.EnabledByDefault", true); - if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R1)) { + if (Version.isCurrentEqualOrHigher(Version.v1_9_R1)) { c.addComment("BossBar.Enabled", "Enables BossBar feature", "Works only from 1.9 mc version"); BossBarEnabled = c.get("BossBar.Enabled", true); @@ -867,11 +867,11 @@ public class GeneralConfigManager { c.addComment("Sounds", "Sounds", "Extra sounds on some events", "All sounds can be found in https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html"); SoundLevelupUse = c.get("Sounds.LevelUp.use", true); - SoundLevelupSound = c.get("Sounds.LevelUp.sound", Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1) ? "LEVEL_UP " : "ENTITY_PLAYER_LEVELUP"); + SoundLevelupSound = c.get("Sounds.LevelUp.sound", Version.isCurrentLower(Version.v1_9_R1) ? "LEVEL_UP " : "ENTITY_PLAYER_LEVELUP"); SoundLevelupVolume = c.get("Sounds.LevelUp.volume", 1); SoundLevelupPitch = c.get("Sounds.LevelUp.pitch", 3); SoundTitleChangeUse = c.get("Sounds.TitleChange.use", true); - SoundTitleChangeSound = c.get("Sounds.TitleChange.sound", Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1) ? "LEVEL_UP " : "ENTITY_PLAYER_LEVELUP"); + SoundTitleChangeSound = c.get("Sounds.TitleChange.sound", Version.isCurrentLower(Version.v1_9_R1) ? "LEVEL_UP " : "ENTITY_PLAYER_LEVELUP"); SoundTitleChangeVolume = c.get("Sounds.TitleChange.volume", 1); SoundTitleChangePitch = c.get("Sounds.TitleChange.pitch", 3); diff --git a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java index 4f932b76..f9748615 100644 --- a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java +++ b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java @@ -195,7 +195,7 @@ public class BufferedEconomy { // Action bar stuff ShowActionBar(payment); - if (payment.getOfflinePlayer().isOnline() && Jobs.getVersionCheckManager().getVersion().isHigher(Version.v1_8_R3)) { + if (payment.getOfflinePlayer().isOnline() && Version.getCurrent().isHigher(Version.v1_8_R3)) { JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(payment.getOfflinePlayer().getUniqueId()); Jobs.getBBManager().ShowJobProgression(jPlayer); } diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index b5b86a4e..c88744b2 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -1686,7 +1686,7 @@ public class JobsPaymentListener implements Listener { if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle()) return; - if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R2) + if (Version.getCurrent().isEqualOrHigher(Version.v1_9_R2) && !Jobs.getGCManager().payExploringWhenGliding && player.isGliding()) return;