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.
This commit is contained in:
Thijs Wiefferink 2015-01-07 12:01:04 +01:00
parent e6c5653073
commit 679ffe2145
4 changed files with 13 additions and 39 deletions

View File

@ -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

View File

@ -105,6 +105,11 @@ public final class AreaShop extends JavaPlugin {
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)) {

View File

@ -586,18 +586,9 @@ public class FileManager {
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");
}

View File

@ -1028,19 +1028,8 @@ public abstract class GeneralRegion {
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 @@ public abstract class GeneralRegion {
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);
}
}
}