Merge pull request #12 from stijnb1234/malfunction
Added Malfunction GUI back
This commit is contained in:
commit
044fb85668
15 changed files with 463 additions and 112 deletions
21
pom.xml
21
pom.xml
|
@ -55,6 +55,10 @@
|
|||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>nl.sbdeveloper.themeparkplus.libs.bstats</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.samjakob.spigui</pattern>
|
||||
<shadedPattern>nl.sbdeveloper.themeparkplus.libs.spigui</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -143,7 +147,7 @@
|
|||
<dependency>
|
||||
<groupId>de.tr7zw</groupId>
|
||||
<artifactId>item-nbt-api</artifactId>
|
||||
<version>2.6.0</version>
|
||||
<version>2.7.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
|
@ -172,5 +176,20 @@
|
|||
<artifactId>worldguardwrapper</artifactId>
|
||||
<version>1.1.9-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.samjakob</groupId>
|
||||
<artifactId>SpiGUI</artifactId>
|
||||
<version>v1.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package nl.sbdeveloper.themeparkplus;
|
||||
|
||||
import com.samjakob.spigui.SpiGUI;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import nl.sbdeveloper.themeparkplus.commands.TPPCMD;
|
||||
import nl.sbdeveloper.themeparkplus.commands.TPPTabComplete;
|
||||
|
@ -7,6 +8,7 @@ import nl.sbdeveloper.themeparkplus.listeners.*;
|
|||
import nl.sbdeveloper.themeparkplus.managers.DBManager;
|
||||
import nl.sbdeveloper.themeparkplus.sbutils.UpdateManager;
|
||||
import nl.sbdeveloper.themeparkplus.sbutils.YamlFile;
|
||||
import nl.sbdeveloper.themeparkplus.util.ConfigUtil;
|
||||
import nl.sbdeveloper.themeparkplus.util.License;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -32,7 +34,11 @@ public final class ThemeParkPlus extends JavaPlugin {
|
|||
private static Economy econ = null;
|
||||
private static String webhookURL;
|
||||
|
||||
private final int configVersion = 2;
|
||||
private static SpiGUI spiGUI;
|
||||
|
||||
private final int configVersion = 3;
|
||||
|
||||
private static boolean hasTPHook = false;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -72,47 +78,15 @@ public final class ThemeParkPlus extends JavaPlugin {
|
|||
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Checking license...");
|
||||
|
||||
final String license = config.getFile().getString("License");
|
||||
if (config.getFile().contains("License")) {
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Licence code: " + config.getFile().getString("License"));
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Licence code: " + license);
|
||||
} else {
|
||||
Bukkit.getLogger().severe("[ThemeParkPlus] Licence code unknown! Please change the config.yml!");
|
||||
return;
|
||||
}
|
||||
|
||||
new License(this, "TP", config.getFile().getString("License"));
|
||||
|
||||
if (getSConfig().getFile().getBoolean("UpdateChecker.Enabled")) {
|
||||
UpdateManager updateManager = new UpdateManager(this, 6, UpdateManager.CheckType.SBDPLUGINS);
|
||||
|
||||
updateManager.handleResponse((versionResponse, version) -> {
|
||||
if (versionResponse == UpdateManager.VersionResponse.FOUND_NEW) {
|
||||
Bukkit.getLogger().warning("[ThemeParkPlus] There is a new version available! Current: " + this.getDescription().getVersion() + " New: " + version.get());
|
||||
if (getSConfig().getFile().getBoolean("UpdateChecker.DownloadOnUpdate")) {
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Trying to download the update...");
|
||||
|
||||
updateManager.handleDownloadResponse((downloadResponse, fileName) -> {
|
||||
if (downloadResponse == UpdateManager.DownloadResponse.DONE) {
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Update downloaded! If you restart your server, it will be loaded. Filename: " + fileName);
|
||||
} else if (downloadResponse == UpdateManager.DownloadResponse.ERROR) {
|
||||
Bukkit.getLogger().severe("[ThemeParkPlus] Something went wrong when trying downloading the latest version.");
|
||||
} else if (downloadResponse == UpdateManager.DownloadResponse.UNAVAILABLE) {
|
||||
Bukkit.getLogger().warning("[ThemeParkPlus] Unable to download the latest version.");
|
||||
}
|
||||
}).runUpdate();
|
||||
}
|
||||
} else if (versionResponse == UpdateManager.VersionResponse.LATEST) {
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] You are running the latest version [" + this.getDescription().getVersion() + "]!");
|
||||
} else if (versionResponse == UpdateManager.VersionResponse.UNAVAILABLE) {
|
||||
Bukkit.getLogger().severe("[ThemeParkPlus] Unable to perform an update check.");
|
||||
}
|
||||
}).check();
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("ThemePark") == null) {
|
||||
Bukkit.getLogger().severe("[ThemeParkPlus] Missing ThemePark! Please install it first.");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
new License(this, "TP", license);
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldEdit") == null) {
|
||||
Bukkit.getLogger().severe("[ThemeParkPlus] Missing WorldEdit! Please install it first.");
|
||||
|
@ -138,13 +112,23 @@ public final class ThemeParkPlus extends JavaPlugin {
|
|||
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Loading listeners...");
|
||||
Bukkit.getPluginManager().registerEvents(new DirectionalGateListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new FastpassListeners(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new SignListeners(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new WaitingTimeListener(), this);
|
||||
if (getSConfig().getFile().getBoolean("AntiFreerun.Enabled")) {
|
||||
Bukkit.getPluginManager().registerEvents(new AntiFreerunListener(), this);
|
||||
}
|
||||
|
||||
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")) {
|
||||
String URL = getSConfig().getFile().getString("DiscordWebhook.WebhookURL");
|
||||
if (URL != null) {
|
||||
|
@ -156,6 +140,11 @@ public final class ThemeParkPlus extends JavaPlugin {
|
|||
Bukkit.getLogger().severe("[ThemeParkPlus] Couldn't load the webhook builder! The URL is null.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Loading GUI helper...");
|
||||
spiGUI = new SpiGUI(this);
|
||||
spiGUI.setEnableAutomaticPagination(false);
|
||||
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Loading data...");
|
||||
try {
|
||||
|
@ -168,14 +157,53 @@ public final class ThemeParkPlus extends JavaPlugin {
|
|||
Bukkit.getLogger().info("[ThemeParkPlus] Loading metrics (can be disabled in the config of bStats)...");
|
||||
new Metrics(this, 5023);
|
||||
|
||||
if (getSConfig().getFile().getBoolean("UpdateChecker.Enabled")) {
|
||||
UpdateManager updateManager = new UpdateManager(this, 7, license);
|
||||
|
||||
updateManager.handleResponse((versionResponse, version) -> {
|
||||
switch (versionResponse) {
|
||||
case FOUND_NEW:
|
||||
Bukkit.getLogger().warning("[ThemeParkPlus] There is a new version available! Current: " + this.getDescription().getVersion() + " New: " + version.get());
|
||||
if (getSConfig().getFile().getBoolean("UpdateChecker.DownloadOnUpdate")) {
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Trying to download the update. This could take some time...");
|
||||
|
||||
updateManager.handleDownloadResponse((downloadResponse, fileName) -> {
|
||||
switch (downloadResponse) {
|
||||
case DONE:
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Update downloaded! If you restart your server, it will be loaded. Filename: " + fileName);
|
||||
break;
|
||||
case ERROR:
|
||||
Bukkit.getLogger().severe("[ThemeParkPlus] Something went wrong when trying downloading the latest version.");
|
||||
break;
|
||||
case UNAVAILABLE:
|
||||
Bukkit.getLogger().warning("[ThemeParkPlus] Unable to download the latest version.");
|
||||
break;
|
||||
}
|
||||
}).runUpdate();
|
||||
}
|
||||
break;
|
||||
case LATEST:
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] You are running the latest version [" + this.getDescription().getVersion() + "]!");
|
||||
break;
|
||||
case THIS_NEWER:
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] You are running a newer version [" + this.getDescription().getVersion() + "]! This is probably fine.");
|
||||
break;
|
||||
case UNAVAILABLE:
|
||||
Bukkit.getLogger().severe("[ThemeParkPlus] Unable to perform an update check.");
|
||||
break;
|
||||
}
|
||||
}).check();
|
||||
}
|
||||
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Plugin enabled!");
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] -------------------------------");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Saving data to data file...");
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Saving data...");
|
||||
data.save();
|
||||
data.closeConnection();
|
||||
|
||||
Bukkit.getLogger().info("[ThemeParkPlus] Plugin disabled!");
|
||||
instance = null;
|
||||
|
@ -205,6 +233,14 @@ public final class ThemeParkPlus extends JavaPlugin {
|
|||
return webhookURL;
|
||||
}
|
||||
|
||||
public static SpiGUI getSpiGUI() {
|
||||
return spiGUI;
|
||||
}
|
||||
|
||||
public static boolean hasTPHook() {
|
||||
return hasTPHook;
|
||||
}
|
||||
|
||||
private boolean setupEconomy() {
|
||||
if (getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||
return false;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package nl.sbdeveloper.themeparkplus.api;
|
||||
|
||||
import de.tr7zw.changeme.nbtapi.NBTItem;
|
||||
import nl.iobyte.themepark.api.attraction.Attraction;
|
||||
import nl.sbdeveloper.themeparkplus.ThemeParkPlus;
|
||||
import nl.sbdeveloper.themeparkplus.api.objects.Gate;
|
||||
import nl.sbdeveloper.themeparkplus.api.objects.MalfunctionReport;
|
||||
import nl.sbdeveloper.themeparkplus.api.objects.WaitingRow;
|
||||
import nl.sbdeveloper.themeparkplus.util.ConfigUtil;
|
||||
import nl.sbdeveloper.themeparkplus.util.XMaterial;
|
||||
|
@ -18,8 +18,29 @@ import org.jetbrains.annotations.Nullable;
|
|||
import java.util.*;
|
||||
|
||||
public class PlusAPI {
|
||||
private static HashMap<Location, Gate> gates = new HashMap<>();
|
||||
private static HashMap<String, WaitingRow> rows = new HashMap<>();
|
||||
private static final HashMap<Location, Gate> gates = new HashMap<>();
|
||||
private static final HashMap<String, WaitingRow> rows = new HashMap<>();
|
||||
private static final HashMap<String, MalfunctionReport> reports = new HashMap<>();
|
||||
|
||||
public static void addReport(MalfunctionReport report) {
|
||||
reports.put(report.getRideID(), report);
|
||||
}
|
||||
|
||||
public static void removeReport(String rideID) {
|
||||
reports.remove(rideID);
|
||||
}
|
||||
|
||||
public static MalfunctionReport getReport(String rideID) {
|
||||
return reports.get(rideID);
|
||||
}
|
||||
|
||||
public static boolean isReported(String rideID) {
|
||||
return reports.containsKey(rideID);
|
||||
}
|
||||
|
||||
public static HashMap<String, MalfunctionReport> getReports() {
|
||||
return reports;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a gate
|
||||
|
@ -152,7 +173,7 @@ public class PlusAPI {
|
|||
* @return The ticket as ItemStack
|
||||
*/
|
||||
@Nullable
|
||||
public static ItemStack getFastpassTicket(Attraction att) {
|
||||
public static ItemStack getFastpassTicket(nl.iobyte.themepark.api.attraction.Attraction att) {
|
||||
String ticketName = ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Fastpass.Item.DisplayName"));
|
||||
|
||||
ItemStack ticket = XMaterial.PAPER.parseItem();
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package nl.sbdeveloper.themeparkplus.api.objects;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
/** @deprecated Please don't use! It's not implemented yet. */
|
||||
@Getter @Setter @NoArgsConstructor @AllArgsConstructor
|
||||
@Getter @NoArgsConstructor
|
||||
public class MalfunctionReport {
|
||||
private String rideID;
|
||||
private UUID reporterUUID;
|
||||
private LocalDateTime reportDate;
|
||||
private String reason;
|
||||
@Getter private String rideID;
|
||||
@Getter private UUID reporterUUID;
|
||||
@Getter private final LocalDateTime reportDate = LocalDateTime.now();
|
||||
@Getter @Setter private String reason = "Unknown";
|
||||
|
||||
public MalfunctionReport(String rideID, UUID reporterUUID) {
|
||||
this.rideID = rideID;
|
||||
this.reporterUUID = reporterUUID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package nl.sbdeveloper.themeparkplus.commands;
|
||||
|
||||
import nl.iobyte.themepark.api.API;
|
||||
import nl.iobyte.themepark.api.attraction.Attraction;
|
||||
import nl.sbdeveloper.themeparkplus.ThemeParkPlus;
|
||||
import nl.sbdeveloper.themeparkplus.api.PlusAPI;
|
||||
import nl.sbdeveloper.themeparkplus.api.enums.WalkingDirection;
|
||||
|
@ -196,17 +194,22 @@ public class TPPCMD implements CommandExecutor {
|
|||
}
|
||||
|
||||
private boolean giveFPTicketCommand(CommandSender sender, String[] args) {
|
||||
if (!ThemeParkPlus.hasTPHook()) {
|
||||
sender.sendMessage(ConfigUtil.getMessage("General.RequiresThemePark"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 2 && !(sender instanceof Player)) {
|
||||
sender.sendMessage(ConfigUtil.getMessage("General.NoPlayer"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!API.isAttraction(args[1])) {
|
||||
if (!nl.iobyte.themepark.api.API.isAttraction(args[1])) {
|
||||
sender.sendMessage(ConfigUtil.getMessage("Fastpass.UnknownRide", Collections.singletonMap("%ridename%", args[1])));
|
||||
return true;
|
||||
}
|
||||
|
||||
Attraction att = API.getAttraction(args[1]);
|
||||
nl.iobyte.themepark.api.attraction.Attraction att = nl.iobyte.themepark.api.API.getAttraction(args[1]);
|
||||
|
||||
Player target;
|
||||
if (args.length == 3) {
|
||||
|
@ -404,7 +407,7 @@ public class TPPCMD implements CommandExecutor {
|
|||
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(ThemeParkPlus.getInstance(), () -> cub.getBlocks().forEach(block -> {
|
||||
if (block.getType().name().contains("REDSTONE_LAMP")) Bukkit.getScheduler().runTask(ThemeParkPlus.getInstance(), () -> LGUtil.zetLampUit(block));
|
||||
}), secOn * 20);
|
||||
}), secOn * 20L);
|
||||
if (ConfigUtil.sendConsole(sender)) sender.sendMessage(ConfigUtil.getMessage("Lamps.TurnedOnSec", Collections.singletonMap("%sec%", String.valueOf(secOn))));
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
package nl.sbdeveloper.themeparkplus.gui;
|
||||
|
||||
import com.samjakob.spigui.SGMenu;
|
||||
import com.samjakob.spigui.buttons.SGButton;
|
||||
import com.samjakob.spigui.item.ItemBuilder;
|
||||
import nl.iobyte.themepark.api.API;
|
||||
import nl.iobyte.themepark.api.attraction.Attraction;
|
||||
import nl.iobyte.themepark.api.attraction.component.Status;
|
||||
import nl.sbdeveloper.themeparkplus.ThemeParkPlus;
|
||||
import nl.sbdeveloper.themeparkplus.api.PlusAPI;
|
||||
import nl.sbdeveloper.themeparkplus.api.objects.MalfunctionReport;
|
||||
import nl.sbdeveloper.themeparkplus.util.ConfigUtil;
|
||||
import nl.sbdeveloper.themeparkplus.util.XMaterial;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class MalfunctionGUI {
|
||||
public static void open(Attraction att, Player p) {
|
||||
SGMenu menu = ThemeParkPlus.getSpiGUI().create(ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Malfunction.GUI.Title").replace("%ridename%", att.getId())), 1);
|
||||
|
||||
SGButton report = new SGButton(getItem("Report", ConfigUtil.makecolored(att.getName()))).withListener((InventoryClickEvent e) -> {
|
||||
if (!PlusAPI.isReported(att.getId())) {
|
||||
MalfunctionReport malfunctionReport = new MalfunctionReport(att.getId(), p.getUniqueId());
|
||||
PlusAPI.addReport(malfunctionReport);
|
||||
att.setStatus(Status.MALFUNCTION, null); //Player must be null, otherwise we will get a loop in the listener
|
||||
|
||||
p.sendMessage(ConfigUtil.getMessage("Malfunction.Reported", Collections.singletonMap("%ride%", att.getName())));
|
||||
} else {
|
||||
p.sendMessage(ConfigUtil.getMessage("Malfunction.AlreadyReported", Collections.singletonMap("%ride%", att.getName())));
|
||||
}
|
||||
p.closeInventory();
|
||||
});
|
||||
menu.setButton(getSlot("Report"), report);
|
||||
|
||||
SGButton fix = new SGButton(getItem("Fix", PlusAPI.getReport(att.getId()))).withListener((InventoryClickEvent e) -> {
|
||||
if (PlusAPI.isReported(att.getId())) {
|
||||
|
||||
PlusAPI.removeReport(att.getId());
|
||||
att.setStatus(Status.CLOSED, null); //Player must be null, otherwise we will get a loop in the listener
|
||||
|
||||
p.sendMessage(ConfigUtil.getMessage("Malfunction.Fixed", Collections.singletonMap("%ride%", att.getName())));
|
||||
} else {
|
||||
p.sendMessage(ConfigUtil.getMessage("Malfunction.AlreadyFixed", Collections.singletonMap("%ride%", att.getName())));
|
||||
}
|
||||
p.closeInventory();
|
||||
});
|
||||
menu.setButton(getSlot("Fix"), fix);
|
||||
|
||||
SGButton cancel = new SGButton(getItem("Cancel")).withListener((InventoryClickEvent e) -> p.closeInventory());
|
||||
menu.setButton(getSlot("Cancel"), cancel);
|
||||
|
||||
p.openInventory(menu.getInventory());
|
||||
}
|
||||
|
||||
private static int getSlot(String type) {
|
||||
return ThemeParkPlus.getSConfig().getFile().getInt("Malfunction.GUI.Buttons." + type + ".Slot");
|
||||
}
|
||||
|
||||
private static ItemStack getItem(String type, Object... data) { //data is a string or a report
|
||||
String material = ThemeParkPlus.getSConfig().getFile().getString("Malfunction.GUI.Buttons." + type + ".Material");
|
||||
String name = ThemeParkPlus.getSConfig().getFile().getString("Malfunction.GUI.Buttons." + type + ".Name");
|
||||
List<String> lores = ThemeParkPlus.getSConfig().getFile().getStringList("Malfunction.GUI.Buttons." + type + ".Lores");
|
||||
|
||||
if (material == null || name == null || lores.isEmpty()) return null; //Something is wrong in the config
|
||||
|
||||
List<String> loresFormatted = new ArrayList<>();
|
||||
switch (type) {
|
||||
case "Report":
|
||||
lores.forEach(lore -> loresFormatted.add(lore.replace("%ridename%", (String) data[0])));
|
||||
break;
|
||||
case "Fix":
|
||||
String ridename = ConfigUtil.getMessage("Malfunction.ThisRide");
|
||||
String reporter = "-";
|
||||
String date = "-";
|
||||
String reason = "-";
|
||||
if (data[0] != null) {
|
||||
ridename = API.getAttraction(((MalfunctionReport) data[0]).getRideID()).getName();
|
||||
reporter = Bukkit.getOfflinePlayer(((MalfunctionReport) data[0]).getReporterUUID()).getName();
|
||||
date = ((MalfunctionReport) data[0]).getReportDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss"));
|
||||
reason = ((MalfunctionReport) data[0]).getReason();
|
||||
}
|
||||
|
||||
for (String lore : lores) {
|
||||
loresFormatted.add(lore.replace("%ridename%", ridename).replace("%reporter%", reporter).replace("%date%", date).replace("%reason%", reason));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Optional<XMaterial> stack = XMaterial.matchXMaterial(material);
|
||||
return stack.map(xMaterial -> new ItemBuilder(xMaterial.parseItem()).name(name).lore(loresFormatted).build()).orElse(null);
|
||||
}
|
||||
}
|
|
@ -46,7 +46,6 @@ public class FastpassListeners implements Listener {
|
|||
//Buy a ticket
|
||||
String attID = sign.getLine(2);
|
||||
if (!API.isAttraction(attID)) return;
|
||||
|
||||
Attraction att = API.getAttraction(attID);
|
||||
|
||||
double price;
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package nl.sbdeveloper.themeparkplus.listeners;
|
||||
|
||||
import nl.iobyte.themepark.api.API;
|
||||
import nl.iobyte.themepark.api.attraction.Attraction;
|
||||
import nl.sbdeveloper.themeparkplus.ThemeParkPlus;
|
||||
import nl.sbdeveloper.themeparkplus.gui.MalfunctionGUI;
|
||||
import nl.sbdeveloper.themeparkplus.util.ConfigUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
|
||||
public class MalfunctionListener implements Listener {
|
||||
@EventHandler
|
||||
public void onClickSign(PlayerInteractEvent e) {
|
||||
if (e.getClickedBlock() == null || e.getAction() != Action.RIGHT_CLICK_BLOCK || !(e.getClickedBlock().getState() instanceof Sign) || e.getHand() != EquipmentSlot.HAND) return;
|
||||
|
||||
String mrLineOne = ChatColor.stripColor(ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Malfunction.Sign.Row1")));
|
||||
String mrLineTwo = ChatColor.stripColor(ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Malfunction.Sign.Row2")));
|
||||
|
||||
Sign sign = (Sign) e.getClickedBlock().getState();
|
||||
if (ChatColor.stripColor(sign.getLine(0)).equalsIgnoreCase(mrLineOne) && ChatColor.stripColor(sign.getLine(1)).equalsIgnoreCase(mrLineTwo)) {
|
||||
String attID = sign.getLine(2);
|
||||
if (!API.isAttraction(attID)) return;
|
||||
Attraction att = API.getAttraction(attID);
|
||||
|
||||
MalfunctionGUI.open(att, e.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package nl.sbdeveloper.themeparkplus.listeners;
|
||||
|
||||
import nl.iobyte.themepark.api.API;
|
||||
import nl.sbdeveloper.themeparkplus.ThemeParkPlus;
|
||||
import nl.sbdeveloper.themeparkplus.api.PlusAPI;
|
||||
import nl.sbdeveloper.themeparkplus.api.objects.WaitingRow;
|
||||
|
@ -36,12 +35,17 @@ public class SignListeners implements Listener {
|
|||
//Only check themeparkplus signs!
|
||||
if (!lines[0].equalsIgnoreCase("[ThemeParkPlus]")) return;
|
||||
|
||||
if (!ThemeParkPlus.hasTPHook()) {
|
||||
p.sendMessage(ConfigUtil.getMessage("General.RequiresThemePark"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!p.hasPermission("tpp.fastpass.create")) {
|
||||
p.sendMessage(ConfigUtil.getMessage("General.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!API.isAttraction(lines[2])) {
|
||||
if (!nl.iobyte.themepark.api.API.isAttraction(lines[2])) {
|
||||
p.sendMessage(ConfigUtil.getMessage("Fastpass.UnknownRide", Collections.singletonMap("ridename", e.getLine(2))));
|
||||
return;
|
||||
}
|
||||
|
@ -52,6 +56,8 @@ public class SignListeners implements Listener {
|
|||
String sLineTwo = ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Fastpass.ScannerSign.Row2"));
|
||||
String wrLineOne = ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("WaitingRow.Sign.Row1"));
|
||||
String wrLineTwo = ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("WaitingRow.Sign.Row2"));
|
||||
String mrLineOne = ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Malfunction.Sign.Row1"));
|
||||
String mrLineTwo = ConfigUtil.makecolored(ThemeParkPlus.getSConfig().getFile().getString("Malfunction.Sign.Row2"));
|
||||
|
||||
if (lines[1].equalsIgnoreCase("Machine") && !lines[2].isEmpty() && !lines[3].isEmpty()) {
|
||||
e.setLine(0, mLineOne);
|
||||
|
@ -74,10 +80,13 @@ public class SignListeners implements Listener {
|
|||
|
||||
e.setLine(0, wrLineOne);
|
||||
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.");
|
||||
|
||||
p.sendMessage(ConfigUtil.getMessage("WaitingRow.SignCreated"));
|
||||
} else if (lines[1].equalsIgnoreCase("Malfunction") && !lines[2].isEmpty()) {
|
||||
e.setLine(0, mrLineOne);
|
||||
e.setLine(1, mrLineTwo);
|
||||
} else {
|
||||
p.sendMessage(ConfigUtil.getMessage("General.IncorrectSign"));
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package nl.sbdeveloper.themeparkplus.listeners;
|
||||
|
||||
import nl.iobyte.themepark.api.attraction.Attraction;
|
||||
import nl.iobyte.themepark.api.attraction.component.Status;
|
||||
import nl.iobyte.themepark.api.attraction.manager.StatusManager;
|
||||
import nl.iobyte.themepark.api.events.attraction.ChangeStatusEvent;
|
||||
import nl.iobyte.themepark.api.events.attraction.PreChangeStatusEvent;
|
||||
import nl.sbdeveloper.themeparkplus.ThemeParkPlus;
|
||||
import nl.sbdeveloper.themeparkplus.api.PlusAPI;
|
||||
import nl.sbdeveloper.themeparkplus.api.objects.MalfunctionReport;
|
||||
import nl.sbdeveloper.themeparkplus.util.ConfigUtil;
|
||||
import nl.sbdeveloper.themeparkplus.util.DiscordWebhook;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -16,9 +20,33 @@ import java.awt.*;
|
|||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Status change listener for discord webhook
|
||||
* Status change listener for malfunction menu and discord webhook
|
||||
*/
|
||||
public class StatusChangeListener implements Listener {
|
||||
@EventHandler
|
||||
public void onStatusChange(PreChangeStatusEvent e) {
|
||||
Attraction att = e.getAttraction();
|
||||
|
||||
if (!PlusAPI.isReported(att.getId()) && e.getAfter() == Status.MALFUNCTION && e.getPlayer() != null) {
|
||||
if (ThemeParkPlus.getSConfig().getFile().getBoolean("Malfunction.AllowCommandReport")) {
|
||||
MalfunctionReport malfunctionReport = new MalfunctionReport(att.getId(), e.getPlayer().getUniqueId());
|
||||
PlusAPI.addReport(malfunctionReport);
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().sendMessage(ConfigUtil.getMessage("Malfunction.NoCommand"));
|
||||
}
|
||||
}
|
||||
|
||||
if (PlusAPI.isReported(att.getId()) && e.getAfter() != Status.MALFUNCTION && e.getPlayer() != null) {
|
||||
if (ThemeParkPlus.getSConfig().getFile().getBoolean("Malfunction.AllowCommandFix")) {
|
||||
PlusAPI.removeReport(att.getId());
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().sendMessage(ConfigUtil.getMessage("Malfunction.NoCommand"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onStatusChange(@NotNull ChangeStatusEvent e) {
|
||||
if (e.getAfter() != Status.GLOBAL) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
|||
import com.google.gson.GsonBuilder;
|
||||
import nl.sbdeveloper.themeparkplus.api.PlusAPI;
|
||||
import nl.sbdeveloper.themeparkplus.api.objects.Gate;
|
||||
import nl.sbdeveloper.themeparkplus.api.objects.MalfunctionReport;
|
||||
import nl.sbdeveloper.themeparkplus.api.objects.WaitingRow;
|
||||
import nl.sbdeveloper.themeparkplus.sbutils.LocationSerializer;
|
||||
import nl.sbdeveloper.themeparkplus.sbutils.SQLiteDB;
|
||||
|
@ -36,6 +37,10 @@ public class DBManager {
|
|||
query = "CREATE TABLE IF NOT EXISTS rows (rideID varchar(255) NOT NULL, rowData blob NOT NULL, UNIQUE (rideID))";
|
||||
statement = con.prepareStatement(query);
|
||||
statement.execute();
|
||||
|
||||
query = "CREATE TABLE IF NOT EXISTS malfunction_reports (rideID varchar(255) NOT NULL, reportData blob NOT NULL, UNIQUE (rideID))";
|
||||
statement = con.prepareStatement(query);
|
||||
statement.execute();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -74,6 +79,20 @@ public class DBManager {
|
|||
WaitingRow row = gson.fromJson(json, WaitingRow.class);
|
||||
PlusAPI.addRow(row);
|
||||
}
|
||||
|
||||
/* Load reports */
|
||||
query = "SELECT * FROM malfunction_reports";
|
||||
statement = con.prepareStatement(query);
|
||||
ResultSet reportSet = statement.executeQuery();
|
||||
while (reportSet.next()) {
|
||||
//Loading a gates...
|
||||
byte[] blob = reportSet.getBytes("reportData");
|
||||
String json = new String(blob);
|
||||
|
||||
Gson gson = getGson();
|
||||
MalfunctionReport report = gson.fromJson(json, MalfunctionReport.class);
|
||||
PlusAPI.addReport(report);
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
|
@ -103,7 +122,6 @@ public class DBManager {
|
|||
}
|
||||
|
||||
for (Map.Entry<String, WaitingRow> entry : PlusAPI.getRows().entrySet()) {
|
||||
|
||||
Gson gson = getGson();
|
||||
byte[] blob = gson.toJson(entry.getValue()).getBytes();
|
||||
|
||||
|
@ -125,6 +143,29 @@ public class DBManager {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, MalfunctionReport> entry : PlusAPI.getReports().entrySet()) {
|
||||
Gson gson = getGson();
|
||||
byte[] blob = gson.toJson(entry.getValue()).getBytes();
|
||||
|
||||
try {
|
||||
String query = "INSERT INTO malfunction_reports (rideID, reportData) VALUES (?, ?)";
|
||||
PreparedStatement statement = con.prepareStatement(query);
|
||||
statement.setString(1, entry.getKey());
|
||||
statement.setBytes(2, blob);
|
||||
statement.executeUpdate();
|
||||
} catch (SQLException ignored) {}
|
||||
|
||||
try {
|
||||
String query2 = "UPDATE malfunction_reports SET reportData = ? WHERE rideID = ?";
|
||||
PreparedStatement statement2 = con.prepareStatement(query2);
|
||||
statement2.setBytes(1, blob);
|
||||
statement2.setString(2, entry.getKey());
|
||||
statement2.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void closeConnection() {
|
||||
|
|
|
@ -3,7 +3,6 @@ package nl.sbdeveloper.themeparkplus.sbutils;
|
|||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import nl.sbdeveloper.themeparkplus.ThemeParkPlus;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -25,39 +24,54 @@ import java.util.function.BiConsumer;
|
|||
* Update class for SBDevelopment
|
||||
* @author Stijn [SBDeveloper]
|
||||
* @since 05-03-2020
|
||||
* @version 1.6
|
||||
* @version 2.0 [26-12-2020] - This class supports the v2 Update API
|
||||
*
|
||||
* © Stijn Bannink <stijnbannink23@gmail.com> - All rights reserved.
|
||||
* <p>© Stijn Bannink [stijnbannink23@gmail.com] - All rights reserved.</p>
|
||||
*/
|
||||
public class UpdateManager {
|
||||
|
||||
private static final String SPIGOT_API = "https://api.spigotmc.org/legacy/update.php?resource=%d";
|
||||
private static final String SPIGOT_DOWNLOAD = "http://api.spiget.org/v2/resources/%s/download";
|
||||
|
||||
/* Port 4000 is now legacy, 4443 has a SSL cert */
|
||||
/* As of 24-05-2020, using the legacy port because of SSL errors */
|
||||
private static final String SBDPLUGINS_API = "http://updates.sbdplugins.nl:4000/api/resources/%d";
|
||||
private static final String SBDPLUGINS_DOWNLOAD = "http://updates.sbdplugins.nl:4000/api/download/%d";
|
||||
private static final String SBDPLUGINS_API = "https://updates.sbdplugins.nl/api/v2/plugins/%d";
|
||||
private static final String SBDPLUGINS_DOWNLOAD = "https://updates.sbdplugins.nl/api/v2/download/%d";
|
||||
|
||||
private final Plugin plugin;
|
||||
private final Version currentVersion;
|
||||
private final int resourceID;
|
||||
private final CheckType type;
|
||||
private final String license;
|
||||
|
||||
private BiConsumer<VersionResponse, Version> versionResponse;
|
||||
private BiConsumer<DownloadResponse, String> downloadResponse;
|
||||
|
||||
/**
|
||||
* Construct a new UpdateManager
|
||||
* Construct a new UpdateManager for Spigot
|
||||
*
|
||||
* @param plugin The javaplugin (Main class)
|
||||
* @param resourceID The resourceID on spigot/sbdplugins
|
||||
* @param type The check type
|
||||
*/
|
||||
public UpdateManager(@NotNull Plugin plugin, int resourceID, CheckType type) {
|
||||
public UpdateManager(@NotNull Plugin plugin, int resourceID) {
|
||||
this.plugin = plugin;
|
||||
this.currentVersion = new Version(plugin.getDescription().getVersion());
|
||||
this.resourceID = resourceID;
|
||||
this.type = type;
|
||||
this.type = CheckType.SPIGOT;
|
||||
this.license = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new UpdateManager for SBDPlugins
|
||||
*
|
||||
* @param plugin The javaplugin (Main class)
|
||||
* @param resourceID The resourceID on spigot/sbdplugins
|
||||
* @param license The license for the download
|
||||
*/
|
||||
public UpdateManager(@NotNull Plugin plugin, int resourceID, String license) {
|
||||
this.plugin = plugin;
|
||||
this.currentVersion = new Version(plugin.getDescription().getVersion());
|
||||
this.resourceID = resourceID;
|
||||
this.type = CheckType.SBDPLUGINS;
|
||||
this.license = license;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,7 +103,7 @@ public class UpdateManager {
|
|||
|
||||
in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
} else if (type == CheckType.SBDPLUGINS) {
|
||||
HttpURLConnection con = (HttpURLConnection) new URL(String.format(SBDPLUGINS_API, this.resourceID)).openConnection();
|
||||
HttpsURLConnection con = (HttpsURLConnection) new URL(String.format(SBDPLUGINS_API, this.resourceID)).openConnection();
|
||||
con.setRequestMethod("GET");
|
||||
con.setRequestProperty("User-Agent", "Mozilla/5.0");
|
||||
|
||||
|
@ -98,7 +112,7 @@ public class UpdateManager {
|
|||
|
||||
if (in == null) return;
|
||||
|
||||
String version = null;
|
||||
String version;
|
||||
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
|
@ -113,10 +127,10 @@ public class UpdateManager {
|
|||
JsonArray array = parser.parse(response.toString()).getAsJsonArray();
|
||||
|
||||
version = array.get(0).getAsJsonObject().get("name").getAsString();
|
||||
} else if (type == CheckType.SBDPLUGINS) {
|
||||
} else {
|
||||
JsonObject object = parser.parse(response.toString()).getAsJsonObject();
|
||||
|
||||
version = object.get("data").getAsJsonObject().get("version").getAsString();
|
||||
version = object.get("version").getAsString();
|
||||
}
|
||||
|
||||
if (version == null) return;
|
||||
|
@ -134,7 +148,7 @@ public class UpdateManager {
|
|||
}
|
||||
|
||||
public void runUpdate() {
|
||||
File pluginFile = getPluginFile();// /plugins/XXX.jar
|
||||
File pluginFile = getPluginFile(); // /plugins/XXX.jar
|
||||
if (pluginFile == null) {
|
||||
this.downloadResponse.accept(DownloadResponse.ERROR, null);
|
||||
Bukkit.getLogger().info("Pluginfile is null");
|
||||
|
@ -154,11 +168,12 @@ public class UpdateManager {
|
|||
ReadableByteChannel channel;
|
||||
try {
|
||||
//https://stackoverflow.com/questions/921262/how-to-download-and-save-a-file-from-internet-using-java
|
||||
HttpURLConnection connection;
|
||||
int response;
|
||||
InputStream stream;
|
||||
if (type == CheckType.SBDPLUGINS) {
|
||||
connection = (HttpURLConnection) new URL(String.format(SBDPLUGINS_DOWNLOAD, this.resourceID)).openConnection();
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(String.format(SBDPLUGINS_DOWNLOAD, this.resourceID)).openConnection();
|
||||
|
||||
String urlParameters = "license=" + ThemeParkPlus.getSConfig().getFile().getString("License") + "&port=" + Bukkit.getPort();
|
||||
String urlParameters = "license=" + license + "&port=" + Bukkit.getPort();
|
||||
byte[] postData = urlParameters.getBytes(StandardCharsets.UTF_8);
|
||||
int postDataLength = postData.length;
|
||||
|
||||
|
@ -172,27 +187,31 @@ public class UpdateManager {
|
|||
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
|
||||
wr.write(postData);
|
||||
wr.close();
|
||||
|
||||
response = connection.getResponseCode();
|
||||
stream = connection.getInputStream();
|
||||
} else {
|
||||
connection = (HttpURLConnection) new URL(String.format(SPIGOT_DOWNLOAD, this.resourceID)).openConnection();
|
||||
HttpsURLConnection connection = (HttpsURLConnection) new URL(String.format(SPIGOT_DOWNLOAD, this.resourceID)).openConnection();
|
||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
|
||||
|
||||
response = connection.getResponseCode();
|
||||
stream = connection.getInputStream();
|
||||
}
|
||||
|
||||
if (connection.getResponseCode() != 200) {
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
if (response != 200) {
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(stream));
|
||||
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
StringBuilder responsestr = new StringBuilder();
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
responsestr.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
|
||||
Bukkit.getLogger().info(response.toString());
|
||||
|
||||
throw new RuntimeException("Download returned status #" + connection.getResponseCode());
|
||||
throw new RuntimeException("Download returned status #" + response, new Throwable(responsestr.toString()));
|
||||
}
|
||||
|
||||
channel = Channels.newChannel(connection.getInputStream());
|
||||
channel = Channels.newChannel(stream);
|
||||
} catch (IOException e) {
|
||||
Bukkit.getScheduler().runTask(this.plugin, () -> this.downloadResponse.accept(DownloadResponse.ERROR, null));
|
||||
e.printStackTrace();
|
||||
|
@ -243,7 +262,7 @@ public class UpdateManager {
|
|||
}
|
||||
}
|
||||
|
||||
public enum CheckType {
|
||||
private enum CheckType {
|
||||
SPIGOT, SBDPLUGINS
|
||||
}
|
||||
|
||||
|
@ -260,13 +279,13 @@ public class UpdateManager {
|
|||
|
||||
public static class Version {
|
||||
|
||||
private String version;
|
||||
private final String version;
|
||||
|
||||
public final String get() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public Version(String version) {
|
||||
private Version(String version) {
|
||||
if(version == null)
|
||||
throw new IllegalArgumentException("Version can not be null");
|
||||
if(!version.matches("[0-9]+(\\.[0-9]+)*"))
|
||||
|
@ -274,7 +293,7 @@ public class UpdateManager {
|
|||
this.version = version;
|
||||
}
|
||||
|
||||
public VersionResponse check(@NotNull Version that) {
|
||||
private VersionResponse check(@NotNull Version that) {
|
||||
String[] thisParts = this.get().split("\\.");
|
||||
String[] thatParts = that.get().split("\\.");
|
||||
|
||||
|
|
|
@ -88,12 +88,12 @@ public class License implements Listener {
|
|||
try {
|
||||
response = sendGETRequestJSON(url);
|
||||
} catch (IOException e) {
|
||||
disable("Couldn't send the request.");
|
||||
disable("Something went wrong while sending the request.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (response == null) {
|
||||
disable("Couldn't send the request.");
|
||||
disable("Something went wrong while sending the request. Did you even fill out a license?");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -175,12 +175,12 @@ public class License implements Listener {
|
|||
try {
|
||||
response = sendGETRequestJSON(url);
|
||||
} catch (IOException e) {
|
||||
disable("Couldn't send the activate request.");
|
||||
disable("Something went wrong while sending the request.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (response == null) {
|
||||
disable("Couldn't send the activate request.");
|
||||
disable("Something went wrong while sending the request. Did you even fill out a license?");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,6 @@ public class License implements Listener {
|
|||
con.setRequestProperty("Authorization", "Basic " + authStringEnc);
|
||||
int code = con.getResponseCode();
|
||||
if (code == 404) {
|
||||
disable("404_error");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
License: 'TPABCD-1234-ABCD-1234SBD'
|
||||
License: ''
|
||||
AntiFreerun:
|
||||
Enabled: false
|
||||
UpdateChecker:
|
||||
|
@ -8,8 +8,41 @@ MessageInConsole: true
|
|||
WaitingRow:
|
||||
MinutesPerPlayer: 1.5
|
||||
Sign:
|
||||
Row1: "&8[&6ThemeParkPlus&8]"
|
||||
Row2: "&bWaitingRow"
|
||||
Row1: '&8[&6ThemeParkPlus&8]'
|
||||
Row2: '&bWaitingRow'
|
||||
Malfunction:
|
||||
AllowCommandReport: true
|
||||
AllowCommandFix: false
|
||||
Sign:
|
||||
Row1: '&8[&6ThemeParkPlus&8]'
|
||||
Row2: '&bMalfunction'
|
||||
GUI:
|
||||
Title: '&3Report Malfunction for %ridename%'
|
||||
Buttons:
|
||||
Report:
|
||||
Slot: 2
|
||||
Material: GREEN_WOOL
|
||||
Name: '&2&lReport Malfunction'
|
||||
Lores:
|
||||
- '&fClick here to report malfunction for %ridename%.'
|
||||
- '&r'
|
||||
- '&cAbuse of this function is not allowed!'
|
||||
Fix:
|
||||
Slot: 4
|
||||
Material: STONE_PICKAXE
|
||||
Name: '&e&lFix Ride'
|
||||
Lores:
|
||||
- '&fClick here to fix %ridename%!'
|
||||
- '&r'
|
||||
- '&fReporter: &7%reporter%'
|
||||
- '&fDate: &7%date%'
|
||||
- '&fReason: &7%reason%'
|
||||
Cancel:
|
||||
Slot: 6
|
||||
Material: RED_WOOL
|
||||
Name: '&4&lCancel Report'
|
||||
Lores:
|
||||
- '&fClick here to cancel.'
|
||||
Fastpass:
|
||||
Item:
|
||||
DisplayName: '&6Fastpass Ticket'
|
||||
|
|
|
@ -3,6 +3,7 @@ General:
|
|||
NoPlayer: '&cYou have to be a player to do this.'
|
||||
IncorrectAmount: '&cThis amount is incorrect.'
|
||||
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:
|
||||
WrongDir: '&cYou can''t walk through this gate in that direction.'
|
||||
UnknownDir: '&cThis direction is unknown. Choose between: NORTH, SOUTH, EAST, WEST'
|
||||
|
@ -39,3 +40,10 @@ WaitingRow:
|
|||
WrongLocation: '&cA waitingrow sign (from the attraction %ridename%) couldn''t be found! It will be deleted.'
|
||||
RedstoneTimer:
|
||||
Started: '&aThe timer successfully started. It will go off in &f%sec1% &asecond(s), and will turn off in &f%sec2% &asecond(s) after that.'
|
||||
Malfunction:
|
||||
NoCommand: '&cYou can''t report or fix a ride using the command. Please use this Malfunction Sign at the ride.'
|
||||
Reported: '&aSuccessfully reported a malfunction for &f%ride%&a.'
|
||||
AlreadyReported: '&cThere is already a malfunction reported for &f%ride%&c.'
|
||||
Fixed: '&aThe ride &f%ride%&a is now successfully fixed.'
|
||||
AlreadyFixed: '&cThe ride &f%ride%&a &chas no malfunction report, and therefore cannot be fixed.'
|
||||
ThisRide: 'this ride'
|
Reference in a new issue