1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-18 06:01:46 +01:00

Change these

This commit is contained in:
montlikadani 2020-10-17 18:35:40 +02:00
parent 90a7267e0d
commit bc00105bde
9 changed files with 21 additions and 30 deletions

View File

@ -9,8 +9,6 @@ import java.lang.reflect.Method;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gamingmesh.jobs.Jobs;
public class CMIReflections { public class CMIReflections {
//private Class<?> CraftServerClass; //private Class<?> CraftServerClass;
@ -65,11 +63,11 @@ public class CMIReflections {
} }
private static Class<?> getBukkitClass(String nmsClassString) throws ClassNotFoundException { 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 { 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) { 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) { public static ItemStack getItemInOffHand(org.bukkit.entity.Player player) {
if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) return Version.getCurrent().isLower(Version.v1_9_R1) ? null : player.getInventory().getItemInOffHand();
return null;
return player.getInventory().getItemInOffHand();
} }
} }

View File

@ -11,8 +11,6 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gamingmesh.jobs.Jobs;
public class ItemReflection { public class ItemReflection {
private static Class<?> CraftServerClass; private static Class<?> CraftServerClass;
@ -38,11 +36,11 @@ public class ItemReflection {
} }
private static Class<?> getBukkitClass(String nmsClassString) throws ClassNotFoundException { 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 { 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) { public static String getItemMinecraftName(ItemStack item) {
@ -98,9 +96,7 @@ public class ItemReflection {
} }
public static ItemStack getItemInOffHand(org.bukkit.entity.Player player) { public static ItemStack getItemInOffHand(org.bukkit.entity.Player player) {
if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) return Version.getCurrent().isLower(Version.v1_9_R1) ? null : player.getInventory().getItemInOffHand();
return null;
return player.getInventory().getItemInOffHand();
} }
public void setEndermiteActive(Entity ent, boolean state) { public void setEndermiteActive(Entity ent, boolean state) {

View File

@ -21,6 +21,7 @@ public class VersionChecker {
this.plugin = plugin; this.plugin = plugin;
} }
@Deprecated
public Version getVersion() { public Version getVersion() {
return Version.getCurrent(); return Version.getCurrent();
} }

View File

@ -509,12 +509,10 @@ public class editquests implements Cmd {
} else if (actionT == ActionType.ENCHANT) { } else if (actionT == ActionType.ENCHANT) {
Enchantment enchant = Enchantment.getByName(myKey); Enchantment enchant = Enchantment.getByName(myKey);
if (enchant != null) { if (enchant != null && Version.getCurrent().isEqualOrLower(Version.v1_12_R1)) {
if (Jobs.getVersionCheckManager().getVersion().isEqualOrLower(Version.v1_12_R1)) { try {
try { id = (int) enchant.getClass().getMethod("getId").invoke(enchant);
id = (int) enchant.getClass().getMethod("getId").invoke(enchant); } catch (Exception e) {
} catch (Exception e) {
}
} }
} }
type = myKey; type = myKey;

View File

@ -25,7 +25,7 @@ public class BossBarManager {
} }
public synchronized void ShowJobProgression(final JobsPlayer player) { 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; return;
if (player == null) if (player == null)
@ -39,7 +39,7 @@ public class BossBarManager {
} }
public synchronized void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) { 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; return;
String playerUUID = player.getPlayer().getUniqueId().toString(); String playerUUID = player.getPlayer().getUniqueId().toString();

View File

@ -46,7 +46,7 @@ import java.util.List;
public class ConfigManager { public class ConfigManager {
private File jobFile = null; private File jobFile;
public ConfigManager() { public ConfigManager() {
this.jobFile = new File(Jobs.getFolder(), "jobConfig.yml"); this.jobFile = new File(Jobs.getFolder(), "jobConfig.yml");

View File

@ -441,7 +441,7 @@ public class GeneralConfigManager {
c.addComment("enable-pay-near-spawner", c.addComment("enable-pay-near-spawner",
"Option to allow payment to be made when killing mobs from a 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"); "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."); 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); 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"); 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); 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."); 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); 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"); 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); 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"); c.addComment("BossBar.Enabled", "Enables BossBar feature", "Works only from 1.9 mc version");
BossBarEnabled = c.get("BossBar.Enabled", true); BossBarEnabled = c.get("BossBar.Enabled", true);
@ -867,11 +867,11 @@ public class GeneralConfigManager {
c.addComment("Sounds", "Sounds", "Extra sounds on some events", 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"); "All sounds can be found in https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html");
SoundLevelupUse = c.get("Sounds.LevelUp.use", true); 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); SoundLevelupVolume = c.get("Sounds.LevelUp.volume", 1);
SoundLevelupPitch = c.get("Sounds.LevelUp.pitch", 3); SoundLevelupPitch = c.get("Sounds.LevelUp.pitch", 3);
SoundTitleChangeUse = c.get("Sounds.TitleChange.use", true); 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); SoundTitleChangeVolume = c.get("Sounds.TitleChange.volume", 1);
SoundTitleChangePitch = c.get("Sounds.TitleChange.pitch", 3); SoundTitleChangePitch = c.get("Sounds.TitleChange.pitch", 3);

View File

@ -195,7 +195,7 @@ public class BufferedEconomy {
// Action bar stuff // Action bar stuff
ShowActionBar(payment); 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()); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(payment.getOfflinePlayer().getUniqueId());
Jobs.getBBManager().ShowJobProgression(jPlayer); Jobs.getBBManager().ShowJobProgression(jPlayer);
} }

View File

@ -1686,7 +1686,7 @@ public class JobsPaymentListener implements Listener {
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle()) if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
return; return;
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R2) if (Version.getCurrent().isEqualOrHigher(Version.v1_9_R2)
&& !Jobs.getGCManager().payExploringWhenGliding && player.isGliding()) && !Jobs.getGCManager().payExploringWhenGliding && player.isGliding())
return; return;