mirror of
https://github.com/songoda/EpicHoppers.git
synced 2024-11-22 10:15:43 +01:00
WorldGuard Updated for 1.13
Fixed issue saving the default config.
This commit is contained in:
parent
b27c8484b2
commit
bcbc041702
@ -76,7 +76,7 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void checkVersion() {
|
||||
private boolean checkVersion() {
|
||||
int workingVersion = 13;
|
||||
int currentVersion = Integer.parseInt(Bukkit.getServer().getClass()
|
||||
.getPackage().getName().split("\\.")[3].split("_")[1]);
|
||||
@ -87,13 +87,15 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "You installed the 1." + workingVersion + "+ only version of " + this.getDescription().getName() + " on a 1." + currentVersion + " server. Since you are on the wrong version we disabled the plugin for you. Please install correct version to continue using " + this.getDescription().getName() + ".");
|
||||
Bukkit.getConsoleSender().sendMessage("");
|
||||
}, 20L);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Check to make sure the Bukkit version is compatible.
|
||||
checkVersion();
|
||||
if (!checkVersion()) return;
|
||||
|
||||
INSTANCE = this;
|
||||
EpicHoppersAPI.setImplementation(this);
|
||||
@ -359,7 +361,8 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
|
||||
levels.set("Level-7.Cost-eco", 30000);
|
||||
|
||||
}
|
||||
saveConfig();
|
||||
this.getConfig().options().copyDefaults(true);
|
||||
this.saveConfig();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
|
@ -1,6 +1,11 @@
|
||||
package com.songoda.epichoppers.hooks;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import com.songoda.epichoppers.api.utils.ProtectionPluginHook;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -8,20 +13,22 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class HookWorldGuard implements ProtectionPluginHook {
|
||||
|
||||
private final WorldGuardPlugin worldGuard;
|
||||
private final WorldGuard worldGuard;
|
||||
|
||||
public HookWorldGuard() {
|
||||
this.worldGuard = WorldGuardPlugin.inst();
|
||||
this.worldGuard = WorldGuard.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaPlugin getPlugin() {
|
||||
return worldGuard;
|
||||
return WorldGuardPlugin.inst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(Player player, Location location) {
|
||||
return worldGuard.canBuild(player, location);
|
||||
RegionQuery q = worldGuard.getPlatform().getRegionContainer().createQuery();
|
||||
ApplicableRegionSet ars = q.getApplicableRegions(BukkitAdapter.adapt(player.getLocation()));
|
||||
return ars.testState(WorldGuardPlugin.inst().wrapPlayer(player), Flags.BUILD);
|
||||
}
|
||||
|
||||
}
|
@ -189,8 +189,6 @@ public class SettingsManager implements Listener {
|
||||
if (config.contains("settings." + setting.oldSetting)) {
|
||||
config.addDefault(setting.setting, instance.getConfig().get("settings." + setting.oldSetting));
|
||||
config.set("settings." + setting.oldSetting, null);
|
||||
} else if (setting.setting.equals("Main.Upgrade Particle Type")) {
|
||||
config.addDefault(setting.setting, setting.option);
|
||||
} else {
|
||||
config.addDefault(setting.setting, setting.option);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user