diff --git a/src/main/java/nl/iobyte/themeparkconnector/ThemeParkConnector.java b/src/main/java/nl/iobyte/themeparkconnector/ThemeParkConnector.java
old mode 100644
new mode 100755
index cfb04aa..71dba86
--- a/src/main/java/nl/iobyte/themeparkconnector/ThemeParkConnector.java
+++ b/src/main/java/nl/iobyte/themeparkconnector/ThemeParkConnector.java
@@ -6,8 +6,7 @@ import nl.iobyte.themeparkconnector.api.ThemeParkConnectorAPI;
import nl.iobyte.themeparkconnector.api.config.enums.StorageKey;
import nl.iobyte.themeparkconnector.commands.ThemeParkConnectorCommand;
import nl.iobyte.themeparkconnector.listeners.*;
-import nl.iobyte.themeparkconnector.sbd.License;
-import nl.iobyte.themeparkconnector.sbd.UpdateManager;
+import nl.iobyte.themeparkconnector.sbd.Verify;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.RegisteredServiceProvider;
@@ -27,57 +26,13 @@ public class ThemeParkConnector extends JavaPlugin {
Bukkit.getLogger().info(String.format("[%s] - No Vault dependency found!", getDescription().getName()));
}
- instance = this;
- api.enable();
+ instance = this; api.enable();
//License stuff
- new License(this, "TPP", api.getConfigurationManager().getString(StorageKey.LICENSE));
+ new Verify(this);
loadCommands();
loadListeners();
- loadUpdateManager();
- }
-
- private void loadUpdateManager() {
- if(!api.getConfigurationManager().getBoolean(StorageKey.UPDATE_CHECK_ENABLED))
- return;
-
- UpdateManager manager = new UpdateManager(
- this,
- 5,
- api.getConfigurationManager().getString(StorageKey.LICENSE)
- );
- manager.handleResponse((response, version) -> {
- switch (response) {
- case LATEST:
- getLogger().info("You're running the latest version("+version.get()+")");
- break;
- case THIS_NEWER:
- getLogger().info("You're running a newer version("+version.get()+")");
- break;
- case UNAVAILABLE:
- getLogger().info("Unable to check for updates");
- break;
- case FOUND_NEW:
- getLogger().info("Found newer version("+version.get()+")");
- if(!api.getConfigurationManager().getBoolean(StorageKey.UPDATE_DOWNLOAD_ENABLED))
- return;
-
- manager.handleDownloadResponse((downloadResponse, fileName) -> {
- switch (downloadResponse) {
- case DONE:
- getLogger().info("Update downloaded! If you restart your server, it will be loaded. Filename: " + fileName);
- break;
- case ERROR:
- getLogger().severe("Something went wrong when trying downloading the latest version.");
- break;
- case UNAVAILABLE:
- getLogger().warning("Unable to download the latest version.");
- break;
- }
- }).runUpdate();
- }
- }).check();
}
private boolean setupEconomy() {
@@ -89,7 +44,7 @@ public class ThemeParkConnector extends JavaPlugin {
return false;
econ = rsp.getProvider();
- return econ != null;
+ return true;
}
private void loadCommands() {
diff --git a/src/main/java/nl/iobyte/themeparkconnector/ThemeParkConnectorGson.java b/src/main/java/nl/iobyte/themeparkconnector/ThemeParkConnectorGson.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/ThemeParkConnectorAPI.java b/src/main/java/nl/iobyte/themeparkconnector/api/ThemeParkConnectorAPI.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/authentication/AuthenticationService.java b/src/main/java/nl/iobyte/themeparkconnector/api/authentication/AuthenticationService.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/authentication/objects/WeakConcurrentHashMap.java b/src/main/java/nl/iobyte/themeparkconnector/api/authentication/objects/WeakConcurrentHashMap.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/client/ClientConnection.java b/src/main/java/nl/iobyte/themeparkconnector/api/client/ClientConnection.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/client/Publisher.java b/src/main/java/nl/iobyte/themeparkconnector/api/client/Publisher.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/client/objects/Notification.java b/src/main/java/nl/iobyte/themeparkconnector/api/client/objects/Notification.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/config/ConfigurationManager.java b/src/main/java/nl/iobyte/themeparkconnector/api/config/ConfigurationManager.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/config/enums/StorageKey.java b/src/main/java/nl/iobyte/themeparkconnector/api/config/enums/StorageKey.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/config/enums/StorageLocation.java b/src/main/java/nl/iobyte/themeparkconnector/api/config/enums/StorageLocation.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/event/EventDispatcher.java b/src/main/java/nl/iobyte/themeparkconnector/api/event/EventDispatcher.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/event/objects/ChangeEvent.java b/src/main/java/nl/iobyte/themeparkconnector/api/event/objects/ChangeEvent.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/event/objects/OperatorEvent.java b/src/main/java/nl/iobyte/themeparkconnector/api/event/objects/OperatorEvent.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/event/operator/OperatorConnectEvent.java b/src/main/java/nl/iobyte/themeparkconnector/api/event/operator/OperatorConnectEvent.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/event/operator/OperatorDisconnectEvent.java b/src/main/java/nl/iobyte/themeparkconnector/api/event/operator/OperatorDisconnectEvent.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/event/operator/OperatorStateEvent.java b/src/main/java/nl/iobyte/themeparkconnector/api/event/operator/OperatorStateEvent.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/event/ticket/TicketScanEvent.java b/src/main/java/nl/iobyte/themeparkconnector/api/event/ticket/TicketScanEvent.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/load/DataLoadService.java b/src/main/java/nl/iobyte/themeparkconnector/api/load/DataLoadService.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/load/interfaces/IDataLoader.java b/src/main/java/nl/iobyte/themeparkconnector/api/load/interfaces/IDataLoader.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/load/objects/DatabaseLoader.java b/src/main/java/nl/iobyte/themeparkconnector/api/load/objects/DatabaseLoader.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/load/objects/OperatorDataLoader.java b/src/main/java/nl/iobyte/themeparkconnector/api/load/objects/OperatorDataLoader.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/message/MessageKey.java b/src/main/java/nl/iobyte/themeparkconnector/api/message/MessageKey.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/message/Text.java b/src/main/java/nl/iobyte/themeparkconnector/api/message/Text.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/NetworkingService.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/NetworkingService.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/drivers/ClientDriver.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/drivers/ClientDriver.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/drivers/SystemDriver.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/drivers/SystemDriver.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/handlers/ClientConnectivityHandler.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/handlers/ClientConnectivityHandler.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/handlers/ClientOperatorHandler.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/handlers/ClientOperatorHandler.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/io/NullProxySelector.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/io/NullProxySelector.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/io/SocketConnector.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/io/SocketConnector.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/objects/CertificateHelper.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/objects/CertificateHelper.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/objects/INetworkingEvent.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/objects/INetworkingEvent.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/objects/SocketDriver.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/objects/SocketDriver.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/KickClientPacket.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/KickClientPacket.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/NotificationPacket.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/NotificationPacket.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/operator/OperatorRequestReplyPacket.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/operator/OperatorRequestReplyPacket.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/operator/OperatorStatePacket.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/operator/OperatorStatePacket.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/operator/StatusChangePacket.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/packet/operator/StatusChangePacket.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/payload/NotificationPayload.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/payload/NotificationPayload.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/payload/operator/OperatorRequestReplyPayload.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/payload/operator/OperatorRequestReplyPayload.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/payload/operator/OperatorStatePayload.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/payload/operator/OperatorStatePayload.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/payload/operator/StatusChangePayload.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/payload/operator/StatusChangePayload.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/operator/OperatorService.java b/src/main/java/nl/iobyte/themeparkconnector/api/operator/OperatorService.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/operator/adapter/OperatorItemAdapter.java b/src/main/java/nl/iobyte/themeparkconnector/api/operator/adapter/OperatorItemAdapter.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/operator/adapter/OperatorPanelAdapter.java b/src/main/java/nl/iobyte/themeparkconnector/api/operator/adapter/OperatorPanelAdapter.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/operator/enums/OperatorRequestReply.java b/src/main/java/nl/iobyte/themeparkconnector/api/operator/enums/OperatorRequestReply.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/operator/objects/AttractionOperator.java b/src/main/java/nl/iobyte/themeparkconnector/api/operator/objects/AttractionOperator.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/operator/objects/panel/OperatorItem.java b/src/main/java/nl/iobyte/themeparkconnector/api/operator/objects/panel/OperatorItem.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/operator/objects/panel/OperatorItemState.java b/src/main/java/nl/iobyte/themeparkconnector/api/operator/objects/panel/OperatorItemState.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/operator/objects/panel/OperatorPanel.java b/src/main/java/nl/iobyte/themeparkconnector/api/operator/objects/panel/OperatorPanel.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/adapter/PacketPayloadAdapter.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/adapter/PacketPayloadAdapter.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/adapter/StatusAdapter.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/adapter/StatusAdapter.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/enums/PacketChannel.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/enums/PacketChannel.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/handlers/ClientConnectHandler.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/handlers/ClientConnectHandler.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/handlers/ClientDisconnectHandler.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/handlers/ClientDisconnectHandler.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/handlers/operator/ClientOperatorClickHandler.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/handlers/operator/ClientOperatorClickHandler.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/objects/AbstractPacket.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/objects/AbstractPacket.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/objects/AbstractPacketPayload.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/objects/AbstractPacketPayload.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/objects/PayloadHandler.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/objects/PayloadHandler.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/payloads/ClientConnectPayload.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/payloads/ClientConnectPayload.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/payloads/ClientDisconnectPayload.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/payloads/ClientDisconnectPayload.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/packet/payloads/operator/ClientOperatorClickPayload.java b/src/main/java/nl/iobyte/themeparkconnector/api/packet/payloads/operator/ClientOperatorClickPayload.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/player/PlayerStateService.java b/src/main/java/nl/iobyte/themeparkconnector/api/player/PlayerStateService.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/show/ShowService.java b/src/main/java/nl/iobyte/themeparkconnector/api/show/ShowService.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/show/objects/Ticket.java b/src/main/java/nl/iobyte/themeparkconnector/api/show/objects/Ticket.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/state/StateService.java b/src/main/java/nl/iobyte/themeparkconnector/api/state/StateService.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/state/objects/AbstractState.java b/src/main/java/nl/iobyte/themeparkconnector/api/state/objects/AbstractState.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/state/states/ConnectedState.java b/src/main/java/nl/iobyte/themeparkconnector/api/state/states/ConnectedState.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/state/states/ConnectingState.java b/src/main/java/nl/iobyte/themeparkconnector/api/state/states/ConnectingState.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/state/states/IdleState.java b/src/main/java/nl/iobyte/themeparkconnector/api/state/states/IdleState.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/ThemeParkConnectorCommand.java b/src/main/java/nl/iobyte/themeparkconnector/commands/ThemeParkConnectorCommand.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/arguments/OperatorArgument.java b/src/main/java/nl/iobyte/themeparkconnector/commands/arguments/OperatorArgument.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/ConnectCommand.java b/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/ConnectCommand.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/DisconnectCommand.java b/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/DisconnectCommand.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/HelpCommand.java b/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/HelpCommand.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/NotificationCommand.java b/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/NotificationCommand.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/StatusCommand.java b/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/StatusCommand.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/operator/OperatorCommands.java b/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/operator/OperatorCommands.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/operator/OperatorReloadCommand.java b/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/operator/OperatorReloadCommand.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/operator/OperatorStateCommand.java b/src/main/java/nl/iobyte/themeparkconnector/commands/subcommands/operator/OperatorStateCommand.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/listeners/AttractionListener.java b/src/main/java/nl/iobyte/themeparkconnector/listeners/AttractionListener.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/listeners/OperatorListener.java b/src/main/java/nl/iobyte/themeparkconnector/listeners/OperatorListener.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/listeners/PlayerListener.java b/src/main/java/nl/iobyte/themeparkconnector/listeners/PlayerListener.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/listeners/RideCountListener.java b/src/main/java/nl/iobyte/themeparkconnector/listeners/RideCountListener.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/listeners/RideOperatorListener.java b/src/main/java/nl/iobyte/themeparkconnector/listeners/RideOperatorListener.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/listeners/TicketListener.java b/src/main/java/nl/iobyte/themeparkconnector/listeners/TicketListener.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/logger/ThemeParkConnectorLogger.java b/src/main/java/nl/iobyte/themeparkconnector/logger/ThemeParkConnectorLogger.java
old mode 100644
new mode 100755
diff --git a/src/main/java/nl/iobyte/themeparkconnector/sbd/License.java b/src/main/java/nl/iobyte/themeparkconnector/sbd/License.java
deleted file mode 100644
index 4f08b7d..0000000
--- a/src/main/java/nl/iobyte/themeparkconnector/sbd/License.java
+++ /dev/null
@@ -1,292 +0,0 @@
-package nl.iobyte.themeparkconnector.sbd;
-
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.plugin.java.JavaPlugin;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * License class for SBDevelopment
- *
- * v1.8 - Changed on 24-01-2022
- *
- * @author Stijn [SBDeveloper]
- * @since 23-12-2019
- */
-public class License implements Listener {
- private final JavaPlugin plugin; // The plugin instance
- private final String license; // The license code
- private final String prefix; // The correct prefix for this plugin
- private String invalidReason = null; // The reason the license is invalid, if null it's not invalid!
- private static Boolean valid = null; // If true, it's valid, if false, it's not valid, if null it's not checked!
-
- /**
- * Construct a new license
- * @param plugin The plugin
- * @param prefix The wanted prefix, like TPP or AF
- * @param license The license from the config
- */
- public License(JavaPlugin plugin, String prefix, String license) {
- this.prefix = prefix;
- this.plugin = plugin;
- this.license = license;
-
- Bukkit.getPluginManager().registerEvents(this, plugin);
-
- validateLicense();
- }
-
- @EventHandler
- public void onJoin(PlayerJoinEvent e) {
- if (this.invalidReason == null) return;
-
- Player p = e.getPlayer();
- if (p.isOp() || p.hasPermission("sbd.licensemessages")) {
- Bukkit.getScheduler().runTaskLater(this.plugin, () -> p.sendMessage(ChatColor.GOLD + "[" + ChatColor.RED + this.plugin.getName() + ChatColor.GOLD + "] " + ChatColor.RED + "The license is incorrect! Reason: " + ChatColor.GOLD + this.invalidReason), 5 * 20L /* 5 sec */);
- }
- }
-
- /**
- * Check a license
- *
- */
- private void validateLicense() {
- //STEP 1: Check prefix
- if (!this.license.split("-")[0].contains(this.prefix)) {
- disable("You used the wrong license for this product.");
- return;
- }
-
- //STEP 2: Send license request
- String url = "https://sbdplugins.nl/wp-json/lmfwc/v2/licenses/" + this.license;
- JsonObject response;
- try {
- response = sendGETRequestJSON(url);
- } catch (IOException e) {
- disable("Couldn't send the request.");
- return;
- }
-
- if (response == null) {
- disable("Failed to request license information. Check if you entered a license in the plugin configuration.");
- return;
- }
-
- JsonObject dataObject = response.get("data").getAsJsonObject();
-
- //STEP 3: Check status
- switch(dataObject.get("status").getAsString()) {
- case "2":
- //Delivered -> Try to activate (double check timesActivated)
- break;
- case "3":
- //Activated!
- break;
- default:
- disable("Your license has a wrong status.");
- return;
- }
-
- //STEP 4: Check times activated, and if not activated, activate.
- if (dataObject.get("timesActivated").isJsonNull() || dataObject.get("timesActivated").getAsString().equalsIgnoreCase("0")) {
- activate();
- return;
- }
-
- //STEP 5: Check expire date
- if (dataObject.get("expiresAt").isJsonNull()) {
- disable("Your license has no expire date.");
- return;
- }
-
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Date date;
- try {
- date = format.parse(dataObject.get("expiresAt").getAsString());
- } catch (ParseException e) {
- e.printStackTrace();
- disable("Your license has a wrong expire date.");
- return;
- }
-
- if (date == null) {
- disable("Your license has a wrong expire date.");
- return;
- }
-
- if (!(date.after(new Date()))) {
- disable("Your license has expired.");
- return;
- }
-
- //STEP 6: Check IP and port.
- if (!dataObject.get("ipcheck").getAsBoolean()) {
- disable("Your license has been used with another IP. Update it in our Discord.");
- return;
- }
-
- if (dataObject.get("port").isJsonNull()) {
- disable("Your license has no port.");
- return;
- }
-
- String por = dataObject.get("port").getAsString();
- if (!checkPortValue(Bukkit.getServer().getPort(), por)) {
- disable("Your license has been used with another Port. Update it in our Discord.");
- return;
- }
-
- valid = true;
- }
-
- /**
- * Activate the license
- *
- */
- private void activate() {
- //STEP 1: Send license activate request
- String url = "https://sbdplugins.nl/wp-json/lmfwc/v2/licenses/activate/" + this.license + "?port=" + Bukkit.getServer().getPort();
- JsonObject response;
- try {
- response = sendGETRequestJSON(url);
- } catch (IOException e) {
- disable("Couldn't send the activate request.");
- return;
- }
-
- if (response == null) {
- disable("Failed to request license information. Check if you entered a license in the plugin configuration.");
- return;
- }
-
- JsonObject dataObject = response.get("data").getAsJsonObject();
-
- //STEP 2: Check status
- switch(dataObject.get("status").getAsString()) {
- case "2":
- //Delivered -> STILL NOT ACTIVATED?! -> Double check
- break;
- case "3":
- //Activated!
- break;
- default:
- disable("Your license has a wrong status.");
- return;
- }
-
- //STEP 3: Check times activated, and if still not activated, disable.
- if (dataObject.get("timesActivated").isJsonNull() || dataObject.get("timesActivated").getAsString().equalsIgnoreCase("0")) {
- disable("Couldn't activate the license.");
- }
- }
-
- /**
- * Disable the plugin (private)
- *
- * @param reason The disabling reason
- */
- private void disable(String reason) {
- this.invalidReason = reason;
-
- Bukkit.getScheduler().runTask(this.plugin, () -> {
- valid = false;
-
- Bukkit.getLogger().severe("[" + this.plugin.getName() + "] Stopping plugin because licensing system check failed.");
- Bukkit.getLogger().severe("[" + this.plugin.getName() + "] Reason: " + reason);
- Bukkit.getLogger().severe("[" + this.plugin.getName() + "] Contact the developer if you believe something is wrong on their side.");
- Bukkit.getPluginManager().disablePlugin(this.plugin);
- });
- }
-
- /**
- * Send an GET request with JSONObject response
- *
- * @param uri The URL
- *
- * @return The JSONObject
- * @throws IOException URL errors
- */
- private JsonObject sendGETRequestJSON(String uri) throws IOException {
- URL url = new URL(uri);
- HttpURLConnection con = (HttpURLConnection) url.openConnection();
- con.setRequestMethod("GET");
- con.setRequestProperty("User-Agent", "Mozilla/5.0");
- String authStringEnc = "Y2tfMGEzNWEzMWE2NzExNmM3NDg2MGEwYTJhNjUxNGVjZjM4NTBmM2JmMDpjc185NmYxZGNlYjI4MWRkZDExOTBjMzQ3ZjJjYzMwMGNjZTIzYWNhODI1";
- con.setRequestProperty("Authorization", "Basic " + authStringEnc);
- con.setConnectTimeout(5000); //Timeout after 5 sec.
- con.setReadTimeout(5000); //Timeout after 5 sec.
- int code = con.getResponseCode();
- if (code == 404) {
- return null;
- }
- BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
- String inputLine;
- StringBuilder response = new StringBuilder();
- while ((inputLine = in.readLine()) != null) {
- response.append(inputLine);
- }
- in.close();
-
- return new JsonParser().parse(response.toString()).getAsJsonObject(); //parseString is only available from 1.18, so keep deprecated function!
- }
-
- private boolean checkPortValue(int input, String dataValue) {
- //STEP 1: Check wildcard
- if (dataValue.equals("*")) return true;
-
- //STEP 2: Check if equals
- try {
- int dataVal = Integer.parseInt(dataValue);
-
- return input == dataVal;
- } catch (NumberFormatException ignored) {}
-
- //STEP 3: Check if range
- if (dataValue.contains("-")) {
- String[] dataSplit = dataValue.split("-");
-
- //STEP 3.1: Check if min or max is wildcard
- if (dataSplit[0].equals("*") && !dataSplit[1].equals("*")) {
- int max = Integer.parseInt(dataSplit[1]);
- return input <= max;
- } else if (dataSplit[1].equals("*") && !dataSplit[0].equals("*")) {
- int min = Integer.parseInt(dataSplit[0]);
- return min <= input;
- } else {
- try {
- int min = Integer.parseInt(dataSplit[0]);
- int max = Integer.parseInt(dataSplit[1]);
-
- return (min <= input) && (input <= max);
- } catch (NumberFormatException ex) {
- return false;
- }
- }
- }
-
- //Else, invalid value
- return false;
- }
-
- /**
- * Check if the license is valid
- *
- * @return true = VALID, false = INVALID, null = UNCHECKED
- */
- public static Boolean isValid() {
- return valid;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/nl/iobyte/themeparkconnector/sbd/UpdateManager.java b/src/main/java/nl/iobyte/themeparkconnector/sbd/UpdateManager.java
deleted file mode 100644
index 09d9cb3..0000000
--- a/src/main/java/nl/iobyte/themeparkconnector/sbd/UpdateManager.java
+++ /dev/null
@@ -1,308 +0,0 @@
-package nl.iobyte.themeparkconnector.sbd;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import org.bukkit.Bukkit;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.java.JavaPlugin;
-import javax.net.ssl.HttpsURLConnection;
-import java.io.*;
-import java.lang.reflect.Method;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.nio.channels.Channels;
-import java.nio.channels.FileChannel;
-import java.nio.channels.ReadableByteChannel;
-import java.nio.charset.StandardCharsets;
-import java.util.function.BiConsumer;
-
-/**
- * Update class for SBDevelopment
- * @author Stijn [SBDeveloper]
- * @since 05-03-2020
- * @version 2.0 [26-12-2020] - This class supports the v2 Update API
- *
- * © Stijn Bannink [stijnbannink23@gmail.com] - All rights reserved.
- */
-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";
-
- 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;
- private BiConsumer downloadResponse;
-
- /**
- * Construct a new UpdateManager for Spigot
- *
- * @param plugin The javaplugin (Main class)
- * @param resourceID The resourceID on spigot/sbdplugins
- */
- public UpdateManager(Plugin plugin, int resourceID) {
- this.plugin = plugin;
- this.currentVersion = new Version(plugin.getDescription().getVersion());
- this.resourceID = resourceID;
- 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(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;
- }
-
- /**
- * Handle the response given by check();
- * @param versionResponse The response
- * @return The updatemanager
- */
- public UpdateManager handleResponse(BiConsumer versionResponse) {
- this.versionResponse = versionResponse;
- return this;
- }
-
- public UpdateManager handleDownloadResponse(BiConsumer downloadResponse) {
- this.downloadResponse = downloadResponse;
- return this;
- }
-
- /**
- * Check for a new version
- */
- public void check() {
- Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
- try {
- BufferedReader in = null;
- if (type == CheckType.SPIGOT) {
- HttpsURLConnection con = (HttpsURLConnection) new URL(String.format(SPIGOT_API, this.resourceID)).openConnection();
- con.setRequestMethod("GET");
- con.setRequestProperty("User-Agent", "Mozilla/5.0");
-
- in = new BufferedReader(new InputStreamReader(con.getInputStream()));
- } else if (type == CheckType.SBDPLUGINS) {
- HttpsURLConnection con = (HttpsURLConnection) new URL(String.format(SBDPLUGINS_API, this.resourceID)).openConnection();
- con.setRequestMethod("GET");
- con.setRequestProperty("User-Agent", "Mozilla/5.0");
-
- in = new BufferedReader(new InputStreamReader(con.getInputStream()));
- }
-
- if (in == null) return;
-
- String version;
-
- String inputLine;
- StringBuilder response = new StringBuilder();
- while ((inputLine = in.readLine()) != null) {
- response.append(inputLine);
- }
- in.close();
-
- JsonParser parser = new JsonParser();
-
- if (type == CheckType.SPIGOT) {
- JsonArray array = parser.parse(response.toString()).getAsJsonArray();
-
- version = array.get(0).getAsJsonObject().get("name").getAsString();
- } else {
- JsonObject object = parser.parse(response.toString()).getAsJsonObject();
-
- version = object.get("version").getAsString();
- }
-
- if (version == null) return;
-
- Version onlineVersion = new Version(version);
-
- VersionResponse verRes = this.currentVersion.check(onlineVersion);
-
- Bukkit.getScheduler().runTask(this.plugin, () -> this.versionResponse.accept(verRes, onlineVersion));
- } catch (IOException | NullPointerException e) {
- e.printStackTrace();
- Bukkit.getScheduler().runTask(this.plugin, () -> this.versionResponse.accept(VersionResponse.UNAVAILABLE, null));
- }
- });
- }
-
- public void runUpdate() {
- File pluginFile = getPluginFile(); // /plugins/XXX.jar
- if (pluginFile == null) {
- this.downloadResponse.accept(DownloadResponse.ERROR, null);
- Bukkit.getLogger().info("Pluginfile is null");
- return;
- }
- File updateFolder = Bukkit.getUpdateFolderFile();
- if (!updateFolder.exists()) {
- if (!updateFolder.mkdirs()) {
- this.downloadResponse.accept(DownloadResponse.ERROR, null);
- Bukkit.getLogger().info("Updatefolder doesn't exists, and can't be made");
- return;
- }
- }
- final File updateFile = new File(updateFolder, pluginFile.getName());
-
- Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
- ReadableByteChannel channel;
- try {
- //https://stackoverflow.com/questions/921262/how-to-download-and-save-a-file-from-internet-using-java
- int response;
- InputStream stream;
- if (type == CheckType.SBDPLUGINS) {
- HttpURLConnection connection = (HttpURLConnection) new URL(String.format(SBDPLUGINS_DOWNLOAD, this.resourceID)).openConnection();
-
- String urlParameters = "license=" + license + "&port=" + Bukkit.getPort();
- byte[] postData = urlParameters.getBytes(StandardCharsets.UTF_8);
- int postDataLength = postData.length;
-
- connection.setRequestMethod("GET");
- connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
- connection.setRequestProperty("charset", "utf-8");
- connection.setRequestProperty("Content-Length", Integer.toString(postDataLength));
- connection.setRequestProperty("User-Agent", "Mozilla/5.0");
- connection.setDoOutput(true);
-
- DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
- wr.write(postData);
- wr.close();
-
- response = connection.getResponseCode();
- stream = connection.getInputStream();
- } else {
- 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 (response != 200) {
- BufferedReader in = new BufferedReader(new InputStreamReader(stream));
-
- String inputLine;
- StringBuilder responsestr = new StringBuilder();
- while ((inputLine = in.readLine()) != null) {
- responsestr.append(inputLine);
- }
- in.close();
-
- throw new RuntimeException("Download returned status #" + response, new Throwable(responsestr.toString()));
- }
-
- channel = Channels.newChannel(stream);
- } catch (IOException e) {
- Bukkit.getScheduler().runTask(this.plugin, () -> this.downloadResponse.accept(DownloadResponse.ERROR, null));
- e.printStackTrace();
- return;
- }
-
- FileChannel fileChannel = null;
- try {
- FileOutputStream fosForDownloadedFile = new FileOutputStream(updateFile);
- fileChannel = fosForDownloadedFile.getChannel();
-
- fileChannel.transferFrom(channel, 0, Long.MAX_VALUE);
- } catch (IOException e) {
- Bukkit.getScheduler().runTask(this.plugin, () -> this.downloadResponse.accept(DownloadResponse.ERROR, null));
- e.printStackTrace();
- return;
- } finally {
- if (channel != null) {
- try {
- channel.close();
- } catch (IOException ioe) {
- System.out.println("Error while closing response body channel");
- }
- }
-
- if (fileChannel != null) {
- try {
- fileChannel.close();
- } catch (IOException ioe) {
- System.out.println("Error while closing file channel for downloaded file");
- }
- }
- }
-
- Bukkit.getScheduler().runTask(this.plugin, () -> this.downloadResponse.accept(DownloadResponse.DONE, updateFile.getPath()));
- });
- }
-
- private File getPluginFile() {
- if (!(this.plugin instanceof JavaPlugin)) { return null; }
- try {
- Method method = JavaPlugin.class.getDeclaredMethod("getFile");
- method.setAccessible(true);
- return (File) method.invoke(this.plugin);
- } catch (ReflectiveOperationException e) {
- throw new RuntimeException("Could not get plugin file", e);
- }
- }
-
- private enum CheckType {
- SPIGOT, SBDPLUGINS
- }
-
- public enum VersionResponse {
- LATEST, //Latest version
- FOUND_NEW, //Newer available
- THIS_NEWER, //Local version is newer?
- UNAVAILABLE //Error
- }
-
- public enum DownloadResponse {
- DONE, ERROR, UNAVAILABLE
- }
-
- public static class Version {
-
- private final String version;
-
- public final String get() {
- return this.version;
- }
-
- private Version(String version) {
- if(version == null)
- throw new IllegalArgumentException("Version can not be null");
- if(!version.matches("[0-9]+(\\.[0-9]+)*"))
- throw new IllegalArgumentException("Invalid version format");
- this.version = version;
- }
-
- private VersionResponse check(Version that) {
- String[] thisParts = this.get().split("\\.");
- String[] thatParts = that.get().split("\\.");
-
- int length = Math.max(thisParts.length, thatParts.length);
- for (int i = 0; i < length; i++) {
- int thisPart = i < thisParts.length ? Integer.parseInt(thisParts[i]) : 0;
- int thatPart = i < thatParts.length ? Integer.parseInt(thatParts[i]) : 0;
- if(thisPart < thatPart)
- return VersionResponse.FOUND_NEW;
- if(thisPart > thatPart)
- return VersionResponse.THIS_NEWER;
- }
- return VersionResponse.LATEST;
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/nl/iobyte/themeparkconnector/sbd/Verify.java b/src/main/java/nl/iobyte/themeparkconnector/sbd/Verify.java
new file mode 100755
index 0000000..a47420b
--- /dev/null
+++ b/src/main/java/nl/iobyte/themeparkconnector/sbd/Verify.java
@@ -0,0 +1,148 @@
+package nl.iobyte.themeparkconnector.sbd;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+/**
+ * Purchase verification class
+ *
+ * @author Stijn [SBDeveloper]
+ * @version 2.0 [17-04-2022] - Updated to Polymart
+ * @since 23-12-2019
+ */
+public class Verify implements Listener {
+ private static final String endpointURL = "https://api.polymart.org/v1/verifyPurchase/?inject_version=%d&resource_id=%d&user_id=%d&nonce=%d&download_agent=%d&download_time=%d&download_token=%s";
+
+ private final JavaPlugin plugin; // The plugin instance
+
+ private final int resourceID;
+ private final int injector_version;
+ private final int user_id;
+ private final int nonce;
+ private final int download_agent;
+ private final int download_time;
+ private final String download_token;
+
+ private String invalidReason = null; // The reason the license is invalid, if null it's not invalid!
+ private static Boolean valid = null; // If true, it's valid, if false, it's not valid, if null it's not checked!
+
+ /**
+ * Construct a new license
+ *
+ * @param plugin The plugin
+ */
+ public Verify(JavaPlugin plugin) {
+ this.plugin = plugin;
+
+ this.resourceID = Integer.parseInt("%%__RESOURCE__%%");
+ this.injector_version = Integer.parseInt("%%__INJECT_VER__%%");
+ this.user_id = Integer.parseInt("%%__USER__%%");
+ this.nonce = Integer.parseInt("%%__NONCE__%%");
+ this.download_agent = Integer.parseInt("%%__AGENT__%%");
+ this.download_time = Integer.parseInt("%%__TIMESTAMP__%%");
+ this.download_token = "%%__VERIFY_TOKEN__%%";
+
+ Bukkit.getPluginManager().registerEvents(this, plugin);
+
+ validate();
+ }
+
+ @EventHandler
+ public void onJoin(PlayerJoinEvent e) {
+ if (this.invalidReason == null) return;
+
+ Player p = e.getPlayer();
+ if (p.isOp() || p.hasPermission("sbd.licensemessages")) {
+ Bukkit.getScheduler().runTaskLater(this.plugin, () -> p.sendMessage(ChatColor.GOLD + "[" + ChatColor.RED + this.plugin.getName() + ChatColor.GOLD + "] " + ChatColor.RED + "The license is incorrect! Reason: " + ChatColor.GOLD + this.invalidReason), 5 * 20L /* 5 sec */);
+ }
+ }
+
+ /**
+ * Validate the purchase
+ */
+ private void validate() {
+ try {
+ URL url = new URL(String.format(endpointURL, this.injector_version, this.resourceID, this.user_id, this.nonce, this.download_agent, this.download_time, this.download_token));
+ HttpURLConnection con = (HttpURLConnection) url.openConnection();
+ con.setRequestMethod("GET");
+ con.setRequestProperty("User-Agent", "SBDVerify/2.0");
+ con.setConnectTimeout(5000); //Timeout after 5 sec.
+ con.setReadTimeout(5000); //Timeout after 5 sec.
+ int code = con.getResponseCode();
+ if (code != 200) {
+ disable("Could not send the validating request.");
+ return;
+ }
+ BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
+ String inputLine;
+ StringBuilder response = new StringBuilder();
+ while ((inputLine = in.readLine()) != null) {
+ response.append(inputLine);
+ }
+ in.close();
+
+ JsonObject json = new JsonParser().parse(response.toString()).getAsJsonObject();
+ if (json == null) {
+ disable("Could not send the validating request.");
+ return;
+ }
+
+ if (!json.has("response")) {
+ disable("An invalid response was returned by the validating request.");
+ return;
+ }
+
+ JsonObject resp = json.get("response").getAsJsonObject();
+ if (!resp.has("success")) {
+ disable("An invalid response was returned by the validating request.");
+ return;
+ }
+
+ if (!resp.get("success").getAsBoolean()) {
+ disable("The purchase of this plugin could not be verified.");
+ }
+ } catch (IOException e) {
+ disable("Could not send the validating request.");
+ }
+ }
+
+ /**
+ * Disable the plugin (private)
+ *
+ * @param reason The disabling reason
+ */
+ private void disable(String reason) {
+ this.invalidReason = reason;
+
+ Bukkit.getScheduler().runTask(this.plugin, () -> {
+ valid = false;
+
+ plugin.getLogger().severe("Stopping plugin because licensing system check failed.");
+ plugin.getLogger().severe("Reason: " + reason);
+ plugin.getLogger().severe("Contact the developer if you believe something is wrong on their side.");
+ Bukkit.getPluginManager().disablePlugin(this.plugin);
+ });
+ }
+
+ /**
+ * Check if the license is valid
+ *
+ * @return true = VALID, false = INVALID, null = UNCHECKED
+ */
+ public static Boolean isValid() {
+ return valid;
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/message.yml b/src/main/resources/message.yml
old mode 100644
new mode 100755
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
old mode 100644
new mode 100755
diff --git a/src/main/resources/settings.yml b/src/main/resources/settings.yml
old mode 100644
new mode 100755
index 045c197..e324154
--- a/src/main/resources/settings.yml
+++ b/src/main/resources/settings.yml
@@ -1,6 +1,4 @@
-version: 1.1
-
-license: ''
+version: 1.2
update:
check: true