From 679ffe214573903e29e99168fb45faee6469d6eb Mon Sep 17 00:00:00 2001 From: Thijs Wiefferink Date: Wed, 7 Jan 2015 12:01:04 +0100 Subject: [PATCH] Releasing 1 version for WorldGuard 5.9 and one for 6.0+ now The code represents the state of the WorldGuard 6.0+ version, the uploaded version for 5.9 has some minor changes. --- plugin.yml | 2 +- src/nl/evolutioncoding/areashop/AreaShop.java | 5 ++++ .../evolutioncoding/areashop/FileManager.java | 15 ++-------- .../areashop/regions/GeneralRegion.java | 30 +++---------------- 4 files changed, 13 insertions(+), 39 deletions(-) diff --git a/plugin.yml b/plugin.yml index d9773bbc..b895800d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: AreaShop main: nl.evolutioncoding.areashop.AreaShop -version: 2.1.2 +version: 2.1.3 depend: [Vault, WorldGuard, WorldEdit] softdepend: [Multiverse-Core] author: NLThijs48 diff --git a/src/nl/evolutioncoding/areashop/AreaShop.java b/src/nl/evolutioncoding/areashop/AreaShop.java index 5820686f..3c76e1c0 100644 --- a/src/nl/evolutioncoding/areashop/AreaShop.java +++ b/src/nl/evolutioncoding/areashop/AreaShop.java @@ -105,6 +105,11 @@ public void onEnable() { worldGuard = (WorldGuardPlugin)plugin; } + if(getWorldGuard() != null && getWorldGuard().getDescription().getVersion().startsWith("5.")) { + getLogger().severe("This version of AreaShop is not meant for WorldGuard 5.x, use the correct version matching your WorldGuard version"); + error = true; + } + /* Check if WorldEdit is present */ plugin = getServer().getPluginManager().getPlugin("WorldEdit"); if (plugin == null || !(plugin instanceof WorldEditPlugin)) { diff --git a/src/nl/evolutioncoding/areashop/FileManager.java b/src/nl/evolutioncoding/areashop/FileManager.java index 4d2e5623..42a7139e 100644 --- a/src/nl/evolutioncoding/areashop/FileManager.java +++ b/src/nl/evolutioncoding/areashop/FileManager.java @@ -586,18 +586,9 @@ public void saveWorldGuardRegions() { RegionManager manager = plugin.getWorldGuard().getRegionManager(bukkitWorld); if(manager != null) { try { - String version = plugin.getWorldGuard().getDescription().getVersion(); - AreaShop.debug("WorldGuard version: " + version); - // Detect WorldGuard version 5 - if(version.startsWith("5.")) { - //AreaShop.debug(" Saved the old way"); - manager.save(); - } - // Assume a newer version - else { - //AreaShop.debug(" Saved the new way"); - manager.saveChanges(); - } + //String version = plugin.getWorldGuard().getDescription().getVersion(); + //AreaShop.debug("WorldGuard version: " + version); + manager.saveChanges(); } catch(Exception e) { plugin.getLogger().warning("WorldGuard regions in world " + world + " could not be saved"); } diff --git a/src/nl/evolutioncoding/areashop/regions/GeneralRegion.java b/src/nl/evolutioncoding/areashop/regions/GeneralRegion.java index 556434d1..2eee9e4f 100644 --- a/src/nl/evolutioncoding/areashop/regions/GeneralRegion.java +++ b/src/nl/evolutioncoding/areashop/regions/GeneralRegion.java @@ -1028,19 +1028,8 @@ protected boolean setRegionFlags(ConfigurationSection flags) { uuid = null; } if(uuid != null) { - // Detect WorldGuard version 5 - if(plugin.getWorldGuard().getDescription().getVersion().startsWith("5.")) { - AreaShop.debug(" Added player by name"); - OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid); - if(offlinePlayer != null) { - members.addPlayer(offlinePlayer.getName()); - } - } - // Assume a newer version - else { - AreaShop.debug(" Added player by UUID"); - members.addPlayer(uuid); - } + //AreaShop.debug(" Added player by UUID"); + members.addPlayer(uuid); } } } @@ -1073,19 +1062,8 @@ protected boolean setRegionFlags(ConfigurationSection flags) { uuid = null; } if(uuid != null) { - // Detect WorldGuard version 5 - if(plugin.getWorldGuard().getDescription().getVersion().startsWith("5.")) { - //AreaShop.debug(" Added player by name"); - OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid); - if(offlinePlayer != null) { - owners.addPlayer(offlinePlayer.getName()); - } - } - // Assume a newer version - else { - //AreaShop.debug(" Added player by UUID"); - owners.addPlayer(uuid); - } + //AreaShop.debug(" Added player by UUID"); + owners.addPlayer(uuid); } } }