Removed ThemePark dependency
This commit is contained in:
parent
6e4b8f6326
commit
d0f3045c34
4 changed files with 39 additions and 22 deletions
|
@ -8,6 +8,7 @@ import nl.sbdeveloper.themeparkplus.listeners.*;
|
||||||
import nl.sbdeveloper.themeparkplus.managers.DBManager;
|
import nl.sbdeveloper.themeparkplus.managers.DBManager;
|
||||||
import nl.sbdeveloper.themeparkplus.sbutils.UpdateManager;
|
import nl.sbdeveloper.themeparkplus.sbutils.UpdateManager;
|
||||||
import nl.sbdeveloper.themeparkplus.sbutils.YamlFile;
|
import nl.sbdeveloper.themeparkplus.sbutils.YamlFile;
|
||||||
|
import nl.sbdeveloper.themeparkplus.util.ConfigUtil;
|
||||||
import nl.sbdeveloper.themeparkplus.util.License;
|
import nl.sbdeveloper.themeparkplus.util.License;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -37,6 +38,8 @@ public final class ThemeParkPlus extends JavaPlugin {
|
||||||
|
|
||||||
private final int configVersion = 3;
|
private final int configVersion = 3;
|
||||||
|
|
||||||
|
private static boolean hasTPHook = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
@ -85,12 +88,6 @@ public final class ThemeParkPlus extends JavaPlugin {
|
||||||
|
|
||||||
new License(this, "TP", license);
|
new License(this, "TP", license);
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("ThemePark") == null) {
|
|
||||||
Bukkit.getLogger().severe("[ThemeParkPlus] Missing ThemePark! Please install it first.");
|
|
||||||
getServer().getPluginManager().disablePlugin(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("WorldEdit") == null) {
|
if (Bukkit.getPluginManager().getPlugin("WorldEdit") == null) {
|
||||||
Bukkit.getLogger().severe("[ThemeParkPlus] Missing WorldEdit! Please install it first.");
|
Bukkit.getLogger().severe("[ThemeParkPlus] Missing WorldEdit! Please install it first.");
|
||||||
getServer().getPluginManager().disablePlugin(this);
|
getServer().getPluginManager().disablePlugin(this);
|
||||||
|
@ -115,15 +112,23 @@ public final class ThemeParkPlus extends JavaPlugin {
|
||||||
|
|
||||||
Bukkit.getLogger().info("[ThemeParkPlus] Loading listeners...");
|
Bukkit.getLogger().info("[ThemeParkPlus] Loading listeners...");
|
||||||
Bukkit.getPluginManager().registerEvents(new DirectionalGateListener(), this);
|
Bukkit.getPluginManager().registerEvents(new DirectionalGateListener(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new FastpassListeners(), this); //TODO Detect if ThemePark is found.
|
|
||||||
Bukkit.getPluginManager().registerEvents(new SignListeners(), this);
|
Bukkit.getPluginManager().registerEvents(new SignListeners(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new MalfunctionListener(), this); //TODO Detect if ThemePark is found.
|
|
||||||
Bukkit.getPluginManager().registerEvents(new WaitingTimeListener(), this);
|
Bukkit.getPluginManager().registerEvents(new WaitingTimeListener(), this);
|
||||||
if (getSConfig().getFile().getBoolean("AntiFreerun.Enabled")) {
|
if (getSConfig().getFile().getBoolean("AntiFreerun.Enabled")) {
|
||||||
Bukkit.getPluginManager().registerEvents(new AntiFreerunListener(), this);
|
Bukkit.getPluginManager().registerEvents(new AntiFreerunListener(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Detect if ThemePark is found.
|
if (Bukkit.getPluginManager().getPlugin("ThemePark") == null) {
|
||||||
|
Bukkit.getLogger().severe("[ThemeParkPlus] Missing ThemePark! Some functions will not work without it!");
|
||||||
|
} else {
|
||||||
|
Bukkit.getLogger().severe("[ThemeParkPlus] Enabling ThemePark hook...");
|
||||||
|
hasTPHook = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasTPHook) {
|
||||||
|
Bukkit.getPluginManager().registerEvents(new FastpassListeners(), this);
|
||||||
|
Bukkit.getPluginManager().registerEvents(new MalfunctionListener(), this);
|
||||||
|
|
||||||
if (getSConfig().getFile().getBoolean("DiscordWebhook.Enabled")) {
|
if (getSConfig().getFile().getBoolean("DiscordWebhook.Enabled")) {
|
||||||
String URL = getSConfig().getFile().getString("DiscordWebhook.WebhookURL");
|
String URL = getSConfig().getFile().getString("DiscordWebhook.WebhookURL");
|
||||||
if (URL != null) {
|
if (URL != null) {
|
||||||
|
@ -135,6 +140,7 @@ public final class ThemeParkPlus extends JavaPlugin {
|
||||||
Bukkit.getLogger().severe("[ThemeParkPlus] Couldn't load the webhook builder! The URL is null.");
|
Bukkit.getLogger().severe("[ThemeParkPlus] Couldn't load the webhook builder! The URL is null.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getLogger().info("[ThemeParkPlus] Loading GUI helper...");
|
Bukkit.getLogger().info("[ThemeParkPlus] Loading GUI helper...");
|
||||||
spiGUI = new SpiGUI(this);
|
spiGUI = new SpiGUI(this);
|
||||||
|
@ -231,6 +237,10 @@ public final class ThemeParkPlus extends JavaPlugin {
|
||||||
return spiGUI;
|
return spiGUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasTPHook() {
|
||||||
|
return hasTPHook;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean setupEconomy() {
|
private boolean setupEconomy() {
|
||||||
if (getServer().getPluginManager().getPlugin("Vault") == null) {
|
if (getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -194,7 +194,10 @@ public class TPPCMD implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean giveFPTicketCommand(CommandSender sender, String[] args) {
|
private boolean giveFPTicketCommand(CommandSender sender, String[] args) {
|
||||||
//TODO Detect if ThemePark is found.
|
if (!ThemeParkPlus.hasTPHook()) {
|
||||||
|
sender.sendMessage(ConfigUtil.getMessage("General.RequiresThemePark"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.length == 2 && !(sender instanceof Player)) {
|
if (args.length == 2 && !(sender instanceof Player)) {
|
||||||
sender.sendMessage(ConfigUtil.getMessage("General.NoPlayer"));
|
sender.sendMessage(ConfigUtil.getMessage("General.NoPlayer"));
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package nl.sbdeveloper.themeparkplus.listeners;
|
package nl.sbdeveloper.themeparkplus.listeners;
|
||||||
|
|
||||||
import nl.iobyte.themepark.api.API;
|
|
||||||
import nl.sbdeveloper.themeparkplus.ThemeParkPlus;
|
import nl.sbdeveloper.themeparkplus.ThemeParkPlus;
|
||||||
import nl.sbdeveloper.themeparkplus.api.PlusAPI;
|
import nl.sbdeveloper.themeparkplus.api.PlusAPI;
|
||||||
import nl.sbdeveloper.themeparkplus.api.objects.WaitingRow;
|
import nl.sbdeveloper.themeparkplus.api.objects.WaitingRow;
|
||||||
|
@ -36,13 +35,17 @@ public class SignListeners implements Listener {
|
||||||
//Only check themeparkplus signs!
|
//Only check themeparkplus signs!
|
||||||
if (!lines[0].equalsIgnoreCase("[ThemeParkPlus]")) return;
|
if (!lines[0].equalsIgnoreCase("[ThemeParkPlus]")) return;
|
||||||
|
|
||||||
|
if (!ThemeParkPlus.hasTPHook()) {
|
||||||
|
p.sendMessage(ConfigUtil.getMessage("General.RequiresThemePark"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!p.hasPermission("tpp.fastpass.create")) {
|
if (!p.hasPermission("tpp.fastpass.create")) {
|
||||||
p.sendMessage(ConfigUtil.getMessage("General.NoPermission"));
|
p.sendMessage(ConfigUtil.getMessage("General.NoPermission"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Detect if ThemePark is found.
|
if (!nl.iobyte.themepark.api.API.isAttraction(lines[2])) {
|
||||||
if (!API.isAttraction(lines[2])) {
|
|
||||||
p.sendMessage(ConfigUtil.getMessage("Fastpass.UnknownRide", Collections.singletonMap("ridename", e.getLine(2))));
|
p.sendMessage(ConfigUtil.getMessage("Fastpass.UnknownRide", Collections.singletonMap("ridename", e.getLine(2))));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +80,7 @@ public class SignListeners implements Listener {
|
||||||
|
|
||||||
e.setLine(0, wrLineOne);
|
e.setLine(0, wrLineOne);
|
||||||
e.setLine(1, wrLineTwo);
|
e.setLine(1, wrLineTwo);
|
||||||
e.setLine(2, ConfigUtil.makecolored(API.getAttraction(lines[2]).getName()));
|
e.setLine(2, ConfigUtil.makecolored(nl.iobyte.themepark.api.API.getAttraction(lines[2]).getName()));
|
||||||
e.setLine(3, "0 min.");
|
e.setLine(3, "0 min.");
|
||||||
|
|
||||||
p.sendMessage(ConfigUtil.getMessage("WaitingRow.SignCreated"));
|
p.sendMessage(ConfigUtil.getMessage("WaitingRow.SignCreated"));
|
||||||
|
|
|
@ -3,6 +3,7 @@ General:
|
||||||
NoPlayer: '&cYou have to be a player to do this.'
|
NoPlayer: '&cYou have to be a player to do this.'
|
||||||
IncorrectAmount: '&cThis amount is incorrect.'
|
IncorrectAmount: '&cThis amount is incorrect.'
|
||||||
IncorrectSign: '&cThis sign is incorrect. Please read the wiki for more information.'
|
IncorrectSign: '&cThis sign is incorrect. Please read the wiki for more information.'
|
||||||
|
RequiresThemePark: '&cThis function requires ThemePark to work. Install it to use this function.'
|
||||||
Gates:
|
Gates:
|
||||||
WrongDir: '&cYou can''t walk through this gate in that direction.'
|
WrongDir: '&cYou can''t walk through this gate in that direction.'
|
||||||
UnknownDir: '&cThis direction is unknown. Choose between: NORTH, SOUTH, EAST, WEST'
|
UnknownDir: '&cThis direction is unknown. Choose between: NORTH, SOUTH, EAST, WEST'
|
||||||
|
|
Reference in a new issue