This commit is contained in:
RayzsYT committed 2024-07-08 00:25:21 +02:00
1 parent 43546ad2a0
commit 0f8fe5a7f8
1 file changed
+36
@@ -0,0 +1,36 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper;
import java.util.Collections;
public class CustomVersionSection extends ConfigStorage {
public boolean ENABLED;
public MultipleMessagesHelper MESSAGE;
private final String[] PLUGIN_COMMANDS = new String[] { "icanhasbukkit", "ver", "version", "bukkit:ver", "bukkit:version" };
public CustomVersionSection() {
super("custom-version");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", false).getOrSet();
MESSAGE = new MultipleMessagesHelper(this, "message", Collections.singletonList("&fThis server is running CraftBukkit version git-ProSpigot-294 (MC: 1.8-1.21) (Implementing API version cool-api-version-SNAPSHOT)"));
}
public boolean isCommand(String command) {
if(!ENABLED) return false;
command = StringUtils.getFirstArg(command);
for (String currentCommand : PLUGIN_COMMANDS) {
if (currentCommand.equals(command.toLowerCase()))
return true;
}
return false;
}
}