Skip to content

Commit

Permalink
Releasing 1 version for WorldGuard 5.9 and one for 6.0+ now
Browse files Browse the repository at this point in the history
The code represents the state of the WorldGuard 6.0+ version, the
uploaded version for 5.9 has some minor changes.
  • Loading branch information
NLthijs48 committed Jan 7, 2015
1 parent e6c5653 commit 679ffe2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 39 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/nl/evolutioncoding/areashop/AreaShop.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
15 changes: 3 additions & 12 deletions src/nl/evolutioncoding/areashop/FileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
30 changes: 4 additions & 26 deletions src/nl/evolutioncoding/areashop/regions/GeneralRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 679ffe2

Please sign in to comment.