mirror of
https://github.com/songoda/EpicAnchors.git
synced 2024-11-10 20:41:30 +01:00
Misuse Prevention
This commit is contained in:
parent
df14eebecc
commit
af1091017c
@ -22,6 +22,7 @@ import com.songoda.epicanchors.utils.Methods;
|
||||
import com.songoda.epicanchors.utils.SettingsManager;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -48,7 +49,25 @@ public class EpicAnchorsPlugin extends JavaPlugin implements EpicAnchors {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void checkVersion() {
|
||||
int workingVersion = 13;
|
||||
int currentVersion = Integer.parseInt(Bukkit.getServer().getClass()
|
||||
.getPackage().getName().split("\\.")[3].split("_")[1]);
|
||||
|
||||
if (currentVersion < workingVersion) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> {
|
||||
Bukkit.getConsoleSender().sendMessage("");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Check to make sure the Bukkit version is compatible.
|
||||
checkVersion();
|
||||
|
||||
INSTANCE = this;
|
||||
CommandSender console = Bukkit.getConsoleSender();
|
||||
console.sendMessage(TextComponent.formatText("&a============================="));
|
||||
|
@ -71,7 +71,7 @@ public class AnchorHandler {
|
||||
for (int z = cz; z < cz + 16; z++) {
|
||||
for (int y = 0; y < location.getWorld().getMaxHeight(); y++) {
|
||||
Block block = location.getWorld().getBlockAt(x, y, z);
|
||||
if (block.getType() != Material.SPAWNER) continue;
|
||||
if (block.getType() != Material.MOB_SPAWNER) continue;
|
||||
Spawner spawner = EpicSpawnersAPI.getSpawnerManager().getSpawnerFromWorld(block.getLocation());
|
||||
if (!delays.containsKey(block.getLocation())) {
|
||||
if (block == null || block.getLocation() == null || spawner == null) continue;
|
||||
|
@ -22,7 +22,7 @@ public class SettingsManager implements Listener {
|
||||
}
|
||||
|
||||
public enum settings {
|
||||
o8("Main.Anchor Block Material", "END_PORTAL_FRAME"),
|
||||
o8("Main.Anchor Block Material", "ENDER_PORTAL_FRAME"),
|
||||
o11("Interfaces.Glass Type 1", 7),
|
||||
o12("Interfaces.Glass Type 2", 11),
|
||||
o13("Interfaces.Glass Type 3", 3);
|
||||
|
@ -4,10 +4,9 @@ version: 1
|
||||
depend: [Arconix]
|
||||
main: com.songoda.epicanchors.EpicAnchorsPlugin
|
||||
author: songoda
|
||||
api-version: 1.13
|
||||
commands:
|
||||
EpicAnchors:
|
||||
description: I have no idea.
|
||||
default: true
|
||||
aliases: [eca]
|
||||
aliases: [ea]
|
||||
usage: /<command> [reload]
|
Loading…
Reference in New Issue
Block a user