diff --git a/rpgregions/src/main/java/net/islandearth/rpgregions/RPGRegions.java b/rpgregions/src/main/java/net/islandearth/rpgregions/RPGRegions.java index 5000abf..a430ac2 100644 --- a/rpgregions/src/main/java/net/islandearth/rpgregions/RPGRegions.java +++ b/rpgregions/src/main/java/net/islandearth/rpgregions/RPGRegions.java @@ -350,14 +350,6 @@ public final class RPGRegions extends JavaPlugin implements IRPGRegionsAPI, Lang .serializeNulls().create(); } - public boolean isLegacyServer() { - return Bukkit.getVersion().contains("1.12") - || Bukkit.getVersion().contains("1.11") - || Bukkit.getVersion().contains("1.10") - || Bukkit.getVersion().contains("1.9") - || Bukkit.getVersion().contains("1.8"); - } - @Override public boolean hasHeadDatabase() { return Bukkit.getPluginManager().getPlugin("HeadDatabase") != null; @@ -366,7 +358,7 @@ public final class RPGRegions extends JavaPlugin implements IRPGRegionsAPI, Lang @NotNull private String getIntegration() { if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) { - return isLegacyServer() ? "WorldGuard_Legacy" : "WorldGuard"; + return "WorldGuard"; } else if (Bukkit.getPluginManager().getPlugin("Residence") != null) { return "Residence"; } else if (Bukkit.getPluginManager().getPlugin("GriefPrevention") != null) { diff --git a/rpgregions/src/main/java/net/islandearth/rpgregions/commands/RPGRegionsCommand.java b/rpgregions/src/main/java/net/islandearth/rpgregions/commands/RPGRegionsCommand.java index e74cbf5..02af954 100644 --- a/rpgregions/src/main/java/net/islandearth/rpgregions/commands/RPGRegionsCommand.java +++ b/rpgregions/src/main/java/net/islandearth/rpgregions/commands/RPGRegionsCommand.java @@ -202,28 +202,24 @@ public class RPGRegionsCommand extends BaseCommand { } switch (args.length) { - case 1: { + case 1 -> { plugin.getManagers().getStorageManager().clearDiscoveries(player.getUniqueId()); - if (!player.isOnline()) plugin.getManagers().getStorageManager().removeCachedAccount(player.getUniqueId()); + if (!player.isOnline()) + plugin.getManagers().getStorageManager().removeCachedAccount(player.getUniqueId()); sender.sendMessage(ChatColor.GREEN + "Players discoveries has been cleared."); - break; } - - case 2: { + case 2 -> { String regionId = args[1]; if (plugin.getManagers().getRegionsCache().getConfiguredRegions().containsKey(regionId)) { plugin.getManagers().getStorageManager().clearDiscovery(player.getUniqueId(), regionId); - if (!player.isOnline()) plugin.getManagers().getStorageManager().removeCachedAccount(player.getUniqueId()); + if (!player.isOnline()) + plugin.getManagers().getStorageManager().removeCachedAccount(player.getUniqueId()); sender.sendMessage(ChatColor.GREEN + "Discovery cleared."); } else { sender.sendMessage(ChatColor.RED + "Region does not exist or is not configured."); } - break; } - - default: - sender.sendMessage(ChatColor.RED + "Usage: /rpgregions reset [region_id]"); - break; + default -> sender.sendMessage(ChatColor.RED + "Usage: /rpgregions reset [region_id]"); } } @@ -308,17 +304,6 @@ public class RPGRegionsCommand extends BaseCommand { } } - @Subcommand("discover") - @CommandPermission("rpgregions.discover") - @CommandCompletion("@regions @players") - @Deprecated - public void onDiscover(Player player, ConfiguredRegion configuredRegion, Player target) { - player.sendMessage(ChatColor.RED + "Use of this command format is deprecated/discouraged. " + - "Please switch to the /discoveries command to handle this. " + - "The new format also supports console and offline player usage."); - player.performCommand("discoveries discover " + configuredRegion.getId() + " " + target.getName()); - } - @Subcommand("forceupdateicons") @CommandPermission("rpgregions.forceupdate") public void onForceUpdateIcons(Player player) { diff --git a/rpgregions/src/main/java/net/islandearth/rpgregions/gson/PotionEffectAdapter.java b/rpgregions/src/main/java/net/islandearth/rpgregions/gson/PotionEffectAdapter.java index 9f9eaa9..bb2aced 100644 --- a/rpgregions/src/main/java/net/islandearth/rpgregions/gson/PotionEffectAdapter.java +++ b/rpgregions/src/main/java/net/islandearth/rpgregions/gson/PotionEffectAdapter.java @@ -35,23 +35,14 @@ public class PotionEffectAdapter implements JsonSerializer, JsonDe @Override public JsonElement serialize(PotionEffect potionEffect, Type type, JsonSerializationContext context) { // Our own serialisation - use type name instead of id - if (!plugin.isLegacyServer()) - return gson.toJsonTree(ImmutableMap.builder() - .put("type", potionEffect.getType().getName()) - .put("duration", potionEffect.getDuration()) - .put("amplifier", potionEffect.getAmplifier()) - .put("ambient", potionEffect.isAmbient()) - .put("particles", potionEffect.hasParticles()) - .put("icon", potionEffect.hasIcon()) - .build()); - else - return gson.toJsonTree(ImmutableMap.builder() - .put("type", potionEffect.getType().getName()) - .put("duration", potionEffect.getDuration()) - .put("amplifier", potionEffect.getAmplifier()) - .put("ambient", potionEffect.isAmbient()) - .put("particles", potionEffect.hasParticles()) - .build()); + return gson.toJsonTree(ImmutableMap.builder() + .put("type", potionEffect.getType().getName()) + .put("duration", potionEffect.getDuration()) + .put("amplifier", potionEffect.getAmplifier()) + .put("ambient", potionEffect.isAmbient()) + .put("particles", potionEffect.hasParticles()) + .put("icon", potionEffect.hasIcon()) + .build()); } /* @@ -63,9 +54,7 @@ public class PotionEffectAdapter implements JsonSerializer, JsonDe double amplifier = (double) map.get("amplifier"); boolean ambient = (boolean) map.get("ambient"); boolean particles = (boolean) map.get("particles"); - if (!plugin.isLegacyServer()) { - boolean icon = (boolean) map.get("icon"); - return new PotionEffect(type, (int) duration, (int) amplifier, ambient, particles, icon); - } else return new PotionEffect(type, (int) duration, (int) amplifier, ambient, particles); + boolean icon = (boolean) map.get("icon"); + return new PotionEffect(type, (int) duration, (int) amplifier, ambient, particles, icon); } } \ No newline at end of file diff --git a/rpgregions/src/main/java/net/islandearth/rpgregions/managers/RPGRegionsManagers.java b/rpgregions/src/main/java/net/islandearth/rpgregions/managers/RPGRegionsManagers.java index 6872721..fbd2dd7 100644 --- a/rpgregions/src/main/java/net/islandearth/rpgregions/managers/RPGRegionsManagers.java +++ b/rpgregions/src/main/java/net/islandearth/rpgregions/managers/RPGRegionsManagers.java @@ -102,14 +102,10 @@ public class RPGRegionsManagers implements IRPGRegionsManagers { rewards.add(new ConsoleCommandReward(plugin, "say Server sees you discovered a region!")); rewards.add(new MessageReward(plugin, Collections.singletonList("&aExample message as a reward"))); List effects = new ArrayList<>(); - if (!plugin.isLegacyServer()) effects.add(new PotionRegionEffect(plugin, + effects.add(new PotionRegionEffect(plugin, new PotionEffect(PotionEffectType.GLOWING, 100, 1, true, true, true), true, Collections.singletonList(new ItemStackBuilder(Material.IRON_CHESTPLATE).build()))); - else effects.add(new PotionRegionEffect(plugin, - new PotionEffect(PotionEffectType.GLOWING, 100, 1, true, true), - true, - Collections.singletonList(new ItemStackBuilder(Material.IRON_CHESTPLATE).build()))); ConfiguredRegion configuredRegion = new ConfiguredRegion(null, "exampleconfig", "ExampleConfig", rewards, effects, XSound.AMBIENT_UNDERWATER_EXIT.parseSound(),