Compare commits
118 Commits
Author | SHA1 | Date |
---|---|---|
JaTiTV | 36e6702e8b | |
JaTiTV | 7768530c19 | |
JaTiTV | a0026381af | |
JaTiTV | a2cb76733d | |
JaTiTV | ae5a3b3557 | |
JaTiTV | 367f1e32f4 | |
JaTiTV | feed3914b0 | |
JaTiTV | 2f3c555195 | |
JaTiTV | bcfe98bf22 | |
JaTiTV | b83766744d | |
JaTiTV | cd366cbe14 | |
JaTiTV | 82cc31d41f | |
JaTiTV | b81071156f | |
JaTiTV | 3050ad337d | |
JaTiTV | b825152415 | |
JaTiTV | 38b644bb27 | |
JaTiTV | 8826ca9b6e | |
JaTiTV | 7be7c9f09e | |
JaTiTV | 893f99c3e5 | |
JaTiTV | 16e6af2fd4 | |
JaTiTV | fa1af88777 | |
JaTiTV | abe9cfbe76 | |
JaTiTV | f947025afa | |
JaTiTV | da4bd4975a | |
JaTiTV | 621f626707 | |
JaTiTV | 78a0bd5f7e | |
JaTiTV | bdb6711907 | |
JaTiTV | 2f114cca41 | |
JaTiTV | d0277deeb8 | |
JaTiTV | a6dff7e243 | |
JaTiTV | e2e649aef2 | |
JaTiTV | 7c7cd51cec | |
JaTiTV | e7f5b00b31 | |
JaTiTV | 57ba6e6687 | |
JaTiTV | d168a7afec | |
JaTiTV | 92d3e9a2d8 | |
JaTiTV | b45895dff8 | |
JaTiTV | c43a5fd90c | |
JaTiTV | 48c06696ef | |
JaTiTV | 16123ec578 | |
JaTiTV | 7f2b346f7b | |
JaTiTV | c590255d38 | |
JaTiTV | 5d646fce48 | |
JaTiTV | 5b089a57d8 | |
JaTiTV | 87d0f75a4c | |
JaTiTV | 6f3da3e3f4 | |
JaTiTV | 80255a60eb | |
JaTiTV | f6860e9ab5 | |
JaTiTV | ebbec1f660 | |
JaTiTV | 5674b54593 | |
JaTiTV | 381afeba89 | |
JaTiTV | 19822f7024 | |
JaTiTV | ed810f31d7 | |
JaTiTV | b0286e597f | |
JaTiTV | ddfea4eba6 | |
JaTiTV | ed86e7b143 | |
JaTiTV | 32c1219bb2 | |
JaTiTV | 326dfae0e9 | |
JaTiTV | a05b941aaf | |
JaTiTV | 36de2ff0ca | |
JaTiTV | 777c6876fc | |
JaTiTV | b6347c8fad | |
JaTiTV | f3feddd317 | |
JaTiTV | 35a9930017 | |
JaTiTV | fc98f931e2 | |
JaTiTV | cfd07b01f2 | |
JaTiTV | c5bc880ab1 | |
JaTiTV | 3bd0662273 | |
JaTiTV | 7993dca126 | |
JaTiTV | 520df8dc97 | |
JaTiTV | 8e90aee0ca | |
JaTiTV | 7fda797cae | |
JaTiTV | 007d8776b9 | |
JaTiTV | b0ff520847 | |
JaTiTV | f2a666773f | |
JaTiTV | dcd524ab3c | |
JaTiTV | c3d0990853 | |
JaTiTV | 04a7d4952e | |
JaTiTV | 65a01513ce | |
JaTiTV | d96205887c | |
JaTiTV | 31a4f2d2ad | |
JaTiTV | 0c45b650b8 | |
JaTiTV | c17733fe3f | |
JaTiTV | 5e4998734d | |
JaTiTV | c2782bbb97 | |
JaTiTV | 58409dc523 | |
JaTiTV | 17b1a0568e | |
JaTiTV | 1c6e6d6660 | |
JaTiTV | ff2cb3ce96 | |
JaTiTV | 92d4c86aa0 | |
JaTiTV | e98c047ff0 | |
JaTiTV | 4cbe8ed802 | |
JaTiTV | e8b5d49822 | |
JaTiTV | ce07fd2f37 | |
JaTiTV | c7fe0603fe | |
JaTiTV | 4849ca06e7 | |
JaTiTV | fe7ae61242 | |
JaTiTV | b3934e22cc | |
JaTiTV | 7808a3bf6e | |
JaTiTV | f1e1c0de57 | |
JaTiTV | c4525a0055 | |
JaTiTV | 7e81c3403d | |
JaTiTV | cb5f8a7350 | |
JaTiTV | 811d6a7a9d | |
JaTiTV | 88bdac1fc8 | |
JaTiTV | 2e29bfb270 | |
JaTiTV | 89030215a1 | |
JaTiTV | b212b68f67 | |
JaTiTV | ee587742d1 | |
JaTiTV | 908e137943 | |
JaTiTV | 47c2329ff9 | |
JaTiTV | 75ab60bbaa | |
JaTiTV | 8377667f55 | |
JaTiTV | 7afbdd695c | |
JaTiTV | 91f8d744cc | |
JaTiTV | b80eaa08be | |
JaTiTV | b36fdc2d67 | |
JaTiTV | 35c277ba3b |
|
@ -2,8 +2,8 @@
|
|||
name: Question
|
||||
about: Ask a question or get advice
|
||||
title: ''
|
||||
labels: question
|
||||
assignees: ''
|
||||
labels:
|
||||
- question
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>CommandGUI_V2</artifactId>
|
||||
<version>2.5.16</version>
|
||||
<version>2.8.18</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandGUI</name>
|
||||
<name>T2C-CommandGUI</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
|
@ -17,6 +17,7 @@
|
|||
</properties>
|
||||
|
||||
<build>
|
||||
<finalName>${project.name}_${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -53,120 +54,101 @@
|
|||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>Builders-Paradise</id>
|
||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||
</repository>
|
||||
<!-- repo.t2code / T2Code -->
|
||||
<repository>
|
||||
<id>T2Code</id>
|
||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
<id>Builders-Paradise</id>
|
||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||
</repository>
|
||||
|
||||
<!-- placeholderAPI -->
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- repo.t2code / T2Code -->
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>16.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>LuckyBox-API</artifactId>
|
||||
<version>4.2.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>bungee</artifactId>
|
||||
<version>1615</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>PlugmanGUI</artifactId>
|
||||
<version>3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_18.r1</groupId>
|
||||
<groupId>net.t2code.minecraft.1_20.r2</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.18r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_17.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.17r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_16.r3</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.16r3</version>
|
||||
<version>1.20r2</version>
|
||||
<classifier>1.20.2</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_16.r2</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.16r2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_16.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.16r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_15.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.15r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_14.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.14r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_13.r2</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.13r2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_13.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.13r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_12.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.12r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_11.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.11r1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_10.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.10r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_9.r2</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.9r2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_9.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.9r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_8.r3</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8r3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_8.r2</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8r2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_8.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8r1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>PlugmanGUI</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- placeholderAPI -->
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.11.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP -->
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>4.0.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<version>1.7.10</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.22</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
import net.t2code.lib.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class BConfig {
|
||||
|
||||
public static void create() {
|
||||
|
||||
if (!BMain.plugin.getDataFolder().exists())
|
||||
BMain.plugin.getDataFolder().mkdir();
|
||||
|
||||
File file = new File(BMain.plugin.getDataFolder(), "config.yml");
|
||||
|
||||
|
||||
if (!file.exists()) {
|
||||
try (InputStream in = BMain.plugin.getResourceAsStream("config.yml")) {
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Configuration configuration;
|
||||
try {
|
||||
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(BMain.plugin.getDataFolder(), "config.yml"));
|
||||
BMySQL.Enable = configuration.getBoolean("MySQL.Enable");
|
||||
} catch (IOException e) {
|
||||
Bsend.console(Util.Prefix + " Please replace the config: MySQL.Enable: [false,true]");
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(BMain.plugin.getDataFolder(), "config.yml"));
|
||||
BMySQL.ip = configuration.getString("MySQL.IP");
|
||||
BMySQL.port = configuration.getInt("MySQL.Port");
|
||||
BMySQL.database = configuration.getString("MySQL.Database");
|
||||
BMySQL.user = configuration.getString("MySQL.User");
|
||||
BMySQL.password = configuration.getString("MySQL.Password");
|
||||
BMySQL.SSL = configuration.getBoolean("MySQL.SSL");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class BListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPluginmessage(PluginMessageEvent event) {
|
||||
if (event.getTag().equalsIgnoreCase("cgui:bungee")) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
ProxiedPlayer player = BungeeCord.getInstance().getPlayer(channel);
|
||||
if (player != null) {
|
||||
BungeeCord.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PostLoginEvent e) {
|
||||
ProxiedPlayer player = e.getPlayer();
|
||||
sendToSpigotPlayer(player.getName(), true);
|
||||
if (BMySQL.Enable) {
|
||||
BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = 'true';");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDisconnect(PlayerDisconnectEvent e) {
|
||||
ProxiedPlayer player = e.getPlayer();
|
||||
sendToSpigotPlayer(e.getPlayer().getName(), false);
|
||||
if (BMySQL.Enable) {
|
||||
BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = 'false';");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void sendToSpigotPlayer(String name, Boolean join) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
if (join) {
|
||||
output.writeUTF("join");
|
||||
} else {
|
||||
output.writeUTF("left");
|
||||
}
|
||||
output.writeUTF(name);
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData("cgui:onlineplayers", stream.toByteArray());
|
||||
});
|
||||
}
|
||||
|
||||
public static void sendToSpigotDeleteAll() {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF("clear");
|
||||
output.writeUTF("");
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData("cgui:onlineplayers", stream.toByteArray());
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class BMain extends Plugin {
|
||||
private boolean enable = false;
|
||||
public static Plugin plugin;
|
||||
public static String update_version = null;
|
||||
|
||||
public static String prefix = "§8[§4C§9GUI§8]";
|
||||
|
||||
public static String version;
|
||||
public static String autor;
|
||||
public static Integer spigotID = 90671;
|
||||
public static Integer bstatsID = 10840;
|
||||
public static String spigot = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
public static String discord = "http://dc.t2code.net";
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthor();
|
||||
version = plugin.getDescription().getVersion();
|
||||
if (pluginNotFound("T2CodeLib", 96388, Util.requiredT2CodeLibVersion)) return;
|
||||
Bsend.console(prefix + "§4============================= §8[§4Command§9GUI§5BUNGEE§8] §4=============================");
|
||||
Bsend.console(prefix + "§4 _____ §9_____ _ _ _____ §e ___ ");
|
||||
Bsend.console(prefix + "§4 / ____§9/ ____| | | |_ _|§e |__ \\ ");
|
||||
Bsend.console(prefix + "§4 | | §9| | __| | | | | |§e_ __ ) |");
|
||||
Bsend.console(prefix + "§4 | | §9| | |_ | | | | | §e\\ \\ / // / ");
|
||||
Bsend.console(prefix + "§4 | |___§9| |__| | |__| |_| |§e\\ V // /_ ");
|
||||
Bsend.console(prefix + "§4 \\_____§9\\_____|\\____/|_____§e\\_/|____|");
|
||||
Bsend.console(prefix);
|
||||
Bsend.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
Bsend.console(prefix + " §2Version: §6" + version);
|
||||
Bsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
Bsend.console(prefix + " §2Discord: §6" + discord);
|
||||
BConfig.create();
|
||||
|
||||
plugin.getProxy().registerChannel("cgui:bungee");
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new BListener());
|
||||
BListener.sendToSpigotDeleteAll();
|
||||
BMetrics metrics = new BMetrics(this, bstatsID);
|
||||
|
||||
if (BMySQL.Enable){
|
||||
BMySQL.main();
|
||||
BMySQL.query("CREATE TABLE IF NOT EXISTS `gui-bungeeplayer` (" +
|
||||
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Name` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Online` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" UNIQUE INDEX `UUID` (`UUID`)" +
|
||||
")" +
|
||||
"COLLATE='utf8mb4_general_ci'" +
|
||||
"ENGINE=InnoDB" +
|
||||
";");
|
||||
|
||||
}
|
||||
|
||||
Bsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
Bsend.console(prefix + "§4==============================================================================");
|
||||
BUpdateChecker.onUpdateCheck();
|
||||
BUpdateChecker.onUpdateCheckTimer();
|
||||
enable = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
if (!enable) {
|
||||
return;
|
||||
}
|
||||
Bsend.console(prefix + "§4============================= §8[§4Command§9GUI§5BUNGEE§8] §4=============================");
|
||||
Bsend.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
Bsend.console(prefix + " §2Version: §6" + version);
|
||||
Bsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
Bsend.console(prefix + " §2Discord: §6" + discord);
|
||||
Bsend.console(prefix + " §4Plugin successfully disabled.");
|
||||
Bsend.console(prefix + "§4==============================================================================");
|
||||
}
|
||||
|
||||
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
|
||||
|
||||
if (ProxyServer.getInstance().getPluginManager().getPlugin(pl) == null) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
ProxyServer.getInstance().getConsole().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
// BMain.plugin.getPluginLoader().disablePlugin(BMain.plugin);
|
||||
BMain.plugin.onDisable();
|
||||
return true;
|
||||
} else {
|
||||
if (Double.parseDouble(ProxyServer.getInstance().getPluginManager().getPlugin(pl).getDescription().getVersion()) < ver) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
ProxyServer.getInstance().getConsole().sendMessage(prefix + " §e" + pl + " §4is out of date! This plugin requires at least version §2" + ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to use this version of " + plugin.getDescription().getName() + ".");
|
||||
// BMain.plugin.getPluginLoader().disablePlugin(BMain.plugin);
|
||||
BMain.plugin.onDisable();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,857 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
|
||||
public class BMetrics {
|
||||
|
||||
private final Plugin plugin;
|
||||
|
||||
private final MetricsBase metricsBase;
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
private String serverUUID;
|
||||
|
||||
private boolean logErrors = false;
|
||||
|
||||
private boolean logSentData;
|
||||
|
||||
private boolean logResponseStatusText;
|
||||
|
||||
/**
|
||||
* Creates a new Metrics instance.
|
||||
*
|
||||
* @param plugin Your plugin instance.
|
||||
* @param serviceId The id of the service. It can be found at <a
|
||||
* href="https://bstats.org/what-is-my-plugin-id">What is my plugin id?</a>
|
||||
*/
|
||||
public BMetrics(Plugin plugin, int serviceId) {
|
||||
this.plugin = plugin;
|
||||
try {
|
||||
loadConfig();
|
||||
} catch (IOException e) {
|
||||
// Failed to load configuration
|
||||
plugin.getLogger().log(Level.WARNING, "Failed to load bStats config!", e);
|
||||
metricsBase = null;
|
||||
return;
|
||||
}
|
||||
metricsBase =
|
||||
new MetricsBase(
|
||||
"bungeecord",
|
||||
serverUUID,
|
||||
serviceId,
|
||||
enabled,
|
||||
this::appendPlatformData,
|
||||
this::appendServiceData,
|
||||
null,
|
||||
() -> true,
|
||||
(message, error) -> this.plugin.getLogger().log(Level.WARNING, message, error),
|
||||
(message) -> this.plugin.getLogger().log(Level.INFO, message),
|
||||
logErrors,
|
||||
logSentData,
|
||||
logResponseStatusText);
|
||||
}
|
||||
|
||||
/** Loads the bStats configuration. */
|
||||
private void loadConfig() throws IOException {
|
||||
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
|
||||
bStatsFolder.mkdirs();
|
||||
File configFile = new File(bStatsFolder, "config.yml");
|
||||
if (!configFile.exists()) {
|
||||
writeFile(
|
||||
configFile,
|
||||
"# bStats (https://bStats.org) collects some basic information for plugin authors, like how",
|
||||
"# many people use their plugin and their total player count. It's recommended to keep bStats",
|
||||
"# enabled, but if you're not comfortable with this, you can turn this setting off. There is no",
|
||||
"# performance penalty associated with having metrics enabled, and data sent to bStats is fully",
|
||||
"# anonymous.",
|
||||
"enabled: true",
|
||||
"serverUuid: \"" + UUID.randomUUID() + "\"",
|
||||
"logFailedRequests: false",
|
||||
"logSentData: false",
|
||||
"logResponseStatusText: false");
|
||||
}
|
||||
Configuration configuration =
|
||||
ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
|
||||
// Load configuration
|
||||
enabled = configuration.getBoolean("enabled", true);
|
||||
serverUUID = configuration.getString("serverUuid");
|
||||
logErrors = configuration.getBoolean("logFailedRequests", false);
|
||||
logSentData = configuration.getBoolean("logSentData", false);
|
||||
logResponseStatusText = configuration.getBoolean("logResponseStatusText", false);
|
||||
}
|
||||
|
||||
private void writeFile(File file, String... lines) throws IOException {
|
||||
try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file))) {
|
||||
for (String line : lines) {
|
||||
bufferedWriter.write(line);
|
||||
bufferedWriter.newLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a custom chart.
|
||||
*
|
||||
* @param chart The chart to add.
|
||||
*/
|
||||
public void addCustomChart(CustomChart chart) {
|
||||
metricsBase.addCustomChart(chart);
|
||||
}
|
||||
|
||||
private void appendPlatformData(JsonObjectBuilder builder) {
|
||||
builder.appendField("playerAmount", plugin.getProxy().getOnlineCount());
|
||||
builder.appendField("managedServers", plugin.getProxy().getServers().size());
|
||||
builder.appendField("onlineMode", plugin.getProxy().getConfig().isOnlineMode() ? 1 : 0);
|
||||
builder.appendField("bungeecordVersion", plugin.getProxy().getVersion());
|
||||
builder.appendField("javaVersion", System.getProperty("java.version"));
|
||||
builder.appendField("osName", System.getProperty("os.name"));
|
||||
builder.appendField("osArch", System.getProperty("os.arch"));
|
||||
builder.appendField("osVersion", System.getProperty("os.version"));
|
||||
builder.appendField("coreCount", Runtime.getRuntime().availableProcessors());
|
||||
}
|
||||
|
||||
private void appendServiceData(JsonObjectBuilder builder) {
|
||||
builder.appendField("pluginVersion", plugin.getDescription().getVersion());
|
||||
}
|
||||
|
||||
public static class MetricsBase {
|
||||
|
||||
/** The version of the Metrics class. */
|
||||
public static final String METRICS_VERSION = "2.2.1";
|
||||
|
||||
private static final ScheduledExecutorService scheduler =
|
||||
Executors.newScheduledThreadPool(1, task -> new Thread(task, "bStats-Metrics"));
|
||||
|
||||
private static final String REPORT_URL = "https://bStats.org/api/v2/data/%s";
|
||||
|
||||
private final String platform;
|
||||
|
||||
private final String serverUuid;
|
||||
|
||||
private final int serviceId;
|
||||
|
||||
private final Consumer<JsonObjectBuilder> appendPlatformDataConsumer;
|
||||
|
||||
private final Consumer<JsonObjectBuilder> appendServiceDataConsumer;
|
||||
|
||||
private final Consumer<Runnable> submitTaskConsumer;
|
||||
|
||||
private final Supplier<Boolean> checkServiceEnabledSupplier;
|
||||
|
||||
private final BiConsumer<String, Throwable> errorLogger;
|
||||
|
||||
private final Consumer<String> infoLogger;
|
||||
|
||||
private final boolean logErrors;
|
||||
|
||||
private final boolean logSentData;
|
||||
|
||||
private final boolean logResponseStatusText;
|
||||
|
||||
private final Set<CustomChart> customCharts = new HashSet<>();
|
||||
|
||||
private final boolean enabled;
|
||||
|
||||
/**
|
||||
* Creates a new MetricsBase class instance.
|
||||
*
|
||||
* @param platform The platform of the service.
|
||||
* @param serviceId The id of the service.
|
||||
* @param serverUuid The server uuid.
|
||||
* @param enabled Whether or not data sending is enabled.
|
||||
* @param appendPlatformDataConsumer A consumer that receives a {@code JsonObjectBuilder} and
|
||||
* appends all platform-specific data.
|
||||
* @param appendServiceDataConsumer A consumer that receives a {@code JsonObjectBuilder} and
|
||||
* appends all service-specific data.
|
||||
* @param submitTaskConsumer A consumer that takes a runnable with the submit task. This can be
|
||||
* used to delegate the data collection to a another thread to prevent errors caused by
|
||||
* concurrency. Can be {@code null}.
|
||||
* @param checkServiceEnabledSupplier A supplier to check if the service is still enabled.
|
||||
* @param errorLogger A consumer that accepts log message and an error.
|
||||
* @param infoLogger A consumer that accepts info log messages.
|
||||
* @param logErrors Whether or not errors should be logged.
|
||||
* @param logSentData Whether or not the sent data should be logged.
|
||||
* @param logResponseStatusText Whether or not the response status text should be logged.
|
||||
*/
|
||||
public MetricsBase(
|
||||
String platform,
|
||||
String serverUuid,
|
||||
int serviceId,
|
||||
boolean enabled,
|
||||
Consumer<JsonObjectBuilder> appendPlatformDataConsumer,
|
||||
Consumer<JsonObjectBuilder> appendServiceDataConsumer,
|
||||
Consumer<Runnable> submitTaskConsumer,
|
||||
Supplier<Boolean> checkServiceEnabledSupplier,
|
||||
BiConsumer<String, Throwable> errorLogger,
|
||||
Consumer<String> infoLogger,
|
||||
boolean logErrors,
|
||||
boolean logSentData,
|
||||
boolean logResponseStatusText) {
|
||||
this.platform = platform;
|
||||
this.serverUuid = serverUuid;
|
||||
this.serviceId = serviceId;
|
||||
this.enabled = enabled;
|
||||
this.appendPlatformDataConsumer = appendPlatformDataConsumer;
|
||||
this.appendServiceDataConsumer = appendServiceDataConsumer;
|
||||
this.submitTaskConsumer = submitTaskConsumer;
|
||||
this.checkServiceEnabledSupplier = checkServiceEnabledSupplier;
|
||||
this.errorLogger = errorLogger;
|
||||
this.infoLogger = infoLogger;
|
||||
this.logErrors = logErrors;
|
||||
this.logSentData = logSentData;
|
||||
this.logResponseStatusText = logResponseStatusText;
|
||||
checkRelocation();
|
||||
if (enabled) {
|
||||
startSubmitting();
|
||||
}
|
||||
}
|
||||
|
||||
public void addCustomChart(CustomChart chart) {
|
||||
this.customCharts.add(chart);
|
||||
}
|
||||
|
||||
private void startSubmitting() {
|
||||
final Runnable submitTask =
|
||||
() -> {
|
||||
if (!enabled || !checkServiceEnabledSupplier.get()) {
|
||||
// Submitting data or service is disabled
|
||||
scheduler.shutdown();
|
||||
return;
|
||||
}
|
||||
if (submitTaskConsumer != null) {
|
||||
submitTaskConsumer.accept(this::submitData);
|
||||
} else {
|
||||
this.submitData();
|
||||
}
|
||||
};
|
||||
// Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution
|
||||
// of requests on the
|
||||
// bStats backend. To circumvent this problem, we introduce some randomness into the initial
|
||||
// and second delay.
|
||||
// WARNING: You must not modify and part of this Metrics class, including the submit delay or
|
||||
// frequency!
|
||||
// WARNING: Modifying this code will get your plugin banned on bStats. Just don't do it!
|
||||
long initialDelay = (long) (1000 * 60 * (3 + Math.random() * 3));
|
||||
long secondDelay = (long) (1000 * 60 * (Math.random() * 30));
|
||||
scheduler.schedule(submitTask, initialDelay, TimeUnit.MILLISECONDS);
|
||||
scheduler.scheduleAtFixedRate(
|
||||
submitTask, initialDelay + secondDelay, 1000 * 60 * 30, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
private void submitData() {
|
||||
final JsonObjectBuilder baseJsonBuilder = new JsonObjectBuilder();
|
||||
appendPlatformDataConsumer.accept(baseJsonBuilder);
|
||||
final JsonObjectBuilder serviceJsonBuilder = new JsonObjectBuilder();
|
||||
appendServiceDataConsumer.accept(serviceJsonBuilder);
|
||||
JsonObjectBuilder.JsonObject[] chartData =
|
||||
customCharts.stream()
|
||||
.map(customChart -> customChart.getRequestJsonObject(errorLogger, logErrors))
|
||||
.filter(Objects::nonNull)
|
||||
.toArray(JsonObjectBuilder.JsonObject[]::new);
|
||||
serviceJsonBuilder.appendField("id", serviceId);
|
||||
serviceJsonBuilder.appendField("customCharts", chartData);
|
||||
baseJsonBuilder.appendField("service", serviceJsonBuilder.build());
|
||||
baseJsonBuilder.appendField("serverUUID", serverUuid);
|
||||
baseJsonBuilder.appendField("metricsVersion", METRICS_VERSION);
|
||||
JsonObjectBuilder.JsonObject data = baseJsonBuilder.build();
|
||||
scheduler.execute(
|
||||
() -> {
|
||||
try {
|
||||
// Send the data
|
||||
sendData(data);
|
||||
} catch (Exception e) {
|
||||
// Something went wrong! :(
|
||||
if (logErrors) {
|
||||
errorLogger.accept("Could not submit bStats metrics data", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendData(JsonObjectBuilder.JsonObject data) throws Exception {
|
||||
if (logSentData) {
|
||||
infoLogger.accept("Sent bStats metrics data: " + data.toString());
|
||||
}
|
||||
String url = String.format(REPORT_URL, platform);
|
||||
HttpsURLConnection connection = (HttpsURLConnection) new URL(url).openConnection();
|
||||
// Compress the data to save bandwidth
|
||||
byte[] compressedData = compress(data.toString());
|
||||
connection.setRequestMethod("POST");
|
||||
connection.addRequestProperty("Accept", "application/json");
|
||||
connection.addRequestProperty("Connection", "close");
|
||||
connection.addRequestProperty("Content-Encoding", "gzip");
|
||||
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setRequestProperty("User-Agent", "Metrics-Service/1");
|
||||
connection.setDoOutput(true);
|
||||
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
|
||||
outputStream.write(compressedData);
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
try (BufferedReader bufferedReader =
|
||||
new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
builder.append(line);
|
||||
}
|
||||
}
|
||||
if (logResponseStatusText) {
|
||||
infoLogger.accept("Sent data to bStats and received response: " + builder);
|
||||
}
|
||||
}
|
||||
|
||||
/** Checks that the class was properly relocated. */
|
||||
private void checkRelocation() {
|
||||
// You can use the property to disable the check in your test environment
|
||||
if (System.getProperty("bstats.relocatecheck") == null
|
||||
|| !System.getProperty("bstats.relocatecheck").equals("false")) {
|
||||
// Maven's Relocate is clever and changes strings, too. So we have to use this little
|
||||
// "trick" ... :D
|
||||
final String defaultPackage =
|
||||
new String(new byte[] {'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's'});
|
||||
final String examplePackage =
|
||||
new String(new byte[] {'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
|
||||
// We want to make sure no one just copy & pastes the example and uses the wrong package
|
||||
// names
|
||||
if (MetricsBase.class.getPackage().getName().startsWith(defaultPackage)
|
||||
|| MetricsBase.class.getPackage().getName().startsWith(examplePackage)) {
|
||||
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gzips the given string.
|
||||
*
|
||||
* @param str The string to gzip.
|
||||
* @return The gzipped string.
|
||||
*/
|
||||
private static byte[] compress(final String str) throws IOException {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
try (GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) {
|
||||
gzip.write(str.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static class AdvancedBarChart extends CustomChart {
|
||||
|
||||
private final Callable<Map<String, int[]>> callable;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param chartId The id of the chart.
|
||||
* @param callable The callable which is used to request the chart data.
|
||||
*/
|
||||
public AdvancedBarChart(String chartId, Callable<Map<String, int[]>> callable) {
|
||||
super(chartId);
|
||||
this.callable = callable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||
Map<String, int[]> map = callable.call();
|
||||
if (map == null || map.isEmpty()) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
boolean allSkipped = true;
|
||||
for (Map.Entry<String, int[]> entry : map.entrySet()) {
|
||||
if (entry.getValue().length == 0) {
|
||||
// Skip this invalid
|
||||
continue;
|
||||
}
|
||||
allSkipped = false;
|
||||
valuesBuilder.appendField(entry.getKey(), entry.getValue());
|
||||
}
|
||||
if (allSkipped) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SimpleBarChart extends CustomChart {
|
||||
|
||||
private final Callable<Map<String, Integer>> callable;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param chartId The id of the chart.
|
||||
* @param callable The callable which is used to request the chart data.
|
||||
*/
|
||||
public SimpleBarChart(String chartId, Callable<Map<String, Integer>> callable) {
|
||||
super(chartId);
|
||||
this.callable = callable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||
Map<String, Integer> map = callable.call();
|
||||
if (map == null || map.isEmpty()) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||
valuesBuilder.appendField(entry.getKey(), new int[] {entry.getValue()});
|
||||
}
|
||||
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||
}
|
||||
}
|
||||
|
||||
public static class MultiLineChart extends CustomChart {
|
||||
|
||||
private final Callable<Map<String, Integer>> callable;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param chartId The id of the chart.
|
||||
* @param callable The callable which is used to request the chart data.
|
||||
*/
|
||||
public MultiLineChart(String chartId, Callable<Map<String, Integer>> callable) {
|
||||
super(chartId);
|
||||
this.callable = callable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||
Map<String, Integer> map = callable.call();
|
||||
if (map == null || map.isEmpty()) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
boolean allSkipped = true;
|
||||
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||
if (entry.getValue() == 0) {
|
||||
// Skip this invalid
|
||||
continue;
|
||||
}
|
||||
allSkipped = false;
|
||||
valuesBuilder.appendField(entry.getKey(), entry.getValue());
|
||||
}
|
||||
if (allSkipped) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||
}
|
||||
}
|
||||
|
||||
public static class AdvancedPie extends CustomChart {
|
||||
|
||||
private final Callable<Map<String, Integer>> callable;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param chartId The id of the chart.
|
||||
* @param callable The callable which is used to request the chart data.
|
||||
*/
|
||||
public AdvancedPie(String chartId, Callable<Map<String, Integer>> callable) {
|
||||
super(chartId);
|
||||
this.callable = callable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||
Map<String, Integer> map = callable.call();
|
||||
if (map == null || map.isEmpty()) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
boolean allSkipped = true;
|
||||
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||
if (entry.getValue() == 0) {
|
||||
// Skip this invalid
|
||||
continue;
|
||||
}
|
||||
allSkipped = false;
|
||||
valuesBuilder.appendField(entry.getKey(), entry.getValue());
|
||||
}
|
||||
if (allSkipped) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract static class CustomChart {
|
||||
|
||||
private final String chartId;
|
||||
|
||||
protected CustomChart(String chartId) {
|
||||
if (chartId == null) {
|
||||
throw new IllegalArgumentException("chartId must not be null");
|
||||
}
|
||||
this.chartId = chartId;
|
||||
}
|
||||
|
||||
public JsonObjectBuilder.JsonObject getRequestJsonObject(
|
||||
BiConsumer<String, Throwable> errorLogger, boolean logErrors) {
|
||||
JsonObjectBuilder builder = new JsonObjectBuilder();
|
||||
builder.appendField("chartId", chartId);
|
||||
try {
|
||||
JsonObjectBuilder.JsonObject data = getChartData();
|
||||
if (data == null) {
|
||||
// If the data is null we don't send the chart.
|
||||
return null;
|
||||
}
|
||||
builder.appendField("data", data);
|
||||
} catch (Throwable t) {
|
||||
if (logErrors) {
|
||||
errorLogger.accept("Failed to get data for custom chart with id " + chartId, t);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
protected abstract JsonObjectBuilder.JsonObject getChartData() throws Exception;
|
||||
}
|
||||
|
||||
public static class SingleLineChart extends CustomChart {
|
||||
|
||||
private final Callable<Integer> callable;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param chartId The id of the chart.
|
||||
* @param callable The callable which is used to request the chart data.
|
||||
*/
|
||||
public SingleLineChart(String chartId, Callable<Integer> callable) {
|
||||
super(chartId);
|
||||
this.callable = callable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||
int value = callable.call();
|
||||
if (value == 0) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
return new JsonObjectBuilder().appendField("value", value).build();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SimplePie extends CustomChart {
|
||||
|
||||
private final Callable<String> callable;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param chartId The id of the chart.
|
||||
* @param callable The callable which is used to request the chart data.
|
||||
*/
|
||||
public SimplePie(String chartId, Callable<String> callable) {
|
||||
super(chartId);
|
||||
this.callable = callable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||
String value = callable.call();
|
||||
if (value == null || value.isEmpty()) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
return new JsonObjectBuilder().appendField("value", value).build();
|
||||
}
|
||||
}
|
||||
|
||||
public static class DrilldownPie extends CustomChart {
|
||||
|
||||
private final Callable<Map<String, Map<String, Integer>>> callable;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param chartId The id of the chart.
|
||||
* @param callable The callable which is used to request the chart data.
|
||||
*/
|
||||
public DrilldownPie(String chartId, Callable<Map<String, Map<String, Integer>>> callable) {
|
||||
super(chartId);
|
||||
this.callable = callable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||
Map<String, Map<String, Integer>> map = callable.call();
|
||||
if (map == null || map.isEmpty()) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
boolean reallyAllSkipped = true;
|
||||
for (Map.Entry<String, Map<String, Integer>> entryValues : map.entrySet()) {
|
||||
JsonObjectBuilder valueBuilder = new JsonObjectBuilder();
|
||||
boolean allSkipped = true;
|
||||
for (Map.Entry<String, Integer> valueEntry : map.get(entryValues.getKey()).entrySet()) {
|
||||
valueBuilder.appendField(valueEntry.getKey(), valueEntry.getValue());
|
||||
allSkipped = false;
|
||||
}
|
||||
if (!allSkipped) {
|
||||
reallyAllSkipped = false;
|
||||
valuesBuilder.appendField(entryValues.getKey(), valueBuilder.build());
|
||||
}
|
||||
}
|
||||
if (reallyAllSkipped) {
|
||||
// Null = skip the chart
|
||||
return null;
|
||||
}
|
||||
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An extremely simple JSON builder.
|
||||
*
|
||||
* <p>While this class is neither feature-rich nor the most performant one, it's sufficient enough
|
||||
* for its use-case.
|
||||
*/
|
||||
public static class JsonObjectBuilder {
|
||||
|
||||
private StringBuilder builder = new StringBuilder();
|
||||
|
||||
private boolean hasAtLeastOneField = false;
|
||||
|
||||
public JsonObjectBuilder() {
|
||||
builder.append("{");
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a null field to the JSON.
|
||||
*
|
||||
* @param key The key of the field.
|
||||
* @return A reference to this object.
|
||||
*/
|
||||
public JsonObjectBuilder appendNull(String key) {
|
||||
appendFieldUnescaped(key, "null");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a string field to the JSON.
|
||||
*
|
||||
* @param key The key of the field.
|
||||
* @param value The value of the field.
|
||||
* @return A reference to this object.
|
||||
*/
|
||||
public JsonObjectBuilder appendField(String key, String value) {
|
||||
if (value == null) {
|
||||
throw new IllegalArgumentException("JSON value must not be null");
|
||||
}
|
||||
appendFieldUnescaped(key, "\"" + escape(value) + "\"");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an integer field to the JSON.
|
||||
*
|
||||
* @param key The key of the field.
|
||||
* @param value The value of the field.
|
||||
* @return A reference to this object.
|
||||
*/
|
||||
public JsonObjectBuilder appendField(String key, int value) {
|
||||
appendFieldUnescaped(key, String.valueOf(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an object to the JSON.
|
||||
*
|
||||
* @param key The key of the field.
|
||||
* @param object The object.
|
||||
* @return A reference to this object.
|
||||
*/
|
||||
public JsonObjectBuilder appendField(String key, JsonObject object) {
|
||||
if (object == null) {
|
||||
throw new IllegalArgumentException("JSON object must not be null");
|
||||
}
|
||||
appendFieldUnescaped(key, object.toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a string array to the JSON.
|
||||
*
|
||||
* @param key The key of the field.
|
||||
* @param values The string array.
|
||||
* @return A reference to this object.
|
||||
*/
|
||||
public JsonObjectBuilder appendField(String key, String[] values) {
|
||||
if (values == null) {
|
||||
throw new IllegalArgumentException("JSON values must not be null");
|
||||
}
|
||||
String escapedValues =
|
||||
Arrays.stream(values)
|
||||
.map(value -> "\"" + escape(value) + "\"")
|
||||
.collect(Collectors.joining(","));
|
||||
appendFieldUnescaped(key, "[" + escapedValues + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an integer array to the JSON.
|
||||
*
|
||||
* @param key The key of the field.
|
||||
* @param values The integer array.
|
||||
* @return A reference to this object.
|
||||
*/
|
||||
public JsonObjectBuilder appendField(String key, int[] values) {
|
||||
if (values == null) {
|
||||
throw new IllegalArgumentException("JSON values must not be null");
|
||||
}
|
||||
String escapedValues =
|
||||
Arrays.stream(values).mapToObj(String::valueOf).collect(Collectors.joining(","));
|
||||
appendFieldUnescaped(key, "[" + escapedValues + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an object array to the JSON.
|
||||
*
|
||||
* @param key The key of the field.
|
||||
* @param values The integer array.
|
||||
* @return A reference to this object.
|
||||
*/
|
||||
public JsonObjectBuilder appendField(String key, JsonObject[] values) {
|
||||
if (values == null) {
|
||||
throw new IllegalArgumentException("JSON values must not be null");
|
||||
}
|
||||
String escapedValues =
|
||||
Arrays.stream(values).map(JsonObject::toString).collect(Collectors.joining(","));
|
||||
appendFieldUnescaped(key, "[" + escapedValues + "]");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a field to the object.
|
||||
*
|
||||
* @param key The key of the field.
|
||||
* @param escapedValue The escaped value of the field.
|
||||
*/
|
||||
private void appendFieldUnescaped(String key, String escapedValue) {
|
||||
if (builder == null) {
|
||||
throw new IllegalStateException("JSON has already been built");
|
||||
}
|
||||
if (key == null) {
|
||||
throw new IllegalArgumentException("JSON key must not be null");
|
||||
}
|
||||
if (hasAtLeastOneField) {
|
||||
builder.append(",");
|
||||
}
|
||||
builder.append("\"").append(escape(key)).append("\":").append(escapedValue);
|
||||
hasAtLeastOneField = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the JSON string and invalidates this builder.
|
||||
*
|
||||
* @return The built JSON string.
|
||||
*/
|
||||
public JsonObject build() {
|
||||
if (builder == null) {
|
||||
throw new IllegalStateException("JSON has already been built");
|
||||
}
|
||||
JsonObject object = new JsonObject(builder.append("}").toString());
|
||||
builder = null;
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes the given string like stated in https://www.ietf.org/rfc/rfc4627.txt.
|
||||
*
|
||||
* <p>This method escapes only the necessary characters '"', '\'. and '\u0000' - '\u001F'.
|
||||
* Compact escapes are not used (e.g., '\n' is escaped as "\u000a" and not as "\n").
|
||||
*
|
||||
* @param value The value to escape.
|
||||
* @return The escaped value.
|
||||
*/
|
||||
private static String escape(String value) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
char c = value.charAt(i);
|
||||
if (c == '"') {
|
||||
builder.append("\\\"");
|
||||
} else if (c == '\\') {
|
||||
builder.append("\\\\");
|
||||
} else if (c <= '\u000F') {
|
||||
builder.append("\\u000").append(Integer.toHexString(c));
|
||||
} else if (c <= '\u001F') {
|
||||
builder.append("\\u00").append(Integer.toHexString(c));
|
||||
} else {
|
||||
builder.append(c);
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* A super simple representation of a JSON object.
|
||||
*
|
||||
* <p>This class only exists to make methods of the {@link JsonObjectBuilder} type-safe and not
|
||||
* allow a raw string inputs for methods like {@link JsonObjectBuilder#appendField(String,
|
||||
* JsonObject)}.
|
||||
*/
|
||||
public static class JsonObject {
|
||||
|
||||
private final String value;
|
||||
|
||||
private JsonObject(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
|
||||
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
|
||||
import java.sql.*;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class BMySQL {
|
||||
private static Plugin plugin = BMain.plugin;
|
||||
protected static Boolean Enable = false;
|
||||
|
||||
protected static String ip = "localhost";
|
||||
protected static Integer port = 3306;
|
||||
protected static String database;
|
||||
protected static String user = "root";
|
||||
protected static String password = "";
|
||||
protected static String url;
|
||||
protected static Boolean SSL;
|
||||
|
||||
public static void main() {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
Calendar now = Calendar.getInstance();
|
||||
ZoneId timeZone = now.getTimeZone().toZoneId();
|
||||
Bsend.debug(plugin, "Server TimeZone is : " + timeZone);
|
||||
url = "jdbc:mysql://" + ip + ":" + port + "/" + database + "?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=" + timeZone;
|
||||
// Europe/Berlin
|
||||
if (SSL) {
|
||||
url = url + "&useSSL=true";
|
||||
} else url = url + "&useSSL=false";
|
||||
Bsend.debug(plugin, url);
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.close();
|
||||
Bsend.console(BMain.prefix + " §2MySQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} catch (SQLException ex) {
|
||||
Bsend.console(BMain.prefix + " §4MySQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
Bsend.error(plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
}
|
||||
|
||||
public static void query(String query) {
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute(query);
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<String> selectAll(String query) {
|
||||
ArrayList<String> Result = new ArrayList<>();
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
Result.add(rs.getString(1));
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static String select(String query) {
|
||||
String Ausgabe = "";
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
Ausgabe = String.valueOf(rs.getString(1));
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Ausgabe;
|
||||
}
|
||||
|
||||
public static int count(String query) {
|
||||
Integer count = 0;
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
// This claas was created by JaTiTV
|
||||
|
||||
// -----------------------------
|
||||
// _____ _____ _ _ _____
|
||||
// / ____/ ____| | | |_ _|
|
||||
// | | | | __| | | | | |
|
||||
// | | | | |_ | | | | | |
|
||||
// | |___| |__| | |__| |_| |_
|
||||
// \_____\_____|\____/|_____|
|
||||
// -----------------------------
|
||||
|
||||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class BUpdateChecker {
|
||||
|
||||
public static void sendUpdateMsg(String Prefix, String foundVersion, String update_version) {
|
||||
Bsend.console("§4=========== " + Prefix + " §4===========");
|
||||
Bsend.console("§6A new version was found!");
|
||||
Bsend.console("§6Your version: §c" + foundVersion + " §7- §6Current version: §a" + update_version+"_Bungee");
|
||||
Bsend.console("§6You can download it here: §e" + BMain.spigot);
|
||||
Bsend.console("§6You can find more information on Discord: §e" + BMain.discord);
|
||||
Bsend.console("§4=========== " + Prefix + " §4===========");
|
||||
}
|
||||
|
||||
|
||||
public static void onUpdateCheckTimer() {
|
||||
ProxyServer.getInstance().getScheduler().schedule(BMain.plugin, new Runnable() {
|
||||
public void run() {
|
||||
(new BUpdateChecker(BMain.plugin, BMain.spigotID)).getVersion((update_version) -> {
|
||||
String foundVersion = BMain.plugin.getDescription().getVersion();
|
||||
BMain.update_version = update_version;
|
||||
if (!foundVersion.replace("_Bungee", "").equalsIgnoreCase(update_version)) {
|
||||
sendUpdateMsg(BMain.prefix, foundVersion, update_version);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 0, 20 * 60 * 60L, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public static void onUpdateCheck() {
|
||||
(new BUpdateChecker(BMain.plugin, BMain.spigotID)).getVersion((update_version) -> {
|
||||
String foundVersion = BMain.plugin.getDescription().getVersion();
|
||||
BMain.update_version = update_version;
|
||||
if (foundVersion.replace("_Bungee", "").equalsIgnoreCase(update_version)) {
|
||||
Bsend.console(BMain.prefix + " §2No update found.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Plugin plugin;
|
||||
private int resourceId;
|
||||
|
||||
public BUpdateChecker(Plugin plugin, int resourceId) {
|
||||
this.plugin = plugin;
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<String> consumer) {
|
||||
ProxyServer.getInstance().getScheduler().runAsync(this.plugin, () -> {
|
||||
try {
|
||||
InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
|
||||
try {
|
||||
Scanner scanner = new Scanner(inputStream);
|
||||
|
||||
try {
|
||||
if (scanner.hasNext()) {
|
||||
consumer.accept(scanner.next());
|
||||
}
|
||||
} catch (Throwable var8) {
|
||||
try {
|
||||
scanner.close();
|
||||
} catch (Throwable var7) {
|
||||
var8.addSuppressed(var7);
|
||||
}
|
||||
throw var8;
|
||||
}
|
||||
scanner.close();
|
||||
} catch (Throwable var9) {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (Throwable var6) {
|
||||
var9.addSuppressed(var6);
|
||||
}
|
||||
}
|
||||
throw var9;
|
||||
}
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException var10) {
|
||||
this.plugin.getLogger().severe(BMain.prefix + "§4 Cannot look for updates: " + var10.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.Listener;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ConfigChat implements Listener {
|
||||
public static HashMap<Player, String> EditChat = new HashMap<>();
|
||||
|
||||
@EventHandler
|
||||
public void onChat(AsyncPlayerChatEvent playerChatEvent) {
|
||||
Player player = playerChatEvent.getPlayer();
|
||||
if (EditChat.containsKey(player)) {
|
||||
if (playerChatEvent.getMessage().equals("cancel")) {
|
||||
//player.sendMessage(DefaultValue.SettingsGUIchatIsCanceled.replace("[setting]", EditChat.get(player)));
|
||||
} else {
|
||||
for (Object gui : Main.guiHashMap.values()) {
|
||||
for (Slot slot : gui.GUI_Slots) {
|
||||
if (slot.ConfigOptionPath.equals(EditChat.get(player))) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,396 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.Listener;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Bungee_Sender_Reciver;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.lib.Spigot.Lib.vault.Vault;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class GUI_Listener implements Listener {
|
||||
|
||||
private static String prefix = Util.Prefix;
|
||||
public static String GUICode;
|
||||
private static Plugin plugin = Main.plugin;
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
if (e.getInventory() != null && e.getCurrentItem() != null) {
|
||||
for (Object gui : Main.guiHashMap.values()) {
|
||||
if (player.getOpenInventory().getTitle().equals(Replace.replace(prefix, GUICode + gui.GUI_Name))
|
||||
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(Replace.replace(prefix, player, GUICode + gui.GUI_Name)))) {
|
||||
e.setCancelled(true);
|
||||
for (Slot slot : gui.GUI_Slots) {
|
||||
/* if (!slot.ItemsRemovable) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
*/
|
||||
|
||||
if (e.getSlot() == slot.Slot) {
|
||||
|
||||
if (!slot.Perm || player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|
||||
|| player.hasPermission("commandgui.admin")) {
|
||||
|
||||
if (slot.Enable) {
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, slot.Name))) {
|
||||
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == Material.valueOf(slot.Item.toUpperCase().replace(".", "_"))) {
|
||||
if (slot.Cost_Enable) {
|
||||
if (slot.Command_Enable || slot.Message_Enable || slot.OpenGUI_Enable || slot.ServerChange) {
|
||||
if (Vault.buy(prefix, player, slot.Price)) {
|
||||
player.sendMessage(SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, slot.Name))
|
||||
.replace("[price]", slot.Price + " " + SelectConfig.Currency));
|
||||
if (slot.Command_Enable) {
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (slot.Command_BungeeCommand && SelectConfig.Bungee) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bungee_Sender_Reciver.sendToBungee(player, player.getName(), cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
} else {
|
||||
if (slot.CommandAsConsole) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
} else {
|
||||
for (String cmd : slot.Command) {
|
||||
player.chat("/" + cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
if (slot.OpenGUI_Enable) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
OpenGUI.openGUI(player, Main.guiHashMap.get(slot.OpenGUI), slot.OpenGUI);
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
if (slot.Message_Enable) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
for (String msg : slot.Message) {
|
||||
if (Main.PaPi) {
|
||||
player.sendMessage(Replace.replacePrice(prefix, player, msg, slot.Price + " " + SelectConfig.Currency));
|
||||
} else
|
||||
player.sendMessage(Replace.replacePrice(prefix, msg, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
}
|
||||
if (slot.ServerChange) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
send.player(player, SelectMessages.onServerChange.replace("[server]", slot.ServerChangeServer));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ServerChange.send(player, slot.ServerChangeServer);
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 20L);
|
||||
}
|
||||
if (slot.SetConfigEnable) {
|
||||
File config = new File(slot.ConfigFilePath);
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
/*if (slot.ConfigChatInput){
|
||||
ConfigChat.EditChat.put(player, slot.ConfigOptionPath);
|
||||
player.sendMessage(DefaultValue.SettingsGUIchatSet.replace("[setting]", "Shop Name Chest small"));
|
||||
player.sendMessage(DefaultValue.SettingsGUIchatCancel);
|
||||
} else
|
||||
{
|
||||
*/
|
||||
if (e.isLeftClick()) {
|
||||
if (slot.ConfigOptionPremat.equals("String")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueLeft);
|
||||
} else if (slot.ConfigOptionPremat.equals("Boolean")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigBooleanValueLeft);
|
||||
} else if (slot.ConfigOptionPremat.equals("Integer")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigIntegerValueLeft);
|
||||
} else if (slot.ConfigOptionPremat.equals("Double")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigDoubleValueLeft);
|
||||
} else if (slot.ConfigOptionPremat.equals("List")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigListValueLeft);
|
||||
} else {
|
||||
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
}
|
||||
}
|
||||
if (e.isRightClick()) {
|
||||
if (slot.ConfigOptionPremat.equals("String")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueRight);
|
||||
} else if (slot.ConfigOptionPremat.equals("Boolean")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigBooleanValueRight);
|
||||
} else if (slot.ConfigOptionPremat.equals("Integer")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigIntegerValueRight);
|
||||
} else if (slot.ConfigOptionPremat.equals("Double")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigDoubleValueRight);
|
||||
} else if (slot.ConfigOptionPremat.equals("List")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigListValueRight);
|
||||
} else {
|
||||
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
}
|
||||
}
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException tac) {
|
||||
tac.printStackTrace();
|
||||
}
|
||||
if (slot.PluginReloadEnable) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), slot.PluginReloadCommand);
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
}
|
||||
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) {
|
||||
if (slot.CustomSound_Enable) {
|
||||
if (!slot.CustomSound_NoSound) {
|
||||
try {
|
||||
player.playSound(player.getLocation(), Sound.valueOf(slot.CustomSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
|
||||
|
||||
} catch (Exception e1) {
|
||||
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§6GUI: §e" + Replace.replace(prefix, gui.GUI_Name) + "§r §6Slot: §e" + slot.Slot + " §6CustomSound: §9" + slot.CustomSound_Sound));
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
|
||||
}
|
||||
}
|
||||
} else
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
player.sendMessage(SelectMessages.No_money);
|
||||
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (slot.Command_Enable) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (slot.Command_BungeeCommand) {
|
||||
if (SelectConfig.Bungee) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bungee_Sender_Reciver.sendToBungee(player, player.getName(), cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
} else {
|
||||
send.console(prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
send.player(player, prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
}
|
||||
|
||||
} else {
|
||||
if (slot.CommandAsConsole) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
} else {
|
||||
for (String cmd : slot.Command) {
|
||||
player.chat("/" + cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
if (slot.OpenGUI_Enable) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
OpenGUI.openGUI(player, Main.guiHashMap.get(slot.OpenGUI), slot.OpenGUI);
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
if (slot.Message_Enable) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
|
||||
for (String msg : slot.Message) {
|
||||
if (Main.PaPi) {
|
||||
player.sendMessage(Replace.replace(prefix, player, msg.replace("[prefix]", prefix)));
|
||||
} else
|
||||
player.sendMessage(Replace.replace(prefix, msg.replace("[prefix]", prefix)));
|
||||
}
|
||||
}
|
||||
if (slot.ServerChange) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
send.player(player, SelectMessages.onServerChange.replace("[server]", slot.ServerChangeServer));
|
||||
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ServerChange.send(player, slot.ServerChangeServer);
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 20L);
|
||||
}
|
||||
if (slot.SetConfigEnable) {
|
||||
File config = new File(slot.ConfigFilePath);
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
/*if (slot.ConfigChatInput){
|
||||
ConfigChat.EditChat.put(player, slot.ConfigOptionPath);
|
||||
player.sendMessage(DefaultValue.SettingsGUIchatSet.replace("[setting]", "Shop Name Chest small"));
|
||||
player.sendMessage(DefaultValue.SettingsGUIchatCancel);
|
||||
} else
|
||||
{
|
||||
*/
|
||||
if (e.isLeftClick()) {
|
||||
if (slot.ConfigOptionPremat.equals("String")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueLeft);
|
||||
} else if (slot.ConfigOptionPremat.equals("Boolean")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigBooleanValueLeft);
|
||||
} else if (slot.ConfigOptionPremat.equals("Integer")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigIntegerValueLeft);
|
||||
} else if (slot.ConfigOptionPremat.equals("Double")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigDoubleValueLeft);
|
||||
} else if (slot.ConfigOptionPremat.equals("List")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigListValueLeft);
|
||||
} else {
|
||||
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
}
|
||||
}
|
||||
if (e.isRightClick()) {
|
||||
if (slot.ConfigOptionPremat.equals("String")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueRight);
|
||||
} else if (slot.ConfigOptionPremat.equals("Boolean")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigBooleanValueRight);
|
||||
} else if (slot.ConfigOptionPremat.equals("Integer")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigIntegerValueRight);
|
||||
} else if (slot.ConfigOptionPremat.equals("Double")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigDoubleValueRight);
|
||||
} else if (slot.ConfigOptionPremat.equals("List")) {
|
||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigListValueRight);
|
||||
} else {
|
||||
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
}
|
||||
}
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException tac) {
|
||||
tac.printStackTrace();
|
||||
}
|
||||
if (slot.PluginReloadEnable) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), slot.PluginReloadCommand);
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
}
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) {
|
||||
if (slot.CustomSound_Enable) {
|
||||
if (!slot.CustomSound_NoSound) {
|
||||
try {
|
||||
player.playSound(player.getLocation(), Sound.valueOf(slot.CustomSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
|
||||
|
||||
} catch (Exception e1) {
|
||||
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§6GUI: §e" + Replace.replace(prefix, gui.GUI_Name) + "§r §6Slot: §e" + slot.Slot + " §6CustomSound: §9" + slot.CustomSound_Sound));
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
|
||||
}
|
||||
}
|
||||
} else
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, slot.Name))
|
||||
.replace("[perm]", "commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.Listener;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Give_UseItem;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ItemChange {
|
||||
public static void itemChange(Player player) {
|
||||
Integer slot;
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce){
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
if (Select_Database.selectSlot(player) == null) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
slot = Select_Database.selectSlot(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (!SelectConfig.UseItem_Enable) {
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
|
||||
if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Give_UseItem.onGive(player);
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L * 1);
|
||||
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin || SelectConfig.Cursor_ToGUIItem_OnLogin) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.UseItem_GiveOnEveryJoin) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
|
||||
Give_UseItem.onGive(player);
|
||||
if (SelectConfig.Cursor_ToGUIItem_OnLogin) {
|
||||
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
}
|
||||
} else {
|
||||
if (SelectConfig.Bungee) {
|
||||
if (SelectConfig.UseItem_ServerChange) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
} else {
|
||||
if (Main.bungeejoinplayers.contains(player.getName())) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
Main.bungeejoinplayers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
} else player.getInventory().setHeldItemSlot(slot - 1);
|
||||
}
|
||||
}
|
||||
} else if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
|
||||
boolean empty = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (player.getInventory().getItem(i) == null) {
|
||||
empty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty) {
|
||||
Give_UseItem.onGiveADD(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L * 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
// This claas was created by JaTiTV
|
||||
|
||||
package de.jatitv.commandguiv2.Spigot.Listener;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class PluginEvent implements Listener {
|
||||
private static String prefix = Main.prefix;
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Select_Database.nameCheck(player);
|
||||
UpdateAPI.join(Main.plugin,prefix, "commandgui.updatemsg", event.getPlayer(), Main.spigot, Main.discord);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onClearServer(ServerCommandEvent event) {
|
||||
if (SelectConfig.UseItem_KeepAtCommandClear) {
|
||||
if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Player player = Bukkit.getPlayer(event.getCommand().replace("/", "").replace("clear ", ""));
|
||||
if (player == null){
|
||||
return;
|
||||
}
|
||||
clearGive(player);
|
||||
} catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onClearPlayer(PlayerCommandPreprocessEvent event) {
|
||||
if (SelectConfig.UseItem_KeepAtCommandClear) {
|
||||
if (event.getMessage().toLowerCase().contains("clear")) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clearGive(event.getPlayer());
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L);
|
||||
}
|
||||
if (event.getMessage().toLowerCase().contains("clear " + event.getMessage().toLowerCase().replace("/", "").replace("clear ", ""))) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clearGive(Bukkit.getPlayer(event.getMessage().toLowerCase().replace("/", "").replace("clear ", "")));
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void clearGive(Player player) {
|
||||
ItemChange.itemChange(player);
|
||||
}
|
||||
}
|
|
@ -1,271 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.ItemChange;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
|
||||
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
|
||||
import de.jatitv.commandguiv2.api.CGuiAPI;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class Events implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
if (CGuiAPI.JoinDisable) return;
|
||||
if (e.getPlayer().hasPermission("commandgui.get.guiitem.at.login")) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ItemChange.itemChange(e.getPlayer());
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 20L * 1);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDeathDrop(PlayerDeathEvent e) {
|
||||
Player player = e.getEntity().getPlayer();
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!e.getDrops().isEmpty()) {
|
||||
Iterator var3 = (new ArrayList(e.getDrops())).iterator();
|
||||
while (var3.hasNext()) {
|
||||
ItemStack items = (ItemStack) var3.next();
|
||||
if (items != null && items.hasItemMeta() && items.getItemMeta().hasDisplayName()
|
||||
&& items.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.getDrops().remove(items);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onRespawn(PlayerRespawnEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (SelectConfig.UseItem_Enable) {
|
||||
ItemChange.itemChange(player);
|
||||
//if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||
// if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
|
||||
// if (!player.hasPlayedBefore()) {
|
||||
// new BukkitRunnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Give_UseItem.onGive(player);
|
||||
// }
|
||||
// }.runTaskLater(Main.plugin, 20L * 1);
|
||||
// }
|
||||
// } else {
|
||||
// new BukkitRunnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Give_UseItem.onGive(player);
|
||||
// }
|
||||
// }.runTaskLater(Main.plugin, 20L * 1);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onGameModeChange(PlayerGameModeChangeEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (SelectConfig.UseItemGameModeChangeDisableInSpectator) {
|
||||
if (player.getGameMode() != GameMode.SPECTATOR) {
|
||||
ItemChange.itemChange(player);
|
||||
return;
|
||||
}
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else ItemChange.itemChange(player);
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInteract(PlayerInteractEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (SelectConfig.UseItem_Enable) {
|
||||
if (SelectConfig.UseItem_PlayerHead_Enable) {
|
||||
if (e.getItem() != null && p.getItemInHand().getType() == ItemVersion.getHead()) {
|
||||
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.setCancelled(true);
|
||||
if (p.isSneaking()) {
|
||||
Commands.info(p);
|
||||
return;
|
||||
}
|
||||
if (!legacy()) {
|
||||
if (!topInventoryIsEmpty(p)) return;
|
||||
}
|
||||
if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) {
|
||||
OpenGUI.openGUI(p, Main.guiHashMap.get(SelectConfig.UseItem_OpenGUI), SelectConfig.UseItem_OpenGUI);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
p.playSound(p.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
||||
.replace("[gui]", SelectConfig.UseItem_OpenGUI));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(SelectConfig.UseItem_Material)) {
|
||||
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.setCancelled(true);
|
||||
if (p.isSneaking()) {
|
||||
Commands.info(p);
|
||||
return;
|
||||
}
|
||||
if (!legacy()) {
|
||||
if (!topInventoryIsEmpty(p)) return;
|
||||
}
|
||||
if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) {
|
||||
OpenGUI.openGUI(p, Main.guiHashMap.get(SelectConfig.UseItem_OpenGUI), SelectConfig.UseItem_OpenGUI);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
p.playSound(p.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
||||
.replace("[gui]", SelectConfig.UseItem_OpenGUI));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMoveEvent(InventoryMoveItemEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
|
||||
&& e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.setCancelled(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(InventoryDragEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
if (e.getWhoClicked() instanceof Player) {
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
ItemChange.itemChange(p);
|
||||
}
|
||||
|
||||
if (e.getOldCursor() != null && e.getOldCursor().hasItemMeta() && e.getOldCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getOldCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
ItemChange.itemChange(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemMove(InventoryClickEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
|
||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
|
||||
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
|
||||
e.setCancelled(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(InventoryPickupItemEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
if (e.getItem() != null && e.getItem().getItemStack() != null) {
|
||||
ItemStack item = e.getItem().getItemStack();
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlace(BlockPlaceEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
|
||||
&& e.getItemInHand().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDrop(PlayerDropItemEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
|
||||
ItemStack item = e.getItemDrop().getItemStack();
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean legacy() {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15) {
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
private static boolean topInventoryIsEmpty(Player p) {
|
||||
return p.getOpenInventory().getTopInventory().isEmpty();
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot;
|
||||
//s<ds
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.system.Load;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
public static ArrayList<String> bungeeplayers = new ArrayList<>();
|
||||
public static ArrayList<String> bungeejoinplayers = new ArrayList<>();
|
||||
|
||||
public static File getPath() {
|
||||
return plugin.getDataFolder();
|
||||
}
|
||||
|
||||
private static Boolean enable = false;
|
||||
|
||||
public static String prefix = "§8[§4C§9GUI§8]";
|
||||
|
||||
public static String version;
|
||||
|
||||
public static List<String> autor;
|
||||
public static Integer spigotID = Util.SpigotID;
|
||||
public static Integer bstatsID = Util.BstatsID;
|
||||
public static String spigot = Util.Spigot;
|
||||
public static String discord = Util.Discord;
|
||||
|
||||
public static Main plugin;
|
||||
public static List plugins;
|
||||
|
||||
public static String update_version = null;
|
||||
public static Boolean PaPi = false;
|
||||
public static Boolean PlotSquaredGUI = false;
|
||||
public static Boolean PlugManGUI = false;
|
||||
|
||||
public static HashMap<String, Object> guiHashMap = new HashMap<>();
|
||||
public static ArrayList<String> allAliases = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
plugins = Arrays.asList(getServer().getPluginManager().getPlugins());
|
||||
// Plugin startup logic
|
||||
// Plugin startup logic
|
||||
Logger logger = this.getLogger();
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
version = plugin.getDescription().getVersion();
|
||||
if (pluginNotFound("T2CodeLib", 96388, Util.requiredT2CodeLibVersion)) return;
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
if (PluginCheck.papi()) {
|
||||
PaPi = true;
|
||||
}
|
||||
Load.onLoad(prefix, autor, version, spigot, spigotID, discord, bstatsID);
|
||||
enable = true;
|
||||
|
||||
}
|
||||
|
||||
public static void addonLoad() {
|
||||
if (Bukkit.getPluginManager().getPlugin("PlotSquaredGUI") != null) {
|
||||
PlotSquaredGUI = true;
|
||||
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("PlugManGUI") != null) {
|
||||
PlugManGUI = true;
|
||||
addonEnable(Bukkit.getPluginManager().getPlugin("PlugManGUI"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void addonEnable(Plugin plugin) {
|
||||
send.console(prefix + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
|
||||
}
|
||||
|
||||
public static Boolean pluginNotFound(String pl, Integer spigotID) {
|
||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
|
||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
} else {
|
||||
if (Double.parseDouble(Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion()) < ver) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4is out of date! This plugin requires at least version §2" + ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to use this version of " + plugin.getDescription().getName() + ".");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
if (enable) T2CodeTemplate.onDisable(prefix, autor, version, spigot, discord);
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.Objekte;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Obj_Select {
|
||||
public static void onSelect() {
|
||||
Main.guiHashMap.clear();
|
||||
Main.allAliases.clear();
|
||||
File f = new File(Main.getPath() + "/GUIs/");
|
||||
File[] fileArray = f.listFiles();
|
||||
|
||||
for (File config_gui : fileArray) {
|
||||
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
Main.allAliases.add(config_gui.getName().replace(".yml", ""));
|
||||
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config_gui);
|
||||
|
||||
Boolean GUI_Enable = yamlConfiguration_gui.getBoolean("GUI.Enable");
|
||||
Integer GUI_Lines = yamlConfiguration_gui.getInt("GUI.Lines");
|
||||
if (yamlConfiguration_gui.getInt("GUI.Lines") > 6) {
|
||||
yamlConfiguration_gui.set("GUI.Lines", 6);
|
||||
}
|
||||
if (yamlConfiguration_gui.getInt("GUI.Lines") < 1) {
|
||||
yamlConfiguration_gui.set("GUI.Lines", 1);
|
||||
}
|
||||
String GUI_Name = yamlConfiguration_gui.getString("GUI.Name");
|
||||
Boolean GUI_FillItem_Enable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
|
||||
String GUI_FillItem_Item;
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
GUI_FillItem_Item = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneCollor");
|
||||
} else GUI_FillItem_Item = yamlConfiguration_gui.getString("GUI.FillItem.Item");
|
||||
|
||||
Boolean Command_Alias_Enable = yamlConfiguration_gui.getBoolean("Command.Alias");
|
||||
Boolean Command_Permission = yamlConfiguration_gui.getBoolean("Command.Permission.Required");
|
||||
|
||||
ArrayList<Slot> slots = new ArrayList<>();
|
||||
for (String key : yamlConfiguration_gui.getConfigurationSection("Slots").getKeys(false)) {
|
||||
Slot slot = new Slot(yamlConfiguration_gui.getInt("Slots." + key + ".Slot") - 1,
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Enable"),
|
||||
// yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.Removable"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.Empty"),
|
||||
yamlConfiguration_gui.getInt("Slots." + key + ".Item.Amount"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.PlayerHead.Enable"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.PlayerHead.Base64.Enable"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".Item.PlayerHead.Base64.Base64Value"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.PlayerHead.PlayerWhoHasOpenedTheGUI"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".Item.PlayerHead.PlayerName"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".Item.Material"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".Item.Name"),
|
||||
yamlConfiguration_gui.getList("Slots." + key + ".Item.Lore"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".CustomSound.Enable"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".CustomSound.NoSound"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".CustomSound.Sound"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Cost.Enable"),
|
||||
yamlConfiguration_gui.getDouble("Slots." + key + ".Cost.Price"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Command.Enable"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Command.BungeeCommand"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Command.CommandAsConsole"),
|
||||
yamlConfiguration_gui.getStringList("Slots." + key + ".Command.Command"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".ServerChange.Enable"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".ServerChange.Server"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".OpenGUI.Enable"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".OpenGUI.GUI"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Message.Enable"),
|
||||
yamlConfiguration_gui.getStringList("Slots." + key + ".Message.Message"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Permission.Required"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Enable"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.File.Path"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Option.Path"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Option.Premat"),
|
||||
// yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Value.ChatInput"),
|
||||
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Value.LeftClick.String"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Value.LeftClick.Boolean"),
|
||||
yamlConfiguration_gui.getInt("Slots." + key + ".SetConfig.Value.LeftClick.Integer"),
|
||||
yamlConfiguration_gui.getDouble("Slots." + key + ".SetConfig.Value.LeftClick.Double"),
|
||||
yamlConfiguration_gui.getStringList("Slots." + key + ".SetConfig.Value.LeftClick.List"),
|
||||
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Value.RightClick.String"),
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Value.RightClick.Boolean"),
|
||||
yamlConfiguration_gui.getInt("Slots." + key + ".SetConfig.Value.RightClick.Integer"),
|
||||
yamlConfiguration_gui.getDouble("Slots." + key + ".SetConfig.Value.RightClick.Double"),
|
||||
yamlConfiguration_gui.getStringList("Slots." + key + ".SetConfig.RightClick.Value.List"),
|
||||
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.PluginReload.Enable"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.PluginReload.Command"));
|
||||
slots.add(slot);
|
||||
|
||||
}
|
||||
Object objekt = new Object(GUI_Enable, GUI_Lines, GUI_Name, GUI_FillItem_Enable, GUI_FillItem_Item,
|
||||
config_gui.getName().replace(".yml", ""), Command_Alias_Enable, Command_Permission, slots);
|
||||
|
||||
Main.guiHashMap.put(config_gui.getName().replace(".yml", ""), objekt);
|
||||
CmdExecuter_GUI.arg1.put(config_gui.getName().replace(".yml", ""), "commandgui.gui." + config_gui.getName().replace(".yml", ""));
|
||||
|
||||
try {
|
||||
yamlConfiguration_gui.save(config_gui);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.Objekte;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Object {
|
||||
public Boolean GUI_Enable;
|
||||
public Integer GUI_Lines;
|
||||
public String GUI_Name;
|
||||
public Boolean GUI_FillItem_Enable;
|
||||
public String GUI_FillItem_Item;
|
||||
|
||||
|
||||
public String Command_Command;
|
||||
public Boolean Command_Alias_Enable;
|
||||
public Boolean Command_Permission_Enable;
|
||||
public ArrayList<Slot> GUI_Slots;
|
||||
|
||||
public Object(Boolean GUI_Enable, Integer GUI_Lines, String GUI_Name, Boolean GUI_FillItem_Enable, String GUI_FillItem_Item,
|
||||
String Command_Command, Boolean Command_Alias_Enable, Boolean Command_Permission_Enable, ArrayList<Slot> GUI_Slots){
|
||||
this.GUI_Enable = GUI_Enable;
|
||||
this.GUI_Lines = GUI_Lines;
|
||||
this.GUI_Name = GUI_Name;
|
||||
this.GUI_FillItem_Enable = GUI_FillItem_Enable;
|
||||
this.GUI_FillItem_Item = GUI_FillItem_Item;
|
||||
this.Command_Command = Command_Command;
|
||||
this.Command_Alias_Enable = Command_Alias_Enable;
|
||||
this.Command_Permission_Enable = Command_Permission_Enable;
|
||||
this.GUI_Slots = GUI_Slots;
|
||||
}
|
||||
}
|
|
@ -1,158 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.Objekte;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Slot {
|
||||
|
||||
public Integer Slot;
|
||||
public Boolean Enable;
|
||||
// public Boolean ItemsRemovable;
|
||||
public Boolean Empty;
|
||||
public Integer ItemAmount;
|
||||
public Boolean PlayerHead_Enable;
|
||||
public Boolean Base64_Enable;
|
||||
public String Base64Value;
|
||||
public Boolean PlayerWhoHasOpenedTheGUI;
|
||||
public String PlayerName;
|
||||
public String Item;
|
||||
public String Name;
|
||||
public List Lore;
|
||||
public Boolean CustomSound_Enable;
|
||||
public Boolean CustomSound_NoSound;
|
||||
public String CustomSound_Sound;
|
||||
public Boolean Cost_Enable;
|
||||
public Double Price;
|
||||
public Boolean Command_Enable;
|
||||
public Boolean Command_BungeeCommand;
|
||||
public Boolean CommandAsConsole;
|
||||
public Boolean ServerChange;
|
||||
public String ServerChangeServer;
|
||||
public List<String> Command;
|
||||
public Boolean OpenGUI_Enable;
|
||||
public String OpenGUI;
|
||||
public Boolean Message_Enable;
|
||||
public List<String> Message;
|
||||
public Boolean Perm;
|
||||
public Boolean SetConfigEnable;
|
||||
public String ConfigFilePath;
|
||||
public String ConfigOptionPath;
|
||||
public String ConfigOptionPremat;
|
||||
// public Boolean ConfigChatInput;
|
||||
|
||||
public String ConfigStringValueLeft;
|
||||
public Boolean ConfigBooleanValueLeft;
|
||||
public Integer ConfigIntegerValueLeft;
|
||||
public Double ConfigDoubleValueLeft;
|
||||
public List<String> ConfigListValueLeft;
|
||||
|
||||
public String ConfigStringValueRight;
|
||||
public Boolean ConfigBooleanValueRight;
|
||||
public Integer ConfigIntegerValueRight;
|
||||
public Double ConfigDoubleValueRight;
|
||||
public List<String> ConfigListValueRight;
|
||||
|
||||
|
||||
public Boolean PluginReloadEnable;
|
||||
public String PluginReloadCommand;
|
||||
|
||||
public Slot(Integer Slot,
|
||||
Boolean Enable,
|
||||
// Boolean ItemsRemovable,
|
||||
Boolean Empty,
|
||||
Integer ItemAmount,
|
||||
Boolean PlayerHead_Enable,
|
||||
Boolean Base64Value_Enable,
|
||||
String Base64Value,
|
||||
Boolean PlayerWhoHasOpenedTheGUI,
|
||||
String PlayerName,
|
||||
String Item,
|
||||
String Name,
|
||||
List Lore,
|
||||
Boolean CustomSound_Enable,
|
||||
Boolean CustomSound_NoSound,
|
||||
String CustomSound_Sound,
|
||||
Boolean Cost_Enable,
|
||||
Double Price,
|
||||
Boolean Command_Enable,
|
||||
Boolean Command_BungeeCommand,
|
||||
Boolean CommandAsConsole,
|
||||
List<String> Command,
|
||||
Boolean ServerChange,
|
||||
String ServerChangeServer,
|
||||
Boolean OpenGUI_Enable,
|
||||
String OpenGUI,
|
||||
Boolean Message_Enable,
|
||||
List<String> Message,
|
||||
Boolean Perm,
|
||||
Boolean SetConfigEnable,
|
||||
String ConfigFilePath,
|
||||
String ConfigOptionPath,
|
||||
String ConfigOptionPremat,
|
||||
// Boolean ConfigChatInput,
|
||||
|
||||
String ConfigStringValueLeft,
|
||||
Boolean ConfigBooleanValueLeft,
|
||||
Integer ConfigIntegerValueLeft,
|
||||
Double ConfigDoubleValueLeft,
|
||||
List<String> ConfigListValueLeft,
|
||||
|
||||
String ConfigStringValueRight,
|
||||
Boolean ConfigBooleanValueRight,
|
||||
Integer ConfigIntegerValueRight,
|
||||
Double ConfigDoubleValueRight,
|
||||
List<String> ConfigListValueRight,
|
||||
|
||||
Boolean PluginReloadEnable,
|
||||
String PluginReloadCommand) {
|
||||
this.Slot = Slot;
|
||||
this.Enable = Enable;
|
||||
// this.ItemsRemovable = ItemsRemovable;
|
||||
this.Empty = Empty;
|
||||
this.ItemAmount = ItemAmount;
|
||||
this.PlayerHead_Enable = PlayerHead_Enable;
|
||||
this.Base64_Enable = Base64Value_Enable;
|
||||
this.Base64Value = Base64Value;
|
||||
this.PlayerWhoHasOpenedTheGUI = PlayerWhoHasOpenedTheGUI;
|
||||
this.PlayerName = PlayerName;
|
||||
this.Item = Item;
|
||||
this.Name = Name;
|
||||
this.Lore = Lore;
|
||||
this.CustomSound_Enable = CustomSound_Enable;
|
||||
this.CustomSound_NoSound = CustomSound_NoSound;
|
||||
this.CustomSound_Sound = CustomSound_Sound;
|
||||
this.Cost_Enable = Cost_Enable;
|
||||
this.Price = Price;
|
||||
this.Command_Enable = Command_Enable;
|
||||
this.Command_BungeeCommand = Command_BungeeCommand;
|
||||
this.CommandAsConsole = CommandAsConsole;
|
||||
this.Command = Command;
|
||||
this.ServerChange = ServerChange;
|
||||
this.ServerChangeServer = ServerChangeServer;
|
||||
this.OpenGUI_Enable = OpenGUI_Enable;
|
||||
this.OpenGUI = OpenGUI;
|
||||
this.Message_Enable = Message_Enable;
|
||||
this.Message = Message;
|
||||
this.Perm = Perm;
|
||||
this.SetConfigEnable = SetConfigEnable;
|
||||
this.ConfigFilePath = ConfigFilePath;
|
||||
this.ConfigOptionPath = ConfigOptionPath;
|
||||
this.ConfigOptionPremat = ConfigOptionPremat;
|
||||
// this.ConfigChatInput = ConfigChatInput;
|
||||
|
||||
this.ConfigStringValueLeft = ConfigStringValueLeft;
|
||||
this.ConfigBooleanValueLeft = ConfigBooleanValueLeft;
|
||||
this.ConfigIntegerValueLeft = ConfigIntegerValueLeft;
|
||||
this.ConfigDoubleValueLeft = ConfigDoubleValueLeft;
|
||||
this.ConfigListValueLeft = ConfigListValueLeft;
|
||||
|
||||
this.ConfigStringValueRight = ConfigStringValueRight;
|
||||
this.ConfigBooleanValueRight = ConfigBooleanValueRight;
|
||||
this.ConfigIntegerValueRight = ConfigIntegerValueRight;
|
||||
this.ConfigDoubleValueRight = ConfigDoubleValueRight;
|
||||
this.ConfigListValueRight = ConfigListValueRight;
|
||||
|
||||
|
||||
this.PluginReloadEnable = PluginReloadEnable;
|
||||
this.PluginReloadCommand = PluginReloadCommand;
|
||||
}
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.system.Debug;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.DefaultGUICreate;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class CmdExecuter_Admin implements CommandExecutor, TabCompleter {
|
||||
private static String prefix = Util.Prefix;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (args.length == 0) {
|
||||
Help.sendHelp(sender, prefix);
|
||||
} else {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "info":
|
||||
if (sender.hasPermission("commandgui.command.info")) {
|
||||
Commands.info(sender);
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.command.info"));
|
||||
|
||||
break;
|
||||
case "reload":
|
||||
case "rl":
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
Commands.reload(sender);
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||
break;
|
||||
case "createdefaultgui":
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
DefaultGUICreate.configCreate();
|
||||
sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "/GUIs/default.yml"));
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||
break;
|
||||
case "debug":
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
Debug.onDebugFile(sender);
|
||||
/*if (args.length == 2) {
|
||||
if (args[1].equals("config")) {
|
||||
Debug.debugmsg();
|
||||
}
|
||||
if (args[1].equals("2")) {
|
||||
send.debug("2");
|
||||
}
|
||||
break;
|
||||
|
||||
} else Debug.debugmsg();
|
||||
|
||||
*/
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||
break;
|
||||
|
||||
case "give":
|
||||
if (args.length == 2) {
|
||||
if (sender.hasPermission("commandgui.giveitem.other")) {
|
||||
Player target = Bukkit.getPlayer(args[1]);
|
||||
Commands.give(sender, target);
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui give")
|
||||
.replace("[perm]", "commandgui.command.give"));
|
||||
} else Help.sendHelp(sender, prefix);
|
||||
break;
|
||||
case "help":
|
||||
default:
|
||||
Help.sendHelp(sender, prefix);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//TabCompleter
|
||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||
put("reload", "commandgui.admin");
|
||||
put("rl", "commandgui.admin");
|
||||
put("createdefaultgui", "commandgui.admin");
|
||||
put("give", "commandgui.giveitem.other");
|
||||
put("info", "commandgui.command.info");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
if (args.length == 1) {
|
||||
for (String command : arg1.keySet()) {
|
||||
Boolean passend = true;
|
||||
for (int i = 0; i < args[0].length(); i++) {
|
||||
if (args[0].length() >= command.length()) {
|
||||
passend = false;
|
||||
} else {
|
||||
if (args[0].charAt(i) != command.charAt(i)) {
|
||||
passend = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasPermission(p, arg1.get(command)) && passend) {
|
||||
list.add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("give")) {
|
||||
if (sender.hasPermission("commandgui.giveitem.other")) {
|
||||
Iterator var6 = Bukkit.getOnlinePlayers().iterator();
|
||||
|
||||
while (var6.hasNext()) {
|
||||
Player player1 = (Player) var6.next();
|
||||
list.add(player1.getName());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasPermission(Player player, String permission) {
|
||||
if (player.isOp()) {
|
||||
return true;
|
||||
}
|
||||
String[] Permissions = permission.split(";");
|
||||
for (String perm : Permissions) {
|
||||
if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,252 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Obj_Select;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
||||
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Give_UseItem;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.ConfigCreate;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.LanguagesCreate;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.TextBuilder;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class Commands {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static String prefix = Util.Prefix;
|
||||
private static String autor = String.valueOf(Main.autor);
|
||||
private static String version = Main.version;
|
||||
private static String spigot = Util.Spigot;
|
||||
private static String discord = Util.Discord;
|
||||
|
||||
public static void info(CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
send.player(player, prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
|
||||
send.player(player, prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
|
||||
if (UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion.equalsIgnoreCase(version)) {
|
||||
send.player(player, prefix + " §2Version: §6" + version);
|
||||
} else {
|
||||
UpdateAPI.sendUpdateMsg(prefix,spigot,discord,version,UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion,player);
|
||||
}
|
||||
|
||||
send.player(player, prefix + " §2Spigot: §6" + spigot);
|
||||
send.player(player, prefix + " §2Discord: §6" + discord);
|
||||
send.player(player, prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
|
||||
} else {
|
||||
send.sender(sender, prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
|
||||
send.sender(sender, prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
|
||||
if (UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion.equalsIgnoreCase(version)) {
|
||||
send.sender(sender,prefix + " §2Version: §6" + version);
|
||||
} else {
|
||||
UpdateAPI.sendUpdateMsg(prefix,spigot,discord,version,UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion);
|
||||
}
|
||||
|
||||
send.sender(sender, prefix + " §2Spigot: §6" + spigot);
|
||||
send.sender(sender, prefix + " §2Discord: §6" + discord);
|
||||
send.sender(sender, prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
|
||||
}
|
||||
}
|
||||
|
||||
public static void reload(CommandSender sender) {
|
||||
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadStart);
|
||||
send.console(prefix + "§8-------------------------------");
|
||||
send.console(prefix + " §6Plugin reload...");
|
||||
send.console(prefix + "§8-------------------------------");
|
||||
|
||||
CmdExecuter_GUI.arg1.clear();
|
||||
CmdExecuter_GUI.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
ConfigCreate.configCreate();
|
||||
SelectConfig.onSelect();
|
||||
plugin.reloadConfig();
|
||||
|
||||
LanguagesCreate.langCreate();
|
||||
|
||||
Obj_Select.onSelect();
|
||||
SelectMessages.onSelect(prefix);
|
||||
SelectConfig.sound(prefix);
|
||||
try {
|
||||
AliasRegister.onRegister();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (SelectConfig.Bungee){
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "commandgui:bungee");
|
||||
|
||||
}
|
||||
|
||||
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadEnd);
|
||||
send.console(prefix + "§8-------------------------------");
|
||||
send.console(prefix + " §2Plugin successfully reloaded.");
|
||||
send.console(prefix + "§8-------------------------------");
|
||||
}
|
||||
|
||||
public static void give(CommandSender sender, Player target) {
|
||||
if (Bukkit.getPlayer(target.getName()) != null) {
|
||||
Give_UseItem.onGive(target);
|
||||
send.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", SelectConfig.UseItem_Name));
|
||||
send.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", SelectConfig.UseItem_Name));
|
||||
if (SelectConfig.Sound_Give_Enable && SelectConfig.Sound_Enable) {
|
||||
target.playSound(target.getLocation(), SelectConfig.Sound_Give, 3, 1);
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(SelectMessages.PlayerNotFond.replace("[player]", target.getName()));
|
||||
if (SelectConfig.Sound_PlayerNotFound_Enable && SelectConfig.Sound_Enable) {
|
||||
if (sender instanceof Player)
|
||||
((Player) sender).playSound(((Player) sender).getLocation(), SelectConfig.Sound_PlayerNotFound, 3, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void itemOn(Player player) {
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Integer slot = null;
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce){
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
if (Select_Database.selectSlot(player) == null) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
slot = Select_Database.selectSlot(player);
|
||||
}
|
||||
}
|
||||
send.debug(plugin,String.valueOf(slot));
|
||||
if (player.getInventory().getItem(slot - 1) == null) {
|
||||
Select_Database.setItemStatusTrue(player);
|
||||
Give_UseItem.onGive(player);
|
||||
} else {
|
||||
boolean empty = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (player.getInventory().getItem(i) == null) {
|
||||
empty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty) {
|
||||
Select_Database.setItemStatusTrue(player);
|
||||
Give_UseItem.onGiveADD(player);
|
||||
send.player(player, SelectMessages.ItemON);
|
||||
} else {
|
||||
player.sendMessage(SelectMessages.NoInventorySpace);
|
||||
if (SelectConfig.Sound_NoInventorySpace_Enable && SelectConfig.Sound_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_NoInventorySpace, 3, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void itemOff(Player player) {
|
||||
Select_Database.setItemStatusFalse(player);
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
send.player(player, SelectMessages.ItemOFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void onSetSlot(Player player, Integer setSlot) {
|
||||
if (SelectConfig.UseItem_AllowSetSlot) {
|
||||
if (setSlot < 1) {
|
||||
send.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
return;
|
||||
}
|
||||
if (setSlot > 9) {
|
||||
send.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
return;
|
||||
}
|
||||
ItemStack itm1 = player.getInventory().getItem(setSlot - 1);
|
||||
if (itm1 != null) {
|
||||
if (itm1.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm1.getType() == ItemVersion.getHead()) {
|
||||
if (itm1.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.sendMessage(SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(setSlot - 1) != null) {
|
||||
send.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
|
||||
return;
|
||||
}
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Select_Database.setSlot(player, setSlot);
|
||||
if (Select_Database.selectItemStatus(player)) {
|
||||
Give_UseItem.onGive(player);
|
||||
}
|
||||
send.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
|
||||
} else player.sendMessage(prefix + " §4Function disabled");
|
||||
}
|
||||
|
||||
public static void gui(Player player) {
|
||||
if (Main.guiHashMap.containsKey(SelectConfig.DefaultGUI)) {
|
||||
Object gui = Main.guiHashMap.get(SelectConfig.DefaultGUI);
|
||||
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, gui, SelectConfig.DefaultGUI);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
} else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
|
||||
.replace("[perm]", "commandgui.command"));
|
||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name));
|
||||
}
|
||||
}
|
||||
public static void gui(Player player, String arg){
|
||||
if (Main.guiHashMap.containsKey(arg)) {
|
||||
Object gui = Main.guiHashMap.get(arg);
|
||||
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + gui.Command_Command) || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, gui, arg);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
} else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.Command_Command)
|
||||
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
|
||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.Command_Command));
|
||||
} else player.sendMessage(SelectMessages.GUInotFound);
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class Help {
|
||||
private static String prefix = Util.Prefix;
|
||||
public static void sendHelp(CommandSender sender, String Prefix) {
|
||||
send.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
|
||||
if (sender.hasPermission("commandgui.command")) {
|
||||
Object gui = Main.guiHashMap.get(SelectConfig.DefaultGUI);
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpCgui.replace("[gui]", Replace.replace(prefix,gui.GUI_Name)));
|
||||
for (String alias : Main.allAliases) {
|
||||
if (Main.guiHashMap.get(alias).GUI_Enable || sender.hasPermission("commandgui.bypass")) {
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpOpen.replace("[gui]", alias).replace("[guiname]", Replace.replace(prefix,Main.guiHashMap.get(alias).GUI_Name)));
|
||||
}
|
||||
}
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpHelp);
|
||||
}
|
||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||
send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_on);
|
||||
send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_off);
|
||||
send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_Slot);
|
||||
}
|
||||
if (sender.hasPermission("commandgui.command.info")) {
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpInfo);
|
||||
}
|
||||
// if (sender.hasPermission("commandgui.command.give")) {
|
||||
// send.sender(sender, Prefix + " " + Select_msg.HelpGive);
|
||||
// }
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpCreateDefaultGUI.replace("[directory]", Main.getPath()+ "\\GUIs\\default.yml"));
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpReload);
|
||||
}
|
||||
send.sender(sender, Prefix + " §8-------------------------");
|
||||
}
|
||||
|
||||
public static void sendGUIItemHelp(CommandSender sender, String Prefix) {
|
||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||
send.sender(sender, Prefix + " §8------ §4Command§9GUI§2Item §chelp §8------");
|
||||
send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_on);
|
||||
send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_off);
|
||||
send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_Slot);
|
||||
send.sender(sender, Prefix + " §8------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.cmdManagement.register;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
public class AliasRegister {
|
||||
public static void onRegister() {
|
||||
Plugin plugin = Main.plugin;
|
||||
send.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
|
||||
File f = new File(Main.getPath() + "/GUIs/");
|
||||
File[] fileArray = f.listFiles();
|
||||
if (Main.allAliases.toString().equals("[]")) {
|
||||
send.console(Util.Prefix + " §4No GUI files available");
|
||||
return;
|
||||
}
|
||||
for (String alias : Main.allAliases) {
|
||||
if (Main.guiHashMap.get(alias) != null) {
|
||||
if (Main.guiHashMap.get(alias).Command_Alias_Enable) {
|
||||
String version;
|
||||
if (NMSVersion.v1_8_R1) {
|
||||
send.debug(plugin, "Alias register 1.8_R1");
|
||||
org.bukkit.craftbukkit.v1_8_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_8_R2) {
|
||||
send.debug(plugin, "Alias register 1.8_R2");
|
||||
org.bukkit.craftbukkit.v1_8_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R2.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_8_R3) {
|
||||
send.debug(plugin, "Alias register 1.8_R3");
|
||||
org.bukkit.craftbukkit.v1_8_R3.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R3.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_9_R1) {
|
||||
send.debug(plugin, "Alias register 1.9_R1");
|
||||
org.bukkit.craftbukkit.v1_9_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_9_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_9_R2) {
|
||||
send.debug(plugin, "Alias register 1.9_R2");
|
||||
org.bukkit.craftbukkit.v1_9_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_9_R2.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_10_R1) {
|
||||
send.debug(plugin, "Alias register 1.10_R1");
|
||||
org.bukkit.craftbukkit.v1_10_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_10_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_11_R1) {
|
||||
send.debug(plugin, "Alias register 1.11_R1");
|
||||
org.bukkit.craftbukkit.v1_11_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_11_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_12_R1) {
|
||||
send.debug(plugin, "Alias register 1.12_R1");
|
||||
org.bukkit.craftbukkit.v1_12_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_12_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_13_R1) {
|
||||
send.debug(plugin, "Alias register 1.13_R1");
|
||||
org.bukkit.craftbukkit.v1_13_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_13_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_13_R2) {
|
||||
send.debug(plugin, "Alias register 1.13_R2");
|
||||
org.bukkit.craftbukkit.v1_13_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_13_R2.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_14_R1) {
|
||||
send.debug(plugin, "Alias register 1.14_R1");
|
||||
org.bukkit.craftbukkit.v1_14_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_14_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_15_R1) {
|
||||
send.debug(plugin, "Alias register 1.15_R1");
|
||||
org.bukkit.craftbukkit.v1_15_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_15_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_16_R1) {
|
||||
send.debug(plugin, "Alias register 1.16_R1");
|
||||
org.bukkit.craftbukkit.v1_16_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_16_R2) {
|
||||
send.debug(plugin, "Alias register 1.16_R2");
|
||||
org.bukkit.craftbukkit.v1_16_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R2.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_16_R3) {
|
||||
send.debug(plugin, "Alias register 1.16_R3");
|
||||
org.bukkit.craftbukkit.v1_16_R3.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R3.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_17_R1) {
|
||||
send.debug(plugin, "Alias register 1.17_R1");
|
||||
org.bukkit.craftbukkit.v1_17_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_17_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_18_R1) {
|
||||
send.debug(plugin, "Alias register 1.18_R1");
|
||||
org.bukkit.craftbukkit.v1_18_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_18_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.cmdManagement.register;
|
||||
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class RegisterCommand extends Command {
|
||||
private String alias;
|
||||
|
||||
public RegisterCommand(String alias) {
|
||||
super(alias);
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Object gui = Main.guiHashMap.get(alias);
|
||||
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, gui, alias);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
} else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
|
||||
.replace("[perm]", "commandgui.command." + alias));
|
||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name));
|
||||
} else sender.sendMessage("§8[§6Command§9GUI§8] §cThis command is only for players!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.gui;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.GUI_Listener;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
|
||||
public class OpenGUI {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static String prefix = Util.Prefix;
|
||||
|
||||
public static void openGUI(Player player, Object gui, String guiString) {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
switch (guiString) {
|
||||
//case "plugin.PlotSquaredGUI":
|
||||
// if (Main.PlotSquaredGUI) {
|
||||
// PlotSquaredGUIapi.openMainGUI(player);
|
||||
// } else {
|
||||
// if (player.hasPermission("commandgui.admin")) {
|
||||
// send.player(player, prefix + " §4PlotSquaredGUI could not be found! §9Please download it here: " +
|
||||
// "§6https://spigotmc.org/resources/plotsquaredgui.77506/");
|
||||
// }
|
||||
// }
|
||||
// return; todo
|
||||
case "plugin.PlugManGUI":
|
||||
if (Main.PlugManGUI) {
|
||||
player.openInventory((new PluginListGUI(54, 1)).getInventory());
|
||||
} else {
|
||||
if (player.hasPermission("commandgui.admin")) {
|
||||
send.player(player, prefix + " §4PlugManGUI could not be found! §9Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/plugmangui.87599/");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (MCVersion.minecraft1_13) {
|
||||
GUI_Listener.GUICode = "";
|
||||
} else GUI_Listener.GUICode = "§6§8§9§r";
|
||||
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
|
||||
Inventory inventory;
|
||||
if (Main.PaPi) {
|
||||
inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.GUI_Lines, (Replace.replace(prefix, player, GUI_Listener.GUICode + gui.GUI_Name)));
|
||||
} else inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.GUI_Lines, (Replace.replace(prefix, GUI_Listener.GUICode + gui.GUI_Name)));
|
||||
|
||||
if (gui.GUI_FillItem_Enable) {
|
||||
ItemStack glass;
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.valueOf(gui.GUI_FillItem_Item));
|
||||
} else glass = new ItemStack(Material.valueOf(gui.GUI_FillItem_Item.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMetaglass = glass.getItemMeta();
|
||||
itemMetaglass.setDisplayName(" ");
|
||||
glass.setItemMeta(itemMetaglass);
|
||||
glass.setAmount(1);
|
||||
for (int i = 0; i < 9 * gui.GUI_Lines; i++) {
|
||||
inventory.setItem(i, glass);
|
||||
}
|
||||
}
|
||||
for (Slot slot : gui.GUI_Slots) {
|
||||
if (slot.Enable) {
|
||||
if (slot.Empty) {
|
||||
ItemStack air = new ItemStack(Material.AIR);
|
||||
inventory.setItem(slot.Slot, air);
|
||||
} else {
|
||||
if (slot.PlayerHead_Enable) {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
send.player(player, prefix + "§c Playerheads are only available from version §61.13§c! §7- §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
||||
send.error(plugin, "Playerheads are only available from version 1.13!");
|
||||
send.console(prefix + " §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
||||
} else {
|
||||
|
||||
if (slot.Base64_Enable) {
|
||||
ItemStack item = ItemVersion.getHeadIS();
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||
profile.getProperties().put("textures", new Property("textures", slot.Base64Value));
|
||||
Field profileField = null;
|
||||
try {
|
||||
profileField = itemMeta.getClass().getDeclaredField("profile");
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(itemMeta, profile);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
} else {
|
||||
if (slot.PlayerWhoHasOpenedTheGUI) {
|
||||
ItemStack item = ItemVersion.getHeadIS();
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
itemMeta.setOwner(player.getName());
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
} else {
|
||||
ItemStack item = ItemVersion.getHeadIS();
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
itemMeta.setOwner(slot.PlayerName);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ItemStack item = new ItemStack(Material.valueOf(slot.Item.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.openInventory(inventory);
|
||||
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.GUI_Name) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.GUI_Name)));
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class Bungee_Sender_Reciver implements PluginMessageListener {
|
||||
|
||||
public static void sendToBungee(Player player,String channel, String information) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF(channel);
|
||||
output.writeUTF(information);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
||||
try {
|
||||
String subChannel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
switch (subChannel) {
|
||||
case "join":
|
||||
Main.bungeeplayers.add(input);
|
||||
Main.bungeejoinplayers.add(input);
|
||||
break;
|
||||
case "left":
|
||||
Main.bungeeplayers.remove(input);
|
||||
Main.bungeejoinplayers.remove(input);
|
||||
break;
|
||||
case "clear":
|
||||
Main.bungeeplayers.clear();
|
||||
Main.bungeejoinplayers.clear();
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
public class Debug {
|
||||
|
||||
private static Plugin plugin = Main.plugin;
|
||||
public static void debugmsg() {
|
||||
|
||||
|
||||
send.debug(plugin,"§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.debug(plugin,"§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
|
||||
send.debug(plugin,"§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
|
||||
send.debug(plugin,"§3Version: §e" + Bukkit.getVersion());
|
||||
send.debug(plugin,"§3Java: §e" + System.getProperty("java.version"));
|
||||
send.debug(plugin,"§3Worlds: §e" +String.valueOf(Bukkit.getServer().getWorlds()));
|
||||
send.debug(plugin,String.valueOf(Main.plugins));
|
||||
send.debug(plugin,"§5----------------------------------");
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
File f = new File(String.valueOf(Main.getPath()));
|
||||
File f2 = new File(String.valueOf(Main.getPath() + "/GUIs/"));
|
||||
File f3 = new File(String.valueOf(Main.getPath() + "/languages/"));
|
||||
File[] fileArray = f.listFiles();
|
||||
File[] fileArray2 = f2.listFiles();
|
||||
File[] fileArray3 = f3.listFiles();
|
||||
for (File config : fileArray) {
|
||||
send.debug(plugin,String.valueOf(config).replace("plugins/CommandGUI/", ""));
|
||||
}
|
||||
for (File config2 : fileArray2) {
|
||||
send.debug(plugin,String.valueOf(config2).replace("plugins/CommandGUI/", ""));
|
||||
}
|
||||
for (File config3 : fileArray3) {
|
||||
send.debug(plugin,String.valueOf(config3).replace("plugins/CommandGUI/", ""));
|
||||
}
|
||||
}
|
||||
send.debug(plugin,"§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
|
||||
}
|
||||
|
||||
public static void onDebugFile(CommandSender sender){
|
||||
String timeStamp = new SimpleDateFormat("dd_MM_yyyy_HH_mm_ss").format(Calendar.getInstance().getTime());
|
||||
String timeStampcfg = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(Calendar.getInstance().getTime());
|
||||
send.sender(sender, Main.prefix + " §5Debug file was createt: §e" + Main.getPath() + "\\debug\\commandgui_debug_"+ timeStamp +".yml");
|
||||
File debug = new File(Main.getPath(), "debug/commandgui_debug_"+ timeStamp +".yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(debug);
|
||||
|
||||
set("Time", timeStampcfg, yamlConfiguration);
|
||||
set("CommandGUI.Version", String.valueOf(plugin.getDescription().getVersion()), yamlConfiguration);
|
||||
|
||||
set("Server.Bukkit_Version", String.valueOf(Bukkit.getBukkitVersion()), yamlConfiguration);
|
||||
set("Server.NMS_Version", String.valueOf(Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", "")), yamlConfiguration);
|
||||
set("Server.Version", String.valueOf(Bukkit.getVersion()), yamlConfiguration);
|
||||
set("Server.Java", String.valueOf(System.getProperty("java.version")), yamlConfiguration);
|
||||
set("Server.Worlds", String.valueOf(Bukkit.getServer().getWorlds()), yamlConfiguration);
|
||||
set("Server.Plugins", String.valueOf(Main.plugins) , yamlConfiguration);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(debug);
|
||||
} catch (IOException e) {
|
||||
send.warning(plugin,e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, String value, YamlConfiguration config){
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
private static void set(String path, Integer value, YamlConfiguration config){
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
private static void set(String path, Boolean value, YamlConfiguration config){
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
private static void set(String path, List value, YamlConfiguration config){
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Give_UseItem {
|
||||
private static String prefix = Util.Prefix;
|
||||
|
||||
|
||||
public static void onGive(Player player) {
|
||||
Integer slot;
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce){
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
if (Select_Database.selectSlot(player) == null) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
slot = Select_Database.selectSlot(player);
|
||||
}
|
||||
}
|
||||
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
|
||||
player.getInventory().addItem(itemStack(player));
|
||||
} else player.getInventory().setItem(slot - 1, itemStack(player));
|
||||
}
|
||||
|
||||
public static void onGiveADD(Player player) {
|
||||
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
|
||||
player.getInventory().addItem(itemStack(player));
|
||||
} else player.getInventory().addItem(itemStack(player));
|
||||
}
|
||||
|
||||
private static ItemStack itemStack(Player player) {
|
||||
ItemStack item = null;
|
||||
if (SelectConfig.UseItem_PlayerHead_Enable) {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
send.player(player, Main.prefix + "§c Playerheads for UseItem are only available from version §61.13§c!");
|
||||
send.error(Main.plugin, "Playerheads for UseItem are only available from version 1.13!");
|
||||
} else {
|
||||
item = ItemVersion.getHeadIS();
|
||||
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||
playerheadmeta.setDisplayName(SelectConfig.UseItem_Name);
|
||||
if (SelectConfig.UseItem_Base64_Enable) {
|
||||
if (Main.PaPi) {
|
||||
playerheadmeta.setLore(Replace.replace(prefix, player, SelectConfig.UseItem_Lore));
|
||||
} else playerheadmeta.setLore(Replace.replace(prefix, SelectConfig.UseItem_Lore));
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||
profile.getProperties().put("textures", new Property("textures", SelectConfig.UseItem_Base64value));
|
||||
Field profileField = null;
|
||||
try {
|
||||
profileField = playerheadmeta.getClass().getDeclaredField("profile");
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(playerheadmeta, profile);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
String p;
|
||||
if (SelectConfig.UseItem_PlayerWhoHasOpenedTheGUI) {
|
||||
p = player.getName();
|
||||
} else p = SelectConfig.UseItem_PlayerName;
|
||||
playerheadmeta.setOwner(p);
|
||||
if (Main.PaPi) {
|
||||
playerheadmeta.setLore(Replace.replace(prefix, player, SelectConfig.UseItem_Lore));
|
||||
} else playerheadmeta.setLore(Replace.replace(prefix, SelectConfig.UseItem_Lore));
|
||||
}
|
||||
item.setItemMeta(playerheadmeta);
|
||||
}
|
||||
} else {
|
||||
item = new ItemStack(Material.valueOf(SelectConfig.UseItem_Material));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(SelectConfig.UseItem_Name);
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setLore(Replace.replace(prefix, player, SelectConfig.UseItem_Lore));
|
||||
} else itemMeta.setLore(Replace.replace(prefix, SelectConfig.UseItem_Lore));
|
||||
item.setItemMeta(itemMeta);
|
||||
item.setAmount(1);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.GUI_Listener;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events_from1_10;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_Admin;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.DefaultGUICreate;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.LanguagesCreate;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.PluginEvent;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Obj_Select;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.ConfigCreate;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
public class Load {
|
||||
static Plugin plugin = Main.plugin;
|
||||
|
||||
public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
||||
|
||||
Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
try {
|
||||
Debug.debugmsg();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
|
||||
|
||||
if (!new File(Main.getPath(), "config.yml").exists()) {
|
||||
try {
|
||||
DefaultGUICreate.configCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
ConfigCreate.configCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
SelectConfig.onSelect();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (SelectConfig.Bungee) {
|
||||
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin,"cgui:bungee")){
|
||||
send.debug(plugin, "registerIncomingPluginChannel §ecgui:bungee");
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin,"cgui:bungee");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
LanguagesCreate.langCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
Obj_Select.onSelect();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CmdExecuter_GUI.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
SelectMessages.onSelect(prefix);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
SelectConfig.sound(prefix);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.main();
|
||||
try {
|
||||
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Name` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Status` INT(1) NOT NULL DEFAULT '1'," +
|
||||
" `Slot` INT(1) NULL DEFAULT NULL," +
|
||||
" UNIQUE INDEX `UUID` (`UUID`)" +
|
||||
")" +
|
||||
"COLLATE='utf8mb4_general_ci'" +
|
||||
"ENGINE=InnoDB" +
|
||||
";");
|
||||
MySQL.query("ALTER TABLE `gui-item` ADD COLUMN IF NOT EXISTS `Slot` INT(1) NULL DEFAULT NULL AFTER `Status`;");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (SelectConfig.Debug) send.console(prefix + " §6Storage medium §2YML §6is used.");
|
||||
}
|
||||
if (Main.PaPi) {
|
||||
send.console(prefix + " §2PlaceholderAPI successfully connected!");
|
||||
} else {
|
||||
send.console(prefix + " §4PlaceholderAPI could not be connected / found!");
|
||||
}
|
||||
|
||||
try {
|
||||
RegisterPermissions.onPermRegister();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Main.plugin.getCommand("commandguiadmin").setExecutor(new CmdExecuter_Admin());
|
||||
// send.debug(plugin, "Commandregister: commandguiadmin");
|
||||
|
||||
if (SelectConfig.HelpAlias) {
|
||||
Main.plugin.getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
||||
send.debug(plugin, "Commandregister: commandguihelp");
|
||||
}
|
||||
Main.plugin.getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
|
||||
send.debug(plugin, "Commandregister: commandgui");
|
||||
Main.plugin.getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
||||
send.debug(plugin, "Commandregister: commandgui-item");
|
||||
|
||||
try {
|
||||
AliasRegister.onRegister();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new GUI_Listener(), plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.plugin);
|
||||
|
||||
if (!MCVersion.minecraft1_8 && !MCVersion.minecraft1_9) {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Events_from1_10(), plugin);
|
||||
}
|
||||
|
||||
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
Metrics.Bstats();
|
||||
Main.addonLoad();
|
||||
T2CodeTemplate.onLoadFooter(prefix, long_);
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
||||
public class RegisterPermissions {
|
||||
public static void onPermRegister() {
|
||||
for (Object gui : Main.guiHashMap.values()) {
|
||||
if (Bukkit.getPluginManager().getPermission("commandgui.command." + gui.Command_Command) == null) {
|
||||
Bukkit.getPluginManager().addPermission(new Permission("commandgui.command." + gui.Command_Command));
|
||||
}
|
||||
for (Slot slot : gui.GUI_Slots) {
|
||||
if (Bukkit.getPluginManager().getPermission("commandgui." + gui.Command_Command + ".slot." + (slot.Slot + 1)) == null) {
|
||||
Bukkit.getPluginManager().addPermission(new Permission("commandgui." + gui.Command_Command + ".slot." + (slot.Slot + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,191 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system.config;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class DefaultGUICreate {
|
||||
|
||||
private static Boolean GUI_Enable = true;
|
||||
private static Integer GUI_Lines = 1;
|
||||
private static String GUI_Name = "&5default &9GUI";
|
||||
private static Boolean GUI_FillItem_Enable = true;
|
||||
private static Integer GUI_FillItem_Item_1_8 = 15;
|
||||
private static String GUI_FillItem_Item = "BLACK_STAINED_GLASS_PANE";
|
||||
|
||||
private static Boolean Command_Alias = true;
|
||||
private static Boolean Command_Permission = true;
|
||||
|
||||
private static Integer slot = 5;
|
||||
private static Boolean enable = true;
|
||||
private static Boolean ItemEmty = false;
|
||||
private static Integer ItemAmout = 1;
|
||||
private static Boolean Playerhead_enable = true;
|
||||
private static Boolean base64_Enable = true;
|
||||
private static String base64value = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19";
|
||||
private static Boolean PlayerWhoHasOpenedTheGUI = false;
|
||||
private static String PlayerName = "";
|
||||
private static String Item = "";
|
||||
private static String Itemname = "&3Support Discord";
|
||||
private static List ItemLore = Arrays.asList(
|
||||
"&8-----------------",
|
||||
"&bIf you need help setting up the plugin,",
|
||||
"&bfeel free to contact me on the Suport Discord.",
|
||||
"&8-----------------",
|
||||
"&eIf you find any errors or bugs,",
|
||||
"&eplease contact me so I can fix them.",
|
||||
"&8-----------------",
|
||||
"&5Discord: §7http://dc.t2code.net");
|
||||
private static Boolean CustomSound = false;
|
||||
private static Boolean CustomSound_NoSound = false;
|
||||
private static String CustomSound_Sound = "";
|
||||
private static Boolean Cost = false;
|
||||
private static Double Cost_Price = 0.0;
|
||||
private static Boolean Command = false;
|
||||
private static Boolean BungeeCommand = false;
|
||||
private static Boolean CommandAsConsole = false;
|
||||
private static List Commands = Arrays.asList();
|
||||
private static Boolean Server_Change = false;
|
||||
private static String Server_Change_Server = "";
|
||||
private static Boolean OpenGUI = false;
|
||||
private static String OpenGUI_GUI = "";
|
||||
private static Boolean Message = true;
|
||||
private static List Messages = Arrays.asList("&6You can find more information on Discord: &ehttp://dc.t2code.net");
|
||||
private static Boolean Permission = false;
|
||||
|
||||
private static Boolean SetConfig_Enable = false;
|
||||
private static String SetConfig_FilePath = "";
|
||||
private static String SetConfig_OptionPath = "";
|
||||
private static String SetConfig_OptionPremat = "String";
|
||||
|
||||
private static String SetConfig_ValueLeftString = "";
|
||||
private static Boolean SetConfig_ValueLeftBoolean = false;
|
||||
private static Integer SetConfig_ValueLeftInteger = 0;
|
||||
private static Double SetConfig_ValueLeftDouble = 0.0;
|
||||
private static List SetConfig_ValueLeftList = Arrays.asList();
|
||||
|
||||
private static String SetConfig_ValueRightString = "";
|
||||
private static Boolean SetConfig_ValueRightBoolean = false;
|
||||
private static Integer SetConfig_ValueRightInteger = 0;
|
||||
private static Double SetConfig_ValueRightDouble = 0.0;
|
||||
private static List SetConfig_ValueRightList = Arrays.asList();
|
||||
|
||||
private static Boolean SetConfig_PluginReloadEnable = false;
|
||||
private static String SetConfig_PluginReloadCommand = "";
|
||||
|
||||
|
||||
|
||||
public static void configCreate() {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
send.console(Main.prefix + " §4Default GUI file (GUIs/default.yml) is loaded...");
|
||||
File config = new File(Main.getPath(), "GUIs/default.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
set("GUI.Enable", GUI_Enable, yamlConfiguration);
|
||||
set("GUI.Lines", GUI_Lines, yamlConfiguration);
|
||||
set("GUI.Name", GUI_Name, yamlConfiguration);
|
||||
set("GUI.FillItem.Enable", GUI_FillItem_Enable, yamlConfiguration);
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
set("GUI.FillItem.GlassPaneCollor", GUI_FillItem_Item_1_8, yamlConfiguration);
|
||||
} else set("GUI.FillItem.Item", GUI_FillItem_Item, yamlConfiguration);
|
||||
|
||||
set("Command.Alias", Command_Alias, yamlConfiguration);
|
||||
set("Command.Permission.Required", Command_Permission, yamlConfiguration);
|
||||
set("Slots.Example.Slot", slot, yamlConfiguration);
|
||||
set("Slots.Example.Enable", enable, yamlConfiguration);
|
||||
set("Slots.Example.Item.Empty", ItemEmty, yamlConfiguration);
|
||||
set("Slots.Example.Item.Amount", ItemAmout, yamlConfiguration);
|
||||
if (!(MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12)) {
|
||||
set("Slots.Example.Item.PlayerHead.Enable", Playerhead_enable, yamlConfiguration);
|
||||
set("Slots.Example.Item.PlayerHead.Base64.Enable", base64_Enable, yamlConfiguration);
|
||||
set("Slots.Example.Item.PlayerHead.Base64.Base64Value", base64value, yamlConfiguration);
|
||||
set("Slots.Example.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", PlayerWhoHasOpenedTheGUI, yamlConfiguration);
|
||||
set("Slots.Example.Item.PlayerHead.PlayerName", PlayerName, yamlConfiguration);
|
||||
}
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
set("Slots.Example.Item.Material", "TNT", yamlConfiguration);
|
||||
} else set("Slots.Example.Item.Material", Item, yamlConfiguration);
|
||||
set("Slots.Example.Item.Name", Itemname, yamlConfiguration);
|
||||
set("Slots.Example.Item.Lore", ItemLore, yamlConfiguration);
|
||||
set("Slots.Example.CustomSound.Enable", CustomSound, yamlConfiguration);
|
||||
set("Slots.Example.CustomSound.NoSound", CustomSound_NoSound, yamlConfiguration);
|
||||
set("Slots.Example.CustomSound.Sound", CustomSound_Sound, yamlConfiguration);
|
||||
set("Slots.Example.Cost.Enable", Cost, yamlConfiguration);
|
||||
set("Slots.Example.Cost.Price", Cost_Price, yamlConfiguration);
|
||||
set("Slots.Example.Command.Enable", Command, yamlConfiguration);
|
||||
set("Slots.Example.Command.BungeeCommand", BungeeCommand, yamlConfiguration);
|
||||
set("Slots.Example.Command.CommandAsConsole", CommandAsConsole, yamlConfiguration);
|
||||
set("Slots.Example.Command.Command", Commands, yamlConfiguration);
|
||||
set("Slots.Example.ServerChange.Enable", Server_Change, yamlConfiguration);
|
||||
set("Slots.Example.ServerChange.Server", Server_Change_Server, yamlConfiguration);
|
||||
set("Slots.Example.OpenGUI.Enable", OpenGUI, yamlConfiguration);
|
||||
set("Slots.Example.OpenGUI.GUI", OpenGUI_GUI, yamlConfiguration);
|
||||
set("Slots.Example.Message.Enable", Message, yamlConfiguration);
|
||||
set("Slots.Example.Message.Message", Messages, yamlConfiguration);
|
||||
set("Slots.Example.Permission.Required", Permission, yamlConfiguration);
|
||||
|
||||
set("Slots.Example.SetConfig.Enable", SetConfig_Enable, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.File.Path", SetConfig_FilePath, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Option.Path", SetConfig_OptionPath, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Option.Premat", SetConfig_OptionPremat, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.LeftClick.String", SetConfig_ValueLeftString, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.LeftClick.Boolean", SetConfig_ValueLeftBoolean, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.LeftClick.Integer", SetConfig_ValueLeftInteger, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.LeftClick.Double", SetConfig_ValueLeftDouble, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.LeftClick.List", SetConfig_ValueLeftList, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.RightClick.String", SetConfig_ValueRightString, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.RightClick.Boolean", SetConfig_ValueRightBoolean, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.RightClick.Integer", SetConfig_ValueRightInteger, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.RightClick.Double", SetConfig_ValueRightDouble, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.Value.RightClick.List", SetConfig_ValueRightList, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.PluginReload.Enable", SetConfig_PluginReloadEnable, yamlConfiguration);
|
||||
set("Slots.Example.SetConfig.PluginReload.Command", SetConfig_PluginReloadCommand, yamlConfiguration);
|
||||
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
send.console(Main.prefix + " §2Default GUI file (GUIs/default.yml) was loaded." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
|
||||
private static void set(String path, String value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Integer value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Boolean value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, List value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Double value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,226 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system.config.config;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ConfigCreate {
|
||||
|
||||
private static String prefix = Util.Prefix;
|
||||
|
||||
public static Integer ConfigVersion = 2;
|
||||
|
||||
private static Boolean UpdateCheckOnJoin = true;
|
||||
private static Boolean Debug = false;
|
||||
private static Boolean HelpAlias = true;
|
||||
private static String language = "english";
|
||||
private static String Currency = "$";
|
||||
private static String DefaultGUI = "default";
|
||||
|
||||
|
||||
private static String Storage = "YML";
|
||||
private static String ip = "localhost";
|
||||
private static Integer port = 3306;
|
||||
private static String database = "database";
|
||||
private static String user = "root";
|
||||
private static String password = "password";
|
||||
private static Boolean SSL = false;
|
||||
|
||||
private static Boolean Bungee = false;
|
||||
private static String thisServer = "server";
|
||||
|
||||
|
||||
private static Boolean UseItem_Enable = true;
|
||||
private static Boolean UseItem_AllowToggle = true;
|
||||
private static Boolean UseItem_AllowSetSlot = true;
|
||||
private static Boolean UseItem_BlockMoveAndDrop = true;
|
||||
private static String UseItem_OpenGUI = "default";
|
||||
private static Boolean UseItem_Permission = true;
|
||||
private static Boolean UseItem_KeepAtCommandClear = true;
|
||||
|
||||
private static Integer UseItem_InventorySlot = 1;
|
||||
private static Boolean UseItem_InventorySlotEnforce = false;
|
||||
private static Boolean UseItem_InventorySlot_FreeSlot = false;
|
||||
private static String UseItem_Material = "paper";
|
||||
private static Boolean UseItem_PlayerHead_Enable = false;
|
||||
private static Boolean base64_Enable = false;
|
||||
private static String base64value= "";
|
||||
private static Boolean UseItem_PlayerWhoHasOpenedTheGUI = false;
|
||||
private static String UseItem_PlayerName = "";
|
||||
private static String UseItem_Name = "&bDefault &6GUI";
|
||||
private static List UseItem_Lore = Arrays.asList("&eThis is an example GUI");
|
||||
private static Boolean UseItem_GiveOnEveryJoin = true;
|
||||
private static Boolean UseItem_GiveOnlyOnFirstJoin = false;
|
||||
private static Boolean Cursor_ToGUIItem_OnLogin = true;
|
||||
private static Boolean Cursor_ToGUIItem_OnlyOnFirstLogin = true;
|
||||
private static Boolean Cursor_ServerChange_EXPERIMENTELL = false;
|
||||
|
||||
private static int UseItemGameModeChangeDelayInTicks = 1;
|
||||
private static boolean UseItemGameModeChangeDisableInSpectator = true;
|
||||
|
||||
private static Boolean Sound_Enable = true;
|
||||
|
||||
private static Boolean Sound_OpenInventory_Enable = true;
|
||||
public static String Sound_OpenInventory_1_8 = "CHEST_OPEN";
|
||||
public static String Sound_OpenInventory_ab_1_9 = "BLOCK_CHEST_OPEN";
|
||||
|
||||
private static Boolean Sound_Click_Enable = true;
|
||||
public static String Sound_Click_1_8 = "NOTE_STICKS";
|
||||
public static String Sound_Click_1_9_bis_1_12 = "BLOCK_NOTE_HAT";
|
||||
public static String Sound_Click_ab_1_13 = "BLOCK_NOTE_BLOCK_HAT";
|
||||
|
||||
private static Boolean Sound_NoMoney_Enable = true;
|
||||
public static String Sound_NoMoney_1_8 = "NOTE_PIANO";
|
||||
public static String Sound_NoMoney_1_9_bis_1_12 = "BLOCK_NOTE_HARP";
|
||||
public static String Sound_NoMoney_ab_1_13 = "BLOCK_NOTE_BLOCK_HARP";
|
||||
|
||||
private static Boolean Sound_NoInventorySpace_Enable = true;
|
||||
public static String Sound_NoInventorySpace_1_8 = "NOTE_PIANO";
|
||||
public static String Sound_NoInventorySpace_1_9_bis_1_12 = "BLOCK_NOTE_HARP";
|
||||
public static String Sound_NoInventorySpace_ab_1_13 = "BLOCK_NOTE_BLOCK_HARP";
|
||||
|
||||
private static Boolean Sound_Give_Enable = true;
|
||||
public static String Sound_Give_1_8 = "LEVEL_UP";
|
||||
public static String Sound_Give_ab_1_9 = "ENTITY_PLAYER_LEVELUP";
|
||||
|
||||
private static Boolean Sound_PlayerNotFound_Enable = true;
|
||||
public static String Sound_PlayerNotFound_1_8 = "NOTE_PIANO";
|
||||
public static String Sound_PlayerNotFound_1_9_bis_1_12 = "BLOCK_NOTE_HARP";
|
||||
public static String Sound_PlayerNotFound_ab_1_13 = "BLOCK_NOTE_BLOCK_HARP";
|
||||
|
||||
|
||||
public static void configCreate() {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
if (new File(Main.getPath(), "config.yml").exists()){
|
||||
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Main.prefix + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
} else send.console(Main.prefix + " §4config.yml are created...");
|
||||
|
||||
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
yamlConfiguration.set("ConfigVersion", ConfigVersion);
|
||||
|
||||
Config.set("Plugin.UpdateCheckOnJoin", UpdateCheckOnJoin, yamlConfiguration);
|
||||
Config.set("Plugin.Debug", Debug, yamlConfiguration);
|
||||
Config.set("Plugin.HelpAlias", HelpAlias, yamlConfiguration);
|
||||
Config.set("Plugin.language", language, yamlConfiguration);
|
||||
Config.set("Plugin.Currency", Currency, yamlConfiguration);
|
||||
Config.set("Plugin.DefaultGUI", DefaultGUI, yamlConfiguration);
|
||||
|
||||
Config.set("Storage.Type", Storage, yamlConfiguration);
|
||||
Config.set("Storage.MySQL.IP", ip, yamlConfiguration);
|
||||
Config.set("Storage.MySQL.Port", port, yamlConfiguration);
|
||||
Config.set("Storage.MySQL.Database", database, yamlConfiguration);
|
||||
Config.set("Storage.MySQL.User", user, yamlConfiguration);
|
||||
Config.set("Storage.MySQL.Password", password, yamlConfiguration);
|
||||
Config.set("Storage.MySQL.SSL", SSL, yamlConfiguration);
|
||||
|
||||
Config.set("BungeeCord.Enable", Bungee, yamlConfiguration);
|
||||
Config.set("BungeeCord.ThisServer", thisServer, yamlConfiguration);
|
||||
|
||||
Config.set("UseItem.Enable", UseItem_Enable, yamlConfiguration);
|
||||
Config.set("UseItem.AllowToggle", UseItem_AllowToggle, yamlConfiguration);
|
||||
Config.set("UseItem.AllowSetSlot", UseItem_AllowSetSlot, yamlConfiguration);
|
||||
Config.set("UseItem.BlockMoveAndDrop", UseItem_BlockMoveAndDrop, yamlConfiguration);
|
||||
Config.set("UseItem.OpenGUI", UseItem_OpenGUI, yamlConfiguration);
|
||||
Config.set("UseItem.Permission.NeededToUse", UseItem_Permission, yamlConfiguration);
|
||||
Config.set("UseItem.KeepAtCommandClear", UseItem_KeepAtCommandClear, yamlConfiguration);
|
||||
|
||||
Config.set("UseItem.InventorySlot.Slot", UseItem_InventorySlot, yamlConfiguration);
|
||||
Config.set("UseItem.InventorySlot.SlotEnforce", UseItem_InventorySlotEnforce, yamlConfiguration);
|
||||
Config.set("UseItem.InventorySlot.FreeSlot", UseItem_InventorySlot_FreeSlot, yamlConfiguration);
|
||||
|
||||
Config.set("UseItem.Item.Material", UseItem_Material, yamlConfiguration);
|
||||
if (!(MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12)) {
|
||||
Config.set("UseItem.Item.PlayerHead.Enable", UseItem_PlayerHead_Enable, yamlConfiguration);
|
||||
Config.set("UseItem.Item.PlayerHead.Base64.Enable", base64_Enable, yamlConfiguration);
|
||||
Config.set("UseItem.Item.PlayerHead.Base64.Base64Value", base64value, yamlConfiguration);
|
||||
Config.set("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", UseItem_PlayerWhoHasOpenedTheGUI, yamlConfiguration);
|
||||
Config.set("UseItem.Item.PlayerHead.Playername", UseItem_PlayerName, yamlConfiguration);
|
||||
}
|
||||
Config.set("UseItem.Item.Name", UseItem_Name, yamlConfiguration);
|
||||
Config.set("UseItem.Item.Lore", UseItem_Lore, yamlConfiguration);
|
||||
Config.set("UseItem.Join.GiveOnEveryJoin", UseItem_GiveOnEveryJoin, yamlConfiguration);
|
||||
Config.set("UseItem.Join.GiveOnlyOnFirstJoin", UseItem_GiveOnlyOnFirstJoin, yamlConfiguration);
|
||||
|
||||
//convert
|
||||
if (yamlConfiguration.contains("UseItem.Join.Cursor.ToGUIItem.OnEveryLogin")){
|
||||
Config.set("UseItem.Join.Cursor.ToGUIItem.OnEveryLogin", yamlConfiguration);
|
||||
Config.set("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnEveryLogin"), yamlConfiguration);
|
||||
}
|
||||
if (yamlConfiguration.contains("UseItem.Join.Cursor.ToGUIItem.OnOnlyFirstLogin")){
|
||||
Config.set("UseItem.Join.Cursor.ToGUIItem.OnOnlyFirstLogin", yamlConfiguration);
|
||||
Config.set("UseItem.Join.Cursor.ToGUIItem.Spigot.OnOnlyFirstLogin", yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnOnlyFirstLogin"), yamlConfiguration);
|
||||
}
|
||||
if (yamlConfiguration.contains("UseItem.Join.Cursor.ToGUIItem.EXPERIMENTELL_ServerChange")){
|
||||
Config.set("UseItem.Join.Cursor.ToGUIItem.EXPERIMENTELL_ServerChange", yamlConfiguration);
|
||||
Config.set("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.EXPERIMENTELL_ServerChange"), yamlConfiguration);
|
||||
}
|
||||
|
||||
Config.set("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", Cursor_ToGUIItem_OnLogin, yamlConfiguration);
|
||||
Config.set("UseItem.Join.Cursor.ToGUIItem.Spigot.OnOnlyFirstLogin", Cursor_ToGUIItem_OnlyOnFirstLogin, yamlConfiguration);
|
||||
Config.set("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", Cursor_ServerChange_EXPERIMENTELL, yamlConfiguration);
|
||||
|
||||
Config.set("Advanced.UseItem.GameModeChange.DelayInTicks", UseItemGameModeChangeDelayInTicks, yamlConfiguration);
|
||||
Config.set("Advanced.UseItem.GameModeChange.DisableInSpectator", UseItemGameModeChangeDisableInSpectator, yamlConfiguration);
|
||||
|
||||
Config.set("Sound.Enable", Sound_Enable, yamlConfiguration);
|
||||
|
||||
Config.set("Sound.OpenInventory.Enable", Sound_OpenInventory_Enable, yamlConfiguration);
|
||||
if (MCVersion.minecraft1_8) {
|
||||
Config.set("Sound.OpenInventory.Sound", Sound_OpenInventory_1_8, yamlConfiguration);
|
||||
} else Config.set("Sound.OpenInventory.Sound", Sound_OpenInventory_ab_1_9, yamlConfiguration);
|
||||
|
||||
Config.set("Sound.Click.Enable", Sound_Click_Enable, yamlConfiguration);
|
||||
if (MCVersion.minecraft1_8) {
|
||||
Config.set("Sound.Click.Sound", Sound_Click_1_8, yamlConfiguration);
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
Config.set("Sound.Click.Sound", Sound_Click_1_9_bis_1_12, yamlConfiguration);
|
||||
} else Config.set("Sound.Click.Sound", Sound_Click_ab_1_13, yamlConfiguration);
|
||||
|
||||
Config.set("Sound.NoMoney.Enable", Sound_NoMoney_Enable, yamlConfiguration);
|
||||
if (MCVersion.minecraft1_8) {
|
||||
Config.set("Sound.NoMoney.Sound", Sound_NoMoney_1_8, yamlConfiguration);
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
Config.set("Sound.NoMoney.Sound", Sound_NoMoney_1_9_bis_1_12, yamlConfiguration);
|
||||
} else Config.set("Sound.NoMoney.Sound", Sound_NoMoney_ab_1_13, yamlConfiguration);
|
||||
|
||||
Config.set("Sound.NoInventorySpace.Enable", Sound_NoInventorySpace_Enable, yamlConfiguration);
|
||||
if (MCVersion.minecraft1_8) {
|
||||
Config.set("Sound.NoInventorySpace.Sound", Sound_NoInventorySpace_1_8, yamlConfiguration);
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
Config.set("Sound.NoInventorySpace.Sound", Sound_NoInventorySpace_1_9_bis_1_12, yamlConfiguration);
|
||||
} else Config.set("Sound.NoInventorySpace.Sound", Sound_NoInventorySpace_ab_1_13, yamlConfiguration);
|
||||
|
||||
Config.set("Sound.Give.Enable", Sound_Give_Enable, yamlConfiguration);
|
||||
if (MCVersion.minecraft1_8) {
|
||||
Config.set("Sound.Give.Sound", Sound_Give_1_8, yamlConfiguration);
|
||||
} else Config.set("Sound.Give.Sound", Sound_Give_ab_1_9, yamlConfiguration);
|
||||
|
||||
Config.set("Sound.PlayerNotFound.Enable", Sound_PlayerNotFound_Enable, yamlConfiguration);
|
||||
if (MCVersion.minecraft1_8) {
|
||||
Config.set("Sound.PlayerNotFound.Sound", Sound_PlayerNotFound_1_8, yamlConfiguration);
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
Config.set("Sound.PlayerNotFound.Sound", Sound_PlayerNotFound_1_9_bis_1_12, yamlConfiguration);
|
||||
} else Config.set("Sound.PlayerNotFound.Sound", Sound_PlayerNotFound_ab_1_13, yamlConfiguration);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
send.console(Main.prefix + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
|
||||
}
|
||||
}
|
|
@ -1,279 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system.config.config;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class SelectConfig {private static String prefix = Util.Prefix;
|
||||
|
||||
public static Boolean DisableUpdateChecker;
|
||||
public static Boolean UpdateCheckOnJoin;
|
||||
public static Boolean Debug;
|
||||
public static Boolean HelpAlias;
|
||||
public static String language;
|
||||
public static String Currency;
|
||||
|
||||
public static String Storage;
|
||||
|
||||
public static Boolean Bungee;
|
||||
public static String thisServer;
|
||||
|
||||
public static String DefaultGUI;
|
||||
|
||||
public static Boolean UseItem_Enable;
|
||||
public static Boolean UseItem_AllowToggle;
|
||||
public static Boolean UseItem_AllowSetSlot;
|
||||
public static Boolean UseItem_GiveOnEveryJoin;
|
||||
public static Boolean UseItem_GiveOnlyOnFirstJoin;
|
||||
public static Boolean UseItem_ServerChange;
|
||||
public static Boolean Cursor_ToGUIItem_OnLogin;
|
||||
public static Boolean Cursor_ToGUIItem_OnlyOnFirstLogin;
|
||||
public static Boolean UseItem_BlockMoveAndDrop;
|
||||
public static String UseItem_OpenGUI;
|
||||
public static Boolean UseItem_Permission;
|
||||
public static Boolean UseItem_KeepAtCommandClear;
|
||||
|
||||
public static int UseItemGameModeChangeDelayInTicks;
|
||||
public static Boolean UseItemGameModeChangeDisableInSpectator;
|
||||
|
||||
public static Boolean UseItem_InventorySlot_FreeSlot;
|
||||
public static Integer UseItem_InventorySlot;
|
||||
public static Boolean UseItem_InventorySlotEnforce;
|
||||
public static String UseItem_Material;
|
||||
public static Boolean UseItem_PlayerHead_Enable;
|
||||
public static Boolean UseItem_Base64_Enable;
|
||||
public static String UseItem_Base64value;
|
||||
public static Boolean UseItem_PlayerWhoHasOpenedTheGUI;
|
||||
public static String UseItem_PlayerName;
|
||||
public static String UseItem_Name;
|
||||
public static List UseItem_Lore;
|
||||
|
||||
public static Boolean Sound_Enable = true;
|
||||
|
||||
public static Boolean Sound_OpenInventory_Enable = true;
|
||||
public static Sound Sound_OpenInventory;
|
||||
public static String Sound_OpenInventory_input;
|
||||
|
||||
public static Boolean Sound_Click_Enable = true;
|
||||
public static Sound Sound_Click;
|
||||
public static String Sound_Click_input;
|
||||
|
||||
public static Boolean Sound_NoMoney_Enable = true;
|
||||
public static Sound Sound_NoMoney;
|
||||
public static String Sound_NoMoney_input;
|
||||
|
||||
|
||||
public static Boolean Sound_NoInventorySpace_Enable = true;
|
||||
public static Sound Sound_NoInventorySpace;
|
||||
public static String Sound_NoInventorySpace_input;
|
||||
|
||||
public static Boolean Sound_Give_Enable = true;
|
||||
public static Sound Sound_Give;
|
||||
public static String Sound_Give_input;
|
||||
|
||||
public static Boolean Sound_PlayerNotFound_Enable = true;
|
||||
public static Sound Sound_PlayerNotFound;
|
||||
public static String Sound_PlayerNotFound_input;
|
||||
|
||||
|
||||
public static void onSelect() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (yamlConfiguration.get("Plugin.DisableUpdateChecker") == null) {
|
||||
DisableUpdateChecker = false;
|
||||
} else DisableUpdateChecker = yamlConfiguration.getBoolean("Plugin.DisableUpdateChecker");
|
||||
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
|
||||
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||
HelpAlias = yamlConfiguration.getBoolean("Plugin.HelpAlias");
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
Currency = yamlConfiguration.getString("Plugin.Currency");
|
||||
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");
|
||||
|
||||
Storage = yamlConfiguration.getString("Storage.Type").toUpperCase();
|
||||
|
||||
MySQL.ip = yamlConfiguration.getString("Storage.MySQL.IP");
|
||||
MySQL.port = yamlConfiguration.getInt("Storage.MySQL.Port");
|
||||
MySQL.database = yamlConfiguration.getString("Storage.MySQL.Database");
|
||||
MySQL.user = yamlConfiguration.getString("Storage.MySQL.User");
|
||||
MySQL.password = yamlConfiguration.getString("Storage.MySQL.Password");
|
||||
MySQL.SSL = yamlConfiguration.getBoolean("Storage.MySQL.SSL");
|
||||
|
||||
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
||||
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
|
||||
|
||||
|
||||
UseItem_Enable = yamlConfiguration.getBoolean("UseItem.Enable");
|
||||
UseItem_AllowToggle = yamlConfiguration.getBoolean("UseItem.AllowToggle");
|
||||
UseItem_AllowSetSlot = yamlConfiguration.getBoolean("UseItem.AllowSetSlot");
|
||||
UseItem_BlockMoveAndDrop = yamlConfiguration.getBoolean("UseItem.BlockMoveAndDrop");
|
||||
UseItem_OpenGUI = yamlConfiguration.getString("UseItem.OpenGUI");
|
||||
UseItem_Permission = yamlConfiguration.getBoolean("UseItem.Permission.NeededToUse");
|
||||
UseItem_KeepAtCommandClear = yamlConfiguration.getBoolean("UseItem.KeepAtCommandClear");
|
||||
|
||||
UseItem_InventorySlot_FreeSlot = yamlConfiguration.getBoolean("UseItem.InventorySlot.FreeSlot");
|
||||
UseItem_InventorySlot = yamlConfiguration.getInt("UseItem.InventorySlot.Slot");
|
||||
UseItem_InventorySlotEnforce = yamlConfiguration.getBoolean("UseItem.InventorySlot.SlotEnforce");
|
||||
UseItem_Material = yamlConfiguration.getString("UseItem.Item.Material").toUpperCase();
|
||||
UseItem_PlayerHead_Enable = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.Enable");
|
||||
UseItem_Base64_Enable = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.Base64.Enable");
|
||||
UseItem_Base64value = yamlConfiguration.getString("UseItem.Item.PlayerHead.Base64.Base64Value");
|
||||
UseItem_PlayerWhoHasOpenedTheGUI = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
||||
UseItem_PlayerName = yamlConfiguration.getString("UseItem.Item.PlayerHead.PlayerName");
|
||||
UseItem_Name = Replace.replace(prefix,yamlConfiguration.getString("UseItem.Item.Name"));
|
||||
UseItem_Lore = yamlConfiguration.getList("UseItem.Item.Lore");
|
||||
UseItem_GiveOnEveryJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnEveryJoin");
|
||||
UseItem_GiveOnlyOnFirstJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnlyOnFirstJoin");
|
||||
Cursor_ToGUIItem_OnLogin = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable");
|
||||
Cursor_ToGUIItem_OnlyOnFirstLogin = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin");
|
||||
UseItem_ServerChange = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange");
|
||||
|
||||
UseItemGameModeChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.GameModeChange.DelayInTicks");
|
||||
UseItemGameModeChangeDisableInSpectator = yamlConfiguration.getBoolean("Advanced.UseItem.GameModeChange.DisableInSpectator");
|
||||
|
||||
Sound_Enable = yamlConfiguration.getBoolean("Sound.Enable");
|
||||
Sound_OpenInventory_Enable = yamlConfiguration.getBoolean("Sound.OpenInventory.Enable");
|
||||
Sound_OpenInventory_input = (yamlConfiguration.getString("Sound.OpenInventory.Sound").toUpperCase().replace(".", "_"));
|
||||
Sound_Click_Enable = yamlConfiguration.getBoolean("Sound.Click.Enable");
|
||||
Sound_Click_input = (yamlConfiguration.getString("Sound.Click.Sound").toUpperCase().replace(".", "_"));
|
||||
Sound_NoMoney_Enable = yamlConfiguration.getBoolean("Sound.NoMoney.Enable");
|
||||
Sound_NoMoney_input = (yamlConfiguration.getString("Sound.NoMoney.Sound").toUpperCase().replace(".", "_"));
|
||||
|
||||
Sound_NoInventorySpace_Enable = yamlConfiguration.getBoolean("Sound.NoInventorySpace.Enable");
|
||||
Sound_NoInventorySpace_input = (yamlConfiguration.getString("Sound.NoInventorySpace.Sound").toUpperCase().replace(".", "_"));
|
||||
Sound_Give_Enable = yamlConfiguration.getBoolean("Sound.Give.Enable");
|
||||
Sound_Give_input = (yamlConfiguration.getString("Sound.Give.Sound").toUpperCase().replace(".", "_"));
|
||||
Sound_PlayerNotFound_Enable = yamlConfiguration.getBoolean("Sound.PlayerNotFound.Enable");
|
||||
Sound_PlayerNotFound_input = (yamlConfiguration.getString("Sound.PlayerNotFound.Sound").toUpperCase().replace(".", "_"));
|
||||
|
||||
}
|
||||
|
||||
public static void sound(String Prefix) {
|
||||
String soundOpenInventory;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
soundOpenInventory = ConfigCreate.Sound_OpenInventory_1_8;
|
||||
} else {
|
||||
soundOpenInventory = ConfigCreate.Sound_OpenInventory_ab_1_9;
|
||||
}
|
||||
|
||||
String soundClick;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
soundClick = ConfigCreate.Sound_Click_1_8;
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
soundClick = ConfigCreate.Sound_Click_1_9_bis_1_12;
|
||||
} else {
|
||||
soundClick = ConfigCreate.Sound_Click_ab_1_13;
|
||||
}
|
||||
|
||||
String soundNoMoney;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
soundNoMoney = ConfigCreate.Sound_NoMoney_1_8;
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
soundNoMoney = ConfigCreate.Sound_NoMoney_1_9_bis_1_12;
|
||||
} else {
|
||||
soundNoMoney = ConfigCreate.Sound_NoMoney_ab_1_13;
|
||||
}
|
||||
|
||||
String soundNoInventorySpace;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
soundNoInventorySpace = "NOTE_PIANO";
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
soundNoInventorySpace = "BLOCK_NOTE_BASS";
|
||||
} else {
|
||||
soundNoInventorySpace = "BLOCK_NOTE_BLOCK_GUITAR";
|
||||
}
|
||||
|
||||
String soundGive;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
soundGive = "LEVEL_UP";
|
||||
} else {
|
||||
soundGive = "ENTITY_PLAYER_LEVELUP";
|
||||
}
|
||||
|
||||
String soundPlayerNotFound;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
soundPlayerNotFound = "NOTE_PIANO";
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
soundPlayerNotFound = "BLOCK_NOTE_HARP";
|
||||
} else {
|
||||
soundPlayerNotFound = "BLOCK_NOTE_BLOCK_HARP";
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_OpenInventory = Sound.valueOf(Sound_OpenInventory_input);
|
||||
if (sound_OpenInventory != null) {
|
||||
Sound_OpenInventory = sound_OpenInventory;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8OpenInventory: §6" + Sound_OpenInventory_input) + "§4\n§4\n§4\n");
|
||||
Sound_OpenInventory = Sound.valueOf(soundOpenInventory);
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_Click = Sound.valueOf(Sound_Click_input);
|
||||
if (sound_Click != null) {
|
||||
Sound_Click = sound_Click;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8Click: §6" + Sound_Click_input) + "§4\n§4\n§4\n");
|
||||
Sound_Click = Sound.valueOf(soundClick);
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_NoMoney = Sound.valueOf(Sound_NoMoney_input);
|
||||
if (sound_NoMoney != null) {
|
||||
Sound_Click = sound_NoMoney;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8NoMoney: §6" + Sound_NoMoney_input) + "§4\n§4\n§4\n");
|
||||
Sound_NoMoney = Sound.valueOf(soundNoMoney);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Sound sound_NoInventorySpace = Sound.valueOf(Sound_NoInventorySpace_input);
|
||||
if (sound_NoInventorySpace != null) {
|
||||
Sound_NoInventorySpace = sound_NoInventorySpace;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8NoInventorySpace: §6" + Sound_NoInventorySpace_input) + "§4\n§4\n§4\n");
|
||||
Sound_NoInventorySpace = Sound.valueOf(soundNoInventorySpace);
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_Give = Sound.valueOf(Sound_Give_input);
|
||||
if (sound_Give != null) {
|
||||
Sound_Give = sound_Give;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8Give: §6" + Sound_Give_input) + "§4\n§4\n§4\n");
|
||||
Sound_Give = Sound.valueOf(soundGive);
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_PlayerNotFound = Sound.valueOf(Sound_PlayerNotFound_input);
|
||||
if (sound_PlayerNotFound != null) {
|
||||
Sound_PlayerNotFound = sound_PlayerNotFound;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8PlayerNotFound: §6" + Sound_PlayerNotFound_input) + "§4\n§4\n§4\n");
|
||||
Sound_PlayerNotFound = Sound.valueOf(soundPlayerNotFound);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.sql.*;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class MySQL {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
public static String ip = "localhost";
|
||||
public static Integer port = 3306;
|
||||
public static String database;
|
||||
public static String user = "root";
|
||||
public static String password = "";
|
||||
public static String url;
|
||||
public static Boolean SSL;
|
||||
|
||||
public static void main() {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
Calendar now = Calendar.getInstance();
|
||||
ZoneId timeZone = now.getTimeZone().toZoneId();
|
||||
send.debug(plugin, "Server TimeZone is : " + timeZone);
|
||||
url = "jdbc:mysql://" + ip + ":" + port + "/" + database + "?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=" + timeZone;
|
||||
// Europe/Berlin
|
||||
if (SSL) {
|
||||
url = url + "&useSSL=true";
|
||||
} else url = url + "&useSSL=false";
|
||||
send.debug(plugin, url);
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.close();
|
||||
send.console(Main.prefix + " §2MySQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} catch (SQLException ex) {
|
||||
send.console(Main.prefix + " §4MySQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
send.error(plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
}
|
||||
|
||||
public static void query(String query) {
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute(query);
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<String> selectAll(String query) {
|
||||
ArrayList<String> Result = new ArrayList<>();
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
Result.add(rs.getString(1));
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static String select(String query) {
|
||||
String Ausgabe = "";
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
Ausgabe = String.valueOf(rs.getString(1));
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Ausgabe;
|
||||
}
|
||||
|
||||
public static int count(String query) {
|
||||
Integer count = 0;
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Select_Database {
|
||||
|
||||
public static void nameCheck(Player player) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setSlot(Player player, Integer slot) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Slot`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "','" + slot + "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Slot` = '" + slot + "';");
|
||||
} else {
|
||||
YML.setGuiitemSlot(player, slot);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setItemStatusTrue(Player player) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '1';");
|
||||
} else {
|
||||
YML.setGuiitemOn(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setItemStatusFalse(Player player) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', '0') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '0';");
|
||||
} else {
|
||||
YML.setGuiitemOff(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean selectItemStatus(Player player) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
if (MySQL.count("SELECT * FROM `gui-item` WHERE BINARY UUID='" + player.getUniqueId() + "'") > 0) {
|
||||
if (MySQL.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';").equals("1")) {
|
||||
return true;
|
||||
} else return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return YML.selectGuiitemOn(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer selectSlot(Player player) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
if (MySQL.count("SELECT * FROM `gui-item` WHERE BINARY UUID='" + player.getUniqueId() + "'") > 0) {
|
||||
if (MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';") != "null") {
|
||||
return Integer.valueOf(MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';"));
|
||||
} else return null;
|
||||
} else return null;
|
||||
|
||||
} else {
|
||||
return YML.selectSlot(player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package de.jatitv.commandguiv2;
|
||||
|
||||
public class Util {
|
||||
public static double requiredT2CodeLibVersion = 8;
|
||||
public static String Prefix = "§8[§4C§9GUI§8]";
|
||||
public static Integer SpigotID = 90671;
|
||||
public static Integer BstatsID = 10840;
|
||||
public static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
|
||||
public static String Discord = "http://dc.t2code.net";
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
package de.jatitv.commandguiv2.api;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.ItemChange;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events_from1_10;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.Help;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.DefaultGUICreate;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CGuiAPI {
|
||||
public static Boolean JoinDisable = false;
|
||||
|
||||
public static void onItemChange(Player player) {
|
||||
ItemChange.itemChange(player);
|
||||
}
|
||||
|
||||
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
||||
JoinDisable = disableItemGiveOnJoin;
|
||||
}
|
||||
|
||||
public static Boolean selectPlayerItemEnable(Player player) {
|
||||
return Select_Database.selectItemStatus(player);
|
||||
}
|
||||
|
||||
public static Integer selectPlayerItemSlot(Player player) {
|
||||
return Select_Database.selectSlot(player);
|
||||
}
|
||||
|
||||
public static void setPlayerItemEnable(Player player, Boolean value) {
|
||||
if (value) {
|
||||
Select_Database.setItemStatusTrue(player);
|
||||
} else Select_Database.setItemStatusFalse(player);
|
||||
}
|
||||
|
||||
public static void setPlayerItemSlot(Player player, Integer value) {
|
||||
Select_Database.setSlot(player, value);
|
||||
}
|
||||
|
||||
public static void openDefaultGUI(Player player) {
|
||||
Commands.gui(player);
|
||||
}
|
||||
|
||||
public static void openGUI(Player player, String GUI_CommandName) {
|
||||
Commands.gui(player, GUI_CommandName);
|
||||
}
|
||||
|
||||
public static void sendHelp(CommandSender sender) {
|
||||
Help.sendHelp(sender, Main.prefix);
|
||||
}
|
||||
|
||||
public static void sendPluginInfo(CommandSender sender) {
|
||||
if (sender.hasPermission("commandgui.command.info")) {
|
||||
Commands.info(sender);
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.command.info"));
|
||||
}
|
||||
|
||||
public static void createDefaultGUI(CommandSender sender) {
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
DefaultGUICreate.configCreate();
|
||||
sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||
}
|
||||
|
||||
public static void reload(CommandSender sender) {
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
Commands.reload(sender);
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
package net.t2code.commandguiv2.Spigot;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
import net.t2code.commandguiv2.Spigot.system.Load;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.database.MySQL;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
public static ArrayList<String> bungeejoinplayers = new ArrayList<>();
|
||||
|
||||
public static File getPath() {
|
||||
return plugin.getDataFolder();
|
||||
}
|
||||
|
||||
private static Boolean enable = false;
|
||||
public static Boolean legacy = false;
|
||||
|
||||
public static String version;
|
||||
|
||||
public static List<String> autor;
|
||||
|
||||
private static Main plugin;
|
||||
|
||||
public static Boolean PaPi = false;
|
||||
public static Boolean PlotSquaredGUI = false;
|
||||
public static Boolean LuckyBox = false;
|
||||
public static Boolean PlugManGUI = false;
|
||||
|
||||
public static HashMap<String, Gui> guiHashMap = new HashMap<>();
|
||||
public static ArrayList<String> allAliases = new ArrayList<>();
|
||||
|
||||
public static HashMap<String, Function> functionHashMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
autor = this.getDescription().getAuthors();
|
||||
version = this.getDescription().getVersion();
|
||||
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12() || T2CmcVersion.isMc1_13() ||
|
||||
T2CmcVersion.isMc1_14() || T2CmcVersion.isMc1_15() || T2CmcVersion.isNms1_16_R1()) {
|
||||
legacy = true;
|
||||
}
|
||||
|
||||
if (T2CpluginCheck.pluginCheck("CommandGUI")) {
|
||||
T2Csend.error( plugin, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.error( plugin,"");
|
||||
T2Csend.error( plugin,"An older version of the plugin T2C-CommandGUI was found!");
|
||||
T2Csend.error( plugin,"This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
|
||||
T2Csend.error( plugin,"Please remove the older version (CommandGUI)!");
|
||||
T2Csend.error( plugin,this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
|
||||
T2Csend.error( plugin,"");
|
||||
T2Csend.error( plugin,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return;
|
||||
}
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
if (T2CpluginCheck.papi()) {
|
||||
PaPi = true;
|
||||
}
|
||||
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
|
||||
enable = true;
|
||||
}
|
||||
|
||||
public static void addonLoad() {
|
||||
if (T2CpluginCheck.plotSquaredGUI()) {
|
||||
PlotSquaredGUI = true;
|
||||
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
|
||||
}
|
||||
|
||||
if (T2CpluginCheck.luckyBox()) {
|
||||
LuckyBox = true;
|
||||
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
|
||||
}
|
||||
|
||||
if (T2CpluginCheck.plugManGUI()) {
|
||||
PlugManGUI = true;
|
||||
addonEnable(Bukkit.getPluginManager().getPlugin("PlugManGUI"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void addonEnable(Plugin plugin) {
|
||||
T2Csend.console(Util.getPrefix() + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
|
||||
}
|
||||
|
||||
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
|
||||
+ "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
} else {
|
||||
String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
|
||||
if (ver.contains("_")) {
|
||||
if (!plVer.equals(ver)) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
|
||||
+ ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
|
||||
+ pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
String[] split = plVer.split("_");
|
||||
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2"
|
||||
+ ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID
|
||||
+ " §4to use this version of " + plugin.getDescription().getName() + ".");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendTryCatch(Class c, StackTraceElement line) {
|
||||
T2Csend.error(plugin,c.getName() + " Line: " + line.getLineNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
if (enable) T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
MySQL.close();
|
||||
}
|
||||
|
||||
public static Main getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,11 @@
|
|||
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.system.Debug;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.DefaultGUICreate;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Bungee.Lib.commands.BTab;
|
||||
import net.t2code.lib.Spigot.Lib.commands.Tab;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
@ -19,7 +18,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
||||
private static String prefix = Util.Prefix;
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
@ -31,7 +30,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||
Player player = (Player) sender;
|
||||
Commands.gui(player);
|
||||
} else {
|
||||
if (args[0].equals("admin")) {
|
||||
if (args[0].equals(SelectConfig.getAdminSubCommand())) {
|
||||
if (args.length == 1) {
|
||||
Help.sendHelp(sender, prefix);
|
||||
return false;
|
||||
|
@ -57,29 +56,11 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||
break;
|
||||
case "createdefaultgui":
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
DefaultGUICreate.configCreate();
|
||||
CreateGUI.configCreate();
|
||||
sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "/GUIs/default.yml"));
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||
break;
|
||||
case "debug":
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
Debug.onDebugFile(sender);
|
||||
/*if (args.length == 2) {
|
||||
if (args[1].equals("config")) {
|
||||
Debug.debugmsg();
|
||||
}
|
||||
if (args[1].equals("2")) {
|
||||
send.debug("2");
|
||||
}
|
||||
break;
|
||||
|
||||
} else Debug.debugmsg();
|
||||
|
||||
*/
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||
break;
|
||||
|
||||
case "give":
|
||||
if (args.length == 3) {
|
||||
if (sender.hasPermission("commandgui.giveitem.other")) {
|
||||
|
@ -95,6 +76,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
if (!args[0].equalsIgnoreCase("updateinfo")){
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Commands.gui(player, args[0]);
|
||||
|
@ -102,6 +84,8 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||
}
|
||||
Help.sendHelp(sender, prefix);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -109,7 +93,6 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||
|
||||
//TabCompleter
|
||||
|
||||
|
||||
public static HashMap<String, String> arg1 = new HashMap<String, String>();
|
||||
|
||||
private static HashMap<String, String> arg2 = new HashMap<String, String>() {{
|
||||
|
@ -124,49 +107,11 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
Tab.tab(list, sender, 0, args, arg1);
|
||||
Tab.tab(list, sender, 0, "admin", 1, args, arg2);
|
||||
Tab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
|
||||
|
||||
// if (args.length == 1) {
|
||||
// for (String command : arg1.keySet()) {
|
||||
// Boolean passend = true;
|
||||
// for (int i = 0; i < args[0].length(); i++) {
|
||||
// if (args[0].length() >= command.length()) {
|
||||
// passend = false;
|
||||
// } else {
|
||||
// if (args[0].charAt(i) != command.charAt(i)) {
|
||||
// passend = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (hasPermission(sender, arg1.get(command)) && passend) {
|
||||
// list.add(command);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (args.length > 1) {
|
||||
// if (args[0].toLowerCase().equals("admin")){
|
||||
// return Tab.tab(sender,1,args,arg2);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
T2Ctab.tab(list, sender, 0, args, arg1);
|
||||
T2Ctab.tab(list, sender, 0, SelectConfig.getAdminSubCommand(), 1, args, arg2);
|
||||
T2Ctab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
|
||||
return list;
|
||||
}
|
||||
|
||||
public static boolean hasPermission(CommandSender sender, String permission) {
|
||||
|
||||
if (permission.equals("")) {
|
||||
return true;
|
||||
}
|
||||
String[] Permissions = permission.split(";");
|
||||
for (String perm : Permissions) {
|
||||
if (sender.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -16,20 +15,20 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
||||
private static String prefix = Util.Prefix;
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||
if (args.length == 0) {
|
||||
if (SelectConfig.UseItem_AllowToggle) {
|
||||
Help.sendGUIItemHelp(sender, prefix);
|
||||
} else send.sender(sender, "§4UseItem toggle is disabled!");// todo
|
||||
if (SelectConfig.getUseItem_AllowToggle()) {
|
||||
Help.sendGUIItemHelp(sender);
|
||||
} else T2Csend.sender(sender, "§4UseItem toggle is disabled!");// todo
|
||||
} else {
|
||||
if (args.length == 1 || args.length == 2) {
|
||||
if (sender instanceof Player) {
|
||||
if (SelectConfig.UseItem_AllowToggle) {
|
||||
if (SelectConfig.getUseItem_AllowToggle()) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "on":
|
||||
Commands.itemOn(player);
|
||||
|
@ -42,21 +41,22 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||
try {
|
||||
Commands.onSetSlot(player, Integer.valueOf(args[1]));
|
||||
} catch (Exception e5) {
|
||||
send.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
}
|
||||
|
||||
} else send.player(player, "§4Use: §7/gui-item slot [slot]");
|
||||
} else T2Csend.player(player, "§4Use: §7/gui-item slot [slot]");
|
||||
|
||||
break;
|
||||
default:
|
||||
Help.sendHelp(player, prefix);
|
||||
|
||||
}
|
||||
} else send.sender(sender, "§4UseItem toggle is disabled!");// todo
|
||||
} else T2Csend.sender(sender, "§4UseItem toggle is disabled!");// todo
|
||||
} else sender.sendMessage(SelectMessages.OnlyForPlayer);
|
||||
}
|
||||
}
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui-item").replace("[perm]", "commandgui.useitem.toggle"));
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui-item")
|
||||
.replace("[perm]", "commandgui.useitem.toggle"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||
put("on", "commandgui.useitem.toggle");
|
||||
put("off", "commandgui.useitem.toggle");
|
||||
if (SelectConfig.UseItem_AllowSetSlot) {
|
||||
if (SelectConfig.getUseItem_AllowSetSlot()) {
|
||||
put("slot", "commandgui.useitem.toggle");
|
||||
}
|
||||
}};
|
||||
|
@ -74,7 +74,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (sender instanceof Player) {
|
||||
if (SelectConfig.UseItem_AllowToggle) {
|
||||
if (SelectConfig.getUseItem_AllowToggle()) {
|
||||
Player p = (Player) sender;
|
||||
if (args.length == 1) {
|
||||
for (String command : arg1.keySet()) {
|
|
@ -1,13 +1,12 @@
|
|||
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class CmdExecuter_Help implements CommandExecutor {
|
||||
private static String prefix = Util.Prefix;
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
@ -0,0 +1,191 @@
|
|||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
||||
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.UseItem;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Commands {
|
||||
public static void info(CommandSender sender) {
|
||||
T2Ctemplate.sendInfo(sender, Main.getPlugin(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText());
|
||||
}
|
||||
|
||||
public static void reload(CommandSender sender) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadStart);
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
SelectConfig.onSelect();
|
||||
Main.getPlugin().reloadConfig();
|
||||
|
||||
CmdExecuter_GUI.arg1.clear();
|
||||
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
|
||||
if (!Objects.equals(SelectDatabase.getStorage().toString(), SelectConfig.getStorage())) {
|
||||
if (sender instanceof Player) T2Csend.sender(sender, "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||
T2Csend.warning(Main.getPlugin(), "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||
}
|
||||
|
||||
LanguagesCreate.langCreate();
|
||||
|
||||
Obj_Select.onSelect();
|
||||
SelectMessages.onSelect(Util.getPrefix());
|
||||
SelectConfig.sound(Util.getPrefix());
|
||||
|
||||
try {
|
||||
AliasRegister.onRegister();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
Permissions.onPermRegister();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (SelectLibConfig.getBungee()) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.getPlugin(), "commandgui:bungee");
|
||||
|
||||
}
|
||||
|
||||
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadEnd);
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void give(CommandSender sender, Player target) {
|
||||
if (Bukkit.getPlayer(target.getName()) != null) {
|
||||
UseItem.giveUseItem(target);
|
||||
T2Csend.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
|
||||
T2Csend.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
|
||||
Sound.play(target, SoundEnum.Give);
|
||||
} else {
|
||||
sender.sendMessage(SelectMessages.PlayerNotFond.replace("[player]", target.getName()));
|
||||
if (sender instanceof Player) Sound.play((Player) sender, SoundEnum.PlayerNotFound);
|
||||
}
|
||||
}
|
||||
|
||||
public static void itemOn(Player player) {
|
||||
UseItem.removeItem(player);
|
||||
Integer slot = null;
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
|
||||
slot = SelectConfig.getUseItem_InventorySlot();
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), String.valueOf(slot));
|
||||
if (player.getInventory().getItem(slot - 1) == null) {
|
||||
SelectDatabase.setItemStatusTrue(player);
|
||||
UseItem.giveUseItem(player);
|
||||
} else {
|
||||
boolean empty = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (player.getInventory().getItem(i) == null) {
|
||||
empty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty) {
|
||||
SelectDatabase.setItemStatusTrue(player);
|
||||
UseItem.addUseItem(player);
|
||||
T2Csend.player(player, SelectMessages.ItemON);
|
||||
} else {
|
||||
T2Csend.player(player, SelectMessages.NoInventorySpace);
|
||||
Sound.play(player, SoundEnum.NoInventorySpace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void itemOff(Player player) {
|
||||
SelectDatabase.setItemStatusFalse(player);
|
||||
UseItem.removeItem(player);
|
||||
T2Csend.player(player, SelectMessages.ItemOFF);
|
||||
}
|
||||
|
||||
public static void onSetSlot(Player player, Integer setSlot) {
|
||||
if (!SelectConfig.getUseItem_AllowSetSlot()) {
|
||||
T2Csend.player(player, Util.getPrefix() + " §4Function disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
if (setSlot < 1) {
|
||||
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
return;
|
||||
}
|
||||
if (setSlot > 9) {
|
||||
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Events.useItemHashMap.get(player.getName())) {
|
||||
if (Objects.equals(Events.useItemSlotHashMap.get(player.getName()), setSlot)) {
|
||||
T2Csend.player(player, SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(setSlot - 1) != null) {
|
||||
T2Csend.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
|
||||
return;
|
||||
}
|
||||
|
||||
UseItem.removeItem(player);
|
||||
SelectDatabase.setSlot(player, setSlot);
|
||||
Events.useItemSlotHashMap.replace(player.getName(), setSlot);
|
||||
|
||||
if (Events.useItemHashMap.get(player.getName())) {
|
||||
UseItem.giveUseItem(player);
|
||||
}
|
||||
|
||||
T2Csend.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
|
||||
}
|
||||
|
||||
public static void gui(Player player) {
|
||||
if (Main.guiHashMap.containsKey(SelectConfig.getDefaultGUI())) {
|
||||
Gui gui = Main.guiHashMap.get(SelectConfig.getDefaultGUI());
|
||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, SelectConfig.getDefaultGUI(), true);
|
||||
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
|
||||
.replace("[perm]", "commandgui.command"));
|
||||
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
|
||||
}
|
||||
}
|
||||
|
||||
public static void gui(Player player, String arg) {
|
||||
if (Main.guiHashMap.containsKey(arg)) {
|
||||
Gui gui = Main.guiHashMap.get(arg);
|
||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, arg, true);
|
||||
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.key)
|
||||
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
|
||||
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.key));
|
||||
} else T2Csend.player(player, SelectMessages.guiNotFound);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Help {
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
public static void sendHelp(CommandSender sender, String Prefix) {
|
||||
Gui gui = Main.guiHashMap.get(SelectConfig.getDefaultGUI());
|
||||
|
||||
T2Csend.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
|
||||
cgui(sender, gui);
|
||||
open(sender);
|
||||
help(sender);
|
||||
gUIItemHelp(sender);
|
||||
info(sender);
|
||||
give(sender);
|
||||
createDefaultGUI(sender);
|
||||
reload(sender);
|
||||
T2Csend.sender(sender, Prefix + " §8-------------------------");
|
||||
}
|
||||
|
||||
|
||||
private static void cgui(CommandSender sender, Gui gui) {
|
||||
if (!sender.hasPermission("commandgui.command")) return;
|
||||
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpCgui.replace("[gui]", T2Creplace.replace(prefix, gui.guiName)));
|
||||
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpCgui.replace("[gui]", T2Creplace.replace(prefix, gui.guiName)));
|
||||
}
|
||||
|
||||
private static void open(CommandSender sender) {
|
||||
if (!sender.hasPermission("commandgui.command")) return;
|
||||
|
||||
for (String alias : Main.allAliases) {
|
||||
if (Main.guiHashMap.get(alias).guiEnable || sender.hasPermission("commandgui.bypass")) {
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpOpen.replace("[gui]", alias).replace("[guiname]", T2Creplace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
|
||||
} else
|
||||
T2Csend.sender(sender, prefix + " " + SelectMessages.HelpOpen.replace("[gui]", alias).replace("[guiname]", T2Creplace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void help(CommandSender sender) {
|
||||
if (!sender.hasPermission("commandgui.command")) return;
|
||||
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpHelp);
|
||||
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpHelp);
|
||||
}
|
||||
|
||||
private static void info(CommandSender sender) {
|
||||
if (!sender.hasPermission("commandgui.command.info")) return;
|
||||
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpInfo);
|
||||
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpInfo);
|
||||
}
|
||||
|
||||
private static void give(CommandSender sender) {
|
||||
if (!sender.hasPermission("commandgui.admin")) return;
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpGive);
|
||||
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpGive);
|
||||
}
|
||||
|
||||
private static void createDefaultGUI(CommandSender sender) {
|
||||
if (!sender.hasPermission("commandgui.admin")) return;
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpCreateDefaultGUI.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
||||
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpCreateDefaultGUI.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
||||
}
|
||||
|
||||
private static void reload(CommandSender sender) {
|
||||
if (!sender.hasPermission("commandgui.admin")) return;
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpReload);
|
||||
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpReload);
|
||||
}
|
||||
|
||||
|
||||
public static void gUIItemHelp(CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerGUIItemHelp_on);
|
||||
} else T2Csend.sender(sender, prefix + " " + SelectMessages.GUIItemHelp_on);
|
||||
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerGUIItemHelp_off);
|
||||
} else T2Csend.sender(sender, prefix + " " + SelectMessages.GUIItemHelp_off);
|
||||
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerGUIItemHelp_Slot);
|
||||
} else T2Csend.sender(sender, prefix + " " + SelectMessages.GUIItemHelp_Slot);
|
||||
}
|
||||
|
||||
public static void sendGUIItemHelp(CommandSender sender) {
|
||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||
T2Csend.sender(sender, prefix + " §8------ §4Command§9GUI§2Item §chelp §8------");
|
||||
gUIItemHelp(sender);
|
||||
T2Csend.sender(sender, prefix + " §8------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package net.t2code.commandguiv2.Spigot.cmdManagement.register;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
|
||||
public class AliasRegister {
|
||||
public static void onRegister() {
|
||||
Plugin plugin = Main.getPlugin();
|
||||
T2Csend.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
|
||||
if (Main.allAliases.toString().equals("[]")) {
|
||||
T2Csend.console(Util.getPrefix() + " §4No GUI files available");
|
||||
return;
|
||||
}
|
||||
for (String alias : Main.allAliases) {
|
||||
if (Main.guiHashMap.get(alias) != null) {
|
||||
if (Main.guiHashMap.get(alias).commandAliasEnable) {
|
||||
try {
|
||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
bukkitCommandMap.setAccessible(true);
|
||||
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
||||
commandMap.register(alias, new RegisterCommand(alias));
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package net.t2code.commandguiv2.Spigot.cmdManagement.register;
|
||||
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class RegisterCommand extends Command {
|
||||
private String alias;
|
||||
|
||||
public RegisterCommand(String alias) {
|
||||
super(alias);
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Gui gui = Main.guiHashMap.get(alias);
|
||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, alias, true);
|
||||
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
|
||||
.replace("[perm]", "commandgui.command." + alias));
|
||||
} else T2Csend.player(player,SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
|
||||
} else sender.sendMessage("§8[§6Command§9GUI§8] §cThis command is only for players!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
package net.t2code.commandguiv2.Spigot.config.config;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigCreate {
|
||||
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
if (Main.getPlugin().getConfig().getBoolean("Plugin.Debug")) T2Csend.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
} else T2Csend.console(Util.getPrefix() + " §4config.yml are created...");
|
||||
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (!config.exists()) T2Cconfig.set("ConfigVersion", Util.getConfigVersion(), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Plugin.Debug", false, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.updateCheck.onJoin", true, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.updateCheck.seePreReleaseUpdates", true, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.updateCheck.timeInterval", 60, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.HelpAlias", true, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.AdminSubCommand", "admin", yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.Currency", "$", yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.DefaultGUI", "default", yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.Prefix", "&8[&4C&9GUI&8]", yamlConfiguration);
|
||||
|
||||
if (Main.legacy){
|
||||
T2Cconfig.set("Storage.Type", "YML", yamlConfiguration);
|
||||
} else T2Cconfig.set("Storage.Type", "SQLITE", yamlConfiguration);
|
||||
T2Cconfig.set("Storage.MySQL.IP", "localhost", yamlConfiguration);
|
||||
T2Cconfig.set("Storage.MySQL.Port", 3306, yamlConfiguration);
|
||||
T2Cconfig.set("Storage.MySQL.Database", "database", yamlConfiguration);
|
||||
T2Cconfig.set("Storage.MySQL.User", "root", yamlConfiguration);
|
||||
T2Cconfig.set("Storage.MySQL.Password", "password", yamlConfiguration);
|
||||
T2Cconfig.set("Storage.MySQL.SSL", false, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("UseItem.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.AllowToggle", true, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.AllowSetSlot", true, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.BlockMoveAndDrop", true, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.OpenGUI", "default", yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Permission.NeededToUse", true, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.KeepAtCommandClear", true, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("UseItem.InventorySlot.Slot", 1, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.InventorySlot.SlotEnforce", false, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.InventorySlot.FreeSlot", false, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("UseItem.Item.Material", "paper", yamlConfiguration);
|
||||
if (!(T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12())) {
|
||||
T2Cconfig.set("UseItem.Item.PlayerHead.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Item.PlayerHead.Base64.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Item.PlayerHead.Base64.Base64Value", "", yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", false, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Item.PlayerHead.Playername", "", yamlConfiguration);
|
||||
}
|
||||
T2Cconfig.set("UseItem.Item.Name", "&bDefault &6GUI", yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Item.Lore", Arrays.asList("&eThis is an example GUI"), yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Join.GiveOnEveryJoin", true, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Join.GiveOnlyOnFirstJoin", false, yamlConfiguration);
|
||||
|
||||
//convert
|
||||
if (yamlConfiguration.contains("UseItem.Join.Cursor.ToGUIItem.OnEveryLogin")) {
|
||||
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.OnEveryLogin", yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnEveryLogin"), yamlConfiguration);
|
||||
}
|
||||
if (yamlConfiguration.contains("UseItem.Join.Cursor.ToGUIItem.OnOnlyFirstLogin")) {
|
||||
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.OnOnlyFirstLogin", yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.Spigot.OnOnlyFirstLogin", yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnOnlyFirstLogin"), yamlConfiguration);
|
||||
}
|
||||
if (yamlConfiguration.contains("UseItem.Join.Cursor.ToGUIItem.EXPERIMENTELL_ServerChange")) {
|
||||
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.EXPERIMENTELL_ServerChange", yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.EXPERIMENTELL_ServerChange"), yamlConfiguration);
|
||||
}
|
||||
|
||||
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.Spigot.OnOnlyFirstLogin", true, yamlConfiguration);
|
||||
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", false, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Toggle.Items.OnOrYes.Item.Base64.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", yamlConfiguration);
|
||||
if (Main.legacy) {
|
||||
T2Cconfig.set("Toggle.Items.OnOrYes.Item.Material", "WOOL,5", yamlConfiguration);
|
||||
} else T2Cconfig.set("Toggle.Items.OnOrYes.Item.Material", T2CitemVersion.getGreenWool().getType().toString(), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Toggle.Items.OffOrNo.Item.Base64.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Toggle.Items.OffOrNo.Item.Base64.Base64Value", "", yamlConfiguration);
|
||||
if (Main.legacy) {
|
||||
T2Cconfig.set("Toggle.Items.OffOrNo.Item.Material", "WOOL,14", yamlConfiguration);
|
||||
} else T2Cconfig.set("Toggle.Items.OffOrNo.Item.Material", T2CitemVersion.getRedWool().getType().toString(), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Toggle.Permission.Commands.True", "luckperms user [player] permission set [perm] true", yamlConfiguration);
|
||||
T2Cconfig.set("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Placeholder.True", "&2true", yamlConfiguration);
|
||||
T2Cconfig.set("Placeholder.False", "&4false", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Sound.Enable", true, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Sound.OpenInventory.Enable", true, yamlConfiguration);
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
T2Cconfig.set("Sound.OpenInventory.Sound", "CHEST_OPEN", yamlConfiguration);
|
||||
} else T2Cconfig.set("Sound.OpenInventory.Sound", "BLOCK_CHEST_OPEN", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Sound.Click.Enable", true, yamlConfiguration);
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
T2Cconfig.set("Sound.Click.Sound", "NOTE_STICKS", yamlConfiguration);
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
T2Cconfig.set("Sound.Click.Sound", "BLOCK_NOTE_HAT", yamlConfiguration);
|
||||
} else T2Cconfig.set("Sound.Click.Sound", "BLOCK_NOTE_BLOCK_HAT", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Sound.NoMoney.Enable", true, yamlConfiguration);
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
T2Cconfig.set("Sound.NoMoney.Sound", "NOTE_PIANO", yamlConfiguration);
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
T2Cconfig.set("Sound.NoMoney.Sound", "BLOCK_NOTE_HARP", yamlConfiguration);
|
||||
} else T2Cconfig.set("Sound.NoMoney.Sound", "BLOCK_NOTE_BLOCK_HARP", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Sound.NoInventorySpace.Enable", true, yamlConfiguration);
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
T2Cconfig.set("Sound.NoInventorySpace.Sound", "NOTE_PIANO", yamlConfiguration);
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
T2Cconfig.set("Sound.NoInventorySpace.Sound", "BLOCK_NOTE_HARP", yamlConfiguration);
|
||||
} else T2Cconfig.set("Sound.NoInventorySpace.Sound", "BLOCK_NOTE_BLOCK_HARP", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Sound.Give.Enable", true, yamlConfiguration);
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
T2Cconfig.set("Sound.Give.Sound", "LEVEL_UP", yamlConfiguration);
|
||||
} else T2Cconfig.set("Sound.Give.Sound", "ENTITY_PLAYER_LEVELUP", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Sound.PlayerNotFound.Enable", true, yamlConfiguration);
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
T2Cconfig.set("Sound.PlayerNotFound.Sound", "NOTE_PIANO", yamlConfiguration);
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
T2Cconfig.set("Sound.PlayerNotFound.Sound", "BLOCK_NOTE_HARP", yamlConfiguration);
|
||||
} else T2Cconfig.set("Sound.PlayerNotFound.Sound", "BLOCK_NOTE_BLOCK_HARP", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Advanced.UseItem.GameMode.Change.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.GameMode.Change.DelayInTicks", 1, yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.GameMode.Protection.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.GameMode.Protection.Mode", "blacklist", yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.GameMode.Protection.List", Arrays.asList("CREATIVE", "Spectator"), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Advanced.UseItem.World.Change.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.World.Change.DelayInTicks", 1, yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.World.Protection.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.World.Protection.Mode", "blacklist", yamlConfiguration);
|
||||
T2Cconfig.set("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), yamlConfiguration);
|
||||
|
||||
if (!yamlConfiguration.contains("Advanced.UseItem.ItemBlockBlacklist")) {
|
||||
List<String> materialList = Arrays.asList("BUTTON", "DOOR", "FENCE", "CHEST", "FURNACE", "NOTE_BLOCK", "CRAFTING_TABLE", "WORKBENCH",
|
||||
"ANVIL", "LOOM", "COMPOSTER", "BARREL", "SMOKER", "BLAST_FURNACE", "CARTOGRAPHY_TABLE", "FLETCHING_TABLE", "GRINDSTONE",
|
||||
"SMITHING_TABLE", "STONECUTTER", "HOPPER", "DISPENSER", "DROPPER", "REPEATER", "COMPARATOR", "LEVER", "DAYLIGHT_DETECTOR", "BREWING_STAND", "TRAPDOOR", "BEACON"
|
||||
);
|
||||
|
||||
List<String> materialBlacklist = new ArrayList<>();
|
||||
for (Material material : Material.values()) {
|
||||
for (String target : materialList) {
|
||||
if (material.toString().contains(target)) materialBlacklist.add(material.toString());
|
||||
}
|
||||
}
|
||||
T2Cconfig.set("Advanced.UseItem.ItemBlockBlacklist", materialBlacklist, yamlConfiguration);
|
||||
}
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,709 @@
|
|||
package net.t2code.commandguiv2.Spigot.config.config;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SelectConfig {
|
||||
public static void onSelect() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (yamlConfiguration.getInt("ConfigVersion") < Util.getConfigVersion() && new File(Main.getPath(), "config.yml").exists()) {
|
||||
T2Csend.console(Util.getPrefix() + " §4----------------------");
|
||||
T2Csend.console(Util.getPrefix() + " ");
|
||||
T2Csend.console(Util.getPrefix() + " §6New features have been added to CommandGUI. The Config is adapted!");
|
||||
T2Csend.console(Util.getPrefix() + " ");
|
||||
T2Csend.console(Util.getPrefix() + " §4----------------------");
|
||||
if (yamlConfiguration.getInt("ConfigVersion") < 5) {
|
||||
ConfigConverter.convert();
|
||||
}
|
||||
if (yamlConfiguration.getInt("ConfigVersion") < 6) {
|
||||
ConfigConverter.removeBungeeOption();
|
||||
}
|
||||
if (yamlConfiguration.getInt("ConfigVersion") < 7) {
|
||||
ConfigConverter.convert7();
|
||||
}
|
||||
}
|
||||
|
||||
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin");
|
||||
updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.updateCheck.seePreReleaseUpdates");
|
||||
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval");
|
||||
HelpAlias = yamlConfiguration.getBoolean("Plugin.HelpAlias");
|
||||
adminSubCommand = yamlConfiguration.getString("Plugin.AdminSubCommand").toLowerCase();
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
Currency = yamlConfiguration.getString("Plugin.Currency");
|
||||
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");
|
||||
prefix = T2Creplace.replace("", Objects.requireNonNull(yamlConfiguration.getString("Plugin.Prefix")));
|
||||
|
||||
storage = yamlConfiguration.getString("Storage.Type").toUpperCase();
|
||||
|
||||
mysqlIp = yamlConfiguration.getString("Storage.MySQL.IP");
|
||||
mysqlPort = yamlConfiguration.getInt("Storage.MySQL.Port");
|
||||
mysqlDatabase = yamlConfiguration.getString("Storage.MySQL.Database");
|
||||
mysqlUser = yamlConfiguration.getString("Storage.MySQL.User");
|
||||
mysqlPassword = yamlConfiguration.getString("Storage.MySQL.Password");
|
||||
mysqlSSL = yamlConfiguration.getBoolean("Storage.MySQL.SSL");
|
||||
|
||||
UseItem_Enable = yamlConfiguration.getBoolean("UseItem.Enable");
|
||||
UseItem_AllowToggle = yamlConfiguration.getBoolean("UseItem.AllowToggle");
|
||||
UseItem_AllowSetSlot = yamlConfiguration.getBoolean("UseItem.AllowSetSlot");
|
||||
UseItem_BlockMoveAndDrop = yamlConfiguration.getBoolean("UseItem.BlockMoveAndDrop");
|
||||
UseItem_OpenGUI = yamlConfiguration.getString("UseItem.OpenGUI");
|
||||
UseItem_Permission = yamlConfiguration.getBoolean("UseItem.Permission.NeededToUse");
|
||||
UseItem_KeepAtCommandClear = yamlConfiguration.getBoolean("UseItem.KeepAtCommandClear");
|
||||
|
||||
UseItem_InventorySlot_FreeSlot = yamlConfiguration.getBoolean("UseItem.InventorySlot.FreeSlot");
|
||||
UseItem_InventorySlot = yamlConfiguration.getInt("UseItem.InventorySlot.Slot");
|
||||
UseItem_InventorySlotEnforce = yamlConfiguration.getBoolean("UseItem.InventorySlot.SlotEnforce");
|
||||
UseItem_Material = yamlConfiguration.getString("UseItem.Item.Material").toUpperCase();
|
||||
UseItem_PlayerHead_Enable = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.Enable");
|
||||
UseItem_Base64_Enable = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.Base64.Enable");
|
||||
UseItem_Base64value = yamlConfiguration.getString("UseItem.Item.PlayerHead.Base64.Base64Value");
|
||||
UseItem_PlayerWhoHasOpenedTheGUI = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
||||
UseItem_PlayerName = yamlConfiguration.getString("UseItem.Item.PlayerHead.PlayerName");
|
||||
UseItem_Name = T2Creplace.replace(Util.getPrefix(), yamlConfiguration.getString("UseItem.Item.Name"));
|
||||
UseItem_Lore = yamlConfiguration.getStringList("UseItem.Item.Lore");
|
||||
UseItem_GiveOnEveryJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnEveryJoin");
|
||||
UseItem_GiveOnlyOnFirstJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnlyOnFirstJoin");
|
||||
Cursor_ToGUIItem_OnLogin = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable");
|
||||
Cursor_ToGUIItem_OnlyOnFirstLogin = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin");
|
||||
UseItem_ServerChange = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange");
|
||||
|
||||
toggleItemOnOrYesBase64 = yamlConfiguration.getBoolean("Toggle.Items.OnOrYes.Item.Base64.Enable");
|
||||
toggleItemOnOrYesBase64Value = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Base64.Base64Value");
|
||||
toggleItemOnOrYesMaterial = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Material");
|
||||
|
||||
toggleItemOffOrNoBase64 = yamlConfiguration.getBoolean("Toggle.Items.OffOrNo.Item.Base64.Enable");
|
||||
toggleItemOffOrNoBase64Value = yamlConfiguration.getString("Toggle.Items.OffOrNo.Item.Base64.Base64Value");
|
||||
toggleItemOffOrNoMaterial = yamlConfiguration.getString("Toggle.Items.OffOrNo.Item.Material");
|
||||
|
||||
togglePermTrue = yamlConfiguration.getString("Toggle.Permission.Commands.True");
|
||||
togglePermFalse = yamlConfiguration.getString("Toggle.Permission.Commands.False");
|
||||
|
||||
placeholderTrue = yamlConfiguration.getString("Placeholder.True");
|
||||
placeholderFalse = yamlConfiguration.getString("Placeholder.False");
|
||||
|
||||
Sound_Enable = yamlConfiguration.getBoolean("Sound.Enable");
|
||||
Sound_OpenInventory_Enable = yamlConfiguration.getBoolean("Sound.OpenInventory.Enable");
|
||||
Sound_OpenInventory_input = (yamlConfiguration.getString("Sound.OpenInventory.Sound").toUpperCase().replace(".", "_"));
|
||||
Sound_Click_Enable = yamlConfiguration.getBoolean("Sound.Click.Enable");
|
||||
Sound_Click_input = (yamlConfiguration.getString("Sound.Click.Sound").toUpperCase().replace(".", "_"));
|
||||
Sound_NoMoney_Enable = yamlConfiguration.getBoolean("Sound.NoMoney.Enable");
|
||||
Sound_NoMoney_input = (yamlConfiguration.getString("Sound.NoMoney.Sound").toUpperCase().replace(".", "_"));
|
||||
|
||||
Sound_NoInventorySpace_Enable = yamlConfiguration.getBoolean("Sound.NoInventorySpace.Enable");
|
||||
Sound_NoInventorySpace_input = (yamlConfiguration.getString("Sound.NoInventorySpace.Sound").toUpperCase().replace(".", "_"));
|
||||
Sound_Give_Enable = yamlConfiguration.getBoolean("Sound.Give.Enable");
|
||||
Sound_Give_input = (yamlConfiguration.getString("Sound.Give.Sound").toUpperCase().replace(".", "_"));
|
||||
Sound_PlayerNotFound_Enable = yamlConfiguration.getBoolean("Sound.PlayerNotFound.Enable");
|
||||
Sound_PlayerNotFound_input = (yamlConfiguration.getString("Sound.PlayerNotFound.Sound").toUpperCase().replace(".", "_"));
|
||||
|
||||
UseItemGameModeChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Change.Enable");
|
||||
UseItemGameModeChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.GameMode.Change.DelayInTicks");
|
||||
UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable");
|
||||
UseItemGameModeRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
|
||||
UseItemGameModeMode = yamlConfiguration.getString("Advanced.UseItem.GameMode.Protection.Mode");
|
||||
List<String> gml = new ArrayList<>();
|
||||
for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")) {
|
||||
gml.add(gm.toUpperCase());
|
||||
}
|
||||
UseItemGameModeList = gml;
|
||||
|
||||
UseItemWorldChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.World.Change.Enable");
|
||||
UseItemWorldChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.World.Change.DelayInTicks");
|
||||
UseItemWorldProtection = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.Enable");
|
||||
UseItemWorldRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
|
||||
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
|
||||
UseItemWorldList = yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
|
||||
|
||||
|
||||
if (yamlConfiguration.get("Advanced.UseItem.DisableInfoBySneak") != null) {
|
||||
disableInfoBySneak = yamlConfiguration.getBoolean("Advanced.UseItem.DisableInfoBySneak");
|
||||
}
|
||||
|
||||
UseItemItemBlockBlacklist = yamlConfiguration.getStringList("Advanced.UseItem.ItemBlockBlacklist");
|
||||
}
|
||||
|
||||
|
||||
public static void sound(String Prefix) {
|
||||
String soundOpenInventory;
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
soundOpenInventory = "CHEST_OPEN";
|
||||
} else {
|
||||
soundOpenInventory = "BLOCK_CHEST_OPEN";
|
||||
}
|
||||
|
||||
String soundClick;
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
soundClick = "NOTE_STICKS";
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
soundClick = "BLOCK_NOTE_HAT";
|
||||
} else {
|
||||
soundClick = "BLOCK_NOTE_BLOCK_HAT";
|
||||
}
|
||||
|
||||
String soundNoMoney;
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
soundNoMoney = "NOTE_PIANO";
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
soundNoMoney = "BLOCK_NOTE_HARP";
|
||||
} else {
|
||||
soundNoMoney = "BLOCK_NOTE_BLOCK_HARP";
|
||||
}
|
||||
|
||||
String soundNoInventorySpace;
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
soundNoInventorySpace = "NOTE_PIANO";
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
soundNoInventorySpace = "BLOCK_NOTE_BASS";
|
||||
} else {
|
||||
soundNoInventorySpace = "BLOCK_NOTE_BLOCK_GUITAR";
|
||||
}
|
||||
|
||||
String soundGive;
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
soundGive = "LEVEL_UP";
|
||||
} else {
|
||||
soundGive = "ENTITY_PLAYER_LEVELUP";
|
||||
}
|
||||
|
||||
String soundPlayerNotFound;
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
soundPlayerNotFound = "NOTE_PIANO";
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
soundPlayerNotFound = "BLOCK_NOTE_HARP";
|
||||
} else {
|
||||
soundPlayerNotFound = "BLOCK_NOTE_BLOCK_HARP";
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_OpenInventory = Sound.valueOf(Sound_OpenInventory_input);
|
||||
if (sound_OpenInventory != null) {
|
||||
Sound_OpenInventory = sound_OpenInventory;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§8OpenInventory: §6" + Sound_OpenInventory_input) + "§4\n§4\n§4\n");
|
||||
Sound_OpenInventory = Sound.valueOf(soundOpenInventory);
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_Click = Sound.valueOf(Sound_Click_input);
|
||||
if (sound_Click != null) {
|
||||
Sound_Click = sound_Click;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8Click: §6" + Sound_Click_input) + "§4\n§4\n§4\n");
|
||||
Sound_Click = Sound.valueOf(soundClick);
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_NoMoney = Sound.valueOf(Sound_NoMoney_input);
|
||||
if (sound_NoMoney != null) {
|
||||
Sound_Click = sound_NoMoney;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8NoMoney: §6" + Sound_NoMoney_input) + "§4\n§4\n§4\n");
|
||||
Sound_NoMoney = Sound.valueOf(soundNoMoney);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Sound sound_NoInventorySpace = Sound.valueOf(Sound_NoInventorySpace_input);
|
||||
if (sound_NoInventorySpace != null) {
|
||||
Sound_NoInventorySpace = sound_NoInventorySpace;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8NoInventorySpace: §6" + Sound_NoInventorySpace_input) + "§4\n§4\n§4\n");
|
||||
Sound_NoInventorySpace = Sound.valueOf(soundNoInventorySpace);
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_Give = Sound.valueOf(Sound_Give_input);
|
||||
if (sound_Give != null) {
|
||||
Sound_Give = sound_Give;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8Give: §6" + Sound_Give_input) + "§4\n§4\n§4\n");
|
||||
Sound_Give = Sound.valueOf(soundGive);
|
||||
}
|
||||
|
||||
try {
|
||||
Sound sound_PlayerNotFound = Sound.valueOf(Sound_PlayerNotFound_input);
|
||||
if (sound_PlayerNotFound != null) {
|
||||
Sound_PlayerNotFound = sound_PlayerNotFound;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||
.replace("[sound]", "§8PlayerNotFound: §6" + Sound_PlayerNotFound_input) + "§4\n§4\n§4\n");
|
||||
Sound_PlayerNotFound = Sound.valueOf(soundPlayerNotFound);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void setConfigVersion() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
yamlConfiguration.set("ConfigVersion", Util.getConfigVersion());
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static Boolean Debug;
|
||||
|
||||
private static Boolean updateCheckOnJoin;
|
||||
private static Boolean updateCheckSeePreReleaseUpdates;
|
||||
private static Integer updateCheckTimeInterval;
|
||||
private static Boolean HelpAlias;
|
||||
private static String adminSubCommand;
|
||||
private static String language;
|
||||
private static String Currency;
|
||||
|
||||
private static String storage;
|
||||
|
||||
private static String mysqlIp;
|
||||
private static Integer mysqlPort;
|
||||
private static String mysqlDatabase;
|
||||
private static String mysqlUser;
|
||||
private static String mysqlPassword;
|
||||
private static Boolean mysqlSSL;
|
||||
|
||||
private static String DefaultGUI;
|
||||
private static String prefix;
|
||||
|
||||
private static Boolean UseItem_Enable;
|
||||
private static Boolean UseItem_AllowToggle;
|
||||
private static Boolean UseItem_AllowSetSlot;
|
||||
private static Boolean UseItem_GiveOnEveryJoin;
|
||||
private static Boolean UseItem_GiveOnlyOnFirstJoin;
|
||||
private static Boolean UseItem_ServerChange;
|
||||
private static Boolean Cursor_ToGUIItem_OnLogin;
|
||||
private static Boolean Cursor_ToGUIItem_OnlyOnFirstLogin;
|
||||
private static Boolean UseItem_BlockMoveAndDrop;
|
||||
private static String UseItem_OpenGUI;
|
||||
private static Boolean UseItem_Permission;
|
||||
private static Boolean UseItem_KeepAtCommandClear;
|
||||
|
||||
private static Boolean UseItemGameModeChangeEnable;
|
||||
private static int UseItemGameModeChangeDelayInTicks;
|
||||
private static Boolean UseItemGameModeProtection;
|
||||
private static Boolean UseItemGameModeRemoveItemWhenItIsDisabled;
|
||||
private static String UseItemGameModeMode;
|
||||
private static List<String> UseItemGameModeList;
|
||||
|
||||
private static Boolean UseItemWorldChangeEnable;
|
||||
private static int UseItemWorldChangeDelayInTicks;
|
||||
private static Boolean UseItemWorldProtection;
|
||||
private static Boolean UseItemWorldRemoveItemWhenItIsDisabled;
|
||||
private static String UseItemWorldMode;
|
||||
private static List<String> UseItemWorldList;
|
||||
private static List<String> UseItemItemBlockBlacklist;
|
||||
|
||||
private static Boolean disableInfoBySneak = false;
|
||||
|
||||
private static Boolean UseItem_InventorySlot_FreeSlot;
|
||||
private static Integer UseItem_InventorySlot;
|
||||
private static Boolean UseItem_InventorySlotEnforce;
|
||||
private static String UseItem_Material;
|
||||
private static Boolean UseItem_PlayerHead_Enable;
|
||||
private static Boolean UseItem_Base64_Enable;
|
||||
private static String UseItem_Base64value;
|
||||
private static Boolean UseItem_PlayerWhoHasOpenedTheGUI;
|
||||
private static String UseItem_PlayerName;
|
||||
private static String UseItem_Name;
|
||||
private static List<String> UseItem_Lore;
|
||||
|
||||
private static Boolean toggleItemOnOrYesBase64;
|
||||
private static String toggleItemOnOrYesBase64Value;
|
||||
private static String toggleItemOnOrYesMaterial;
|
||||
|
||||
private static Boolean toggleItemOffOrNoBase64;
|
||||
private static String toggleItemOffOrNoBase64Value;
|
||||
private static String toggleItemOffOrNoMaterial;
|
||||
|
||||
private static String togglePermTrue;
|
||||
private static String togglePermFalse;
|
||||
|
||||
private static String placeholderTrue;
|
||||
private static String placeholderFalse;
|
||||
|
||||
private static Boolean Sound_Enable = true;
|
||||
|
||||
private static Boolean Sound_OpenInventory_Enable = true;
|
||||
private static Sound Sound_OpenInventory;
|
||||
private static String Sound_OpenInventory_input;
|
||||
|
||||
private static Boolean Sound_Click_Enable = true;
|
||||
private static Sound Sound_Click;
|
||||
private static String Sound_Click_input;
|
||||
|
||||
private static Boolean Sound_NoMoney_Enable = true;
|
||||
private static Sound Sound_NoMoney;
|
||||
private static String Sound_NoMoney_input;
|
||||
|
||||
private static Boolean Sound_NoInventorySpace_Enable = true;
|
||||
private static Sound Sound_NoInventorySpace;
|
||||
private static String Sound_NoInventorySpace_input;
|
||||
|
||||
private static Boolean Sound_Give_Enable = true;
|
||||
private static Sound Sound_Give;
|
||||
private static String Sound_Give_input;
|
||||
|
||||
private static Boolean Sound_PlayerNotFound_Enable = true;
|
||||
private static Sound Sound_PlayerNotFound;
|
||||
private static String Sound_PlayerNotFound_input;
|
||||
|
||||
public static Boolean getDebug() {
|
||||
return Debug;
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckOnJoin() {
|
||||
return updateCheckOnJoin;
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckSeePreReleaseUpdates() {
|
||||
return updateCheckSeePreReleaseUpdates;
|
||||
}
|
||||
|
||||
public static Integer getUpdateCheckTimeInterval() {
|
||||
return updateCheckTimeInterval;
|
||||
}
|
||||
|
||||
public static Boolean getHelpAlias() {
|
||||
return HelpAlias;
|
||||
}
|
||||
|
||||
public static String getAdminSubCommand() {
|
||||
return adminSubCommand;
|
||||
}
|
||||
|
||||
public static String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public static String getCurrency() {
|
||||
return Currency;
|
||||
}
|
||||
|
||||
public static String getStorage() {
|
||||
return storage;
|
||||
}
|
||||
|
||||
public static String getMysqlIp() {
|
||||
return mysqlIp;
|
||||
}
|
||||
|
||||
public static Integer getMysqlPort() {
|
||||
return mysqlPort;
|
||||
}
|
||||
|
||||
public static String getMysqlDatabase() {
|
||||
return mysqlDatabase;
|
||||
}
|
||||
|
||||
public static String getMysqlUser() {
|
||||
return mysqlUser;
|
||||
}
|
||||
|
||||
public static String getMysqlPassword() {
|
||||
return mysqlPassword;
|
||||
}
|
||||
|
||||
public static Boolean getMysqlSSL() {
|
||||
return mysqlSSL;
|
||||
}
|
||||
|
||||
public static String getDefaultGUI() {
|
||||
return DefaultGUI;
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_Enable() {
|
||||
return UseItem_Enable;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_AllowToggle() {
|
||||
return UseItem_AllowToggle;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_AllowSetSlot() {
|
||||
return UseItem_AllowSetSlot;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_GiveOnEveryJoin() {
|
||||
return UseItem_GiveOnEveryJoin;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_GiveOnlyOnFirstJoin() {
|
||||
return UseItem_GiveOnlyOnFirstJoin;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_ServerChange() {
|
||||
return UseItem_ServerChange;
|
||||
}
|
||||
|
||||
public static Boolean getCursor_ToGUIItem_OnLogin() {
|
||||
return Cursor_ToGUIItem_OnLogin;
|
||||
}
|
||||
|
||||
public static Boolean getCursor_ToGUIItem_OnlyOnFirstLogin() {
|
||||
return Cursor_ToGUIItem_OnlyOnFirstLogin;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_BlockMoveAndDrop() {
|
||||
return UseItem_BlockMoveAndDrop;
|
||||
}
|
||||
|
||||
public static String getUseItem_OpenGUI() {
|
||||
return UseItem_OpenGUI;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_Permission() {
|
||||
return UseItem_Permission;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_KeepAtCommandClear() {
|
||||
return UseItem_KeepAtCommandClear;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemGameModeChangeEnable() {
|
||||
return UseItemGameModeChangeEnable;
|
||||
}
|
||||
|
||||
public static int getUseItemGameModeChangeDelayInTicks() {
|
||||
return UseItemGameModeChangeDelayInTicks;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemGameModeProtection() {
|
||||
return UseItemGameModeProtection;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemGameModeRemoveItemWhenItIsDisabled() {
|
||||
return UseItemGameModeRemoveItemWhenItIsDisabled;
|
||||
}
|
||||
|
||||
public static String getUseItemGameModeMode() {
|
||||
return UseItemGameModeMode;
|
||||
}
|
||||
|
||||
public static List<String> getUseItemGameModeList() {
|
||||
return UseItemGameModeList;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemWorldChangeEnable() {
|
||||
return UseItemWorldChangeEnable;
|
||||
}
|
||||
|
||||
public static int getUseItemWorldChangeDelayInTicks() {
|
||||
return UseItemWorldChangeDelayInTicks;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemWorldProtection() {
|
||||
return UseItemWorldProtection;
|
||||
}
|
||||
|
||||
public static Boolean getUseItemWorldRemoveItemWhenItIsDisabled() {
|
||||
return UseItemWorldRemoveItemWhenItIsDisabled;
|
||||
}
|
||||
|
||||
public static String getUseItemWorldMode() {
|
||||
return UseItemWorldMode;
|
||||
}
|
||||
|
||||
public static List<String> getUseItemWorldList() {
|
||||
return UseItemWorldList;
|
||||
}
|
||||
|
||||
public static List<String> getUseItemItemBlockBlacklist() {
|
||||
return UseItemItemBlockBlacklist;
|
||||
}
|
||||
|
||||
public static Boolean getDisableInfoBySneak() {
|
||||
return disableInfoBySneak;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_InventorySlot_FreeSlot() {
|
||||
return UseItem_InventorySlot_FreeSlot;
|
||||
}
|
||||
|
||||
public static Integer getUseItem_InventorySlot() {
|
||||
return UseItem_InventorySlot;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_InventorySlotEnforce() {
|
||||
return UseItem_InventorySlotEnforce;
|
||||
}
|
||||
|
||||
public static String getUseItem_Material() {
|
||||
return UseItem_Material;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_PlayerHead_Enable() {
|
||||
return UseItem_PlayerHead_Enable;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_Base64_Enable() {
|
||||
return UseItem_Base64_Enable;
|
||||
}
|
||||
|
||||
public static String getUseItem_Base64value() {
|
||||
return UseItem_Base64value;
|
||||
}
|
||||
|
||||
public static Boolean getUseItem_PlayerWhoHasOpenedTheGUI() {
|
||||
return UseItem_PlayerWhoHasOpenedTheGUI;
|
||||
}
|
||||
|
||||
public static String getUseItem_PlayerName() {
|
||||
return UseItem_PlayerName;
|
||||
}
|
||||
|
||||
public static String getUseItem_Name() {
|
||||
return UseItem_Name;
|
||||
}
|
||||
|
||||
public static List<String> getUseItem_Lore() {
|
||||
return UseItem_Lore;
|
||||
}
|
||||
|
||||
public static Boolean getToggleItemOnOrYesBase64() {
|
||||
return toggleItemOnOrYesBase64;
|
||||
}
|
||||
|
||||
public static String getToggleItemOnOrYesBase64Value() {
|
||||
return toggleItemOnOrYesBase64Value;
|
||||
}
|
||||
|
||||
public static String getToggleItemOnOrYesMaterial() {
|
||||
return toggleItemOnOrYesMaterial;
|
||||
}
|
||||
|
||||
public static Boolean getToggleItemOffOrNoBase64() {
|
||||
return toggleItemOffOrNoBase64;
|
||||
}
|
||||
|
||||
public static String getToggleItemOffOrNoBase64Value() {
|
||||
return toggleItemOffOrNoBase64Value;
|
||||
}
|
||||
|
||||
public static String getToggleItemOffOrNoMaterial() {
|
||||
return toggleItemOffOrNoMaterial;
|
||||
}
|
||||
|
||||
public static String getTogglePermTrue() {
|
||||
return togglePermTrue;
|
||||
}
|
||||
|
||||
public static String getTogglePermFalse() {
|
||||
return togglePermFalse;
|
||||
}
|
||||
|
||||
public static String getPlaceholderTrue() {
|
||||
return placeholderTrue;
|
||||
}
|
||||
|
||||
public static String getPlaceholderFalse() {
|
||||
return placeholderFalse;
|
||||
}
|
||||
|
||||
public static Boolean getSound_Enable() {
|
||||
return Sound_Enable;
|
||||
}
|
||||
|
||||
public static Boolean getSound_OpenInventory_Enable() {
|
||||
return Sound_OpenInventory_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_OpenInventory() {
|
||||
return Sound_OpenInventory;
|
||||
}
|
||||
|
||||
public static String getSound_OpenInventory_input() {
|
||||
return Sound_OpenInventory_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_Click_Enable() {
|
||||
return Sound_Click_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_Click() {
|
||||
return Sound_Click;
|
||||
}
|
||||
|
||||
public static String getSound_Click_input() {
|
||||
return Sound_Click_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_NoMoney_Enable() {
|
||||
return Sound_NoMoney_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_NoMoney() {
|
||||
return Sound_NoMoney;
|
||||
}
|
||||
|
||||
public static String getSound_NoMoney_input() {
|
||||
return Sound_NoMoney_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_NoInventorySpace_Enable() {
|
||||
return Sound_NoInventorySpace_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_NoInventorySpace() {
|
||||
return Sound_NoInventorySpace;
|
||||
}
|
||||
|
||||
public static String getSound_NoInventorySpace_input() {
|
||||
return Sound_NoInventorySpace_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_Give_Enable() {
|
||||
return Sound_Give_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_Give() {
|
||||
return Sound_Give;
|
||||
}
|
||||
|
||||
public static String getSound_Give_input() {
|
||||
return Sound_Give_input;
|
||||
}
|
||||
|
||||
public static Boolean getSound_PlayerNotFound_Enable() {
|
||||
return Sound_PlayerNotFound_Enable;
|
||||
}
|
||||
|
||||
public static Sound getSound_PlayerNotFound() {
|
||||
return Sound_PlayerNotFound;
|
||||
}
|
||||
|
||||
public static String getSound_PlayerNotFound_input() {
|
||||
return Sound_PlayerNotFound_input;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,271 @@
|
|||
package net.t2code.commandguiv2.Spigot.config.configConverter;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.functions.CreateFunctions;
|
||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigConverter {
|
||||
|
||||
public static void removeBungeeOption() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
yamlConfiguration.set("BungeeCord", null);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void renameMainFolder() {
|
||||
if (new File("plugins/CommandGUI").exists() && !Main.getPath().exists()) {
|
||||
File oldF = new File("plugins/CommandGUI");
|
||||
File newF = new File("plugins/T2C-CommandGUI");
|
||||
|
||||
if (oldF.renameTo(newF)) {
|
||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.error(Main.getPlugin(), "");
|
||||
T2Csend.warning(Main.getPlugin(), "File renamed successfully");
|
||||
T2Csend.warning(Main.getPlugin(), "The plugin folder has been renamed from 'CommandGUI' to 'T2C-CommandGUI");
|
||||
T2Csend.error(Main.getPlugin(), "");
|
||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
} else {
|
||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.error(Main.getPlugin(), "");
|
||||
T2Csend.error(Main.getPlugin(), "Failed to rename file");
|
||||
T2Csend.error(Main.getPlugin(), "An error occurred while renaming the plugin folder from 'CommandGUI' to 'T2C-CommandGUI'! Please report on our Discord: " + Util.getDiscord());
|
||||
T2Csend.error(Main.getPlugin(), "");
|
||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void noPermLore(YamlConfiguration yamlConfiguration, File config) {
|
||||
yamlConfiguration.set("Slots.Function.NoPermission.Message.Enable", true);
|
||||
yamlConfiguration.set("Slots.Function.NoPermission.Message.CustomNoPermMessage", "");
|
||||
yamlConfiguration.set("Slots.Function.NoPermission.Item.Lore.Enable", true);
|
||||
yamlConfiguration.set("Slots.Function.NoPermission.Item.Lore.Lore", Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"));
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.error(Main.getPlugin(), "");
|
||||
T2Csend.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Message.Enable' was added to the function " + config.getName() + "!");
|
||||
T2Csend.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Message.CustomNoPermMessage' was added to the function " + config.getName() + "!");
|
||||
T2Csend.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Item.Lore.Enable' was added to the function " + config.getName() + "!");
|
||||
T2Csend.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Item.Lore.Lore' was added to the function " + config.getName() + "!");
|
||||
T2Csend.error(Main.getPlugin(), "");
|
||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
}
|
||||
|
||||
public static void convert() {
|
||||
renameFolder();
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4Config conversion to the new config structure starts!");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
|
||||
File f = new File(Main.getPath() + "/OldConfig/GUIs/Version4");
|
||||
File[] fileArray = f.listFiles();
|
||||
|
||||
for (File configOld : fileArray) {
|
||||
String sub = configOld.getName().substring(configOld.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
YamlConfiguration yamlConfigurationOld = YamlConfiguration.loadConfiguration(configOld);
|
||||
|
||||
File config = new File(Main.getPath(), "GUIs/" + configOld.getName().replace(".yml", "") + ".yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
Boolean enable = yamlConfigurationOld.getBoolean("GUI.Enable");
|
||||
Integer lines = yamlConfigurationOld.getInt("GUI.Lines");
|
||||
|
||||
String name = yamlConfigurationOld.getString("GUI.Name");
|
||||
Boolean fillItemEnable = yamlConfigurationOld.getBoolean("GUI.FillItem.Enable");
|
||||
String fillItem;
|
||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
fillItem = yamlConfigurationOld.getString("GUI.FillItem.GlassPaneColor");
|
||||
} else fillItem = yamlConfigurationOld.getString("GUI.FillItem.Item");
|
||||
|
||||
Boolean alias = yamlConfigurationOld.getBoolean("Command.Alias");
|
||||
Boolean aliasPerm = yamlConfigurationOld.getBoolean("Command.Permission.Required");
|
||||
|
||||
setNew(enable, lines, name, fillItemEnable, fillItem, alias, aliasPerm, yamlConfiguration);
|
||||
|
||||
for (String key : yamlConfigurationOld.getConfigurationSection("Slots").getKeys(false)) {
|
||||
Integer slotNumber = yamlConfigurationOld.getInt("Slots." + key + ".Slot");
|
||||
Boolean slotEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Enable");
|
||||
Boolean permRequired = yamlConfigurationOld.getBoolean("Slots." + key + ".Permission.Required");
|
||||
|
||||
Boolean empty = yamlConfigurationOld.getBoolean("Slots." + key + ".Item.Empty");
|
||||
Integer itemAmount = yamlConfigurationOld.getInt("Slots." + key + ".Item.Amount");
|
||||
Boolean playerHeadEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Item.PlayerHead.Enable");
|
||||
Boolean base64Enable = yamlConfigurationOld.getBoolean("Slots." + key + ".Item.PlayerHead.Base64.Enable");
|
||||
String base64Value = yamlConfigurationOld.getString("Slots." + key + ".Item.PlayerHead.Base64.Base64Value");
|
||||
Boolean playerWhoHasOpenedTheGUI = yamlConfigurationOld.getBoolean("Slots." + key + ".Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
||||
String playerName = yamlConfigurationOld.getString("Slots." + key + ".Item.PlayerHead.PlayerName");
|
||||
String itemMaterial = yamlConfigurationOld.getString("Slots." + key + ".Item.Material");
|
||||
String itemName = yamlConfigurationOld.getString("Slots." + key + ".Item.Name");
|
||||
List<String> lore = yamlConfigurationOld.getStringList("Slots." + key + ".Item.Lore");
|
||||
Boolean customSoundEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".CustomSound.Enable");
|
||||
Boolean customSoundNoSound = yamlConfigurationOld.getBoolean("Slots." + key + ".CustomSound.NoSound");
|
||||
String customSoundSound = yamlConfigurationOld.getString("Slots." + key + ".CustomSound.Sound");
|
||||
Boolean costEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Cost.Enable");
|
||||
Double price = yamlConfigurationOld.getDouble("Slots." + key + ".Cost.Price");
|
||||
Boolean commandEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Command.Enable");
|
||||
Boolean commandBungeeCommand = yamlConfigurationOld.getBoolean("Slots." + key + ".Command.BungeeCommand");
|
||||
Boolean commandAsConsole = yamlConfigurationOld.getBoolean("Slots." + key + ".Command.CommandAsConsole");
|
||||
List<String> command = yamlConfigurationOld.getStringList("Slots." + key + ".Command.Command");
|
||||
Boolean serverChange = yamlConfigurationOld.getBoolean("Slots." + key + ".ServerChange.Enable");
|
||||
String serverChangeServer = yamlConfigurationOld.getString("Slots." + key + ".ServerChange.Server");
|
||||
Boolean openGUIEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".OpenGUI.Enable");
|
||||
String openGUI = yamlConfigurationOld.getString("Slots." + key + ".OpenGUI.GUI");
|
||||
Boolean closeGUI = yamlConfiguration.getBoolean("Slots.Function.CloseGUI.Enable");
|
||||
Boolean togglePermission = yamlConfigurationOld.getBoolean("Slots." + key + ".Toggle.Permission.Enable");
|
||||
String togglePermissionPerm = yamlConfigurationOld.getString("Slots." + key + ".Toggle.Permission.Permission");
|
||||
Boolean toggleUseItem = yamlConfigurationOld.getBoolean("Slots." + key + ".Toggle.UseItem.Enable");
|
||||
Boolean messageEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Message.Enable");
|
||||
List<String> message = yamlConfigurationOld.getStringList("Slots." + key + ".Message.Message");
|
||||
Boolean setConfigEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.Enable");
|
||||
String configFilePath = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.File.Path");
|
||||
String configOptionPath = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Option.Path");
|
||||
String configOptionPremat = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Option.Premat");
|
||||
|
||||
String configStringValueLeft = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Value.LeftClick.String");
|
||||
Boolean configBooleanValueLeft = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.Value.LeftClick.Boolean");
|
||||
Integer configIntegerValueLeft = yamlConfigurationOld.getInt("Slots." + key + ".SetConfig.Value.LeftClick.Integer");
|
||||
Double configDoubleValueLeft = yamlConfigurationOld.getDouble("Slots." + key + ".SetConfig.Value.LeftClick.Double");
|
||||
List<String> configListValueLeft = yamlConfigurationOld.getStringList("Slots." + key + ".SetConfig.Value.LeftClick.List");
|
||||
|
||||
String configStringValueRight = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Value.RightClick.String");
|
||||
Boolean configBooleanValueRight = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.Value.RightClick.Boolean");
|
||||
Integer configIntegerValueRight = yamlConfigurationOld.getInt("Slots." + key + ".SetConfig.Value.RightClick.Integer");
|
||||
Double configDoubleValueRight = yamlConfigurationOld.getDouble("Slots." + key + ".SetConfig.Value.RightClick.Double");
|
||||
List<String> configListValueRight = yamlConfigurationOld.getStringList("Slots." + key + ".SetConfig.RightClick.Value.List");
|
||||
|
||||
Boolean pluginReloadEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.PluginReload.Enable");
|
||||
String pluginReloadCommand = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.PluginReload.Command");
|
||||
|
||||
setNew(key, slotNumber, slotEnable, key, permRequired, yamlConfiguration);
|
||||
CreateFunctions.createFunction(key, empty, itemAmount, playerHeadEnable, base64Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, itemMaterial, itemName, lore,
|
||||
true, "", true, Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"),
|
||||
customSoundEnable, customSoundNoSound, customSoundSound, costEnable, "vault", "DIRT;5", 0, price, commandEnable, commandBungeeCommand, commandAsConsole, command, serverChange,
|
||||
serverChangeServer, openGUIEnable, openGUI,closeGUI, togglePermission, togglePermissionPerm, toggleUseItem, messageEnable, message, setConfigEnable, configFilePath,
|
||||
configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft, configDoubleValueLeft, configListValueLeft,
|
||||
configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight, configListValueRight, pluginReloadEnable, pluginReloadCommand,
|
||||
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
|
||||
}
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4The conversion to the new config structure is completed!");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
|
||||
}
|
||||
|
||||
private static void renameFolder() {
|
||||
File dir = new File(Main.getPath() + "/GUIs");
|
||||
File newDir = new File(Main.getPath() + "/OldConfig/GUIs/Version4");
|
||||
|
||||
try {
|
||||
FileUtils.moveDirectory(dir, newDir);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setNew(Boolean enable, Integer lines, String name, Boolean fillItemEnable, String fillItem, Boolean alias, Boolean aliasPerm, YamlConfiguration yamlConfiguration) {
|
||||
set("GUI.Enable", enable, yamlConfiguration);
|
||||
set("GUI.Lines", lines, yamlConfiguration);
|
||||
set("GUI.Name", name, yamlConfiguration);
|
||||
set("GUI.FillItem.Enable", fillItemEnable, yamlConfiguration);
|
||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
set("GUI.FillItem.GlassPaneColor", fillItem, yamlConfiguration);
|
||||
} else set("GUI.FillItem.Item", fillItem, yamlConfiguration);
|
||||
|
||||
set("Command.Alias", alias, yamlConfiguration);
|
||||
set("Command.Permission.Required", aliasPerm, yamlConfiguration);
|
||||
}
|
||||
|
||||
private static void setNew(String key, Integer slotNumber, Boolean slotEnable, String function, Boolean permRequired, YamlConfiguration yamlConfiguration) {
|
||||
set("Slots." + key + ".Slot", slotNumber, yamlConfiguration);
|
||||
set("Slots." + key + ".Enable", slotEnable, yamlConfiguration);
|
||||
set("Slots." + key + ".Function", function, yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.Required", permRequired, yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||
}
|
||||
|
||||
private static void set(String path, String value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Integer value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Boolean value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void convert7() {
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4Config conversion to the new config structure starts!");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
|
||||
|
||||
File f = new File(Main.getPath() + "/Functions/");
|
||||
File[] fileArray = f.listFiles();
|
||||
|
||||
for (File config : fileArray) {
|
||||
if (config.getName().equals("functionDeclaration.yml")) continue;
|
||||
String sub = config.getName().substring(config.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
yamlConfiguration.set("Slots.Function.CloseGUI.Enable",false);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4The conversion to the new config structure is completed!");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
|
||||
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
package net.t2code.commandguiv2.Spigot.config.functions;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CreateFunctions {
|
||||
public static void create() {
|
||||
createFunction("UseItem", false, 1, false, false, "", false, "", "",
|
||||
"&6Toggle UseItem", Arrays.asList("&bYou currently have the UseItem set to: %commandgui_useitem%"), true, "", true,
|
||||
Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"), false, false,
|
||||
"", false, "VAULT", "DIRT;5", 0, 0.0, false, false, false, Arrays.asList(), false,
|
||||
"", false, "", false,false, "", true, true,
|
||||
Arrays.asList("&bYour UseItem was set to: %commandgui_useitem%&b."), false, "", "", "String",
|
||||
"", false, 0, 0.0, Arrays.asList(), "", false,
|
||||
0, 0.0, Arrays.asList(), false, "",
|
||||
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
|
||||
|
||||
createFunction("SupportDiscord", false, 1, true, true, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19",
|
||||
false, "", "",
|
||||
"&3Support Discord", Arrays.asList("&8-----------------", "&bIf you need help setting up the plugin,", "&bfeel free to contact me on the Suport Discord.",
|
||||
"&8-----------------", "&eIf you find any errors or bugs,", "&eplease contact me so I can fix them.", "&8-----------------", "&5Discord: §7http://dc.t2code.net"),
|
||||
true, "", true, Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"),
|
||||
false, false, "", false, "VAULT", "DIRT;5", 0, 0.0, false, false,
|
||||
false, Arrays.asList(), false, "", false, "", false,false, "",
|
||||
false, true, Arrays.asList("&6You can find more information on Discord: &ehttp://dc.t2code.net"), false, "",
|
||||
"", "String", "", false, 0, 0.0, Arrays.asList(),
|
||||
"", false, 0, 0.0, Arrays.asList(), false, "",
|
||||
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
|
||||
}
|
||||
|
||||
public static void createFunction(String fileName, Boolean empty, Integer itemAmount, Boolean playerHeadEnable, Boolean base64Enable, String base64Value, Boolean playerWhoHasOpenedTheGUI,
|
||||
String playerName, String itemMaterial, String name, List<String> lore, Boolean noPermMessageEnable, String customNoPermMessage, Boolean noPermLoreEnable, List<String> noPermLore, Boolean customSoundEnable, Boolean customSoundNoSound, String customSoundSound,
|
||||
Boolean costEnable, String ecoModule, String ecoItem, Integer ecoVotePoints, Double ecoPrice, Boolean commandEnable, Boolean commandBungeeCommand,
|
||||
Boolean commandAsConsole, List<String> command, Boolean serverChange, String serverChangeServer, Boolean openGUIEnable, String openGUI,Boolean closeGUI,
|
||||
Boolean togglePermission, String togglePermissionPerm, Boolean toggleUseItem, Boolean messageEnable, List<String> message, Boolean setConfigEnable,
|
||||
String configFilePath, String configOptionPath, String configOptionPremat, String configStringValueLeft, Boolean configBooleanValueLeft,
|
||||
Integer configIntegerValueLeft, Double configDoubleValueLeft, List<String> configListValueLeft, String configStringValueRight,
|
||||
Boolean configBooleanValueRight, Integer configIntegerValueRight, Double configDoubleValueRight, List<String> configListValueRight,
|
||||
Boolean pluginReloadEnable, String pluginReloadCommand, Boolean functionVotePoints, FunctionVoteEnum functionVotePointsMode,
|
||||
Integer functionVotePointsAmount, Boolean functionItem, FunctionItemEnum functionItemMode, String functionItemItem) {
|
||||
long long_ = System.currentTimeMillis();
|
||||
|
||||
File config = new File(Main.getPath(), "Functions/" + fileName + ".yml");
|
||||
int i = 1;
|
||||
while (config.exists()) {
|
||||
config = new File(Main.getPath(), "Functions/" + fileName + "-" + i + ".yml");
|
||||
i++;
|
||||
}
|
||||
|
||||
T2Csend.console(Util.getPrefix() + " §4Function GUI file (Functions/" + config.getName() + ") is loaded...");
|
||||
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
set("Slots.Function.Item.Empty", empty, yamlConfiguration);
|
||||
set("Slots.Function.Item.Amount", itemAmount, yamlConfiguration);
|
||||
// if (!(MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12)) {
|
||||
set("Slots.Function.Item.PlayerHead.Enable", playerHeadEnable, yamlConfiguration);
|
||||
set("Slots.Function.Item.PlayerHead.Base64.Enable", base64Enable, yamlConfiguration);
|
||||
set("Slots.Function.Item.PlayerHead.Base64.Base64Value", base64Value, yamlConfiguration);
|
||||
set("Slots.Function.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", playerWhoHasOpenedTheGUI, yamlConfiguration);
|
||||
set("Slots.Function.Item.PlayerHead.PlayerName", playerName, yamlConfiguration);
|
||||
// }
|
||||
set("Slots.Function.Item.Material", itemMaterial == null ? "" : itemMaterial, yamlConfiguration);
|
||||
set("Slots.Function.Item.Name", name == null ? "" : name, yamlConfiguration);
|
||||
set("Slots.Function.Item.Lore", lore, yamlConfiguration);
|
||||
set("Slots.Function.NoPermission.Message.Enable", noPermMessageEnable, yamlConfiguration);
|
||||
set("Slots.Function.NoPermission.Message.CustomNoPermMessage", customNoPermMessage, yamlConfiguration);
|
||||
set("Slots.Function.NoPermission.Item.Lore.Enable", noPermLoreEnable, yamlConfiguration);
|
||||
set("Slots.Function.NoPermission.Item.Lore.Lore", noPermLore, yamlConfiguration);
|
||||
set("Slots.Function.CustomSound.Enable", customSoundEnable, yamlConfiguration);
|
||||
set("Slots.Function.CustomSound.NoSound", customSoundNoSound, yamlConfiguration);
|
||||
set("Slots.Function.CustomSound.Sound", customSoundSound == null ? "" : customSoundSound, yamlConfiguration);
|
||||
set("Slots.Function.Cost.Enable", costEnable, yamlConfiguration);
|
||||
set("Slots.Function.Cost.EcoModule", ecoModule, yamlConfiguration);
|
||||
set("Slots.Function.Cost.Item", ecoItem, yamlConfiguration);
|
||||
set("Slots.Function.Cost.VotePoints", ecoVotePoints, yamlConfiguration);
|
||||
set("Slots.Function.Cost.Price", ecoPrice, yamlConfiguration);
|
||||
set("Slots.Function.Command.Enable", commandEnable, yamlConfiguration);
|
||||
set("Slots.Function.Command.BungeeCommand", commandBungeeCommand, yamlConfiguration);
|
||||
set("Slots.Function.Command.CommandAsConsole", commandAsConsole, yamlConfiguration);
|
||||
set("Slots.Function.Command.Command", command, yamlConfiguration);
|
||||
set("Slots.Function.ServerChange.Enable", serverChange, yamlConfiguration);
|
||||
set("Slots.Function.ServerChange.Server", serverChangeServer == null ? "" : serverChangeServer, yamlConfiguration);
|
||||
set("Slots.Function.OpenGUI.Enable", openGUIEnable, yamlConfiguration);
|
||||
set("Slots.Function.OpenGUI.GUI", openGUI == null ? "" : openGUI, yamlConfiguration);
|
||||
set("Slots.Function.CloseGUI.Enable", closeGUI, yamlConfiguration);
|
||||
|
||||
set("Slots.Function.Toggle.Permission.Enable", togglePermission, yamlConfiguration);
|
||||
set("Slots.Function.Toggle.Permission.Permission", togglePermissionPerm == null ? "" : togglePermissionPerm, yamlConfiguration);
|
||||
set("Slots.Function.Toggle.UseItem.Enable", toggleUseItem, yamlConfiguration);
|
||||
|
||||
set("Slots.Function.Message.Enable", messageEnable, yamlConfiguration);
|
||||
set("Slots.Function.Message.Message", message, yamlConfiguration);
|
||||
|
||||
set("Slots.Function.SetConfig.Enable", setConfigEnable, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.File.Path", configFilePath == null ? "" : configFilePath, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Option.Path", configOptionPath == null ? "" : configOptionPath, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Option.Premat", configOptionPremat == null ? "" : configOptionPremat, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.LeftClick.String", configStringValueLeft == null ? "" : configStringValueLeft, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.LeftClick.Boolean", configBooleanValueLeft, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.LeftClick.Integer", configIntegerValueLeft, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.LeftClick.Double", configDoubleValueLeft, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.LeftClick.List", configListValueLeft, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.RightClick.String", configStringValueRight == null ? "" : configStringValueRight, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.RightClick.Boolean", configBooleanValueRight, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.RightClick.Integer", configIntegerValueRight, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.RightClick.Double", configDoubleValueRight, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.Value.RightClick.List", configListValueRight, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.PluginReload.Enable", pluginReloadEnable, yamlConfiguration);
|
||||
set("Slots.Function.SetConfig.PluginReload.Command", pluginReloadCommand == null ? "" : pluginReloadCommand, yamlConfiguration);
|
||||
|
||||
set("Slots.Function.FunctionVotePoints.Enable", functionVotePoints, yamlConfiguration);
|
||||
set("Slots.Function.FunctionVotePoints.Mode", functionVotePointsMode.toString(), yamlConfiguration);
|
||||
set("Slots.Function.FunctionVotePoints.Amount", functionVotePointsAmount, yamlConfiguration);
|
||||
|
||||
set("Slots.Function.FunctionItem.Enable", functionItem, yamlConfiguration);
|
||||
set("Slots.Function.FunctionItem.Mode", functionItemMode.toString(), yamlConfiguration);
|
||||
set("Slots.Function.FunctionItem.Item", functionItemItem, yamlConfiguration);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
T2Csend.console(Util.getPrefix() + " §2Function file (Functions/" + config.getName() + ") was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void set(String path, String value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Integer value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Boolean value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, List value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Double value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package net.t2code.commandguiv2.Spigot.config.gui;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class CreateGUI {
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
T2Csend.console(Util.getPrefix() + " §4Default GUI file (GUIs/default.yml) is loaded...");
|
||||
File config = new File(Main.getPath(), "GUIs/default.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
set("GUI.Enable", true, yamlConfiguration);
|
||||
set("GUI.Lines", 1, yamlConfiguration);
|
||||
set("GUI.Name", "&5default &9GUI", yamlConfiguration);
|
||||
set("GUI.FillItem.Enable", true, yamlConfiguration);
|
||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
set("GUI.FillItem.GlassPaneColor", 15, yamlConfiguration);
|
||||
} else set("GUI.FillItem.Item", "BLACK_STAINED_GLASS_PANE", yamlConfiguration);
|
||||
|
||||
set("Command.Alias", true, yamlConfiguration);
|
||||
set("Command.Permission.Required", true, yamlConfiguration);
|
||||
|
||||
set("Slots.SupportDiscord.Slot", 4, yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Enable", true, yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Function", "SupportDiscord", yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Permission.Required", false, yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||
|
||||
set("Slots.UseItem.Slot", 6, yamlConfiguration);
|
||||
set("Slots.UseItem.Enable", true, yamlConfiguration);
|
||||
set("Slots.UseItem.Function", "UseItem", yamlConfiguration);
|
||||
set("Slots.UseItem.Permission.Required", false, yamlConfiguration);
|
||||
set("Slots.UseItem.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots.UseItem.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
T2Csend.console(Util.getPrefix() + " §2Default GUI file (GUIs/default.yml) was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
private static void set(String path, String value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Integer value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void set(String path, Boolean value, YamlConfiguration config) {
|
||||
if (!config.contains(path)) {
|
||||
config.set(path, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system.config.languages;
|
||||
package net.t2code.commandguiv2.Spigot.config.languages;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
@ -9,10 +10,10 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
|
||||
public class LanguagesCreate {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static void langCreate() {
|
||||
send.debug(plugin,"§4Language files are created / updated...");
|
||||
T2Csend.debug(plugin, "§4Language files are created / updated...");
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
|
||||
/**
|
||||
|
@ -42,9 +43,13 @@ public class LanguagesCreate {
|
|||
set("UseItem.SlotNotEmpty", MSG.EN_ItemSlotNotEmpty, yamlConfigurationEN);
|
||||
set("UseItem.SlotAlreadySet", MSG.EN_ItemSlotAlreadySet, yamlConfigurationEN);
|
||||
set("UseItem.ItemSlot_wrongValue", MSG.EN_ItemSlot_wrongValue, yamlConfigurationEN);
|
||||
set("UseItem.DisabledInGameMode", MSG.EN_UseItemDisabledInGameMode, yamlConfigurationEN);
|
||||
set("UseItem.DisabledInWorld", MSG.EN_UseItemDisabledInWorld, yamlConfigurationEN);
|
||||
|
||||
set("Cost.Buy_msg", MSG.EN_Buy_msg, yamlConfigurationEN);
|
||||
set("Cost.No_money", MSG.EN_No_money, yamlConfigurationEN);
|
||||
set("Cost.No.Money", MSG.EN_No_money, yamlConfigurationEN);
|
||||
set("Cost.No.Item", MSG.EN_No_moneyItem, yamlConfigurationEN);
|
||||
set("Cost.No.Vote", MSG.EN_No_moneyVote, yamlConfigurationEN);
|
||||
set("Cost.NoInventorySpace", MSG.EN_NoInventorySpace, yamlConfigurationEN);
|
||||
|
||||
set("ServerChange.onServerChange", MSG.EN_onServerChange, yamlConfigurationEN);
|
||||
|
@ -58,6 +63,14 @@ public class LanguagesCreate {
|
|||
set("Player.PlayerNotFond", MSG.EN_PlayerNotFond, yamlConfigurationEN);
|
||||
set("Player.PlayerNoInventorySpace", MSG.EN_PlayerNoInventorySpace, yamlConfigurationEN);
|
||||
|
||||
set("FunctionItem.Add", MSG.EN_FunctionItemAdd, yamlConfigurationEN);
|
||||
set("FunctionItem.Remove", MSG.EN_FunctionItemRemove, yamlConfigurationEN);
|
||||
set("FunctionItem.RemoveError", MSG.EN_FunctionItemRemoveError, yamlConfigurationEN);
|
||||
|
||||
set("FunctionVote.Add", MSG.EN_FunctionVoteAdd, yamlConfigurationEN);
|
||||
set("FunctionVote.Remove", MSG.EN_FunctionVoteRemove, yamlConfigurationEN);
|
||||
set("FunctionVote.RemoveError", MSG.EN_FunctionVoteRemoveError, yamlConfigurationEN);
|
||||
|
||||
set("Help.CGUI", MSG.EN_Help_CGUI, yamlConfigurationEN);
|
||||
set("Help.Help", MSG.EN_Help_Help, yamlConfigurationEN);
|
||||
set("Help.Info", MSG.EN_Help_Info, yamlConfigurationEN);
|
||||
|
@ -69,10 +82,21 @@ public class LanguagesCreate {
|
|||
set("Help.UseItem_Off", MSG.EN_GUIItemHelp_off, yamlConfigurationEN);
|
||||
set("Help.UseItem_Slot", MSG.EN_GUIItemHelp_Slot, yamlConfigurationEN);
|
||||
|
||||
set("Help.Player.CGUI", MSG.EN_PlayerHelp_CGUI, yamlConfigurationEN);
|
||||
set("Help.Player.Help", MSG.EN_PlayerHelp_Help, yamlConfigurationEN);
|
||||
set("Help.Player.Info", MSG.EN_PlayerHelp_Info, yamlConfigurationEN);
|
||||
set("Help.Player.Open", MSG.EN_PlayerHelp_Open, yamlConfigurationEN);
|
||||
set("Help.Player.Give", MSG.EN_PlayerHelp_Give, yamlConfigurationEN);
|
||||
set("Help.Player.CreateDefaultGUI", MSG.EN_PlayerHelp_CreateDefaultGUI, yamlConfigurationEN);
|
||||
set("Help.Player.Reload", MSG.EN_PlayerHelp_Reload, yamlConfigurationEN);
|
||||
set("Help.Player.UseItem_On", MSG.EN_GUIItemPlayerHelp_on, yamlConfigurationEN);
|
||||
set("Help.Player.UseItem_Off", MSG.EN_GUIItemPlayerHelp_off, yamlConfigurationEN);
|
||||
set("Help.Player.UseItem_Slot", MSG.EN_GUIItemPlayerHelp_Slot, yamlConfigurationEN);
|
||||
|
||||
try {
|
||||
yamlConfigurationEN.save(messagesEN);
|
||||
} catch (IOException e) {
|
||||
send.warning(plugin,e.getMessage());
|
||||
T2Csend.warning(plugin, e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -104,9 +128,13 @@ public class LanguagesCreate {
|
|||
set("UseItem.SlotNotEmpty", MSG.DE_ItemSlotNotEmpty, yamlConfigurationDE);
|
||||
set("UseItem.SlotAlreadySet", MSG.DE_ItemSlotAlreadySet, yamlConfigurationDE);
|
||||
set("UseItem.ItemSlot_wrongValue", MSG.DE_ItemSlot_wrongValue, yamlConfigurationDE);
|
||||
set("UseItem.DisabledInGameMode", MSG.DE_UseItemDisabledInGameMode, yamlConfigurationDE);
|
||||
set("UseItem.DisabledInWorld", MSG.DE_UseItemDisabledInWorld, yamlConfigurationDE);
|
||||
|
||||
set("Cost.Buy_msg", MSG.DE_Buy_msg, yamlConfigurationDE);
|
||||
set("Cost.No_money", MSG.DE_No_money, yamlConfigurationDE);
|
||||
set("Cost.No.Money", MSG.DE_No_money, yamlConfigurationDE);
|
||||
set("Cost.No.Item", MSG.DE_No_moneyItem, yamlConfigurationDE);
|
||||
set("Cost.No.Vote", MSG.DE_No_moneyVote, yamlConfigurationDE);
|
||||
set("Cost.NoInventorySpace", MSG.DE_NoInventorySpace, yamlConfigurationDE);
|
||||
|
||||
set("ServerChange.onServerChange", MSG.DE_onServerChange, yamlConfigurationDE);
|
||||
|
@ -120,6 +148,14 @@ public class LanguagesCreate {
|
|||
set("Player.PlayerNotFond", MSG.DE_PlayerNotFond, yamlConfigurationDE);
|
||||
set("Player.PlayerNoInventorySpace", MSG.DE_PlayerNoInventorySpace, yamlConfigurationDE);
|
||||
|
||||
set("FunctionItem.Add", MSG.DE_FunctionItemAdd, yamlConfigurationDE);
|
||||
set("FunctionItem.Remove", MSG.DE_FunctionItemRemove, yamlConfigurationDE);
|
||||
set("FunctionItem.RemoveError", MSG.DE_FunctionItemRemoveError, yamlConfigurationDE);
|
||||
|
||||
set("FunctionVote.Add", MSG.DE_FunctionVoteAdd, yamlConfigurationDE);
|
||||
set("FunctionVote.Remove", MSG.DE_FunctionVoteRemove, yamlConfigurationDE);
|
||||
set("FunctionVote.RemoveError", MSG.DE_FunctionVoteRemoveError, yamlConfigurationDE);
|
||||
|
||||
set("Help.CGUI", MSG.DE_Help_CGUI, yamlConfigurationDE);
|
||||
set("Help.Help", MSG.DE_Help_Help, yamlConfigurationDE);
|
||||
set("Help.Info", MSG.DE_Help_Info, yamlConfigurationDE);
|
||||
|
@ -131,10 +167,21 @@ public class LanguagesCreate {
|
|||
set("Help.UseItem_Off", MSG.DE_GUIItemHelp_off, yamlConfigurationDE);
|
||||
set("Help.UseItem_Slot", MSG.DE_GUIItemHelp_Slot, yamlConfigurationDE);
|
||||
|
||||
set("Help.Player.CGUI", MSG.DE_PlayerHelp_CGUI, yamlConfigurationDE);
|
||||
set("Help.Player.Help", MSG.DE_PlayerHelp_Help, yamlConfigurationDE);
|
||||
set("Help.Player.Info", MSG.DE_PlayerHelp_Info, yamlConfigurationDE);
|
||||
set("Help.Player.Open", MSG.DE_PlayerHelp_Open, yamlConfigurationDE);
|
||||
set("Help.Player.Give", MSG.DE_PlayerHelp_Give, yamlConfigurationDE);
|
||||
set("Help.Player.CreateDefaultGUI", MSG.DE_PlayerHelp_CreateDefaultGUI, yamlConfigurationDE);
|
||||
set("Help.Player.Reload", MSG.DE_PlayerHelp_Reload, yamlConfigurationDE);
|
||||
set("Help.Player.UseItem_On", MSG.DE_GUIItemPlayerHelp_on, yamlConfigurationDE);
|
||||
set("Help.Player.UseItem_Off", MSG.DE_GUIItemPlayerHelp_off, yamlConfigurationDE);
|
||||
set("Help.Player.UseItem_Slot", MSG.DE_GUIItemPlayerHelp_Slot, yamlConfigurationDE);
|
||||
|
||||
try {
|
||||
yamlConfigurationDE.save(messagesDE);
|
||||
} catch (IOException e) {
|
||||
send.warning(plugin,e.getMessage());
|
||||
T2Csend.warning(plugin, e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -167,9 +214,13 @@ public class LanguagesCreate {
|
|||
set("UseItem.SlotNotEmpty", MSG.NO_ItemSlotNotEmpty, yamlConfigurationNO);
|
||||
set("UseItem.SlotAlreadySet", MSG.NO_ItemSlotAlreadySet, yamlConfigurationNO);
|
||||
set("UseItem.ItemSlot_wrongValue", MSG.NO_ItemSlot_wrongValue, yamlConfigurationNO);
|
||||
set("UseItem.DisabledInGameMode", MSG.NO_UseItemDisabledInGameMode, yamlConfigurationNO);
|
||||
set("UseItem.DisabledInWorld", MSG.NO_UseItemDisabledInWorld, yamlConfigurationNO);
|
||||
|
||||
set("Cost.Buy_msg", MSG.NO_Buy_msg, yamlConfigurationNO);
|
||||
set("Cost.No_money", MSG.NO_No_money, yamlConfigurationNO);
|
||||
set("Cost.No.Money", MSG.NO_No_money, yamlConfigurationNO);
|
||||
set("Cost.No.Item", MSG.NO_No_moneyItem, yamlConfigurationNO);
|
||||
set("Cost.No.Vote", MSG.NO_No_moneyVote, yamlConfigurationNO);
|
||||
set("Cost.NoInventorySpace", MSG.NO_NoInventorySpace, yamlConfigurationNO);
|
||||
|
||||
set("ServerChange.onServerChange", MSG.NO_onServerChange, yamlConfigurationNO);
|
||||
|
@ -183,6 +234,14 @@ public class LanguagesCreate {
|
|||
set("Player.PlayerNotFond", MSG.NO_PlayerNotFond, yamlConfigurationNO);
|
||||
set("Player.PlayerNoInventorySpace", MSG.NO_PlayerNoInventorySpace, yamlConfigurationNO);
|
||||
|
||||
set("FunctionItem.Add", MSG.NO_FunctionItemAdd, yamlConfigurationNO);
|
||||
set("FunctionItem.Remove", MSG.NO_FunctionItemRemove, yamlConfigurationNO);
|
||||
set("FunctionItem.RemoveError", MSG.NO_FunctionItemRemoveError, yamlConfigurationNO);
|
||||
|
||||
set("FunctionVote.Add", MSG.NO_FunctionVoteAdd, yamlConfigurationNO);
|
||||
set("FunctionVote.Remove", MSG.NO_FunctionVoteRemove, yamlConfigurationNO);
|
||||
set("FunctionVote.RemoveError", MSG.NO_FunctionVoteRemoveError, yamlConfigurationNO);
|
||||
|
||||
set("Help.CGUI", MSG.NO_Help_CGUI, yamlConfigurationNO);
|
||||
set("Help.Help", MSG.NO_Help_Help, yamlConfigurationNO);
|
||||
set("Help.Info", MSG.NO_Help_Info, yamlConfigurationNO);
|
||||
|
@ -194,15 +253,25 @@ public class LanguagesCreate {
|
|||
set("Help.UseItem_Off", MSG.NO_GUIItemHelp_off, yamlConfigurationNO);
|
||||
set("Help.UseItem_Slot", MSG.NO_GUIItemHelp_Slot, yamlConfigurationNO);
|
||||
|
||||
set("Help.Player.CGUI", MSG.NO_PlayerHelp_CGUI, yamlConfigurationNO);
|
||||
set("Help.Player.Help", MSG.NO_PlayerHelp_Help, yamlConfigurationNO);
|
||||
set("Help.Player.Info", MSG.NO_PlayerHelp_Info, yamlConfigurationNO);
|
||||
set("Help.Player.Open", MSG.NO_PlayerHelp_Open, yamlConfigurationNO);
|
||||
set("Help.Player.Give", MSG.NO_PlayerHelp_Give, yamlConfigurationNO);
|
||||
set("Help.Player.CreateDefaultGUI", MSG.NO_PlayerHelp_CreateDefaultGUI, yamlConfigurationNO);
|
||||
set("Help.Player.Reload", MSG.NO_PlayerHelp_Reload, yamlConfigurationNO);
|
||||
set("Help.Player.UseItem_On", MSG.NO_GUIItemPlayerHelp_on, yamlConfigurationNO);
|
||||
set("Help.Player.UseItem_Off", MSG.NO_GUIItemPlayerHelp_off, yamlConfigurationNO);
|
||||
set("Help.Player.UseItem_Slot", MSG.NO_GUIItemPlayerHelp_Slot, yamlConfigurationNO);
|
||||
|
||||
try {
|
||||
yamlConfigurationNO.save(messagesNO);
|
||||
} catch (IOException e) {
|
||||
send.warning(plugin,e.getMessage());
|
||||
T2Csend.warning(plugin, e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
send.console(Main.prefix + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
T2Csend.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
|
||||
private static void set(String path, String value, YamlConfiguration config) {
|
|
@ -9,7 +9,7 @@
|
|||
// \_____\_____|\____/|_____|
|
||||
// -----------------------------
|
||||
|
||||
package de.jatitv.commandguiv2.Spigot.system.config.languages;
|
||||
package net.t2code.commandguiv2.Spigot.config.languages;
|
||||
|
||||
public class MSG {
|
||||
|
||||
|
@ -27,7 +27,9 @@ public class MSG {
|
|||
public static String EN_NoPermissionForItem = "[prefix] &cFor &b[item] &cyou lack the permission &6[perm]&c!";
|
||||
|
||||
public static String EN_Buy_msg = "[prefix] &2You bought [itemname] &2for &6[price]&2.";
|
||||
public static String EN_No_money = "[prefix] &cYou don't have enough money!";
|
||||
public static String EN_No_money = "[prefix] &cYou don't have enough money!/*/&cYou need: &6[price]&c.";
|
||||
public static String EN_No_moneyItem = "[prefix] &cYou don't have enough items of &6[item] &cin your inventory!/*/&cYou need: &6[amount]&c.";
|
||||
public static String EN_No_moneyVote = "[prefix] &cYou do not have enough vote points!/*/&cYou need: &6[amount]&c.";
|
||||
public static String EN_NoInventorySpace = "[prefix] &cYou have no room in your inventory!";
|
||||
|
||||
public static String EN_onServerChange = "[prefix] &2You will be connected to the server &e[server]§2.";
|
||||
|
@ -38,6 +40,8 @@ public class MSG {
|
|||
public static String EN_ItemSlotNotEmpty = "[prefix] &6The slot &e[slot] &6is currently occupied!";
|
||||
public static String EN_ItemSlotAlreadySet = "[prefix] &6The slot §e[slot] §6is already set!";
|
||||
public static String EN_ItemSlot_wrongValue = "[prefix] &cThe specified slot must be between 1 and 9!";
|
||||
public static String EN_UseItemDisabledInGameMode = "[prefix] &cThe UseItem is disabled in this GameMode!";
|
||||
public static String EN_UseItemDisabledInWorld = "[prefix] &cThe UseItem is disabled in this World!";
|
||||
|
||||
public static String EN_GUInotFound = "[prefix] &cThe GUI chosen by the does not exist.";
|
||||
public static String EN_GUIisDisabled = "[prefix] &cThe GUI [gui] &cis currently Disabled!";
|
||||
|
@ -48,6 +52,14 @@ public class MSG {
|
|||
public static String EN_PlayerNotFond = "[prefix] &cThe player &6[player] &cwas not found or is not online!";
|
||||
public static String EN_PlayerNoInventorySpace = "[prefix] &6[player] &chas no free space in his inventory!";
|
||||
|
||||
public static String EN_FunctionItemAdd = "[prefix] &2You have &6[amount] [item] &2placed in your inventory.";
|
||||
public static String EN_FunctionItemRemove = "[prefix] &2You have been &6[amount] [item] &2removed.";
|
||||
public static String EN_FunctionItemRemoveError = "[prefix] &cYou don't have so many items!/*/&cYou need &6[amount] [item]&c!";
|
||||
|
||||
public static String EN_FunctionVoteAdd = "[prefix] &2You were given &6[amount] &2Vote points.";
|
||||
public static String EN_FunctionVoteRemove = "[prefix] &2You have been removed &6[amount] &2Vote points.";
|
||||
public static String EN_FunctionVoteRemoveError = "[prefix] &cYou don't have so many VotePoints!/*/&cYou need &6[amount]&c!";
|
||||
|
||||
public static String EN_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &eOpen the default GUI &7(&r[gui]&7)&e.";
|
||||
public static String EN_Help_Open = "&8''&b/commandgui [gui]&8'' &eOpen the GUI: &6[guiname]&e.";
|
||||
public static String EN_Help_Help = "&8''&b/commandguihelp&8'' &eOpen this help.";
|
||||
|
@ -58,7 +70,18 @@ public class MSG {
|
|||
|
||||
public static String EN_GUIItemHelp_on = "&8''&b/gui-item on&8'' &eActivate the GUIItem for you.";
|
||||
public static String EN_GUIItemHelp_off = "&8''&b/gui-item off&8'' &eDisable the GUIItem for yourself.";
|
||||
public static String EN_GUIItemHelp_Slot = "&8''&b/gui-item slot [slot]&8'' &eSet the slot for GUIItem for you.";
|
||||
public static String EN_GUIItemHelp_Slot = "&8''&b/gui-item slot &7<slot>&8'' &eSet the slot where you want to have the GUIItem.";
|
||||
public static String EN_PlayerHelp_CGUI = "&b/commandgui &8| &b/cgui/*/&eOpen the default GUI &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui";
|
||||
public static String EN_PlayerHelp_Open = "&b/commandgui [gui]/*/&eOpen the GUI: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui ";
|
||||
public static String EN_PlayerHelp_Help = "&b/commandguihelp/*/&eOpen this help./*/SUGGEST_COMMAND/*//commandguihelp";
|
||||
public static String EN_PlayerHelp_Info = "&b/commandgui admin info/*/&eCall the info from &4Command&9GUI &e./*/SUGGEST_COMMAND/*//commandgui admin info";
|
||||
public static String EN_PlayerHelp_Give = "&b/commandgui admin give &7<player>/*/&eGive a player the GUI item./*/SUGGEST_COMMAND/*//commandgui admin give ";
|
||||
public static String EN_PlayerHelp_CreateDefaultGUI = "&b/commandgui admin createdefaultgui/*/&eCreate a default GUI &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui";
|
||||
public static String EN_PlayerHelp_Reload = "&b/commandgui admin reload/*/&eReload the plugin./*/SUGGEST_COMMAND/*//commandgui admin reload";
|
||||
|
||||
public static String EN_GUIItemPlayerHelp_on = "&b/gui-item on/*/&eActivate the GUIItem for you./*/SUGGEST_COMMAND/*//gui-item on";
|
||||
public static String EN_GUIItemPlayerHelp_off = "&b/gui-item off/*/&eDisable the GUIItem for yourself./*/SUGGEST_COMMAND/*//gui-item off";
|
||||
public static String EN_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eSet the slot where you want to have the GUIItem./*/SUGGEST_COMMAND/*//gui-item slot ";
|
||||
|
||||
// DE
|
||||
public static String DE_VaultNotSetUp = "[prefix] &4Vault / Economy nicht eingerichtet!";
|
||||
|
@ -79,9 +102,13 @@ public class MSG {
|
|||
public static String DE_ItemSlotNotEmpty = "[prefix] &6Der Slot §e[slot] §6ist derzeit belegt!.";
|
||||
public static String DE_ItemSlotAlreadySet = "[prefix] &6Der Slot §e[slot] §6ist bereits eingestellt!";
|
||||
public static String DE_ItemSlot_wrongValue = "[prefix] &cDer angegebene Slot muss sich zwischen 1 und 9 befinden!";
|
||||
public static String DE_UseItemDisabledInGameMode = "[prefix] &cDas UseItem ist in diesem GameMode deaktiviert!";
|
||||
public static String DE_UseItemDisabledInWorld = "[prefix] &cDas UseItem ist in dieser Welt deaktiviert!";
|
||||
|
||||
public static String DE_Buy_msg = "[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft.";
|
||||
public static String DE_No_money = "[prefix] &cDu hast nicht gen[ue]gend Geld!";
|
||||
public static String DE_No_money = "[prefix] &cDu hast nicht gen[ue]gend Geld!/*/&cDu ben[oe]tigst [price].";
|
||||
public static String DE_No_moneyItem = "[prefix] &cDu hast nicht gen[ue]gent Items von &6[item] &cim Inventar!/*/&cDu ben[oe]tigst: &6[amount]&c.";
|
||||
public static String DE_No_moneyVote = "[prefix] &cDu hast nicht gen[ue]gent Vote Punkte!/*/&cDu ben[oe]tigst: &6[amount]&c.";
|
||||
public static String DE_NoInventorySpace = "[prefix] &cDu hast keinen Platz in deinem Inventar!";
|
||||
|
||||
public static String DE_onServerChange = "[prefix] &2Du wirst auf den Server §e[server] §2verbunden.";
|
||||
|
@ -95,6 +122,14 @@ public class MSG {
|
|||
public static String DE_PlayerNotFond = "[prefix] &cDer Spieler &6[player] &cwurde nicht gefunden oder ist nicht Online!";
|
||||
public static String DE_PlayerNoInventorySpace = "[prefix] &6[player] &chat keinen freien Platz in seinem Inventar!";
|
||||
|
||||
public static String DE_FunctionItemAdd = "[prefix] &2Dir wurden &6[amount] [item] &2in dein Inventar gelegt.";
|
||||
public static String DE_FunctionItemRemove = "[prefix] &2Dir wurden &6[amount] [item] &2entfernt.";
|
||||
public static String DE_FunctionItemRemoveError = "[prefix] &cDu hast nicht so viele Items!/*/&cDu benötigets &6[amount] [item]&c!";
|
||||
|
||||
public static String DE_FunctionVoteAdd = "[prefix] &2Dir wurden &6[amount] &2Vote Punkte gegeben.";
|
||||
public static String DE_FunctionVoteRemove = "[prefix] &2Dir wurden &6[amount] &2Vote Punkte entfernt.";
|
||||
public static String DE_FunctionVoteRemoveError = "[prefix] &cDu hast nicht so viele VotePunkte!/*/&cDu benötigets &6[amount]&c!";
|
||||
|
||||
public static String DE_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &e[OE]ffne die default GUI &7(&r[gui]&7)&e.";
|
||||
public static String DE_Help_Open = "&8''&b/commandgui [gui]&8'' &e[OE]ffne die GUI: &6[guiname]&e.";
|
||||
public static String DE_Help_Help = "&8''&b/commandguihelp&8'' &e[OE]ffne diese help.";
|
||||
|
@ -105,7 +140,21 @@ public class MSG {
|
|||
|
||||
public static String DE_GUIItemHelp_on = "&8''&b/gui-item on&8'' &eAktiviere f[ue]r dich das GUIItem.";
|
||||
public static String DE_GUIItemHelp_off = "&8''&b/gui-item off&8'' &eDeaktiviere f[ue]r dich das GUIItem.";
|
||||
public static String DE_GUIItemHelp_Slot = "&8''&b/gui-item slot [slot]&8'' &eSetze den Slot für GUIItem für Sie einstellen.";
|
||||
public static String DE_GUIItemHelp_Slot = "&8''&b/gui-item slot &7<slot>&8'' &eStelle den Slot ein, auf den du das GUIItem haben möchtest.";
|
||||
|
||||
public static String DE_PlayerHelp_CGUI = "&b/commandgui &8| &b/cgui/*/&e[OE]ffne die default GUI &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui";
|
||||
public static String DE_PlayerHelp_Open = "&b/commandgui [gui]/*/&e[OE]ffne die GUI: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui ";
|
||||
public static String DE_PlayerHelp_Help = "&b/commandguihelp/*/&e[OE]ffne diese help./*/SUGGEST_COMMAND/*//commandguihelp";
|
||||
public static String DE_PlayerHelp_Info = "&b/commandgui admin info/*/&eRufe die Infos von &4Command&9GUI &eauf./*/SUGGEST_COMMAND/*//commandgui admin info";
|
||||
public static String DE_PlayerHelp_Give = "&b/commandgui admin give &7<player>/*/&eGebe einem Spieler das GUI-Item./*/SUGGEST_COMMAND/*//commandgui admin give ";
|
||||
public static String DE_PlayerHelp_CreateDefaultGUI = "&b/commandgui admin createdefaultgui/*/&eLasse eine default GUI erstellen &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui";
|
||||
public static String DE_PlayerHelp_Reload = "&b/commandgui admin reload/*/&eLade das Plugin neu./*/SUGGEST_COMMAND/*//commandgui admin reload";
|
||||
|
||||
public static String DE_GUIItemPlayerHelp_on = "&b/gui-item on/*/&eAktiviere f[ue]r dich das GUIItem./*/SUGGEST_COMMAND/*//gui-item on";
|
||||
public static String DE_GUIItemPlayerHelp_off = "&b/gui-item off/*/&eDeaktiviere f[ue]r dich das GUIItem./*/SUGGEST_COMMAND/*//gui-item off";
|
||||
public static String DE_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eStelle den Slot ein, auf den du das GUIItem haben möchtest./*/SUGGEST_COMMAND/*//gui-item slot ";
|
||||
|
||||
|
||||
|
||||
|
||||
// FR
|
||||
|
@ -130,9 +179,13 @@ public class MSG {
|
|||
public static String NO_ItemSlotNotEmpty = "[prefix] &6Plassen &e[slot] &6er opptatt for øyeblikket!";
|
||||
public static String NO_ItemSlotAlreadySet = "[prefix] &6Plassen §e[slot] §6er allerede satt!";
|
||||
public static String NO_ItemSlot_wrongValue = "[prefix] &cDen spesifiserte plassen må være mellom 1 og 9!";
|
||||
public static String NO_UseItemDisabledInGameMode = "[prefix] &cBrukselementet er deaktivert i denne spillmodusen!!";
|
||||
public static String NO_UseItemDisabledInWorld = "[prefix] &cUseItem er deaktivert i denne verden!";
|
||||
|
||||
public static String NO_Buy_msg = "[prefix] &2Du kjøpte [itemname] &2for &6[price]&2.";
|
||||
public static String NO_No_money = "[prefix] &cDu har ikke nok penger!";
|
||||
public static String NO_No_money = "[prefix] &cDu har ikke nok penger!/*/&cDu trenger &6[price]&c.";
|
||||
public static String NO_No_moneyItem = "[prefix] &cDu har ikke nok varer av &6[item] &ci inventaret ditt!/*/&cDu trenger: &6[amount]&c.";
|
||||
public static String NO_No_moneyVote = "[prefix] &cDu har ikke nok stemmepoeng!/*/&cDu trenger: &6[amount]&c.";
|
||||
public static String NO_NoInventorySpace = "[prefix] &cDu har ikke nok plass i inventaret ditt!";
|
||||
|
||||
public static String NO_onServerChange = "[prefix] &2Du vil bli tilkoblet serveren &e[server]&2.";
|
||||
|
@ -146,6 +199,14 @@ public class MSG {
|
|||
public static String NO_PlayerNotFond = "[prefix] &cSpilleren &6[player] &cble ikke funnet eller er ikke pålogget!";
|
||||
public static String NO_PlayerNoInventorySpace = "[prefix] &6[player] &char ikke nok plass i inventaret sitt!";
|
||||
|
||||
public static String NO_FunctionItemAdd = "[prefix] &2Du har &6[amount] [item] &2plassert i beholdningen din.";
|
||||
public static String NO_FunctionItemRemove = "[prefix] &2Du har blitt &6[amount] [item] &2fjernet.";
|
||||
public static String NO_FunctionItemRemoveError = "[prefix] &cDu har ikke så mange varer!/*/&cDu trenger &6[amount] [item]&c!";
|
||||
|
||||
public static String NO_FunctionVoteAdd = "[prefix] &2Du fikk &6[amount] &2stemmepoeng.";
|
||||
public static String NO_FunctionVoteRemove = "[prefix] &2Du har blitt fjernet &6[amount] &2Stemmepoeng.";
|
||||
public static String NO_FunctionVoteRemoveError = "[prefix] &cDu har ikke så mange stemmepoeng!/*/&cDu trenger &6[amount]&c!";
|
||||
|
||||
public static String NO_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &eÅpne default GUIen &7(&r[gui]&7)&e.";
|
||||
public static String NO_Help_Open = "&8''&b/commandgui [gui]&8'' &eÅpne GUIen: &6[guiname]&e.";
|
||||
public static String NO_Help_Help = "&8''&b/commandguihelp&8'' &eSender denne hjelpe meldingen.";
|
||||
|
@ -156,5 +217,17 @@ public class MSG {
|
|||
|
||||
public static String NO_GUIItemHelp_on = "&8''&b/gui-item on&8'' &eAktiverer en GUI gjenstand for deg.";
|
||||
public static String NO_GUIItemHelp_off = "&8''&b/gui-item off&8'' &eDeaktiverer en GUI gjenstand for deg.";
|
||||
public static String NO_GUIItemHelp_Slot = "&8''&b/gui-item slot [slot]&8'' &eSett sporet for GUIItem for deg.";
|
||||
public static String NO_GUIItemHelp_Slot = "&8''&b/gui-item slot &7<slot>&8'' &eSett sporet for GUIItem for deg.";
|
||||
|
||||
public static String NO_PlayerHelp_CGUI = "&b/commandgui &8| &b/cgui/*/&eÅpne default GUIen &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui";
|
||||
public static String NO_PlayerHelp_Open = "&b/commandgui [gui]/*/&eÅpne GUIen: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui ";
|
||||
public static String NO_PlayerHelp_Help = "&b/commandguihelp/*/&eSender denne hjelpe meldingen./*/SUGGEST_COMMAND/*//commandguihelp";
|
||||
public static String NO_PlayerHelp_Info = "&b/commandgui admin info/*/&eKall informasjon fra &4Command&9GUI&e./*/SUGGEST_COMMAND/*//commandgui admin info";
|
||||
public static String NO_PlayerHelp_Give = "&b/commandgui admin give &7<player>/*/&eGi en spiller GUI gjenstanden./*/SUGGEST_COMMAND/*//commandgui admin give ";
|
||||
public static String NO_PlayerHelp_CreateDefaultGUI = "&b/commandgui admin createdefaultgui/*/&eLag en normalverdi GUI &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui";
|
||||
public static String NO_PlayerHelp_Reload = "&b/commandgui admin reload/*/&eLast inn pluginet på nytt./*/SUGGEST_COMMAND/*//commandgui admin reload";
|
||||
|
||||
public static String NO_GUIItemPlayerHelp_on = "&b/gui-item on/*/&eAktiverer en GUI gjenstand for deg./*/SUGGEST_COMMAND/*//gui-item on";
|
||||
public static String NO_GUIItemPlayerHelp_off = "&b/gui-item off/*/&eDeaktiverer en GUI gjenstand for deg./*/SUGGEST_COMMAND/*//gui-item off";
|
||||
public static String NO_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eSett sporet for GUIItem for deg./*/SUGGEST_COMMAND/*//gui-item slot ";
|
||||
}
|
|
@ -1,16 +1,17 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system.config.languages;
|
||||
package net.t2code.commandguiv2.Spigot.config.languages;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SelectMessages {
|
||||
private static String prefix = Util.Prefix;
|
||||
|
||||
|
||||
public static String selectMSG;
|
||||
|
||||
|
@ -32,14 +33,18 @@ public class SelectMessages {
|
|||
public static String ItemSlotNotEmpty;
|
||||
public static String ItemSlotAlreadySet;
|
||||
public static String ItemSlot_wrongValue;
|
||||
public static String UseItemDisabledInGameMode;
|
||||
public static String UseItemDisabledInWorld;
|
||||
|
||||
public static String Buy_msg;
|
||||
public static String No_money;
|
||||
public static String noMoney;
|
||||
public static String noMoneyItem;
|
||||
public static String noMoneyVote;
|
||||
public static String NoInventorySpace;
|
||||
|
||||
public static String onServerChange;
|
||||
|
||||
public static String GUInotFound;
|
||||
public static String guiNotFound;
|
||||
public static String GUIIsDisabled;
|
||||
|
||||
public static String Give_Sender;
|
||||
|
@ -48,6 +53,13 @@ public class SelectMessages {
|
|||
public static String PlayerNotFond;
|
||||
public static String PlayerNoInventorySpace;
|
||||
|
||||
public static String functionItemAdd;
|
||||
public static String functionItemRemove;
|
||||
public static String functionItemRemoveError;
|
||||
public static String functionVoteAdd;
|
||||
public static String functionVoteRemove;
|
||||
public static String functionVoteRemoveError;
|
||||
|
||||
public static String HelpCgui;
|
||||
public static String HelpHelp;
|
||||
public static String HelpInfo;
|
||||
|
@ -58,25 +70,34 @@ public class SelectMessages {
|
|||
public static String GUIItemHelp_on;
|
||||
public static String GUIItemHelp_off;
|
||||
public static String GUIItemHelp_Slot;
|
||||
public static String PlayerHelpCgui;
|
||||
public static String PlayerHelpHelp;
|
||||
public static String PlayerHelpInfo;
|
||||
public static String PlayerHelpOpen;
|
||||
public static String PlayerHelpGive;
|
||||
public static String PlayerHelpCreateDefaultGUI;
|
||||
public static String PlayerHelpReload;
|
||||
public static String PlayerGUIItemHelp_on;
|
||||
public static String PlayerGUIItemHelp_off;
|
||||
public static String PlayerGUIItemHelp_Slot;
|
||||
|
||||
public static void onSelect(String Prefix) {
|
||||
|
||||
send.debug(Main.plugin, "§4Select language...");
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
T2Csend.debug(Main.getPlugin(), "§4Select language...");
|
||||
long long_ = System.currentTimeMillis();
|
||||
|
||||
File msg;
|
||||
|
||||
msg = new File(Main.getPath(), "languages/" + SelectConfig.language + "_messages.yml");
|
||||
msg = new File(Main.getPath(), "languages/" + SelectConfig.getLanguage() + "_messages.yml");
|
||||
if (!msg.isFile()) {
|
||||
send.console(Prefix);
|
||||
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.console(Prefix + " §4The selected §c" + SelectConfig.language + " §4language file was not found.");
|
||||
send.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.console(Prefix);
|
||||
T2Csend.console(Prefix);
|
||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(Prefix + " §4The selected §c" + SelectConfig.getLanguage() + " §4language file was not found.");
|
||||
T2Csend.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(Prefix);
|
||||
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||
selectMSG = "english";
|
||||
} else selectMSG = SelectConfig.language;
|
||||
} else selectMSG = SelectConfig.getLanguage();
|
||||
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
||||
|
||||
VaultNotSetUp = select("Plugin.VaultNotSetUp", yamlConfiguration_msg);
|
||||
|
@ -97,14 +118,19 @@ public class SelectMessages {
|
|||
ItemSlotNotEmpty = select("UseItem.SlotNotEmpty", yamlConfiguration_msg);
|
||||
ItemSlotAlreadySet = select("UseItem.SlotAlreadySet", yamlConfiguration_msg);
|
||||
ItemSlot_wrongValue = select("UseItem.ItemSlot_wrongValue", yamlConfiguration_msg);
|
||||
UseItemDisabledInGameMode = select("UseItem.DisabledInGameMode", yamlConfiguration_msg);
|
||||
UseItemDisabledInWorld = select("UseItem.DisabledInWorld", yamlConfiguration_msg);
|
||||
|
||||
Buy_msg = select("Cost.Buy_msg", yamlConfiguration_msg);
|
||||
No_money = select("Cost.No_money", yamlConfiguration_msg);
|
||||
noMoney = select("Cost.No.Money", yamlConfiguration_msg);
|
||||
noMoneyItem = select("Cost.No.Item", yamlConfiguration_msg);
|
||||
noMoneyVote = select("Cost.No.Vote", yamlConfiguration_msg);
|
||||
|
||||
NoInventorySpace = select("Cost.NoInventorySpace", yamlConfiguration_msg);
|
||||
|
||||
onServerChange = select("ServerChange.onServerChange", yamlConfiguration_msg);
|
||||
|
||||
GUInotFound = select("GUI.GUInotFound", yamlConfiguration_msg);
|
||||
guiNotFound = select("GUI.GUInotFound", yamlConfiguration_msg);
|
||||
GUIIsDisabled = select("GUI.GUIisDisabled", yamlConfiguration_msg);
|
||||
|
||||
Give_Sender = select("Give.Sender", yamlConfiguration_msg);
|
||||
|
@ -113,6 +139,14 @@ public class SelectMessages {
|
|||
PlayerNotFond = select("Player.PlayerNotFond", yamlConfiguration_msg);
|
||||
PlayerNoInventorySpace = select("Player.PlayerNoInventorySpace", yamlConfiguration_msg);
|
||||
|
||||
functionItemAdd = select("FunctionItem.Add", yamlConfiguration_msg);
|
||||
functionItemRemove = select("FunctionItem.Remove", yamlConfiguration_msg);
|
||||
functionItemRemoveError = select("FunctionItem.RemoveError", yamlConfiguration_msg);
|
||||
|
||||
functionVoteAdd = select("FunctionVote.Add", yamlConfiguration_msg);
|
||||
functionVoteRemove = select("FunctionVote.Remove", yamlConfiguration_msg);
|
||||
functionVoteRemoveError = select("FunctionVote.RemoveError", yamlConfiguration_msg);
|
||||
|
||||
HelpCgui = select("Help.CGUI", yamlConfiguration_msg);
|
||||
HelpHelp = select("Help.Help", yamlConfiguration_msg);
|
||||
HelpInfo = select("Help.Info", yamlConfiguration_msg);
|
||||
|
@ -124,11 +158,22 @@ public class SelectMessages {
|
|||
GUIItemHelp_off = select("Help.UseItem_Off", yamlConfiguration_msg);
|
||||
GUIItemHelp_Slot = select("Help.UseItem_Slot", yamlConfiguration_msg);
|
||||
|
||||
PlayerHelpCgui = select("Help.Player.CGUI", yamlConfiguration_msg);
|
||||
PlayerHelpHelp = select("Help.Player.Help", yamlConfiguration_msg);
|
||||
PlayerHelpInfo = select("Help.Player.Info", yamlConfiguration_msg);
|
||||
PlayerHelpOpen = select("Help.Player.Open", yamlConfiguration_msg);
|
||||
PlayerHelpGive = select("Help.Player.Give", yamlConfiguration_msg);
|
||||
PlayerHelpCreateDefaultGUI = select("Help.Player.CreateDefaultGUI", yamlConfiguration_msg);
|
||||
PlayerHelpReload = select("Help.Player.Reload", yamlConfiguration_msg);
|
||||
PlayerGUIItemHelp_on = select("Help.Player.UseItem_On", yamlConfiguration_msg);
|
||||
PlayerGUIItemHelp_off = select("Help.Player.UseItem_Off", yamlConfiguration_msg);
|
||||
PlayerGUIItemHelp_Slot = select("Help.Player.UseItem_Slot", yamlConfiguration_msg);
|
||||
|
||||
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
|
||||
T2Csend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
private static String select(String path, YamlConfiguration yamlConfiguration) {
|
||||
return Replace.replace(prefix,yamlConfiguration.getString(path));
|
||||
return T2Creplace.replace(SelectConfig.getPrefix(), Objects.requireNonNull(yamlConfiguration.getString(path)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package net.t2code.commandguiv2.Spigot.database;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
|
||||
import java.sql.*;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class MySQL {
|
||||
|
||||
private static final HikariConfig config = new HikariConfig();
|
||||
private static HikariDataSource ds;
|
||||
|
||||
public static void main() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
Calendar now = Calendar.getInstance();
|
||||
ZoneId timeZone = now.getTimeZone().toZoneId();
|
||||
T2Csend.debug(Main.getPlugin(), "Server TimeZone is : " + timeZone);
|
||||
try {
|
||||
config.setJdbcUrl("jdbc:mysql://" + SelectConfig.getMysqlIp() + ":" + SelectConfig.getMysqlPort() + "/" + SelectConfig.getMysqlDatabase()
|
||||
+ "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone
|
||||
+ "&useSSL=" + SelectConfig.getMysqlSSL());
|
||||
config.setUsername(SelectConfig.getMysqlUser());
|
||||
config.setPassword(SelectConfig.getMysqlPassword());
|
||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
ds = new HikariDataSource(config);
|
||||
T2Csend.console(Util.getPrefix() + " §2MYSQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} catch (Exception ex) {
|
||||
T2Csend.console(Util.getPrefix() + " §4MYSQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2Csend.error(Main.getPlugin(), ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
if (SelectConfig.getDebug() || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
|
||||
try {
|
||||
T2Csend.error(Main.getPlugin(), "MySQL DEBUG:");
|
||||
Connection con = ds.getConnection();
|
||||
DatabaseMetaData dbmd = con.getMetaData();
|
||||
T2Csend.debugmsg(Main.getPlugin(), "§6Metadata of the database:");
|
||||
T2Csend.debugmsg(Main.getPlugin(), "§6DB: §e" + dbmd.getDatabaseProductName());
|
||||
T2Csend.debugmsg(Main.getPlugin(), "§6Version: §e" + dbmd.getDatabaseProductVersion());
|
||||
T2Csend.debugmsg(Main.getPlugin(), "§6Driver: §e" + dbmd.getDriverName());
|
||||
T2Csend.debugmsg(Main.getPlugin(), "§6Driver MajorVersion: §e" + dbmd.getDriverMajorVersion() + "." + dbmd.getDriverMinorVersion());
|
||||
T2Csend.debugmsg(Main.getPlugin(), "§6Driver Version: §e" + dbmd.getDriverVersion());
|
||||
con.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Bukkit.getConsoleSender().sendMessage((System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
|
||||
public static void query(String query) throws SQLException {
|
||||
if (ds == null) {
|
||||
return;
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
Connection con = ds.getConnection();
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute(query);
|
||||
stmt.close();
|
||||
con.close();
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
ArrayList<String> columnList = new ArrayList<>();
|
||||
for (int i = 1; i <= columns; i++) {
|
||||
columnList.add(rs.getString(i));
|
||||
}
|
||||
Result.put(rs.getString(1), columnList);
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static String select(String query) {
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
String Ausgabe = "";
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
Ausgabe = String.valueOf(rs.getString(1));
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Ausgabe;
|
||||
}
|
||||
|
||||
public static int count(String query) {
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
int count = 0;
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static ArrayList<String> selectRow(String query) {
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
ArrayList<String> Result = new ArrayList<>();
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
for (int i = 1; i <= columns; i++) {
|
||||
Result.add(rs.getString(i));
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static void close() {
|
||||
if (ds != null) ds.close();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
package net.t2code.commandguiv2.Spigot.database;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class SQLITE {
|
||||
protected static String url;
|
||||
private static Connection con;
|
||||
|
||||
public static void main() throws SQLException {
|
||||
long long_ = System.currentTimeMillis();
|
||||
File directory = new File(Main.getPath() + "/Storage");
|
||||
if (!directory.exists()) {
|
||||
directory.mkdir();
|
||||
}
|
||||
url = "jdbc:sqlite:" + Main.getPlugin().getDataFolder() + "/Storage/data.db";
|
||||
con = DriverManager.getConnection(url);
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2SQLITE successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
DatabaseMetaData dbmd = con.getMetaData();
|
||||
}
|
||||
|
||||
public static void query(String query) {
|
||||
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute(query);
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void query(ArrayList<String> queryList) {
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
for (String query : queryList) {
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
stmt.addBatch(query);
|
||||
}
|
||||
stmt.executeBatch();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
ArrayList<String> columnList = new ArrayList<>();
|
||||
for (int i = 1; i <= columns; i++) {
|
||||
columnList.add(rs.getString(i));
|
||||
}
|
||||
Result.put(rs.getString(1), columnList);
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static String select(String query) {
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
String Ausgabe = "";
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
Ausgabe = String.valueOf(rs.getString(1));
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Ausgabe;
|
||||
}
|
||||
|
||||
public static int count(String query) {
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
int count = 0;
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static ArrayList<String> selectRow(String query) {
|
||||
T2Csend.debug(Main.getPlugin(), query);
|
||||
ArrayList<String> Result = new ArrayList<>();
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
for (int i = 1; i <= columns; i++) {
|
||||
Result.add(rs.getString(i));
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static void close() throws SQLException {
|
||||
if (con != null) con.close();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package net.t2code.commandguiv2.Spigot.database;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class SelectDatabase {
|
||||
|
||||
private static StorageEnum Storage;
|
||||
|
||||
public static StorageEnum getStorage() {
|
||||
return Storage;
|
||||
}
|
||||
|
||||
public static void setStorage(StorageEnum storage) {
|
||||
Storage = storage;
|
||||
}
|
||||
|
||||
public static void nameCheck(Player player) {
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
try {
|
||||
MySQL.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
|
||||
} catch (SQLException e) {
|
||||
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
|
||||
break;
|
||||
case SQLITE:
|
||||
default:
|
||||
SQLITE.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setSlot(Player player, Integer slot) {
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
try {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Slot`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "','" + slot + "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Slot` = '" + slot + "';");
|
||||
} catch (SQLException e) {
|
||||
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
YML.setGuiitemSlot(player, slot);
|
||||
break;
|
||||
case SQLITE:
|
||||
default:
|
||||
SQLITE.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Slot`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "','" + slot + "') ON CONFLICT(UUID) DO UPDATE SET `Name` = '" + player.getName() + "', `Slot` = '" + slot + "';");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setItemStatusTrue(Player player) {
|
||||
Events.useItemHashMap.replace(player.getName(), true);
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
try {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '1';");
|
||||
} catch (SQLException e) {
|
||||
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
YML.setGuiitemOn(player);
|
||||
break;
|
||||
case SQLITE:
|
||||
default:
|
||||
SQLITE.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "') ON CONFLICT(UUID) DO UPDATE SET `Name` = '" + player.getName() + "', `Status` = '1';");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setItemStatusFalse(Player player) {
|
||||
Events.useItemHashMap.replace(player.getName(), false);
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
try {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', '0') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '0';");
|
||||
} catch (SQLException e) {
|
||||
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
YML.setGuiitemOff(player);
|
||||
break;
|
||||
case SQLITE:
|
||||
default:
|
||||
SQLITE.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', '0') ON CONFLICT(UUID) DO UPDATE SET `Name` = '" + player.getName() + "', `Status` = '0';");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean selectItemStatus(Player player) {
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
String result = MySQL.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||
if (result == null || result.equals("")) {
|
||||
return true;
|
||||
}
|
||||
return result.equals("1");
|
||||
case YML:
|
||||
return YML.selectGuiitemOn(player);
|
||||
case SQLITE:
|
||||
default:
|
||||
String result2 = SQLITE.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||
if (result2 == null || result2.equals("")) {
|
||||
return true;
|
||||
}
|
||||
return result2.equals("1");
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer selectSlot(Player player) {
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
String result = MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||
if (result == null || result.equals("") || result.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
return Integer.parseInt(result);
|
||||
case YML:
|
||||
return YML.selectSlot(player);
|
||||
case SQLITE:
|
||||
default:
|
||||
String result2 = SQLITE.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||
if (result2 == null || result2.equals("") || result2.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
return Integer.parseInt(result2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
package net.t2code.commandguiv2.Spigot.database;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
@ -11,7 +12,7 @@ import java.io.IOException;
|
|||
|
||||
public class YML {
|
||||
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static final Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static File storage = new File(Main.getPath(), "Storage/gui-item.yml");
|
||||
public static YamlConfiguration yamlConfigurationStorage = YamlConfiguration.loadConfiguration(storage);
|
||||
|
@ -45,6 +46,7 @@ public class YML {
|
|||
try {
|
||||
yamlConfigurationStorage.save(storage);
|
||||
} catch (IOException e) {
|
||||
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -56,11 +58,11 @@ public class YML {
|
|||
|
||||
|
||||
public static Integer selectSlot(Player player) {
|
||||
send.debug(plugin, "yml-1");
|
||||
T2Csend.debug(plugin, "yml-1");
|
||||
if (!yamlConfigurationStorage.contains(String.valueOf(player.getUniqueId()))) return null;
|
||||
if (yamlConfigurationStorage.getString(player.getUniqueId() + ".Slot") == null) return null;
|
||||
send.debug(plugin, "yml-2");
|
||||
send.debug(plugin, String.valueOf(yamlConfigurationStorage.getInt(player.getUniqueId() + ".Slot")));
|
||||
T2Csend.debug(plugin, "yml-2");
|
||||
T2Csend.debug(plugin, String.valueOf(yamlConfigurationStorage.getInt(player.getUniqueId() + ".Slot")));
|
||||
return yamlConfigurationStorage.getInt(player.getUniqueId() + ".Slot");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package net.t2code.commandguiv2.Spigot.enums;
|
||||
|
||||
public enum EcoEnum {
|
||||
VAULT, MONEY,
|
||||
ITEM,
|
||||
VOTEPOINTS
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
package net.t2code.commandguiv2.Spigot.enums;
|
||||
|
||||
public enum FunctionItemEnum {
|
||||
REMOVE, ADD
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package net.t2code.commandguiv2.Spigot.enums;
|
||||
|
||||
public enum FunctionVoteEnum {
|
||||
REMOVE, ADD
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package net.t2code.commandguiv2.Spigot.enums;
|
||||
|
||||
public enum SoundEnum {
|
||||
OpenInventory,
|
||||
Click,
|
||||
NoMoney,
|
||||
NoInventorySpace,
|
||||
Give,
|
||||
PlayerNotFound
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package net.t2code.commandguiv2.Spigot.enums;
|
||||
|
||||
public enum StorageEnum {
|
||||
MYSQL,
|
||||
SQLITE,
|
||||
YML
|
||||
}
|
|
@ -0,0 +1,380 @@
|
|||
package net.t2code.commandguiv2.Spigot.gui;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.listener.ServerChange;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
||||
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class GUIListener implements Listener {
|
||||
|
||||
private static String prefix = Util.getPrefix();
|
||||
public static String GUICode;
|
||||
private static Plugin plugin = Main.getPlugin();
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
if (e.getInventory() == null) return;
|
||||
if (e.getCurrentItem() == null) return;
|
||||
for (Gui gui : Main.guiHashMap.values()) {
|
||||
if (player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, GUICode + gui.guiName))
|
||||
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, player, GUICode + gui.guiName)))) {
|
||||
e.setCancelled(true);
|
||||
if (player.getOpenInventory().getTopInventory() != e.getClickedInventory()) {
|
||||
continue;
|
||||
}
|
||||
for (Slot slot : gui.slots) {
|
||||
execute(e, slot, player, gui);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void execute(InventoryClickEvent e, Slot slot, Player player, Gui gui) {
|
||||
if (e.getSlot() != slot.slot) return;
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) return;
|
||||
if (function.closeGUI_Enable) closeGUI(player);
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
|
||||
if (function.noPermMessageEnable) {
|
||||
if (function.customNoPermMessage == null || function.customNoPermMessage.equals("")) {
|
||||
T2Csend.player(player, SelectMessages.NoPermissionForItem.replace("[item]", T2Creplace.replace(prefix, function.name))
|
||||
.replace("[perm]", slot.permissionToUse));
|
||||
} else T2Csend.player(player, function.customNoPermMessage.replace("[item]", T2Creplace.replace(prefix, function.name))
|
||||
.replace("[perm]", slot.permissionToUse));
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (e.getCurrentItem().getType() == T2CitemVersion.getHead() || e.getCurrentItem().getType() == T2CitemVersion.getGreenWool().getType() ||
|
||||
e.getCurrentItem().getType() == T2CitemVersion.getRedWool().getType() ||
|
||||
e.getCurrentItem().getType() == Material.valueOf(function.item.toUpperCase().replace(".", "_"))) {
|
||||
if (!slot.enable) return;
|
||||
if (function.cost_Enable) {
|
||||
if (functions(function)) {
|
||||
eco(e, slot, player, gui, function);
|
||||
}
|
||||
} else {
|
||||
execute(function, slot, player, e, gui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean functions(Function function) {
|
||||
if (function.togglePermission) return true;
|
||||
if (function.toggleUseItem) return true;
|
||||
if (function.command_Enable) return true;
|
||||
if (function.openGUI_Enable) return true;
|
||||
if (function.closeGUI_Enable) return true;
|
||||
if (function.message_Enable) return true;
|
||||
if (function.serverChange) return true;
|
||||
if (function.setConfigEnable) return true;
|
||||
if (function.functionVotePoints) return true;
|
||||
return function.functionItem;
|
||||
}
|
||||
|
||||
private static void execute(Function function, Slot slot, Player player, InventoryClickEvent e, Gui gui) {
|
||||
if (function.togglePermission) togglePerm(function, gui, player);
|
||||
if (function.toggleUseItem) toggleUseItem(player, gui);
|
||||
if (function.command_Enable) command(function, player);
|
||||
if (function.openGUI_Enable) openGUI(function, player);
|
||||
if (function.message_Enable) message(function, player);
|
||||
if (function.serverChange) serverChange(function, player);
|
||||
if (function.setConfigEnable) setConfig(function, player, e);
|
||||
if (function.functionVotePoints) votePoints(e, function, player);
|
||||
if (function.functionItem) item(function, player);
|
||||
Sound.play(player, SoundEnum.Click, function, slot, gui);
|
||||
}
|
||||
|
||||
private static void command(Function slot, Player player) {
|
||||
player.closeInventory();
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (slot.command_BungeeCommand) {
|
||||
if (SelectLibConfig.getBungee()) {
|
||||
for (String cmd : slot.command) {
|
||||
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.commandAsConsole);
|
||||
}
|
||||
} else {
|
||||
T2Csend.console(prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2Csend.player(player, prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
}
|
||||
} else {
|
||||
for (String cmd : slot.command) {
|
||||
if (slot.commandAsConsole) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
|
||||
} else player.chat("/" + cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
|
||||
private static void openGUI(Function slot, Player player) {
|
||||
player.closeInventory();
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
OpenGUI.openGUI(player, slot.openGUI, true);
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
}
|
||||
|
||||
private static void closeGUI(Player player){
|
||||
player.closeInventory();
|
||||
}
|
||||
|
||||
private static void message(Function slot, Player player) {
|
||||
player.closeInventory();
|
||||
for (String msg : slot.message) {
|
||||
if (Main.PaPi) {
|
||||
if (slot.cost_Enable) {
|
||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.getCurrency()));
|
||||
} else T2Csend.player(player, T2Creplace.replace(prefix, player, Placeholder.replace(msg, player)));
|
||||
} else {
|
||||
if (slot.cost_Enable) {
|
||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.getCurrency()));
|
||||
} else T2Csend.player(player, T2Creplace.replace(prefix, Placeholder.replace(msg, player)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void serverChange(Function slot, Player player) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
T2Csend.player(player, SelectMessages.onServerChange.replace("[server]", slot.serverChangeServer));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ServerChange.send(player, slot.serverChangeServer);
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), 20L);
|
||||
}
|
||||
|
||||
private static void setConfig(Function slot, Player player, InventoryClickEvent e) {
|
||||
File config = new File(slot.configFilePath);
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (e.getClick() == ClickType.LEFT) {
|
||||
switch (slot.configOptionPremat) {
|
||||
case "String":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueLeft);
|
||||
break;
|
||||
case "Boolean":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueLeft);
|
||||
break;
|
||||
case "Integer":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueLeft);
|
||||
break;
|
||||
case "Double":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueLeft);
|
||||
break;
|
||||
case "List":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueLeft);
|
||||
break;
|
||||
default:
|
||||
T2Csend.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (e.getClick() == ClickType.RIGHT) {
|
||||
switch (slot.configOptionPremat) {
|
||||
case "String":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueRight);
|
||||
break;
|
||||
case "Boolean":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueRight);
|
||||
break;
|
||||
case "Integer":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueRight);
|
||||
break;
|
||||
case "Double":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueRight);
|
||||
break;
|
||||
case "List":
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueRight);
|
||||
break;
|
||||
default:
|
||||
T2Csend.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException tac) {
|
||||
tac.printStackTrace();
|
||||
}
|
||||
if (slot.pluginReloadEnable) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), slot.pluginReloadCommand);
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
}
|
||||
|
||||
private static void togglePerm(Function function, Gui gui, Player player) {
|
||||
if (player.hasPermission(function.togglePermissionPerm)) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.getTogglePermFalse().replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
OpenGUI.openGUI(player, gui.key, false);
|
||||
}
|
||||
}.runTaskLater(plugin, 4L);
|
||||
} else
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.getTogglePermTrue().replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
OpenGUI.openGUI(player, gui.key, false);
|
||||
}
|
||||
}.runTaskLater(plugin, 4L);
|
||||
}
|
||||
|
||||
private static void toggleUseItem(Player player, Gui gui) {
|
||||
if (!SelectConfig.getUseItem_AllowToggle()) {
|
||||
T2Csend.sender(player, "§4UseItem toggle is disabled!");
|
||||
return;
|
||||
}
|
||||
if (Events.useItemHashMap.get(player.getName())) {
|
||||
Commands.itemOff(player);
|
||||
} else {
|
||||
Commands.itemOn(player);
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
OpenGUI.openGUI(player, gui.key, false);
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
|
||||
private static void votePoints(InventoryClickEvent e, Function function, Player player) {
|
||||
player.closeInventory();
|
||||
switch (function.functionVotePointsMode) {
|
||||
case ADD:
|
||||
T2Ceco.votePointsAdd(prefix, player, function.functionVotePointsAmount);
|
||||
T2Csend.player(player, SelectMessages.functionVoteAdd.replace("[amount]", function.functionVotePointsAmount.toString()));
|
||||
break;
|
||||
case REMOVE:
|
||||
if (T2Ceco.votePointsRemove(prefix, player, function.functionVotePointsAmount)) {
|
||||
T2Csend.player(player, SelectMessages.functionVoteRemove.replace("[amount]", function.functionVotePointsAmount.toString()));
|
||||
} else T2Csend.player(player, SelectMessages.functionVoteRemoveError.replace("[amount]", function.functionVotePointsAmount.toString()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void item(Function function, Player player) {
|
||||
String[] item = function.functionItemItem.split(";");
|
||||
player.closeInventory();
|
||||
switch (function.functionItemMode) {
|
||||
case ADD:
|
||||
T2Ceco.itemAdd(player, new ItemStack(Material.valueOf(item[0])), Integer.parseInt(item[1]));
|
||||
T2Csend.player(player, SelectMessages.functionItemAdd.replace("[amount]", item[1]).replace("[item]", item[0]));
|
||||
break;
|
||||
case REMOVE:
|
||||
if (T2Ceco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
|
||||
T2Csend.player(player, SelectMessages.functionItemRemove.replace("[amount]", item[1]).replace("[item]", item[0]));
|
||||
|
||||
} else T2Csend.player(player, SelectMessages.functionItemRemoveError.replace("[amount]", item[1]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void eco(InventoryClickEvent e, Slot slot, Player player, Gui gui, Function function) {
|
||||
switch (function.ecoModule) {
|
||||
case ITEM:
|
||||
String[] item = function.ecoItem.split(";");
|
||||
if (!T2Ceco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
T2Csend.player(player, SelectMessages.noMoneyItem.replace("[item]", item[0]).replace("[amount]", item[1]));
|
||||
Sound.play(player, SoundEnum.NoMoney);
|
||||
} else {
|
||||
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||
.replace("[price]", item[1] + " " + item[0]));
|
||||
execute(function, slot, player, e, gui);
|
||||
}
|
||||
break;
|
||||
case VOTEPOINTS:
|
||||
if (T2Ceco.votePointsRemove(prefix, player, function.votePoints)) {
|
||||
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||
.replace("[price]", function.votePoints + " VotePoints"));
|
||||
execute(function, slot, player, e, gui);
|
||||
} else {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
T2Csend.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
|
||||
Sound.play(player, SoundEnum.NoMoney);
|
||||
}
|
||||
break;
|
||||
case VAULT:
|
||||
case MONEY:
|
||||
if (T2Ceco.moneyRemove(prefix, player, function.price)) {
|
||||
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||
.replace("[price]", function.price + " " + SelectConfig.getCurrency()));
|
||||
execute(function, slot, player, e, gui);
|
||||
} else {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
T2Csend.player(player, T2Creplace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
|
||||
Sound.play(player, SoundEnum.NoMoney);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
package net.t2code.commandguiv2.Spigot.gui;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemBuilder;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.profile.PlayerProfile;
|
||||
import org.bukkit.profile.PlayerTextures;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.UUID;
|
||||
|
||||
public class GuiBuilder {
|
||||
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
protected static void item(Slot slot, Player player, Inventory inventory) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
ItemStack item;
|
||||
if (Main.legacy && function.item.toUpperCase().contains(",")) {
|
||||
String[] split = function.item.toUpperCase().split(",");
|
||||
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
|
||||
} else item = new ItemStack(Material.valueOf(function.item.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
setDisplayNameAndLore(itemMeta, player, slot);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (function.itemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = function.itemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.slot, item);
|
||||
}
|
||||
|
||||
protected static void item(String material, Slot slot, Player player, Inventory inventory) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
ItemStack item;
|
||||
if (Main.legacy && material.contains(",")) {
|
||||
String[] split = material.split(",");
|
||||
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
|
||||
} else item = new ItemStack(Material.valueOf(material));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
setDisplayNameAndLore(itemMeta, player, slot);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (function.itemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = function.itemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.slot, item);
|
||||
}
|
||||
|
||||
|
||||
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Slot slot) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(T2Creplace.replace(prefix, player, Placeholder.replace(function.name, player)));
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||
itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
} else {
|
||||
itemMeta.setDisplayName(T2Creplace.replace(prefix, Placeholder.replace(function.name, player)));
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||
itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
}
|
||||
}
|
||||
|
||||
protected static void base64(String base64Value, Slot slot, Player player, Inventory inventory) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
ItemStack item = T2CitemBuilder.base64(base64Value);
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
setDisplayNameAndLore(itemMeta, player, slot);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (function.itemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = function.itemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.slot, item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected static void base64(Slot slot, Player player, Inventory inventory) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
base64(function.base64Value, slot, player, inventory);
|
||||
}
|
||||
|
||||
protected static void playerHead(Slot slot, Player player, Inventory inventory, String skullName) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
ItemStack item = T2CitemVersion.getHeadIS();
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
setDisplayNameAndLore(itemMeta, player, slot);
|
||||
itemMeta.setOwner(skullName);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (function.itemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = function.itemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.slot, item);
|
||||
}
|
||||
|
||||
public static void fillItem(Inventory inventory, Gui gui) {
|
||||
ItemStack glass;
|
||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.parseShort(gui.guiFillItemItem));
|
||||
} else glass = new ItemStack(Material.valueOf(gui.guiFillItemItem.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMetaglass = glass.getItemMeta();
|
||||
itemMetaglass.setDisplayName(" ");
|
||||
glass.setItemMeta(itemMetaglass);
|
||||
glass.setAmount(1);
|
||||
for (int i = 0; i < 9 * gui.guiLines; i++) {
|
||||
inventory.setItem(i, glass);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
package net.t2code.commandguiv2.Spigot.gui;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
||||
import net.t2code.luckyBox.api.LuckyBoxAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class OpenGUI {
|
||||
private static Plugin plugin = Main.getPlugin();
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
public static void openGUI(Player player, String guiString, Boolean sound) {
|
||||
Gui gui = Main.guiHashMap.get(guiString);
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
switch (guiString) {
|
||||
//case "plugin.PlotSquaredGUI":
|
||||
// if (Main.PlotSquaredGUI) {
|
||||
// PlotSquaredGUIapi.openMainGUI(player);
|
||||
// } else {
|
||||
// if (player.hasPermission("commandgui.admin")) {
|
||||
// send.player(player, prefix + " §4PlotSquaredGUI could not be found! §9Please download it here: " +
|
||||
// "§6https://spigotmc.org/resources/plotsquaredgui.77506/");
|
||||
// }
|
||||
// }
|
||||
// return; todo
|
||||
case "plugin.PlugManGUI":
|
||||
if (Main.PlugManGUI) {
|
||||
player.openInventory((new PluginListGUI(54, 1)).getInventory());
|
||||
} else {
|
||||
if (player.hasPermission(Permissions.admin)) {
|
||||
T2Csend.player(player, prefix + " §4PlugManGUI could not be found! §9Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/plugmangui.87599/");
|
||||
}
|
||||
}
|
||||
return;
|
||||
case "plugin.T2C-LuckyBox":
|
||||
if (Main.LuckyBox) {
|
||||
LuckyBoxAPI.openShop(player);
|
||||
} else {
|
||||
if (player.hasPermission(Permissions.admin)) {
|
||||
T2Csend.player(player, prefix + " §4T2C-LuckyBox could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/luckybox.98154/");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (T2CmcVersion.isMc1_13()) {
|
||||
GUIListener.GUICode = "";
|
||||
} else GUIListener.GUICode = "§6§8§9§r";
|
||||
if (gui.guiEnable || player.hasPermission(Permissions.updatemsg)) {
|
||||
Inventory inventory;
|
||||
if (Main.PaPi) {
|
||||
inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (T2Creplace.replace(prefix, player, GUIListener.GUICode + gui.guiName)));
|
||||
} else inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (T2Creplace.replace(prefix, GUIListener.GUICode + gui.guiName)));
|
||||
|
||||
if (gui.guiFillItemEnable) {
|
||||
GuiBuilder.fillItem(inventory, gui);
|
||||
}
|
||||
for (Slot slot : gui.slots) {
|
||||
try {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
if (function == null) {
|
||||
T2Csend.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
||||
continue;
|
||||
}
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
|
||||
if (slot.slot < 0 || slot.slot > gui.guiLines * 9) continue;
|
||||
|
||||
if (slot.enable) {
|
||||
if (function.empty) {
|
||||
ItemStack air = new ItemStack(Material.AIR);
|
||||
inventory.setItem(slot.slot, air);
|
||||
} else {
|
||||
if (function.togglePermission) {
|
||||
if (player.hasPermission(function.togglePermissionPerm)) {
|
||||
toggleOn(function, slot, player, inventory);
|
||||
} else {
|
||||
toggleOff(function, slot, player, inventory);
|
||||
}
|
||||
} else if (function.toggleUseItem) {
|
||||
if (Events.useItemHashMap.get(player.getName())) {
|
||||
toggleOn(function, slot, player, inventory);
|
||||
} else {
|
||||
toggleOff(function, slot, player, inventory);
|
||||
}
|
||||
} else {
|
||||
if (function.playerHead_Enable) {
|
||||
if (function.base64_Enable) {
|
||||
GuiBuilder.base64(slot, player, inventory);
|
||||
} else {
|
||||
if (function.playerWhoHasOpenedTheGUI) {
|
||||
GuiBuilder.playerHead(slot, player, inventory, player.getName());
|
||||
} else {
|
||||
GuiBuilder.playerHead(slot, player, inventory, function.playerName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GuiBuilder.item(slot, player, inventory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
ItemStack air = new ItemStack(Material.AIR);
|
||||
inventory.setItem(slot.slot, air);
|
||||
}
|
||||
|
||||
}
|
||||
if (sound) {
|
||||
Sound.play(player, SoundEnum.OpenInventory);
|
||||
}
|
||||
player.openInventory(inventory);
|
||||
T2Csend.debug(plugin, "§6" + player.getName() + " §5Open §6" + T2Creplace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", T2Creplace.replace(prefix, gui.guiName)));
|
||||
}
|
||||
|
||||
private static void toggleOn(Function function, Slot slot, Player player, Inventory inventory) {
|
||||
if (SelectConfig.getToggleItemOnOrYesBase64()) {
|
||||
GuiBuilder.base64(SelectConfig.getToggleItemOnOrYesBase64Value(), slot, player, inventory);
|
||||
} else GuiBuilder.item(SelectConfig.getToggleItemOnOrYesMaterial(), slot, player, inventory);
|
||||
}
|
||||
|
||||
private static void toggleOff(Function function, Slot slot, Player player, Inventory inventory) {
|
||||
if (SelectConfig.getToggleItemOffOrNoBase64()) {
|
||||
GuiBuilder.base64(SelectConfig.getToggleItemOffOrNoBase64Value(), slot, player, inventory);
|
||||
} else GuiBuilder.item(SelectConfig.getToggleItemOffOrNoMaterial(), slot, player, inventory);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package net.t2code.commandguiv2.Spigot.listener;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class Bungee_Sender_Reciver implements PluginMessageListener {
|
||||
|
||||
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
if (console) {
|
||||
output.writeUTF("T2Code-Console");
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
output.writeUTF(sender.getName());
|
||||
} else {
|
||||
output.writeUTF("T2Code-Console");
|
||||
}
|
||||
}
|
||||
output.writeUTF(information);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.sendPluginMessage(Main.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||
}else {
|
||||
for(Player player : Bukkit.getOnlinePlayers()){
|
||||
player.sendPluginMessage(Main.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
||||
T2Csend.debug(Main.getPlugin(),"stream: "+stream.toString());
|
||||
try {
|
||||
String subChannel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
T2Csend.debug(Main.getPlugin(),"subChannel: " +subChannel);
|
||||
T2Csend.debug(Main.getPlugin(),"input: " +input);
|
||||
switch (subChannel) {
|
||||
case "join":
|
||||
Main.bungeejoinplayers.add(input);
|
||||
break;
|
||||
case "left":
|
||||
Main.bungeejoinplayers.remove(input);
|
||||
break;
|
||||
case "clear":
|
||||
Main.bungeejoinplayers.clear();
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// This claas was created by JaTiTV
|
||||
|
||||
package net.t2code.commandguiv2.Spigot.listener;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
|
||||
public class PluginEvent implements Listener {
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
SelectDatabase.nameCheck(player);
|
||||
T2CupdateAPI.join(Main.getPlugin(),prefix, Permissions.updatemsg, event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package de.jatitv.commandguiv2.Spigot.Listener;
|
||||
package net.t2code.commandguiv2.Spigot.listener;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -8,7 +8,6 @@ import java.io.DataOutputStream;
|
|||
import java.io.IOException;
|
||||
|
||||
public class ServerChange {
|
||||
|
||||
public static void send(Player player, String server){
|
||||
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||
DataOutputStream out = new DataOutputStream(b);
|
||||
|
@ -18,6 +17,6 @@ public class ServerChange {
|
|||
} catch (IOException i) {
|
||||
i.printStackTrace();
|
||||
}
|
||||
player.sendPluginMessage(Main.plugin, "BungeeCord", b.toByteArray());
|
||||
player.sendPluginMessage(Main.getPlugin(), "BungeeCord", b.toByteArray());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,223 @@
|
|||
package net.t2code.commandguiv2.Spigot.objects;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
||||
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
|
||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Obj_Select {
|
||||
public static void onSelect() {
|
||||
onSelectFunction();
|
||||
onSelectGui();
|
||||
}
|
||||
|
||||
public static void onSelectGui() {
|
||||
Main.guiHashMap.clear();
|
||||
Main.allAliases.clear();
|
||||
File f = new File(Main.getPath() + "/GUIs/");
|
||||
File[] fileArray = f.listFiles();
|
||||
|
||||
for (File config : fileArray) {
|
||||
try {
|
||||
if (config.getName().equals("guiDeclaration.yml")) continue;
|
||||
String sub = config.getName().substring(config.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
String key = config.getName().replace(".yml", "");
|
||||
Main.allAliases.add(key);
|
||||
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable");
|
||||
Integer guiLines = yamlConfiguration_gui.getInt("GUI.Lines");
|
||||
if (yamlConfiguration_gui.getInt("GUI.Lines") > 6) {
|
||||
yamlConfiguration_gui.set("GUI.Lines", 6);
|
||||
}
|
||||
if (yamlConfiguration_gui.getInt("GUI.Lines") < 1) {
|
||||
yamlConfiguration_gui.set("GUI.Lines", 1);
|
||||
}
|
||||
|
||||
String guiName = yamlConfiguration_gui.getString("GUI.Name");
|
||||
Boolean guiFillItemEnable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
|
||||
String guiFillItemItem;
|
||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneColor");
|
||||
} else guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.Item");
|
||||
|
||||
Boolean commandAliasEnable = yamlConfiguration_gui.getBoolean("Command.Alias");
|
||||
Boolean commandPermission = yamlConfiguration_gui.getBoolean("Command.Permission.Required");
|
||||
|
||||
ArrayList<Slot> slots = new ArrayList<>();
|
||||
for (String slotKey : yamlConfiguration_gui.getConfigurationSection("Slots").getKeys(false)) {
|
||||
Integer slotNumber = yamlConfiguration_gui.getInt("Slots." + slotKey + ".Slot") - 1;
|
||||
Boolean enable = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Enable");
|
||||
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
|
||||
Function functionCheck = Main.functionHashMap.get(function);
|
||||
if (functionCheck == null) {
|
||||
T2Csend.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
|
||||
}
|
||||
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Permission.Required");
|
||||
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
|
||||
String permUse = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.Use");
|
||||
|
||||
Slot slot = new Slot(slotNumber, enable, function, permRequired,
|
||||
permSee.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
|
||||
.replace("[slotname]", slotKey.toLowerCase()),
|
||||
permUse.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
|
||||
.replace("[slotname]", slotKey.toLowerCase()));
|
||||
slots.add(slot);
|
||||
}
|
||||
Gui gui = new Gui(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,
|
||||
key, commandAliasEnable, commandPermission, slots);
|
||||
|
||||
Main.guiHashMap.put(key, gui);
|
||||
CmdExecuter_GUI.arg1.put(config.getName()
|
||||
.replace(".yml", ""), "commandgui.gui." + key);
|
||||
|
||||
|
||||
yamlConfiguration_gui.save(config);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void onSelectFunction() {
|
||||
Main.functionHashMap.clear();
|
||||
File f = new File(Main.getPath() + "/Functions/");
|
||||
File[] fileArray = f.listFiles();
|
||||
|
||||
for (File config : fileArray) {
|
||||
if (config.getName().equals("functionDeclaration.yml")) continue;
|
||||
String sub = config.getName().substring(config.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
String key = config.getName().replace(".yml", "");
|
||||
Boolean empty = yamlConfiguration.getBoolean("Slots.Function.Item.Empty");
|
||||
Integer itemAmount = yamlConfiguration.getInt("Slots.Function.Item.Amount");
|
||||
Boolean playerHead_Enable = yamlConfiguration.getBoolean("Slots.Function.Item.PlayerHead.Enable");
|
||||
Boolean base64_Enable = yamlConfiguration.getBoolean("Slots.Function.Item.PlayerHead.Base64.Enable");
|
||||
String base64Value = yamlConfiguration.getString("Slots.Function.Item.PlayerHead.Base64.Base64Value");
|
||||
Boolean playerWhoHasOpenedTheGUI = yamlConfiguration.getBoolean("Slots.Function.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
||||
String playerName = yamlConfiguration.getString("Slots.Function.Item.PlayerHead.PlayerName");
|
||||
String item = yamlConfiguration.getString("Slots.Function.Item.Material");
|
||||
String name = yamlConfiguration.getString("Slots.Function.Item.Name");
|
||||
List<String> lore = yamlConfiguration.getStringList("Slots.Function.Item.Lore");
|
||||
if (yamlConfiguration.get("Slots.Function.NoPermission") == null) {
|
||||
ConfigConverter.noPermLore(yamlConfiguration, config);
|
||||
}
|
||||
Boolean noPermMessageEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Message.Enable");
|
||||
String customNoPermMessage = yamlConfiguration.getString("Slots.Function.NoPermission.Message.CustomNoPermMessage");
|
||||
Boolean noPermLoreEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Item.Lore.Enable");
|
||||
List<String> noPermLore = yamlConfiguration.getStringList("Slots.Function.NoPermission.Item.Lore.Lore");
|
||||
Boolean customSound_Enable = yamlConfiguration.getBoolean("Slots.Function.CustomSound.Enable");
|
||||
Boolean customSound_NoSound = yamlConfiguration.getBoolean("Slots.Function.CustomSound.NoSound");
|
||||
String customSound_Sound = yamlConfiguration.getString("Slots.Function.CustomSound.Sound");
|
||||
Boolean cost_Enable = yamlConfiguration.getBoolean("Slots.Function.Cost.Enable");
|
||||
EcoEnum ecoModule = null;
|
||||
if (yamlConfiguration.get("Slots.Function.Cost.EcoModule") != null) {
|
||||
try {
|
||||
ecoModule = EcoEnum.valueOf(yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
T2Csend.error(Main.getPlugin(), "The EcoModule " + yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase() + " in the function file "
|
||||
+ config.getName() + " does not exist. Please use one of the supported modules. (VAULT, ITEM, VOTEPOINTS)");
|
||||
}
|
||||
} else ecoModule = EcoEnum.VAULT;
|
||||
|
||||
String ecoItem = yamlConfiguration.getString("Slots.Function.Cost.Item");
|
||||
Integer votePoints = yamlConfiguration.getInt("Slots.Function.Cost.VotePoints");
|
||||
Double price = yamlConfiguration.getDouble("Slots.Function.Cost.Price");
|
||||
Boolean command_Enable = yamlConfiguration.getBoolean("Slots.Function.Command.Enable");
|
||||
Boolean command_BungeeCommand = yamlConfiguration.getBoolean("Slots.Function.Command.BungeeCommand");
|
||||
Boolean commandAsConsole = yamlConfiguration.getBoolean("Slots.Function.Command.CommandAsConsole");
|
||||
List<String> command = yamlConfiguration.getStringList("Slots.Function.Command.Command");
|
||||
Boolean serverChange = yamlConfiguration.getBoolean("Slots.Function.ServerChange.Enable");
|
||||
String serverChangeServer = yamlConfiguration.getString("Slots.Function.ServerChange.Server");
|
||||
Boolean openGUI_Enable = yamlConfiguration.getBoolean("Slots.Function.OpenGUI.Enable");
|
||||
String openGUI = yamlConfiguration.getString("Slots.Function.OpenGUI.GUI");
|
||||
Boolean closeGUI = yamlConfiguration.getBoolean("Slots.Function.CloseGUI.Enable");
|
||||
Boolean togglePermission = yamlConfiguration.getBoolean("Slots.Function.Toggle.Permission.Enable");
|
||||
String togglePermissionPerm = yamlConfiguration.getString("Slots.Function.Toggle.Permission.Permission");
|
||||
Boolean toggleUseItem = yamlConfiguration.getBoolean("Slots.Function.Toggle.UseItem.Enable");
|
||||
Boolean message_Enable = yamlConfiguration.getBoolean("Slots.Function.Message.Enable");
|
||||
List<String> message = yamlConfiguration.getStringList("Slots.Function.Message.Message");
|
||||
Boolean setConfigEnable = yamlConfiguration.getBoolean("Slots.Function.SetConfig.Enable");
|
||||
String configFilePath = yamlConfiguration.getString("Slots.Function.SetConfig.File.Path");
|
||||
String configOptionPath = yamlConfiguration.getString("Slots.Function.SetConfig.Option.Path");
|
||||
String configOptionPremat = yamlConfiguration.getString("Slots.Function.SetConfig.Option.Premat");
|
||||
// Boolean ConfigChatInput = ;
|
||||
|
||||
String configStringValueLeft = yamlConfiguration.getString("Slots.Function.SetConfig.Value.LeftClick.String");
|
||||
Boolean configBooleanValueLeft = yamlConfiguration.getBoolean("Slots.Function.SetConfig.Value.LeftClick.Boolean");
|
||||
Integer configIntegerValueLeft = yamlConfiguration.getInt("Slots.Function.SetConfig.Value.LeftClick.Integer");
|
||||
Double configDoubleValueLeft = yamlConfiguration.getDouble("Slots.Function.SetConfig.Value.LeftClick.Double");
|
||||
List<String> configListValueLeft = yamlConfiguration.getStringList("Slots.Function.SetConfig.Value.LeftClick.List");
|
||||
|
||||
String configStringValueRight = yamlConfiguration.getString("Slots.Function.SetConfig.Value.RightClick.String");
|
||||
Boolean configBooleanValueRight = yamlConfiguration.getBoolean("Slots.Function.SetConfig.Value.RightClick.Boolean");
|
||||
Integer configIntegerValueRight = yamlConfiguration.getInt("Slots.Function.SetConfig.Value.RightClick.Integer");
|
||||
Double configDoubleValueRight = yamlConfiguration.getDouble("Slots.Function.SetConfig.Value.RightClick.Double");
|
||||
List<String> configListValueRight = yamlConfiguration.getStringList("Slots.Function.SetConfig.RightClick.Value.List");
|
||||
|
||||
|
||||
Boolean pluginReloadEnable = yamlConfiguration.getBoolean("Slots.Function.SetConfig.PluginReload.Enable");
|
||||
String pluginReloadCommand = yamlConfiguration.getString("Slots.Function.SetConfig.PluginReload.Command");
|
||||
|
||||
Boolean functionVotePoints = yamlConfiguration.getBoolean("Slots.Function.FunctionVotePoints.Enable");
|
||||
FunctionVoteEnum functionVotePointsMode = null;
|
||||
if (yamlConfiguration.get("Slots.Function.FunctionVotePoints.Mode") != null) {
|
||||
try {
|
||||
functionVotePointsMode = FunctionVoteEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
T2Csend.error(Main.getPlugin(), "The VotePoints Mode " + yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase() + " in the function file "
|
||||
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
||||
}
|
||||
}
|
||||
|
||||
Integer functionVotePointsAmount = yamlConfiguration.getInt("Slots.Function.FunctionVotePoints.Amount");
|
||||
Boolean functionItem = yamlConfiguration.getBoolean("Slots.Function.FunctionItem.Enable");
|
||||
FunctionItemEnum functionItemMode = null;
|
||||
if (yamlConfiguration.get("Slots.Function.FunctionItem.Mode") != null) {
|
||||
try {
|
||||
functionItemMode = FunctionItemEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
T2Csend.error(Main.getPlugin(), "The Item Mode " + yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase() + " in the function file "
|
||||
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
||||
}
|
||||
}
|
||||
String functionItemItem = yamlConfiguration.getString("Slots.Function.FunctionItem.Item");
|
||||
|
||||
Function function = new Function(key, empty, itemAmount, playerHead_Enable, base64_Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, item, name, lore,
|
||||
noPermMessageEnable, customNoPermMessage, noPermLoreEnable, noPermLore,
|
||||
customSound_Enable, customSound_NoSound, customSound_Sound, cost_Enable, ecoModule, ecoItem, votePoints, price, command_Enable, command_BungeeCommand,
|
||||
commandAsConsole, command, serverChange, serverChangeServer, openGUI_Enable, openGUI, closeGUI, togglePermission, togglePermissionPerm, toggleUseItem, message_Enable,
|
||||
message, setConfigEnable, configFilePath, configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft,
|
||||
configDoubleValueLeft, configListValueLeft, configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight,
|
||||
configListValueRight, pluginReloadEnable, pluginReloadCommand, functionVotePoints, functionVotePointsMode, functionVotePointsAmount,
|
||||
functionItem, functionItemMode, functionItemItem);
|
||||
Main.functionHashMap.put(key, function);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,205 @@
|
|||
package net.t2code.commandguiv2.Spigot.objects.functions;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
|
||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Function {
|
||||
|
||||
public String key;
|
||||
public Boolean empty;
|
||||
public Integer itemAmount;
|
||||
public Boolean playerHead_Enable;
|
||||
public Boolean base64_Enable;
|
||||
public String base64Value;
|
||||
public Boolean playerWhoHasOpenedTheGUI;
|
||||
public String playerName;
|
||||
public String item;
|
||||
public String name;
|
||||
public List<String> lore;
|
||||
public Boolean noPermMessageEnable;
|
||||
public String customNoPermMessage;
|
||||
public Boolean noPermLoreEnable;
|
||||
public List<String> noPermLore;
|
||||
public Boolean customSound_Enable;
|
||||
public Boolean customSound_NoSound;
|
||||
public String customSound_Sound;
|
||||
public Boolean cost_Enable;
|
||||
public EcoEnum ecoModule;
|
||||
public String ecoItem;
|
||||
public Integer votePoints;
|
||||
public Double price;
|
||||
public Boolean command_Enable;
|
||||
public Boolean command_BungeeCommand;
|
||||
public Boolean commandAsConsole;
|
||||
public Boolean serverChange;
|
||||
public String serverChangeServer;
|
||||
public List<String> command;
|
||||
public Boolean openGUI_Enable;
|
||||
public String openGUI;
|
||||
public Boolean closeGUI_Enable;
|
||||
public Boolean togglePermission;
|
||||
public String togglePermissionPerm;
|
||||
public Boolean toggleUseItem;
|
||||
public Boolean message_Enable;
|
||||
public List<String> message;
|
||||
public Boolean setConfigEnable;
|
||||
public String configFilePath;
|
||||
public String configOptionPath;
|
||||
public String configOptionPremat;
|
||||
|
||||
public String configStringValueLeft;
|
||||
public Boolean configBooleanValueLeft;
|
||||
public Integer configIntegerValueLeft;
|
||||
public Double configDoubleValueLeft;
|
||||
public List<String> configListValueLeft;
|
||||
|
||||
public String configStringValueRight;
|
||||
public Boolean configBooleanValueRight;
|
||||
public Integer configIntegerValueRight;
|
||||
public Double configDoubleValueRight;
|
||||
public List<String> configListValueRight;
|
||||
|
||||
|
||||
public Boolean pluginReloadEnable;
|
||||
public String pluginReloadCommand;
|
||||
public Boolean functionVotePoints;
|
||||
public FunctionVoteEnum functionVotePointsMode;
|
||||
public Integer functionVotePointsAmount;
|
||||
public Boolean functionItem;
|
||||
public FunctionItemEnum functionItemMode;
|
||||
public String functionItemItem;
|
||||
|
||||
public Function(String key,
|
||||
Boolean empty,
|
||||
Integer itemAmount,
|
||||
Boolean playerHead_Enable,
|
||||
Boolean base64Value_Enable,
|
||||
String base64Value,
|
||||
Boolean playerWhoHasOpenedTheGUI,
|
||||
String playerName,
|
||||
String item,
|
||||
String name,
|
||||
List<String> lore,
|
||||
Boolean noPermMessageEnable,
|
||||
String customNoPermMessage,
|
||||
Boolean noPermLoreEnable,
|
||||
List<String> noPermLore,
|
||||
Boolean customSound_Enable,
|
||||
Boolean customSound_NoSound,
|
||||
String customSound_Sound,
|
||||
Boolean cost_Enable,
|
||||
EcoEnum ecoModule,
|
||||
String ecoItem,
|
||||
Integer votePoints,
|
||||
Double price,
|
||||
Boolean command_Enable,
|
||||
Boolean command_BungeeCommand,
|
||||
Boolean commandAsConsole,
|
||||
List<String> command,
|
||||
Boolean serverChange,
|
||||
String serverChangeServer,
|
||||
Boolean openGUI_Enable,
|
||||
String openGUI,
|
||||
Boolean closeGUI,
|
||||
Boolean togglePermission,
|
||||
String togglePermissionPerm,
|
||||
Boolean toggleUseItem,
|
||||
Boolean message_Enable,
|
||||
List<String> message,
|
||||
Boolean setConfigEnable,
|
||||
String configFilePath,
|
||||
String configOptionPath,
|
||||
String configOptionPremat,
|
||||
|
||||
String configStringValueLeft,
|
||||
Boolean configBooleanValueLeft,
|
||||
Integer configIntegerValueLeft,
|
||||
Double configDoubleValueLeft,
|
||||
List<String> configListValueLeft,
|
||||
|
||||
String configStringValueRight,
|
||||
Boolean configBooleanValueRight,
|
||||
Integer configIntegerValueRight,
|
||||
Double configDoubleValueRight,
|
||||
List<String> configListValueRight,
|
||||
|
||||
Boolean pluginReloadEnable,
|
||||
String pluginReloadCommand,
|
||||
Boolean functionVotePoints,
|
||||
FunctionVoteEnum functionVotePointsMode,
|
||||
Integer functionVotePointsAmount,
|
||||
Boolean functionItem,
|
||||
FunctionItemEnum functionItemMode,
|
||||
String functionItemItem) {
|
||||
this.key = key;
|
||||
this.empty = empty;
|
||||
this.itemAmount = itemAmount;
|
||||
this.playerHead_Enable = playerHead_Enable;
|
||||
this.base64_Enable = base64Value_Enable;
|
||||
this.base64Value = base64Value;
|
||||
this.playerWhoHasOpenedTheGUI = playerWhoHasOpenedTheGUI;
|
||||
this.playerName = playerName;
|
||||
this.item = item;
|
||||
this.name = name;
|
||||
this.lore = lore;
|
||||
this.noPermMessageEnable = noPermMessageEnable;
|
||||
this.customNoPermMessage = customNoPermMessage;
|
||||
this.noPermLoreEnable = noPermLoreEnable;
|
||||
this.noPermLore = noPermLore;
|
||||
this.customSound_Enable = customSound_Enable;
|
||||
this.customSound_NoSound = customSound_NoSound;
|
||||
this.customSound_Sound = customSound_Sound;
|
||||
this.cost_Enable = cost_Enable;
|
||||
this.ecoModule = ecoModule;
|
||||
this.ecoItem = ecoItem;
|
||||
this.votePoints = votePoints;
|
||||
this.price = price;
|
||||
this.command_Enable = command_Enable;
|
||||
this.command_BungeeCommand = command_BungeeCommand;
|
||||
this.commandAsConsole = commandAsConsole;
|
||||
this.command = command;
|
||||
this.serverChange = serverChange;
|
||||
this.serverChangeServer = serverChangeServer;
|
||||
this.openGUI_Enable = openGUI_Enable;
|
||||
this.openGUI = openGUI;
|
||||
this.closeGUI_Enable =closeGUI;
|
||||
this.togglePermission = togglePermission;
|
||||
this.togglePermissionPerm = togglePermissionPerm;
|
||||
this.toggleUseItem = toggleUseItem;
|
||||
this.message_Enable = message_Enable;
|
||||
this.message = message;
|
||||
this.setConfigEnable = setConfigEnable;
|
||||
this.configFilePath = configFilePath;
|
||||
this.configOptionPath = configOptionPath;
|
||||
this.configOptionPremat = configOptionPremat;
|
||||
// this.ConfigChatInput = ConfigChatInput;
|
||||
|
||||
this.configStringValueLeft = configStringValueLeft;
|
||||
this.configBooleanValueLeft = configBooleanValueLeft;
|
||||
this.configIntegerValueLeft = configIntegerValueLeft;
|
||||
this.configDoubleValueLeft = configDoubleValueLeft;
|
||||
this.configListValueLeft = configListValueLeft;
|
||||
|
||||
this.configStringValueRight = configStringValueRight;
|
||||
this.configBooleanValueRight = configBooleanValueRight;
|
||||
this.configIntegerValueRight = configIntegerValueRight;
|
||||
this.configDoubleValueRight = configDoubleValueRight;
|
||||
this.configListValueRight = configListValueRight;
|
||||
|
||||
|
||||
this.pluginReloadEnable = pluginReloadEnable;
|
||||
this.pluginReloadCommand = pluginReloadCommand;
|
||||
|
||||
this.functionVotePoints = functionVotePoints;
|
||||
this.functionVotePointsMode = functionVotePointsMode;
|
||||
this.functionVotePointsAmount = functionVotePointsAmount;
|
||||
this.functionItem = functionItem;
|
||||
this.functionItemMode = functionItemMode;
|
||||
this.functionItemItem = functionItemItem;
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package net.t2code.commandguiv2.Spigot.objects.guis;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Gui {
|
||||
public Boolean guiEnable;
|
||||
public Integer guiLines;
|
||||
public String guiName;
|
||||
public Boolean guiFillItemEnable;
|
||||
public String guiFillItemItem;
|
||||
|
||||
public String key;
|
||||
public Boolean commandAliasEnable;
|
||||
public Boolean commandPermissionEnable;
|
||||
public ArrayList<Slot> slots;
|
||||
|
||||
public Gui(Boolean guiEnable, Integer guiLines, String guiName, Boolean guiFillitemEnable, String guiFillitemItem,
|
||||
String commandCommand, Boolean commandAliasEnable, Boolean commandPermissionEnable, ArrayList<Slot> slots){
|
||||
this.guiEnable = guiEnable;
|
||||
this.guiLines = guiLines;
|
||||
this.guiName = guiName;
|
||||
this.guiFillItemEnable = guiFillitemEnable;
|
||||
this.guiFillItemItem = guiFillitemItem;
|
||||
this.key = commandCommand;
|
||||
this.commandAliasEnable = commandAliasEnable;
|
||||
this.commandPermissionEnable = commandPermissionEnable;
|
||||
this.slots = slots;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package net.t2code.commandguiv2.Spigot.objects.slots;
|
||||
|
||||
public class Slot {
|
||||
|
||||
public Integer slot;
|
||||
public Boolean enable;
|
||||
public String function;
|
||||
public Boolean permission;
|
||||
public String permissionToSee;
|
||||
public String permissionToUse;
|
||||
|
||||
|
||||
public Slot(Integer slot,
|
||||
Boolean enable,
|
||||
String function,
|
||||
Boolean permission,
|
||||
String permissionToSee,
|
||||
String permissionToUse
|
||||
) {
|
||||
this.slot = slot;
|
||||
this.enable = enable;
|
||||
this.function = function;
|
||||
this.permission = permission;
|
||||
this.permissionToSee = permissionToSee;
|
||||
this.permissionToUse = permissionToUse;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package net.t2code.commandguiv2.Spigot.sound;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Sound {
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
public static void play(Player player, SoundEnum soundEnum) {
|
||||
if (!SelectConfig.getSound_Enable()) return;
|
||||
play(player, soundEnum, null, null, null);
|
||||
}
|
||||
|
||||
public static void play(Player player, SoundEnum soundEnum, Function function, Slot slot, Gui gui) {
|
||||
if (!SelectConfig.getSound_Enable()) return;
|
||||
switch (soundEnum) {
|
||||
case OpenInventory:
|
||||
if (!SelectConfig.getSound_OpenInventory_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_OpenInventory(), 3, 1);
|
||||
break;
|
||||
case Click:
|
||||
if (!SelectConfig.getSound_Click_Enable()) return;
|
||||
if (!function.customSound_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (function.customSound_NoSound) return;
|
||||
try {
|
||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(function.customSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
|
||||
} catch (Exception e1) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||
}
|
||||
break;
|
||||
case NoMoney:
|
||||
if (!SelectConfig.getSound_NoMoney_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_NoMoney(), 3, 1);
|
||||
break;
|
||||
case NoInventorySpace:
|
||||
if (!SelectConfig.getSound_NoInventorySpace_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_NoInventorySpace(), 3, 1);
|
||||
break;
|
||||
case Give:
|
||||
if (!SelectConfig.getSound_Give_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_Give(), 3, 1);
|
||||
break;
|
||||
case PlayerNotFound:
|
||||
if (!SelectConfig.getSound_PlayerNotFound_Enable()) return;
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_PlayerNotFound(), 3, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package net.t2code.commandguiv2.Spigot.system;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Debug {
|
||||
|
||||
private static final Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static void debugmsg() {
|
||||
T2Csend.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.debug(plugin, "§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
|
||||
T2Csend.debug(plugin, "§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
|
||||
T2Csend.debug(plugin, "§3Version: §e" + Bukkit.getVersion());
|
||||
T2Csend.debug(plugin, "§3Java: §e" + System.getProperty("java.version"));
|
||||
T2Csend.debug(plugin, "§3Worlds: §e" + String.valueOf(Bukkit.getServer().getWorlds()));
|
||||
T2Csend.debug(plugin, String.valueOf(Arrays.asList(Main.getPlugin().getServer().getPluginManager().getPlugins())));
|
||||
T2Csend.debug(plugin, "§5----------------------------------");
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
File f = new File(String.valueOf(Main.getPath()));
|
||||
File f2 = new File(String.valueOf(Main.getPath() + "/GUIs/"));
|
||||
File f3 = new File(String.valueOf(Main.getPath() + "/languages/"));
|
||||
File[] fileArray = f.listFiles();
|
||||
File[] fileArray2 = f2.listFiles();
|
||||
File[] fileArray3 = f3.listFiles();
|
||||
if (fileArray != null) {
|
||||
for (File config : fileArray) {
|
||||
T2Csend.debug(plugin, String.valueOf(config).replace("plugins/CommandGUI/", ""));
|
||||
}
|
||||
}
|
||||
if (fileArray2 != null) {
|
||||
for (File config2 : fileArray2) {
|
||||
T2Csend.debug(plugin, String.valueOf(config2).replace("plugins/CommandGUI/", ""));
|
||||
}
|
||||
} else T2Csend.debug(plugin, "No GUI files available");
|
||||
|
||||
if (fileArray3 != null) {
|
||||
for (File config3 : fileArray3) {
|
||||
T2Csend.debug(plugin, String.valueOf(config3).replace("plugins/CommandGUI/", ""));
|
||||
}
|
||||
} else T2Csend.debug(plugin, "No language files available");
|
||||
|
||||
}
|
||||
T2Csend.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,243 @@
|
|||
package net.t2code.commandguiv2.Spigot.system;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
|
||||
import net.t2code.commandguiv2.Spigot.gui.GUIListener;
|
||||
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.EventsFrom110;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
||||
import net.t2code.commandguiv2.Spigot.config.functions.CreateFunctions;
|
||||
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.database.MySQL;
|
||||
import net.t2code.commandguiv2.Spigot.listener.PluginEvent;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.ConfigCreate;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.database.SQLITE;
|
||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
public class Load {
|
||||
static Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
||||
|
||||
long long_ = T2Ctemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
try {
|
||||
Debug.debugmsg();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
T2Csend.console(prefix + " §8-------------------------------");
|
||||
try {
|
||||
ConfigConverter.renameMainFolder();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
if (!new File(Main.getPath(), "config.yml").exists()) {
|
||||
try {
|
||||
plugin.saveResource("configDeclaration.yml", false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CreateGUI.configCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CreateFunctions.create();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ConfigCreate.configCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
SelectConfig.onSelect();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
plugin.saveResource("GUIs/guiDeclaration.yml", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
plugin.saveResource("Functions/functionDeclaration.yml", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
SelectConfig.setConfigVersion();
|
||||
|
||||
if (SelectLibConfig.getBungee()) {
|
||||
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "t2c:bcmd")) {
|
||||
T2Csend.debug(plugin, "registerOutgoingPluginChannel §et2c:bcmd");
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||
}
|
||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:cguiopl")) {
|
||||
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:cguiopl");
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "t2c:cguiopl", new Bungee_Sender_Reciver());
|
||||
}
|
||||
}
|
||||
|
||||
if (T2CpluginCheck.papi()) {
|
||||
new Papi().register();
|
||||
}
|
||||
|
||||
try {
|
||||
LanguagesCreate.langCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
Obj_Select.onSelect();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
SelectMessages.onSelect(prefix);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
SelectConfig.sound(prefix);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), Permissions.admin + ";" + Permissions.giveItemOther + ";" + Permissions.info);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
T2Csend.console(prefix + " §8-------------------------------");
|
||||
loadStorage(prefix);
|
||||
T2Csend.console(prefix + " §8-------------------------------");
|
||||
|
||||
if (Main.PaPi) {
|
||||
T2Csend.console(prefix + " §2PlaceholderAPI successfully connected!");
|
||||
} else {
|
||||
T2Csend.console(prefix + " §4PlaceholderAPI could not be connected / found!");
|
||||
}
|
||||
|
||||
try {
|
||||
Permissions.onPermRegister();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (SelectConfig.getHelpAlias()) {
|
||||
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
||||
T2Csend.debug(plugin, "CommandRegister: commandguihelp");
|
||||
}
|
||||
Main.getPlugin().getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
|
||||
T2Csend.debug(plugin, "CommandRegister: commandgui");
|
||||
Main.getPlugin().getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
||||
T2Csend.debug(plugin, "CommandRegister: commandgui-item");
|
||||
|
||||
try {
|
||||
AliasRegister.onRegister();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new GUIListener(), plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.getPlugin());
|
||||
|
||||
if (!T2CmcVersion.isMc1_8() && !T2CmcVersion.isMc1_9()) {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new EventsFrom110(), plugin);
|
||||
}
|
||||
|
||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(),spigotID,discord
|
||||
,SelectConfig.getUpdateCheckOnJoin(),SelectConfig.getUpdateCheckSeePreReleaseUpdates(),SelectConfig.getUpdateCheckTimeInterval());
|
||||
Metrics.Bstats();
|
||||
Main.addonLoad();
|
||||
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||
}
|
||||
|
||||
private static void loadStorage(String prefix) {
|
||||
try {
|
||||
SelectDatabase.setStorage(StorageEnum.valueOf(SelectConfig.getStorage()));
|
||||
} catch (Exception ignored) {
|
||||
T2Csend.error(plugin, "The storage medium " + SelectConfig.getStorage() + " is not supported!");
|
||||
T2Csend.error(plugin, "Storage medium " + StorageEnum.SQLITE + " is used.");
|
||||
SelectDatabase.setStorage(StorageEnum.SQLITE);
|
||||
}
|
||||
|
||||
switch (SelectDatabase.getStorage()) {
|
||||
case MYSQL:
|
||||
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||
MySQL.main();
|
||||
try {
|
||||
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Name` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Status` INT(1) NOT NULL DEFAULT '1'," +
|
||||
" `Slot` INT(1) NULL DEFAULT NULL," +
|
||||
" UNIQUE INDEX `UUID` (`UUID`)" +
|
||||
")" +
|
||||
"COLLATE='utf8mb4_general_ci'" +
|
||||
"ENGINE=InnoDB" +
|
||||
";");
|
||||
} catch (Exception e) {
|
||||
Main.sendTryCatch(Load.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
MySQL.query("ALTER TABLE `gui-item` ADD COLUMN `Slot` INT(1) NULL DEFAULT NULL AFTER `Status`;");
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||
break;
|
||||
default:
|
||||
case SQLITE:
|
||||
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||
try {
|
||||
SQLITE.main();
|
||||
SQLITE.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||
"UUID TEXT NOT NULL," +
|
||||
"Name TEXT NOT NULL," +
|
||||
"Status INTEGER NOT NULL DEFAULT 1," +
|
||||
"Slot INTEGER," +
|
||||
"PRIMARY KEY(UUID)" +
|
||||
");");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
// This claas was created by JaTiTV
|
||||
|
||||
|
||||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
package net.t2code.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -31,10 +32,15 @@ import java.util.zip.GZIPOutputStream;
|
|||
public class Metrics {
|
||||
|
||||
public static void Bstats() {
|
||||
int pluginId = Main.bstatsID; // <-- Replace with the id of your plugin!
|
||||
Metrics metrics = new Metrics(Main.plugin, pluginId);
|
||||
metrics.addCustomChart(new Metrics.SimplePie("updatecheckonjoin", () -> String.valueOf(SelectConfig.UpdateCheckOnJoin)));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("storage_type_mysql", () -> SelectConfig.Storage));
|
||||
int pluginId = Util.getBstatsID(); // <-- Replace with the id of your plugin!
|
||||
Metrics metrics = new Metrics(Main.getPlugin(), pluginId);
|
||||
metrics.addCustomChart(new DrilldownPie("storage_type_mysql", () -> {
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
String storage = SelectDatabase.getStorage().toString();
|
||||
Map<String, Integer> entry = new HashMap<>();
|
||||
entry.put(storage, 1); map.put(storage, entry);
|
||||
return map;
|
||||
}));
|
||||
}
|
||||
|
||||
private final Plugin plugin;
|
|
@ -0,0 +1,51 @@
|
|||
// This claas was created by JaTiTV
|
||||
|
||||
package net.t2code.commandguiv2.Spigot.system;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Papi extends PlaceholderExpansion {
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "commandgui";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
return Main.getPlugin().getDescription().getAuthors().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return Main.getPlugin().getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean persist() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onPlaceholderRequest(Player p, String params) {
|
||||
if (params.contains("useitem_boolean")) {
|
||||
Placeholder.useitem_boolean(p);
|
||||
}
|
||||
|
||||
if (params.contains("useitem")) {
|
||||
Placeholder.useitem(p);
|
||||
}
|
||||
|
||||
if (params.contains("slot")) {
|
||||
Placeholder.slot(p);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package net.t2code.commandguiv2.Spigot.system;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class Permissions {
|
||||
private static final Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static final String key = "commandgui.";
|
||||
public static final String command = key + "command";
|
||||
public static final String info = key + "command.info";
|
||||
public static final String bypass = key + "bypass";
|
||||
public static final String useitemToggle = key + "useitem.toggle";
|
||||
public static final String useitem = key + "useitem";
|
||||
public static final String getGuiItemAtLogin = key + "get.guiitem.at.login";
|
||||
public static final String giveItemOther = key + "giveitem.other";
|
||||
public static final String updatemsg = key + "updatemsg";
|
||||
|
||||
public static final String player = key + "player";
|
||||
public static final String admin = key + "admin";
|
||||
|
||||
public static final PermissionDefault op = PermissionDefault.OP;
|
||||
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
||||
|
||||
public static void onPermRegister() {
|
||||
T2Cregister.permission(command, op, plugin);
|
||||
T2Cregister.permissionDescription(command, "Required permission to open GUIs via command", plugin);
|
||||
|
||||
T2Cregister.permission(getGuiItemAtLogin, op, plugin);
|
||||
T2Cregister.permission(giveItemOther, op, plugin);
|
||||
T2Cregister.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
|
||||
|
||||
T2Cregister.permission(useitem, op, plugin);
|
||||
T2Cregister.permissionDescription(useitem, "Required permission to use the GUI Item", plugin);
|
||||
|
||||
T2Cregister.permission(useitemToggle, op, plugin);
|
||||
T2Cregister.permissionDescription(useitemToggle, "Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)", plugin);
|
||||
|
||||
T2Cregister.permission(updatemsg, op, plugin);
|
||||
T2Cregister.permissionDescription(updatemsg, "Players with this permission get the update message when joining if an update is available", plugin);
|
||||
|
||||
T2Cregister.permission(bypass, op, plugin);
|
||||
T2Cregister.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
|
||||
|
||||
T2Cregister.permission(info, notOp, plugin);
|
||||
T2Cregister.permissionDescription(info, "Permission to view T2C-CommandGUI info", plugin);
|
||||
|
||||
T2Cregister.permission(player, op, command, true, plugin);
|
||||
T2Cregister.permission(player, op, getGuiItemAtLogin, true, plugin);
|
||||
T2Cregister.permission(player, op, useitem, true, plugin);
|
||||
T2Cregister.permission(player, op, useitemToggle, true, plugin);
|
||||
T2Cregister.permissionDescription(player, "All permissions from T2C-CommandGUI for Player", plugin);
|
||||
|
||||
T2Cregister.permission(admin, op, command, true, plugin);
|
||||
T2Cregister.permission(admin, op, getGuiItemAtLogin, true, plugin);
|
||||
T2Cregister.permission(admin, op, giveItemOther, true, plugin);
|
||||
T2Cregister.permission(admin, op, useitem, true, plugin);
|
||||
T2Cregister.permission(admin, op, useitemToggle, true, plugin);
|
||||
T2Cregister.permission(admin, op, updatemsg, true, plugin);
|
||||
T2Cregister.permission(admin, op, bypass, true, plugin);
|
||||
T2Cregister.permission(admin, op, info, true, plugin);
|
||||
T2Cregister.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
|
||||
|
||||
|
||||
for (Gui gui : Main.guiHashMap.values()) {
|
||||
T2Cregister.permission(command + "." + gui.key, op, plugin);
|
||||
T2Cregister.permission(admin, op, command + "." + gui.key, true, plugin);
|
||||
for (Slot slot : gui.slots) {
|
||||
T2Cregister.permission(slot.permissionToUse, op, plugin);
|
||||
T2Cregister.permission(admin, op, slot.permissionToUse, true, plugin);
|
||||
T2Cregister.permission(slot.permissionToSee, op, plugin);
|
||||
T2Cregister.permission(admin, op, slot.permissionToSee, true, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package net.t2code.commandguiv2.Spigot.system;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Placeholder {
|
||||
public static String useitem(Player p) {
|
||||
if (Events.useItemHashMap.get(p.getName())) {
|
||||
return SelectConfig.getPlaceholderTrue();
|
||||
} else return SelectConfig.getPlaceholderFalse();
|
||||
}
|
||||
|
||||
public static String useitem_boolean(Player p) {
|
||||
return Events.useItemHashMap.get(p.getName()).toString();
|
||||
}
|
||||
|
||||
public static String slot(Player p) {
|
||||
return Events.useItemSlotHashMap.get(p.getName()).toString();
|
||||
}
|
||||
|
||||
public static String replace(String input, Player player) {
|
||||
return input.replace("[player]", player.getName()).replace("%commandgui_useitem%", useitem(player))
|
||||
.replace("%commandgui_useitem_boolean%", useitem_boolean(player)).replace("%commandgui_useitem_slot%", slot(player));
|
||||
}
|
||||
public static List<String> replace(List<String> input, Player player) {
|
||||
ArrayList<String> rp = new ArrayList<String>();
|
||||
|
||||
for (String s : input) {
|
||||
rp.add(s.replace("[player]", player.getName()).replace("%commandgui_useitem%", useitem(player))
|
||||
.replace("%commandgui_useitem_boolean%", useitem_boolean(player)).replace("%commandgui_useitem_slot%", slot(player)));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,350 @@
|
|||
package net.t2code.commandguiv2.Spigot.useItem;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||
import net.t2code.commandguiv2.api.CGuiAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class Events implements Listener {
|
||||
|
||||
public static HashMap<String, Boolean> useItemHashMap = new HashMap<>();
|
||||
public static HashMap<String, Integer> useItemSlotHashMap = new HashMap<>();
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
useItemHashMap.put(e.getPlayer().getName(), SelectDatabase.selectItemStatus(e.getPlayer()));
|
||||
Integer i = SelectDatabase.selectSlot(e.getPlayer());
|
||||
if (i == null) {
|
||||
useItemSlotHashMap.put(e.getPlayer().getName(), SelectConfig.getUseItem_InventorySlot());
|
||||
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
|
||||
|
||||
if (CGuiAPI.JoinDisable) {
|
||||
T2Csend.debug(Main.getPlugin(), "JoinDisable");
|
||||
return;
|
||||
}
|
||||
if (e.getPlayer().hasPermission("commandgui.get.guiitem.at.login")) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
T2Csend.debug(Main.getPlugin(), "itemChange: " + e.getPlayer().getName());
|
||||
ItemChange.itemChange(e.getPlayer(), true);
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), 20L * 1);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerQuitEvent e) {
|
||||
useItemHashMap.remove(e.getPlayer().getName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDeathDrop(PlayerDeathEvent e) {
|
||||
Player player = e.getEntity().getPlayer();
|
||||
UseItem.removeItem(player);
|
||||
if (!e.getDrops().isEmpty()) {
|
||||
Iterator var3 = (new ArrayList(e.getDrops())).iterator();
|
||||
while (var3.hasNext()) {
|
||||
ItemStack items = (ItemStack) var3.next();
|
||||
if (items != null && items.hasItemMeta() && items.getItemMeta().hasDisplayName()
|
||||
&& items.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
e.getDrops().remove(items);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onRespawn(PlayerRespawnEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (SelectConfig.getUseItem_Enable()) {
|
||||
ItemChange.itemChange(player, false);
|
||||
//if (!SelectConfig.getUseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||
// if (SelectConfig.getUseItem_GiveOnlyOnFirstJoin) {
|
||||
// if (!player.hasPlayedBefore()) {
|
||||
// new BukkitRunnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Give_UseItem.onGive(player);
|
||||
// }
|
||||
// }.runTaskLater(Main.getPlugin(), 20L * 1);
|
||||
// }
|
||||
// } else {
|
||||
// new BukkitRunnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Give_UseItem.onGive(player);
|
||||
// }
|
||||
// }.runTaskLater(Main.getPlugin(), 20L * 1);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onGameModeChange(PlayerGameModeChangeEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (!SelectConfig.getUseItemGameModeChangeEnable()) {
|
||||
return;
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ItemChange.itemChange(player, false);
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemGameModeChangeDelayInTicks() * 1L);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWorldChange(PlayerChangedWorldEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (!SelectConfig.getUseItemWorldChangeEnable()) {
|
||||
return;
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ItemChange.itemChange(player, false);
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemWorldChangeDelayInTicks() * 1L);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInteract(PlayerInteractEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (!p.isSneaking()) {
|
||||
for (String material : SelectConfig.getUseItemItemBlockBlacklist()) {
|
||||
if (e.getClickedBlock() != null) {
|
||||
if (e.getClickedBlock().getType() == Material.valueOf(material)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectConfig.getUseItem_Enable()) {
|
||||
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
|
||||
if (e.getItem() != null && p.getItemInHand().getType() == T2CitemVersion.getHead()) {
|
||||
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
openGUI(e, p);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(SelectConfig.getUseItem_Material())) {
|
||||
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
openGUI(e, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void openGUI(PlayerInteractEvent e, Player player) {
|
||||
e.setCancelled(true);
|
||||
|
||||
if ((!SelectConfig.getDisableInfoBySneak()) && player.isSneaking()) {
|
||||
Commands.info(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Main.legacy) {
|
||||
if (!topInventoryIsEmpty(player)) return;
|
||||
}
|
||||
|
||||
if (UseItem.protection(player, true)) return;
|
||||
|
||||
if (SelectConfig.getUseItemGameModeProtection()) {
|
||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||
e.setCancelled(true);
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||
e.setCancelled(true);
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectConfig.getUseItemWorldProtection()) {
|
||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||
e.setCancelled(true);
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||
e.setCancelled(true);
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!SelectConfig.getUseItem_Permission() || player.hasPermission("commandgui.useitem")) {
|
||||
OpenGUI.openGUI(player, SelectConfig.getUseItem_OpenGUI(), true);
|
||||
} else {
|
||||
T2Csend.player(player,SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
||||
.replace("[gui]", SelectConfig.getUseItem_OpenGUI()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMoveEvent(InventoryMoveItemEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
|
||||
&& e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(InventoryDragEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
|
||||
if (e.getWhoClicked() instanceof Player) {
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
ItemChange.itemChange(p, false);
|
||||
}
|
||||
|
||||
if (e.getOldCursor() != null && e.getOldCursor().hasItemMeta() && e.getOldCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getOldCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
ItemChange.itemChange(p, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemMove(InventoryClickEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
|
||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
|
||||
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(InventoryPickupItemEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
|
||||
if (e.getItem() != null && e.getItem().getItemStack() != null) {
|
||||
ItemStack item = e.getItem().getItemStack();
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlace(BlockPlaceEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
|
||||
&& e.getItemInHand().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDrop(PlayerDropItemEvent e) {
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
|
||||
if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
|
||||
ItemStack item = e.getItemDrop().getItemStack();
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean topInventoryIsEmpty(Player p) {
|
||||
return p.getOpenInventory().getTopInventory().isEmpty();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClearServer(ServerCommandEvent event) {
|
||||
if (SelectConfig.getUseItem_KeepAtCommandClear()) {
|
||||
if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Player player = Bukkit.getPlayer(event.getCommand().replace("/", "").replace("clear ", ""));
|
||||
if (player == null){
|
||||
return;
|
||||
}
|
||||
clearGive(player);
|
||||
} catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), 1L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onClearPlayer(PlayerCommandPreprocessEvent event) {
|
||||
if (SelectConfig.getUseItem_KeepAtCommandClear()) {
|
||||
if (event.getMessage().toLowerCase().contains("clear")) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clearGive(event.getPlayer());
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), 1L);
|
||||
}
|
||||
if (event.getMessage().toLowerCase().contains("clear " + event.getMessage().toLowerCase().replace("/", "").replace("clear ", ""))) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clearGive(Bukkit.getPlayer(event.getMessage().toLowerCase().replace("/", "").replace("clear ", "")));
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), 1L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void clearGive(Player player) {
|
||||
ItemChange.itemChange(player, false);
|
||||
}
|
||||
}
|
|
@ -1,40 +1,37 @@
|
|||
package de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener;
|
||||
package net.t2code.commandguiv2.Spigot.useItem;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.*;
|
||||
|
||||
public class Events_from1_10 implements Listener {
|
||||
public class EventsFrom110 implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onHandSwap(PlayerSwapHandItemsEvent e) {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9) return;
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
}
|
||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(PlayerSwapHandItemsEvent e) {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9) return;
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||
Player p = e.getPlayer();
|
||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
}
|
||||
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package net.t2code.commandguiv2.Spigot.useItem;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ItemChange {
|
||||
public static void itemChange(Player player, Boolean setCursor) {
|
||||
Integer slot;
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
|
||||
slot = SelectConfig.getUseItem_InventorySlot();
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
|
||||
if (!SelectConfig.getUseItem_Enable()) {
|
||||
return;
|
||||
}
|
||||
UseItem.removeItem(player);
|
||||
if (UseItem.protection(player, false)) return;
|
||||
if (SelectConfig.getUseItem_GiveOnlyOnFirstJoin()) {
|
||||
if (!SelectConfig.getUseItem_AllowToggle() || Events.useItemHashMap.get(player.getName())) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UseItem.giveUseItem(player);
|
||||
if (setCursor) {
|
||||
setCursor(player, slot);
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
||||
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin() || SelectConfig.getCursor_ToGUIItem_OnLogin()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
|
||||
return;
|
||||
}
|
||||
if (!SelectConfig.getUseItem_GiveOnEveryJoin()) {
|
||||
T2Csend.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
|
||||
return;
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Boolean pln = Events.useItemHashMap.get(player.getName());
|
||||
if (pln == null) return;
|
||||
if (!SelectConfig.getUseItem_AllowToggle() || pln) {
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(slot - 1) == null) {
|
||||
T2Csend.debug(Main.getPlugin(), "Give: " + player.getName());
|
||||
UseItem.giveUseItem(player);
|
||||
if (setCursor) {
|
||||
setCursor(player, slot);
|
||||
}
|
||||
} else if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||
boolean empty = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (player.getInventory().getItem(i) == null) {
|
||||
empty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty) {
|
||||
UseItem.addUseItem(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
||||
}
|
||||
|
||||
private static void setCursor(Player player, int slot) {
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
|
||||
|
||||
if (!SelectConfig.getCursor_ToGUIItem_OnLogin()) {
|
||||
return;
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
|
||||
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin()) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
|
||||
}
|
||||
return;
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
|
||||
if (!SelectLibConfig.getBungee()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
|
||||
return;
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
|
||||
if (SelectConfig.getUseItem_ServerChange()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
|
||||
return;
|
||||
}
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 8 Player: " + player.getName());
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor Player: " + player.getName());
|
||||
if (Main.bungeejoinplayers.contains(player.getName())) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
T2Csend.debug(Main.getPlugin(), "setCursor 9 Player: " + player.getName());
|
||||
Main.bungeejoinplayers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
package net.t2code.commandguiv2.Spigot.useItem;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemBuilder;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UseItem {
|
||||
public static void giveUseItem(Player player) {
|
||||
Integer slot;
|
||||
if (protection(player, false)) return;
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
|
||||
slot = SelectConfig.getUseItem_InventorySlot();
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||
player.getInventory().addItem(itemStack(player));
|
||||
} else {
|
||||
T2Csend.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
|
||||
player.getInventory().setItem(slot - 1, itemStack(player));
|
||||
}
|
||||
}
|
||||
|
||||
public static void addUseItem(Player player) {
|
||||
if (protection(player, false)) return;
|
||||
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||
player.getInventory().addItem(itemStack(player));
|
||||
} else player.getInventory().addItem(itemStack(player));
|
||||
}
|
||||
|
||||
private static ItemStack itemStack(Player player) {
|
||||
ItemStack item = null;
|
||||
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
|
||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
T2Csend.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
|
||||
T2Csend.error(Main.getPlugin(), "Playerheads for UseItem are only available from version 1.13!");
|
||||
} else {
|
||||
|
||||
SkullMeta playerheadmeta = null;
|
||||
|
||||
if (SelectConfig.getUseItem_Base64_Enable()) {
|
||||
item = T2CitemBuilder.base64(SelectConfig.getUseItem_Base64value());
|
||||
playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||
} else {
|
||||
item = T2CitemVersion.getHeadIS();
|
||||
playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||
String p;
|
||||
if (SelectConfig.getUseItem_PlayerWhoHasOpenedTheGUI()) {
|
||||
p = player.getName();
|
||||
} else p = SelectConfig.getUseItem_PlayerName();
|
||||
playerheadmeta.setOwner(p);
|
||||
}
|
||||
if (Main.PaPi) {
|
||||
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
|
||||
item.setItemMeta(playerheadmeta);
|
||||
}
|
||||
} else {
|
||||
item = new ItemStack(Material.valueOf(SelectConfig.getUseItem_Material()));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(SelectConfig.getUseItem_Name());
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||
} else itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||
item.setItemMeta(itemMeta);
|
||||
item.setAmount(1);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public static boolean protection(Player player, Boolean interact) {
|
||||
if (SelectConfig.getUseItemGameModeProtection()) {
|
||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||
if (interact) {
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||
if (interact) {
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (SelectConfig.getUseItemWorldProtection()) {
|
||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||
if (interact) {
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||
if (interact) {
|
||||
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void removeItem(Player player) {
|
||||
T2Csend.debug(Main.getPlugin(), "World disabled: " + player.getName() + " " + player.getWorld().toString());
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.getUseItem_Material()) || itm.getType() == T2CitemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package net.t2code.commandguiv2;
|
||||
|
||||
public class Util {
|
||||
|
||||
public static String getInfoText() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getRequiredT2CodeLibVersion() {
|
||||
return "16.2";
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return "§8[§4C§9GUI§8]";
|
||||
}
|
||||
|
||||
public static Integer getSpigotID() {
|
||||
return 90671;
|
||||
}
|
||||
|
||||
public static String getGit() {
|
||||
return "JaTiTV/T2C-CommandGUI";
|
||||
}
|
||||
|
||||
public static Integer getBstatsID() {
|
||||
return 10840;
|
||||
}
|
||||
|
||||
public static String getSpigot() {
|
||||
return "https://www.spigotmc.org/resources/" + getSpigotID();
|
||||
}
|
||||
|
||||
public static String getDiscord() {
|
||||
return net.t2code.t2codelib.Util.getDiscord();
|
||||
}
|
||||
|
||||
public static Integer getConfigVersion() {
|
||||
return 7;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package net.t2code.commandguiv2.api;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.useItem.ItemChange;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.Main;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Help;
|
||||
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||
import net.t2code.commandguiv2.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CGuiAPI {
|
||||
public static Boolean JoinDisable = false;
|
||||
|
||||
public static void onItemChange(Player player) {
|
||||
onItemChange(player,false);
|
||||
}
|
||||
public static void onItemChange(Player player, Boolean setCursor) {
|
||||
ItemChange.itemChange(player, setCursor);
|
||||
}
|
||||
|
||||
public static boolean hasUseItemInMainHand(Player player) {
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name());
|
||||
}
|
||||
|
||||
public static boolean hasUseItemInOffHand(Player player) {
|
||||
ItemStack item = player.getInventory().getItemInOffHand();
|
||||
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name());
|
||||
}
|
||||
|
||||
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
||||
T2Csend.debug(Main.getPlugin(), "CGuiAPI: " + disableItemGiveOnJoin);
|
||||
JoinDisable = disableItemGiveOnJoin;
|
||||
}
|
||||
|
||||
public static Boolean selectPlayerItemEnable(Player player) {
|
||||
return Events.useItemHashMap.get(player.getName());
|
||||
}
|
||||
|
||||
public static Integer selectPlayerItemSlot(Player player) {
|
||||
return Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
|
||||
public static void setPlayerItemEnable(Player player, Boolean value) {
|
||||
if (value) {
|
||||
SelectDatabase.setItemStatusTrue(player);
|
||||
} else SelectDatabase.setItemStatusFalse(player);
|
||||
}
|
||||
|
||||
public static void setPlayerItemSlot(Player player, Integer value) {
|
||||
SelectDatabase.setSlot(player, value);
|
||||
}
|
||||
|
||||
public static void openDefaultGUI(Player player) {
|
||||
Commands.gui(player);
|
||||
}
|
||||
|
||||
public static void openGUI(Player player, String GUI_CommandName) {
|
||||
Commands.gui(player, GUI_CommandName);
|
||||
}
|
||||
|
||||
public static void sendHelp(CommandSender sender) {
|
||||
Help.sendHelp(sender, Util.getPrefix());
|
||||
}
|
||||
|
||||
public static void sendPluginInfo(CommandSender sender) {
|
||||
if (sender.hasPermission(Permissions.info)) {
|
||||
Commands.info(sender);
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.info));
|
||||
}
|
||||
|
||||
public static void createDefaultGUI(CommandSender sender) {
|
||||
if (sender.hasPermission(Permissions.admin)) {
|
||||
CreateGUI.configCreate();
|
||||
sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
|
||||
}
|
||||
|
||||
public static void reload(CommandSender sender) {
|
||||
if (sender.hasPermission(Permissions.admin)) {
|
||||
Commands.reload(sender);
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
#####################################################
|
||||
## To add another Function just create a new file. ##
|
||||
#####################################################
|
||||
|
||||
Slots:
|
||||
Function:
|
||||
Item:
|
||||
# Here you can create an empty slot.
|
||||
# Note: When this is enabled, no functions will work.
|
||||
Empty: false
|
||||
# Here you can set the number of items
|
||||
Amount: 1
|
||||
PlayerHead:
|
||||
# Here you can set if the item should be a player head
|
||||
Enable: false
|
||||
Base64:
|
||||
# Here you can specify whether a Base64 player header should be used
|
||||
Enable: false
|
||||
# Here you can set the Base64 Value.
|
||||
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
||||
Base64Value: ''
|
||||
# Here you can set whether the player head should be used by the player who has opened the GUI.
|
||||
PlayerWhoHasOpenedTheGUI: false
|
||||
# Here you can set a specific player from which the player head should be used
|
||||
PlayerName: ''
|
||||
# Here you can set a Minecraft material to be used. This is ignored when PlayerHead is used
|
||||
Material: 'DIRT'
|
||||
# Here you set the DisplayName of the item
|
||||
Name: 'Item Title'
|
||||
# Here you set the lore of the item
|
||||
Lore:
|
||||
- '&8-----------------'
|
||||
- '&bLine 1'
|
||||
- '&bLine 2'
|
||||
- '&8-----------------'
|
||||
NoPermission:
|
||||
Message:
|
||||
# Here you can define if a message should be displayed when clicking on the function but not having a permission
|
||||
Enable: true
|
||||
# Here you can set a custom No Permission message for this function. If you want to use the default message, just leave this blank.
|
||||
#
|
||||
# You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes
|
||||
# You can use the hover module from T2Code:
|
||||
# You can add a hover and/or clickable feature to all messages sent to players.
|
||||
# Use /*/ to separate the message.
|
||||
# Use [nl] to set a line break in a message or hover.
|
||||
# Hover message: <message >/*/<hover>
|
||||
# Message with hover and click function: <message >/*/<hover>/*/<action>/*/<actionValue>
|
||||
# Message only with click function: <message >/*//*/<action>/*/<actionValue>
|
||||
# Action:
|
||||
# - OPEN_URL - Opens a URL under the path specified in ActionValue.
|
||||
# - OPEN_FILE - Opens a file under the path specified by ActionValue.
|
||||
# - RUN_COMMAND - Runs the command specified by ActionValue.
|
||||
# - SUGGEST_COMMAND - Inserts the string specified in ActionValue into the player text box.
|
||||
# - CHANGE_PAGE - Changes to the page number in a book specified by ActionValue.
|
||||
# - COPY_TO_CLIPBOARD - Copies the string specified by ActionValue to the player's clipboard.
|
||||
# You can also use MiniMessage:
|
||||
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html
|
||||
# WebUI: https://webui.adventure.kyori.net
|
||||
CustomNoPermMessage: ''
|
||||
Item:
|
||||
Lore:
|
||||
# Here you can select whether an extra lore should be displayed if you do not have permission for this function.
|
||||
Enable: true
|
||||
# Here you can set an extra lore that will be displayed if you do not have permission for this action.
|
||||
Lore:
|
||||
- '&8-----------------'
|
||||
- '&4No Permission for this Function'
|
||||
- '&8-----------------'
|
||||
CustomSound:
|
||||
# Here you can set whether a specific sound or the default sound from the config.yml should be used.
|
||||
Enable: false
|
||||
# Here you can deactivate the sound for this item. CustomSound must be activated for this!
|
||||
NoSound: false
|
||||
# Here you set the custom sound
|
||||
Sound: ''
|
||||
Cost:
|
||||
# Here you can specify whether the function should cost or not
|
||||
Enable: false
|
||||
# Here you set which economy mode should be used.
|
||||
# Use 'VAULT' / 'MONEY' for money via vault.
|
||||
# Use 'ITEM' to pay with items.
|
||||
# Use 'VOTEPOINTS' to pay with vote points from VotingPlugin (https://spigotmc.org/resources/votingplugin.15358/).
|
||||
EcoModule: VAULT
|
||||
# Set the item and the quantity for the ITEM mode here. (ITEM;AMOUNT)
|
||||
Item: DIRT;5
|
||||
# Set here the VotePoints for the VOTEPOINTS mode.
|
||||
VotePoints: 0
|
||||
# Set the money here for the mode VAULT or MONEY
|
||||
Price: 0.0
|
||||
Command:
|
||||
# Here you can enable or disable the Command function
|
||||
# Placeholder: [player] = PlayerName
|
||||
Enable: false
|
||||
# Here you can specify if this command should be executed on the bugee
|
||||
BungeeCommand: false
|
||||
# Here you can set if the command should be executed from the console
|
||||
# Example: You can also create a store with this command.
|
||||
# /give [player] stone | So all commands can be executed even those for which the player has no permission.
|
||||
CommandAsConsole: false
|
||||
# Here you can set commands. Several commands are also possible.
|
||||
# They are processed from top to bottom and executed one after the other!
|
||||
Command:
|
||||
- 'command 1'
|
||||
- 'command 2'
|
||||
ServerChange:
|
||||
# Here you can enable or disable the function ServerChange
|
||||
# To use this function the function BungeeCord must be activated in the conig.yml and the plugin must be installed on the proxy!
|
||||
Enable: false
|
||||
# # Here you can say which server the player should be moved to.
|
||||
Server: ''
|
||||
OpenGUI:
|
||||
# Here you can enable or disable the OpenGUI feature
|
||||
Enable: false
|
||||
# Here you can set which GUI should be opened.
|
||||
# Use the file name of the GUI without .yml
|
||||
GUI: ''
|
||||
CloseGUI:
|
||||
# Here you can set a function to close the GUI.
|
||||
Enable: false
|
||||
Toggle:
|
||||
# Here you can enable a feature that allows players to give or remove permissions to each other
|
||||
# The commands for the permission plugin can be set in the config (default for LuckPerms)
|
||||
Permission:
|
||||
# Activate this function here
|
||||
Enable: false
|
||||
# Set the permission here
|
||||
Permission: ''
|
||||
UseItem:
|
||||
# When this function is enabled, players can toggle the UseItem on and off.
|
||||
# For this function 'UseItem.AllowToggle' must be activated in config.yml!
|
||||
Enable: false
|
||||
Message:
|
||||
# Here you can enable or disable the Message function
|
||||
Enable: false
|
||||
# Here you can set the messages to be sent to the player
|
||||
# Placeholder: [player] = PlayerName | [prefix] = PluginPrefix | [price] = price if function Cost is activated
|
||||
#
|
||||
# You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes
|
||||
# You can use the hover module from T2Code:
|
||||
# You can add a hover and/or clickable feature to all messages sent to players.
|
||||
# Use /*/ to separate the message.
|
||||
# Use [nl] to set a line break in a message or hover.
|
||||
# Hover message: <message >/*/<hover>
|
||||
# Message with hover and click function: <message >/*/<hover>/*/<action>/*/<actionValue>
|
||||
# Message only with click function: <message >/*//*/<action>/*/<actionValue>
|
||||
# Action:
|
||||
# - OPEN_URL - Opens a URL under the path specified in ActionValue.
|
||||
# - OPEN_FILE - Opens a file under the path specified by ActionValue.
|
||||
# - RUN_COMMAND - Runs the command specified by ActionValue.
|
||||
# - SUGGEST_COMMAND - Inserts the string specified in ActionValue into the player text box.
|
||||
# - CHANGE_PAGE - Changes to the page number in a book specified by ActionValue.
|
||||
# - COPY_TO_CLIPBOARD - Copies the string specified by ActionValue to the player's clipboard.
|
||||
# You can also use MiniMessage:
|
||||
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html
|
||||
# WebUI: https://webui.adventure.kyori.net
|
||||
Message:
|
||||
- 'Message line 1'
|
||||
- 'Message line 2'
|
||||
SetConfig:
|
||||
# Here you can enable or disable the SetConfig function
|
||||
Enable: false
|
||||
File:
|
||||
# Here you define in which file something should be changed
|
||||
# Example at this file: 'plugins/CommandGUI/GUIs/default.yml'.
|
||||
Path: ''
|
||||
Option:
|
||||
# Here you set the option to be changed
|
||||
# Example on the option of this example slots: 'Slots.Example.Slot'
|
||||
Path: ''
|
||||
# Here you set which format should be set
|
||||
# String = text in one line
|
||||
# Boolean = true / false
|
||||
# Integer = numbers without comma
|
||||
# Double = number with comma | Please use . as comma
|
||||
# List = text with multiple lines (- 'hi')
|
||||
Premat: String
|
||||
Value:
|
||||
# Here you can set which value should be set when you click with the left mouse button.
|
||||
LeftClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
# Here you set which value should be set when clicking with the right mouse button
|
||||
RightClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
PluginReload:
|
||||
# Here you can set if the plugin to which a file was changed should be reloaded directly
|
||||
Enable: false
|
||||
# Here you set the reload command to be used
|
||||
# The command is executed by the console! No / is needed!
|
||||
Command: ''
|
||||
FunctionVotePoints:
|
||||
# With this function you can give or subtract VotePoints from VotingPlugin to a player.
|
||||
Enable: false
|
||||
# Use to add: ADD
|
||||
# Use to subtract: REMOVE
|
||||
Mode: ADD
|
||||
# Set the number of vote points to be subtracted / added here
|
||||
Amount: 0
|
||||
FunctionItem:
|
||||
# With this function you can give or remove items to a player
|
||||
Enable: false
|
||||
# Use to add: ADD
|
||||
# Use to subtract: REMOVE
|
||||
Mode: REMOVE
|
||||
# Enter the item (material) and the number behind it. Separate them with ; (ITEM;AMOUNT)
|
||||
Item: DIRT;5
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
################################################
|
||||
## To add another GUI just create a new file. ##
|
||||
################################################
|
||||
|
||||
GUI:
|
||||
# Enable or disable the GUI
|
||||
Enable: true
|
||||
# Set the lines of the GUI here (1-6)
|
||||
Lines: 1
|
||||
# Here you set the display name of the GUI
|
||||
Name: '&5default &9GUI'
|
||||
FillItem:
|
||||
# Activate or deactivate the FillItem here
|
||||
Enable: true
|
||||
# Here you can set the FillItem
|
||||
Item: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
# Here you set the settings for the alias
|
||||
Command:
|
||||
# Here you can enable or disable the alias of the GUI. The alias is the file name without .yml
|
||||
Alias: true
|
||||
Permission:
|
||||
# Set here if a permission is needed for the alias or not. | Permission: commandgui.command.<alias>
|
||||
Required: true
|
||||
|
||||
# Here you set the functions and slots
|
||||
Slots:
|
||||
# Here is an example of a slot
|
||||
# To add another slot just copy the block. IMPORTANT: The slot name must not be duplicated (Slots.<name>).
|
||||
function1:
|
||||
# Here you set which slot the item / function should be in
|
||||
Slot: 4
|
||||
# Here you can activate and deactivate the slot
|
||||
Enable: true
|
||||
# Here you specify which function this slot should perform
|
||||
Function: function1
|
||||
Permission:
|
||||
# Here you can set if a permission is needed to use this function.
|
||||
Required: false
|
||||
# Placeholder: [function] which function is used | [slot] is the slot number | [slotname] is the name of the key (Slots.KEY)
|
||||
See: commandgui.gui.[function].slot.[slot].see
|
||||
Use: commandgui.gui.[function].slot.[slot].use
|
||||
function2:
|
||||
Slot: 6
|
||||
Enable: true
|
||||
Function: function2
|
||||
Permission:
|
||||
Required: false
|
||||
See: commandgui.gui.[function].slot.[slot].see
|
||||
Use: commandgui.gui.[function].slot.[slot].use
|
|
@ -0,0 +1,9 @@
|
|||
Manifest-Version: 1.0
|
||||
Class-Path: PlugmanGUI-3.0.jar spigot-1.8r3.jar spigot-1.9r1.jar spigot-
|
||||
1.15r1.jar T2CodeLib-10.3.jar spigot-1.18r1.jar bungee-1615.jar spigot-
|
||||
1.9r2.jar spigot-1.16r3.jar spigot-1.14r1.jar slf4j-api-1.7.25.jar Luck
|
||||
yBox-API-4.2.2.jar spigot-1.10r1.jar spigot-1.16r1.jar spigot-1.13r2.ja
|
||||
r HikariCP-3.4.5.jar spigot-1.11r1.jar spigot-1.13r1.jar spigot-1.8r2.j
|
||||
ar spigot-1.17r1.jar spigot-1.12r1.jar spigot-1.16r2.jar spigot-1.8r1.j
|
||||
ar
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
name: CommandGUI
|
||||
version: ${project.version}
|
||||
main: de.jatitv.commandguiv2.Bungee.BMain
|
||||
author: JaTiTV
|
|
@ -1,8 +0,0 @@
|
|||
MySQL:
|
||||
Enable: false
|
||||
IP: localhost
|
||||
Port: 3306
|
||||
Database: database
|
||||
User: user
|
||||
Password: ''
|
||||
SSL: false
|
|
@ -0,0 +1,313 @@
|
|||
|
||||
#########################################
|
||||
## Please do not change ConfigVersion! ##
|
||||
#########################################
|
||||
ConfigVersion: 7
|
||||
|
||||
Plugin:
|
||||
# Here you can set the debug mode of the plugin.
|
||||
# It is recommended not to activate this on productive systems. Only if it is really needed!
|
||||
Debug: false
|
||||
updateCheck:
|
||||
# In this option you can set if players with the permission 'commandgui.updatemsg' will get an update message on join when an update for the plugin is available.
|
||||
onJoin: true
|
||||
# In this option you can set whether you want to receive and display beta and snapshot versions in the update check.
|
||||
seePreReleaseUpdates: true
|
||||
# In this option you can set the time interval in minutes in which updates should be checked.
|
||||
timeInterval: 60
|
||||
# Here you can set whether the Helpalias command (/commandguihelp) should be activated.
|
||||
# If this is changed the server MUST be restarted to change this!
|
||||
HelpAlias: true
|
||||
# Here you set which subcommand should be for the admin functions.
|
||||
# (/commandgui 'admin' reload)
|
||||
AdminSubCommand: admin
|
||||
# here you set the language to be used
|
||||
language: english
|
||||
# Here you set the character or word that will be used as currency
|
||||
Currency: $
|
||||
# Here you set which GUI should be opened at '/commandgui' / '/gui'.
|
||||
DefaultGUI: default
|
||||
|
||||
Storage:
|
||||
# Set here if MySQL, SQLITE or YML should be used as storage.
|
||||
Type: SQLITE
|
||||
# Enter here the access data to the database you want to use, if you use MySQL
|
||||
MySQL:
|
||||
IP: localhost
|
||||
Port: 3306
|
||||
Database: database
|
||||
User: root
|
||||
Password: password
|
||||
SSL: false
|
||||
|
||||
UseItem:
|
||||
# Set here if the UseItem is to be used in use
|
||||
Enable: true
|
||||
# Set here if players are allowed to enable or disable the UseItem with '/gui-item <on/off>'.
|
||||
# Permission 'commandgui.useitem.toggle' is additionally required
|
||||
AllowToggle: true
|
||||
# Set here if players are allowed to change the slot in the inventory where the UseItem is located with '/gui-item <slot>'.
|
||||
# Permission 'commandgui.useitem.toggle' is additionally required
|
||||
AllowSetSlot: true
|
||||
# Set here if the dropping of the UseItem should be blocked
|
||||
BlockMoveAndDrop: true
|
||||
# Set here which GUI should open the UseItem
|
||||
OpenGUI: default
|
||||
Permission:
|
||||
# Set here if the permission 'commandgui.useitem' is required to use the UseItem
|
||||
NeededToUse: true
|
||||
# Set here if the UseItem should stay in the inventory with the '/clear' command
|
||||
KeepAtCommandClear: true
|
||||
InventorySlot:
|
||||
# Set here on which slot the UseItem should be located by default
|
||||
Slot: 1
|
||||
# Set here if the slot should be forced even if another item is on this slot (also the set slot of the player).
|
||||
# NOTE: The item that was on this slot before will be deleted.
|
||||
SlotEnforce: false
|
||||
# Set here if the UseItem should be placed on another free slot, if the selected slot (also the set slot of the player) is occupied.
|
||||
FreeSlot: false
|
||||
# Set here the item that should be used as UseItem
|
||||
Item:
|
||||
# Set here which material should be used as UseItem
|
||||
Material: paper
|
||||
PlayerHead:
|
||||
# Set here if a PlayerHead should be used as UseItem
|
||||
Enable: false
|
||||
Base64:
|
||||
# Set here if a Base64 PlayerHead should be used as UseItem
|
||||
Enable: false
|
||||
# Here you can set the Base64 Value.
|
||||
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
||||
Base64Value: ''
|
||||
# Here you can set whether the player head should be used as a UseItem by the player
|
||||
PlayerWhoHasOpenedTheGUI: false
|
||||
# Here you can set a player name whose head should be used as UseItem
|
||||
Playername: ''
|
||||
# Set the DisplayName of the UseItem here
|
||||
Name: '&6GUI UseItem'
|
||||
# Set the lore of the UseItem here
|
||||
Lore:
|
||||
- 'Lore line 1'
|
||||
- 'Lore line 2'
|
||||
Join:
|
||||
# Set here if the UseItem should be given at every server join
|
||||
GiveOnEveryJoin: true
|
||||
# Set here if the UseItem should only be given to the server at the first join of the player.
|
||||
GiveOnlyOnFirstJoin: false
|
||||
Cursor:
|
||||
ToGUIItem:
|
||||
OnLogin:
|
||||
# Here you define whether the UseItem should be selected when joining the server.
|
||||
Enable: true
|
||||
Spigot:
|
||||
# Set here if the UseItem should only be selected at the first join
|
||||
OnOnlyFirstLogin: true
|
||||
Bungee:
|
||||
# Set here if the UseItem should be selected even if you change the server of the bungee network.
|
||||
# The option BungeeCord must be activated for this!
|
||||
OnServerChange: false
|
||||
|
||||
Toggle:
|
||||
# Set the items to be used with the Toggle function here
|
||||
Items:
|
||||
# Set here the item that should be used if you have the permission or the UseItem is active.
|
||||
OnOrYes:
|
||||
Item:
|
||||
Base64:
|
||||
# Set here if a Base64 head should be used
|
||||
Enable: false
|
||||
# Here you can set the Base64 Value.
|
||||
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
||||
Base64Value: ''
|
||||
# Set the material to be used here
|
||||
Material: GREEN_WOOL
|
||||
# Set here the item to be used if you have the permission or the UseItem is disabled
|
||||
OffOrNo:
|
||||
Item:
|
||||
Base64:
|
||||
# Set here if a Base64 head should be used
|
||||
Enable: false
|
||||
# Here you can set the Base64 Value.
|
||||
# You can find the Base64 Value for example on https://minecraft-heads.com.
|
||||
Base64Value: ''
|
||||
# Set the material to be used here
|
||||
Material: RED_WOOL
|
||||
Permission:
|
||||
# Set here the commands to be used for Toggle.Permission
|
||||
Commands:
|
||||
'True': luckperms user [player] permission set [perm] true
|
||||
'False': luckperms user [player] permission set [perm] false
|
||||
|
||||
# Set the design of the placeholders here
|
||||
Placeholder:
|
||||
# Placeholder for true / enabled
|
||||
'True': '&2true'
|
||||
# Placeholder for false / disabled
|
||||
'False': '&4false'
|
||||
|
||||
Sound:
|
||||
# Here you can disable all sounds
|
||||
Enable: true
|
||||
# Set here At which action which sound should be played or none at all
|
||||
OpenInventory:
|
||||
Enable: true
|
||||
Sound: BLOCK_CHEST_OPEN
|
||||
Click:
|
||||
Enable: true
|
||||
Sound: BLOCK_NOTE_BLOCK_HAT
|
||||
NoMoney:
|
||||
Enable: true
|
||||
Sound: BLOCK_NOTE_BLOCK_HARP
|
||||
NoInventorySpace:
|
||||
Enable: true
|
||||
Sound: BLOCK_NOTE_BLOCK_HARP
|
||||
Give:
|
||||
Enable: true
|
||||
Sound: ENTITY_PLAYER_LEVELUP
|
||||
PlayerNotFound:
|
||||
Enable: true
|
||||
Sound: BLOCK_NOTE_BLOCK_HARP
|
||||
|
||||
Advanced:
|
||||
UseItem:
|
||||
GameMode:
|
||||
Change:
|
||||
# Set here if the UseItem should be reset when the GameMode is changed.
|
||||
Enable: true
|
||||
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
|
||||
DelayInTicks: 1
|
||||
Protection:
|
||||
# Set here in which gamemode the UseItem may be used
|
||||
Enable: false
|
||||
# Set here if the UseItem should be removed if you are in a not allowed Gamemode
|
||||
RemoveItemWhenItIsDisabled: false
|
||||
# Set here if a 'blacklist' or 'whitelist' should be used
|
||||
Mode: blacklist
|
||||
# Set the GameMode list here
|
||||
List:
|
||||
- CREATIVE
|
||||
- Spectator
|
||||
World:
|
||||
Change:
|
||||
# This specifies whether the UseItem should be reset when the world is changed.
|
||||
Enable: true
|
||||
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
|
||||
DelayInTicks: 1
|
||||
Protection:
|
||||
# Set here in which world the UseItem may be used
|
||||
Enable: false
|
||||
# Here you specify whether the UseItem should be removed if you are in a world that is not permitted
|
||||
RemoveItemWhenItIsDisabled: false
|
||||
# Set here if a 'blacklist' or 'whitelist' should be used
|
||||
Mode: blacklist
|
||||
# Set the worlds here
|
||||
List:
|
||||
- World1
|
||||
- World2
|
||||
# Set here for which blocks the UseItem is blocked and the function of the block you are looking at should be used.
|
||||
ItemBlockBlacklist:
|
||||
- CHEST
|
||||
- CRAFTING_TABLE
|
||||
- FURNACE
|
||||
- OAK_FENCE
|
||||
- SPRUCE_FENCE
|
||||
- BIRCH_FENCE
|
||||
- JUNGLE_FENCE
|
||||
- ACACIA_FENCE
|
||||
- DARK_OAK_FENCE
|
||||
- MANGROVE_FENCE
|
||||
- CRIMSON_FENCE
|
||||
- WARPED_FENCE
|
||||
- NETHER_BRICK_FENCE
|
||||
- ENDER_CHEST
|
||||
- BEACON
|
||||
- ANVIL
|
||||
- CHIPPED_ANVIL
|
||||
- DAMAGED_ANVIL
|
||||
- REPEATER
|
||||
- COMPARATOR
|
||||
- HOPPER
|
||||
- DISPENSER
|
||||
- DROPPER
|
||||
- LEVER
|
||||
- DAYLIGHT_DETECTOR
|
||||
- TRAPPED_CHEST
|
||||
- NOTE_BLOCK
|
||||
- STONE_BUTTON
|
||||
- POLISHED_BLACKSTONE_BUTTON
|
||||
- OAK_BUTTON
|
||||
- SPRUCE_BUTTON
|
||||
- BIRCH_BUTTON
|
||||
- JUNGLE_BUTTON
|
||||
- ACACIA_BUTTON
|
||||
- DARK_OAK_BUTTON
|
||||
- MANGROVE_BUTTON
|
||||
- CRIMSON_BUTTON
|
||||
- WARPED_BUTTON
|
||||
- IRON_DOOR
|
||||
- OAK_DOOR
|
||||
- SPRUCE_DOOR
|
||||
- BIRCH_DOOR
|
||||
- JUNGLE_DOOR
|
||||
- ACACIA_DOOR
|
||||
- DARK_OAK_DOOR
|
||||
- MANGROVE_DOOR
|
||||
- CRIMSON_DOOR
|
||||
- WARPED_DOOR
|
||||
- IRON_TRAPDOOR
|
||||
- IRON_TRAPDOOR
|
||||
- OAK_TRAPDOOR
|
||||
- OAK_TRAPDOOR
|
||||
- SPRUCE_TRAPDOOR
|
||||
- SPRUCE_TRAPDOOR
|
||||
- BIRCH_TRAPDOOR
|
||||
- BIRCH_TRAPDOOR
|
||||
- JUNGLE_TRAPDOOR
|
||||
- JUNGLE_TRAPDOOR
|
||||
- ACACIA_TRAPDOOR
|
||||
- ACACIA_TRAPDOOR
|
||||
- DARK_OAK_TRAPDOOR
|
||||
- DARK_OAK_TRAPDOOR
|
||||
- MANGROVE_TRAPDOOR
|
||||
- MANGROVE_TRAPDOOR
|
||||
- CRIMSON_TRAPDOOR
|
||||
- CRIMSON_TRAPDOOR
|
||||
- WARPED_TRAPDOOR
|
||||
- WARPED_TRAPDOOR
|
||||
- OAK_FENCE_GATE
|
||||
- SPRUCE_FENCE_GATE
|
||||
- BIRCH_FENCE_GATE
|
||||
- JUNGLE_FENCE_GATE
|
||||
- ACACIA_FENCE_GATE
|
||||
- DARK_OAK_FENCE_GATE
|
||||
- MANGROVE_FENCE_GATE
|
||||
- CRIMSON_FENCE_GATE
|
||||
- WARPED_FENCE_GATE
|
||||
- CHEST_MINECART
|
||||
- FURNACE_MINECART
|
||||
- HOPPER_MINECART
|
||||
- OAK_CHEST_BOAT
|
||||
- SPRUCE_CHEST_BOAT
|
||||
- BIRCH_CHEST_BOAT
|
||||
- JUNGLE_CHEST_BOAT
|
||||
- ACACIA_CHEST_BOAT
|
||||
- DARK_OAK_CHEST_BOAT
|
||||
- MANGROVE_CHEST_BOAT
|
||||
- LEATHER_CHESTPLATE
|
||||
- CHAINMAIL_CHESTPLATE
|
||||
- IRON_CHESTPLATE
|
||||
- DIAMOND_CHESTPLATE
|
||||
- GOLDEN_CHESTPLATE
|
||||
- NETHERITE_CHESTPLATE
|
||||
- BREWING_STAND
|
||||
- LOOM
|
||||
- COMPOSTER
|
||||
- BARREL
|
||||
- SMOKER
|
||||
- BLAST_FURNACE
|
||||
- BLAST_FURNACE
|
||||
- CARTOGRAPHY_TABLE
|
||||
- FLETCHING_TABLE
|
||||
- GRINDSTONE
|
||||
- SMITHING_TABLE
|
||||
- STONECUTTER
|
|
@ -1,16 +1,11 @@
|
|||
name: CommandGUI
|
||||
name: T2C-CommandGUI
|
||||
version: ${project.version}
|
||||
main: de.jatitv.commandguiv2.Spigot.Main
|
||||
main: net.t2code.commandguiv2.Spigot.Main
|
||||
api-version: 1.13
|
||||
prefix: CommandGUI
|
||||
prefix: T2C-CommandGUI
|
||||
authors: [ JaTiTV ]
|
||||
|
||||
softdepend:
|
||||
- T2CodeLib
|
||||
- Vault
|
||||
- PlaceholderAPI
|
||||
- PlotSquaredGUI
|
||||
- PlugManGUI
|
||||
|
||||
commands:
|
||||
commandgui:
|
||||
|
@ -19,56 +14,5 @@ commands:
|
|||
commandguihelp:
|
||||
description: CommandGUI Help
|
||||
aliases: [cguihelp, guihelp]
|
||||
# commandguiadmin:
|
||||
# aliases: [cguiadmin, cguia]
|
||||
commandgui-item:
|
||||
aliases: [gui-item]
|
||||
|
||||
|
||||
permissions:
|
||||
commandgui.admin:
|
||||
description: All permissions from CommandGUI
|
||||
default: op
|
||||
children:
|
||||
commandgui.updatemsg: true
|
||||
commandgui.command: true
|
||||
commandgui.get.guiitem.at.login: true
|
||||
commandgui.useitem: true
|
||||
commandgui.useitem.toggle: true
|
||||
commandgui.bypass: true
|
||||
commandgui.command.info: true
|
||||
commandgui.command.give: true
|
||||
|
||||
commandgui.player:
|
||||
description: All permissions from CommandGUI
|
||||
default: op
|
||||
children:
|
||||
commandgui.command: true
|
||||
commandgui.get.guiitem.at.login: true
|
||||
commandgui.useitem: true
|
||||
commandgui.useitem.toggle: true
|
||||
|
||||
commandgui.updatemsg:
|
||||
description: Players with this permission get the update message when joining if an update is available
|
||||
default: op
|
||||
commandgui.command:
|
||||
description: Required permission to open GUIs via command
|
||||
default: op
|
||||
commandgui.get.guiitem.at.login:
|
||||
description: Only players with this permission will receive the GUI item
|
||||
default: op
|
||||
commandgui.useitem:
|
||||
description: Required permission to use the GUI Item
|
||||
default: op
|
||||
commandgui.useitem.toggle:
|
||||
description: Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)
|
||||
default: op
|
||||
commandgui.bypass:
|
||||
description: Bypass to open disabled GUIs
|
||||
default: op
|
||||
commandgui.command.info:
|
||||
description: Permission to view CommandGUI info
|
||||
default: not op
|
||||
commandgui.command.give:
|
||||
description: Kommend in V2.1.0
|
||||
default: op
|
||||
aliases: [gui-item, useitem]
|
|
@ -1,19 +1,8 @@
|
|||
GUI:
|
||||
Enable: true
|
||||
Lines: 1
|
||||
Name: '&5default &9GUI'
|
||||
FillItem:
|
||||
Enable: true
|
||||
Item: BLACK_STAINED_GLASS_PANE
|
||||
Command:
|
||||
Alias: true
|
||||
Permission:
|
||||
Required: true
|
||||
Slots:
|
||||
Example:
|
||||
Slot: 5
|
||||
Enable: true
|
||||
Slot:
|
||||
Function:
|
||||
Item:
|
||||
Empty: false
|
||||
Amount: 1
|
||||
PlayerHead:
|
||||
Enable: true
|
||||
Base64:
|
||||
|
@ -31,9 +20,10 @@ Slots:
|
|||
- '&eIf you find any errors or bugs,'
|
||||
- '&eplease contact me so I can fix them.'
|
||||
- '&8-----------------'
|
||||
- '&5Discord: §7https://discord.gg/vRyXFFterJ'
|
||||
- '&5Discord: §7http://dc.t2code.net'
|
||||
CustomSound:
|
||||
Enable: false
|
||||
NoSound: false
|
||||
Sound: ''
|
||||
Cost:
|
||||
Enable: false
|
||||
|
@ -42,17 +32,43 @@ Slots:
|
|||
Enable: false
|
||||
BungeeCommand: false
|
||||
CommandAsConsole: false
|
||||
Command:
|
||||
- ''
|
||||
Command: []
|
||||
ServerChange:
|
||||
Enable: false
|
||||
Server: ''
|
||||
OpenGUI:
|
||||
Enable: false
|
||||
GUI: ''
|
||||
Toggle:
|
||||
Permission:
|
||||
Enable: false
|
||||
Permission: ''
|
||||
UseItem:
|
||||
Enable: false
|
||||
Message:
|
||||
Enable: true
|
||||
Message:
|
||||
- '&6You can find more information on Discord: &ehttps://discord.gg/vRyXFFterJ'
|
||||
Permission:
|
||||
Required: false
|
||||
- '&6You can find more information on Discord: &ehttp://dc.t2code.net'
|
||||
SetConfig:
|
||||
Enable: false
|
||||
File:
|
||||
Path: ''
|
||||
Option:
|
||||
Path: ''
|
||||
Premat: String
|
||||
Value:
|
||||
LeftClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
RightClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
PluginReload:
|
||||
Enable: false
|
||||
Command: ''
|
|
@ -0,0 +1,69 @@
|
|||
Slot:
|
||||
Functions:
|
||||
Item:
|
||||
Empty: false
|
||||
Amount: 1
|
||||
PlayerHead:
|
||||
Enable: false
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
PlayerWhoHasOpenedTheGUI: false
|
||||
PlayerName: ''
|
||||
Material: ''
|
||||
Name: '&6Toggle UseItem'
|
||||
Lore:
|
||||
- '&bYou currently have the UseItem set to: %commandgui_useitem%'
|
||||
CustomSound:
|
||||
Enable: false
|
||||
NoSound: false
|
||||
Sound: ''
|
||||
Cost:
|
||||
Enable: false
|
||||
Price: 0.0
|
||||
Command:
|
||||
Enable: false
|
||||
BungeeCommand: false
|
||||
CommandAsConsole: false
|
||||
Command: []
|
||||
ServerChange:
|
||||
Enable: false
|
||||
Server: ''
|
||||
OpenGUI:
|
||||
Enable: false
|
||||
GUI: ''
|
||||
Toggle:
|
||||
Permission:
|
||||
Enable: false
|
||||
Permission: ''
|
||||
UseItem:
|
||||
Enable: true
|
||||
Message:
|
||||
Enable: true
|
||||
Message:
|
||||
- '&bYour UseItem was set to: %commandgui_useitem%&b.'
|
||||
Permission:
|
||||
Required: false
|
||||
SetConfig:
|
||||
Enable: false
|
||||
File:
|
||||
Path: ''
|
||||
Option:
|
||||
Path: ''
|
||||
Premat: String
|
||||
Value:
|
||||
LeftClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
RightClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
PluginReload:
|
||||
Enable: false
|
||||
Command: ''
|
|
@ -0,0 +1,28 @@
|
|||
GUI:
|
||||
Enable: true
|
||||
Lines: 1
|
||||
Name: '&5default &9GUI'
|
||||
FillItem:
|
||||
Enable: true
|
||||
Item: BLACK_STAINED_GLASS_PANE
|
||||
Command:
|
||||
Alias: true
|
||||
Permission:
|
||||
Required: true
|
||||
Slots:
|
||||
SupportDiscord:
|
||||
Slot: 4
|
||||
Enable: true
|
||||
Function: SupportDiscord
|
||||
Permission:
|
||||
Required: false
|
||||
See: ''
|
||||
Use: ''
|
||||
UseItem:
|
||||
Slot: 6
|
||||
Enable: true
|
||||
Function: UseItem
|
||||
Permission:
|
||||
Required: false
|
||||
See: ''
|
||||
Use: ''
|
|
@ -1,3 +1,4 @@
|
|||
ConfigVersion: 4
|
||||
Plugin:
|
||||
UpdateCheckOnJoin: true
|
||||
Debug: false
|
||||
|
@ -25,6 +26,7 @@ UseItem:
|
|||
OpenGUI: default
|
||||
Permission:
|
||||
NeededToUse: true
|
||||
KeepAtCommandClear: true
|
||||
InventorySlot:
|
||||
Slot: 1
|
||||
SlotEnforce: false
|
||||
|
@ -46,9 +48,57 @@ UseItem:
|
|||
GiveOnlyOnFirstJoin: false
|
||||
Cursor:
|
||||
ToGUIItem:
|
||||
OnEveryLogin: true
|
||||
OnLogin:
|
||||
Enable: true
|
||||
Spigot:
|
||||
OnOnlyFirstLogin: true
|
||||
EXPERIMENTELL_ServerChhange: false
|
||||
Bungee:
|
||||
OnServerChange: false
|
||||
Advanced:
|
||||
UseItem:
|
||||
GameMode:
|
||||
Change:
|
||||
Enable: true
|
||||
DelayInTicks: 1
|
||||
Protection:
|
||||
Enable: false
|
||||
RemoveItemWhenItIsDisabled: false
|
||||
Mode: blacklist
|
||||
List:
|
||||
- CREATIVE
|
||||
- Spectator
|
||||
World:
|
||||
Change:
|
||||
Enable: true
|
||||
DelayInTicks: 1
|
||||
Protection:
|
||||
Enable: false
|
||||
RemoveItemWhenItIsDisabled: false
|
||||
Mode: blacklist
|
||||
List:
|
||||
- World1
|
||||
- World2
|
||||
Toggle:
|
||||
Items:
|
||||
OnOrYes:
|
||||
Item:
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
Material: GREEN_WOOL
|
||||
OffOrNo:
|
||||
Item:
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
Material: RED_WOOL
|
||||
Permission:
|
||||
Commands:
|
||||
'True': luckperms user [player] permission set [perm] true
|
||||
'False': luckperms user [player] permission set [perm] false
|
||||
Placeholder:
|
||||
'True': '&2true'
|
||||
'False': '&4false'
|
||||
Sound:
|
||||
Enable: true
|
||||
OpenInventory:
|
|
@ -4,13 +4,11 @@ Plugin:
|
|||
settings.'
|
||||
OnlyForPlayer: '[prefix] &cThis command is for players only!'
|
||||
DefaultGUI:
|
||||
create: '[prefix] &2DefaultGUI was created. You can find it in the directory::
|
||||
create: '[prefix] &2DefaultGUI was created. You can find it in the directory:
|
||||
&e[directory]&2!'
|
||||
Reload:
|
||||
Start: '[prefix] &6Plugin is reloaded...'
|
||||
End: '[prefix] &2Plugin was successfully reloaded.'
|
||||
Warning: '[prefix] &6To enable / disable alias commands, reload / restart the
|
||||
server!'
|
||||
NoPermission:
|
||||
ForCommandGUI: '[prefix] &cYou do not have permission for &4Command&9GUI&c!'
|
||||
ForCommand: '[prefix] &cFor &b[cmd] &cyou lack the permission &6[perm]&c!'
|
||||
|
@ -24,6 +22,8 @@ UseItem:
|
|||
SlotNotEmpty: '[prefix] &6The slot &e[slot] &6is currently occupied!'
|
||||
SlotAlreadySet: '[prefix] &6The slot §e[slot] §6is already set!'
|
||||
ItemSlot_wrongValue: '[prefix] &cThe specified slot must be between 1 and 9!'
|
||||
DisabledInGameMode: '[prefix] &cThe UseItem is disabled in this GameMode!'
|
||||
DisabledInWorld: '[prefix] &cThe UseItem is disabled in this World!'
|
||||
Cost:
|
||||
Buy_msg: '[prefix] &2You bought [itemname] &2for &6[price]&2.'
|
||||
No_money: '[prefix] &cYou don''t have enough money!'
|
||||
|
@ -42,7 +42,8 @@ Player:
|
|||
Help:
|
||||
CGUI: '&8''''&b/commandgui &8| &b/cgui&8'''' &eOpen the default GUI &7(&r[gui]&7)&e.'
|
||||
Help: '&8''''&b/commandguihelp&8'''' &eOpen this help.'
|
||||
Info: '&8''''&b/commandguiadmin info&8'''' &eCall the info from &4Command&9GUI &e.'
|
||||
Info: '&8''''&b/commandgui admin info&8'''' &eCall the info from &4Command&9GUI
|
||||
&e.'
|
||||
Open: '&8''''&b/commandgui [gui]&8'''' &eOpen the GUI: &6[guiname]&e.'
|
||||
Give: '&8''''&b/commandgui admin give &7<player>&8'''' &eGive a player the GUI item.'
|
||||
CreateDefaultGUI: '&8''''&b/commandgui admin createdefaultgui&8'''' &eCreate a default
|
|
@ -8,8 +8,6 @@ Plugin:
|
|||
Reload:
|
||||
Start: '[prefix] &6Plugin wird neu geladen...'
|
||||
End: '[prefix] &2Plugin wurde erfolgreich neu geladen.'
|
||||
Warning: '[prefix] &6Um Alias-Befehle zu aktivieren / deaktivieren, lade / starte
|
||||
den Server neu!!'
|
||||
NoPermission:
|
||||
ForCommandGUI: '[prefix] &cDu hast keine Permission f[ue]r &4Command&9GUI&c!'
|
||||
ForCommand: '[prefix] &cF[ue]r &b[cmd] &cfehlt dir die Permission &6[perm]&c!'
|
||||
|
@ -24,6 +22,8 @@ UseItem:
|
|||
SlotAlreadySet: '[prefix] &6Der Slot §e[slot] §6ist bereits eingestellt!'
|
||||
ItemSlot_wrongValue: '[prefix] &cDer angegebene Slot muss sich zwischen 1 und 9
|
||||
befinden!'
|
||||
DisabledInGameMode: '[prefix] &cDas UseItem ist in diesem GameMode deaktiviert!'
|
||||
DisabledInWorld: '[prefix] &cDas UseItem ist in dieser Welt deaktiviert!'
|
||||
Cost:
|
||||
Buy_msg: '[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft.'
|
||||
No_money: '[prefix] &cDu hast nicht gen[ue]gend Geld!'
|
||||
|
@ -44,9 +44,11 @@ Player:
|
|||
Help:
|
||||
CGUI: '&8''''&b/commandgui &8| &b/cgui&8'''' &e[OE]ffne die default GUI &7(&r[gui]&7)&e.'
|
||||
Help: '&8''''&b/commandguihelp&8'''' &e[OE]ffne diese help.'
|
||||
Info: '&8''''&b/commandguiadmin info&8'''' &eRufe die Infos von &4Command&9GUI &eauf.'
|
||||
Info: '&8''''&b/commandgui admin info&8'''' &eRufe die Infos von &4Command&9GUI
|
||||
&eauf.'
|
||||
Open: '&8''''&b/commandgui [gui]&8'''' &e[OE]ffne die GUI: &6[guiname]&e.'
|
||||
Give: '&8''''&b/commandguiadmin give &7<player>&8'''' &eGebe einem Spieler das GUI-Item.'
|
||||
Give: '&8''''&b/commandgui admin give &7<player>&8'''' &eGebe einem Spieler das
|
||||
GUI-Item.'
|
||||
CreateDefaultGUI: '&8''''&b/commandgui admin createdefaultgui&8'''' &eLasse eine
|
||||
default GUI erstellen &7([directory])&e.'
|
||||
Reload: '&8''''&b/commandgui admin reload&8'''' &eLade das Plugin neu.'
|
|
@ -8,8 +8,6 @@ Plugin:
|
|||
Reload:
|
||||
Start: '[prefix] &6Pluginet blir relastet...'
|
||||
End: '[prefix] &2Pluginet har blitt lastet inn på nytt.'
|
||||
Warning: '[prefix] &6For å skru på / skru av alias kommandoer, relast / restart
|
||||
serveren!'
|
||||
NoPermission:
|
||||
ForCommandGUI: '[prefix] &cDu har ikke tilgang til &4Command&9GUI&c!'
|
||||
ForCommand: '[prefix] &cFor &b[cmd] &cmangler du tillatelsen &6[perm]&c!'
|
||||
|
@ -23,6 +21,8 @@ UseItem:
|
|||
SlotNotEmpty: '[prefix] &6Plassen &e[slot] &6er opptatt for øyeblikket!'
|
||||
SlotAlreadySet: '[prefix] &6Plassen §e[slot] §6er allerede satt!'
|
||||
ItemSlot_wrongValue: '[prefix] &cDen spesifiserte plassen må være mellom 1 og 9!'
|
||||
DisabledInGameMode: '[prefix] &cBrukselementet er deaktivert i denne spillmodusen!!'
|
||||
DisabledInWorld: '[prefix] &cUseItem er deaktivert i denne verden!'
|
||||
Cost:
|
||||
Buy_msg: '[prefix] &2Du kjøpte [itemname] &2for &6[price]&2.'
|
||||
No_money: '[prefix] &cDu har ikke nok penger!'
|
|
@ -0,0 +1,159 @@
|
|||
GUI:
|
||||
Enable: true
|
||||
Lines: 1
|
||||
Name: '&5default &9GUI'
|
||||
FillItem:
|
||||
Enable: true
|
||||
Item: BLACK_STAINED_GLASS_PANE
|
||||
Command:
|
||||
Alias: true
|
||||
Permission:
|
||||
Required: true
|
||||
Slots:
|
||||
SupportDiscord:
|
||||
Slot: 4
|
||||
Enable: true
|
||||
Item:
|
||||
Empty: false
|
||||
Amount: 1
|
||||
PlayerHead:
|
||||
Enable: true
|
||||
Base64:
|
||||
Enable: true
|
||||
Base64Value: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19
|
||||
PlayerWhoHasOpenedTheGUI: false
|
||||
PlayerName: ''
|
||||
Material: ''
|
||||
Name: '&3Support Discord'
|
||||
Lore:
|
||||
- '&8-----------------'
|
||||
- '&bIf you need help setting up the plugin,'
|
||||
- '&bfeel free to contact me on the Suport Discord.'
|
||||
- '&8-----------------'
|
||||
- '&eIf you find any errors or bugs,'
|
||||
- '&eplease contact me so I can fix them.'
|
||||
- '&8-----------------'
|
||||
- '&5Discord: §7http://dc.t2code.net'
|
||||
CustomSound:
|
||||
Enable: false
|
||||
NoSound: false
|
||||
Sound: ''
|
||||
Cost:
|
||||
Enable: false
|
||||
Price: 0.0
|
||||
Command:
|
||||
Enable: false
|
||||
BungeeCommand: false
|
||||
CommandAsConsole: false
|
||||
Command: []
|
||||
ServerChange:
|
||||
Enable: false
|
||||
Server: ''
|
||||
OpenGUI:
|
||||
Enable: false
|
||||
GUI: ''
|
||||
Toggle:
|
||||
Permission:
|
||||
Enable: false
|
||||
Permission: ''
|
||||
UseItem:
|
||||
Enable: false
|
||||
Message:
|
||||
Enable: true
|
||||
Message:
|
||||
- '&6You can find more information on Discord: &ehttp://dc.t2code.net'
|
||||
Permission:
|
||||
Required: false
|
||||
SetConfig:
|
||||
Enable: false
|
||||
File:
|
||||
Path: ''
|
||||
Option:
|
||||
Path: ''
|
||||
Premat: String
|
||||
Value:
|
||||
LeftClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
RightClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
PluginReload:
|
||||
Enable: false
|
||||
Command: ''
|
||||
UseItem:
|
||||
Slot: 6
|
||||
Enable: true
|
||||
Item:
|
||||
Empty: false
|
||||
Amount: 1
|
||||
PlayerHead:
|
||||
Enable: false
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
PlayerWhoHasOpenedTheGUI: false
|
||||
PlayerName: ''
|
||||
Material: ''
|
||||
Name: '&6Toggle UseItem'
|
||||
Lore:
|
||||
- '&bYou currently have the UseItem set to: %commandgui_useitem%'
|
||||
CustomSound:
|
||||
Enable: false
|
||||
NoSound: false
|
||||
Sound: ''
|
||||
Cost:
|
||||
Enable: false
|
||||
Price: 0.0
|
||||
Command:
|
||||
Enable: false
|
||||
BungeeCommand: false
|
||||
CommandAsConsole: false
|
||||
Command: []
|
||||
ServerChange:
|
||||
Enable: false
|
||||
Server: ''
|
||||
OpenGUI:
|
||||
Enable: false
|
||||
GUI: ''
|
||||
Toggle:
|
||||
Permission:
|
||||
Enable: false
|
||||
Permission: ''
|
||||
UseItem:
|
||||
Enable: true
|
||||
Message:
|
||||
Enable: true
|
||||
Message:
|
||||
- '&bYour UseItem was set to: %commandgui_useitem%&b.'
|
||||
Permission:
|
||||
Required: false
|
||||
SetConfig:
|
||||
Enable: false
|
||||
File:
|
||||
Path: ''
|
||||
Option:
|
||||
Path: ''
|
||||
Premat: String
|
||||
Value:
|
||||
LeftClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
RightClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
PluginReload:
|
||||
Enable: false
|
||||
Command: ''
|
|
@ -0,0 +1,121 @@
|
|||
ConfigVersion: 4
|
||||
Plugin:
|
||||
UpdateCheckOnJoin: true
|
||||
Debug: false
|
||||
HelpAlias: true
|
||||
language: english
|
||||
Currency: $
|
||||
DefaultGUI: default
|
||||
Storage:
|
||||
Type: YML
|
||||
MySQL:
|
||||
IP: localhost
|
||||
Port: 3306
|
||||
Database: database
|
||||
User: root
|
||||
Password: password
|
||||
SSL: false
|
||||
BungeeCord:
|
||||
Enable: false
|
||||
ThisServer: server
|
||||
UseItem:
|
||||
Enable: true
|
||||
AllowToggle: true
|
||||
AllowSetSlot: true
|
||||
BlockMoveAndDrop: true
|
||||
OpenGUI: default
|
||||
Permission:
|
||||
NeededToUse: true
|
||||
KeepAtCommandClear: true
|
||||
InventorySlot:
|
||||
Slot: 1
|
||||
SlotEnforce: false
|
||||
FreeSlot: false
|
||||
Item:
|
||||
Material: paper
|
||||
PlayerHead:
|
||||
Enable: false
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
PlayerWhoHasOpenedTheGUI: false
|
||||
Playername: ''
|
||||
Name: '&bDefault &6GUI'
|
||||
Lore:
|
||||
- '&eThis is an example GUI'
|
||||
Join:
|
||||
GiveOnEveryJoin: true
|
||||
GiveOnlyOnFirstJoin: false
|
||||
Cursor:
|
||||
ToGUIItem:
|
||||
OnLogin:
|
||||
Enable: true
|
||||
Spigot:
|
||||
OnOnlyFirstLogin: true
|
||||
Bungee:
|
||||
OnServerChange: false
|
||||
Advanced:
|
||||
UseItem:
|
||||
GameMode:
|
||||
Change:
|
||||
Enable: true
|
||||
DelayInTicks: 1
|
||||
Protection:
|
||||
Enable: false
|
||||
RemoveItemWhenItIsDisabled: false
|
||||
Mode: blacklist
|
||||
List:
|
||||
- CREATIVE
|
||||
- Spectator
|
||||
World:
|
||||
Change:
|
||||
Enable: true
|
||||
DelayInTicks: 1
|
||||
Protection:
|
||||
Enable: false
|
||||
RemoveItemWhenItIsDisabled: false
|
||||
Mode: blacklist
|
||||
List:
|
||||
- World1
|
||||
- World2
|
||||
Toggle:
|
||||
Items:
|
||||
OnOrYes:
|
||||
Item:
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
Material: GREEN_WOOL
|
||||
OffOrNo:
|
||||
Item:
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
Material: RED_WOOL
|
||||
Permission:
|
||||
Commands:
|
||||
'True': luckperms user [player] permission set [perm] true
|
||||
'False': luckperms user [player] permission set [perm] false
|
||||
Placeholder:
|
||||
'True': '&2true'
|
||||
'False': '&4false'
|
||||
Sound:
|
||||
Enable: true
|
||||
OpenInventory:
|
||||
Enable: true
|
||||
Sound: BLOCK_CHEST_OPEN
|
||||
Click:
|
||||
Enable: true
|
||||
Sound: BLOCK_NOTE_BLOCK_HAT
|
||||
NoMoney:
|
||||
Enable: true
|
||||
Sound: BLOCK_NOTE_BLOCK_HARP
|
||||
NoInventorySpace:
|
||||
Enable: true
|
||||
Sound: BLOCK_NOTE_BLOCK_HARP
|
||||
Give:
|
||||
Enable: true
|
||||
Sound: ENTITY_PLAYER_LEVELUP
|
||||
PlayerNotFound:
|
||||
Enable: true
|
||||
Sound: BLOCK_NOTE_BLOCK_HARP
|
|
@ -0,0 +1,55 @@
|
|||
Plugin:
|
||||
VaultNotSetUp: '[prefix] &4Vault / Economy not set up!'
|
||||
SoundNotFound: '[prefix] &4The sound &6[sound] &4was not found! Please check the
|
||||
settings.'
|
||||
OnlyForPlayer: '[prefix] &cThis command is for players only!'
|
||||
DefaultGUI:
|
||||
create: '[prefix] &2DefaultGUI was created. You can find it in the directory:
|
||||
&e[directory]&2!'
|
||||
Reload:
|
||||
Start: '[prefix] &6Plugin is reloaded...'
|
||||
End: '[prefix] &2Plugin was successfully reloaded.'
|
||||
NoPermission:
|
||||
ForCommandGUI: '[prefix] &cYou do not have permission for &4Command&9GUI&c!'
|
||||
ForCommand: '[prefix] &cFor &b[cmd] &cyou lack the permission &6[perm]&c!'
|
||||
ForUseItem: '[prefix] &cYou lack the permission &6[perm] &cto use the item for the
|
||||
GUI: &6[gui].'
|
||||
ForItem: '[prefix] &cFor &b[item] &cyou lack the permission &6[perm]&c!'
|
||||
UseItem:
|
||||
UseItem_ON: '[prefix] &2You have activated the GUI item.'
|
||||
UseItem_OFF: '[prefix] &2You have disabled the GUI item.'
|
||||
Change_Slot: '[prefix] &2You have changed the GUI item to slot: &6[slot]&2.'
|
||||
SlotNotEmpty: '[prefix] &6The slot &e[slot] &6is currently occupied!'
|
||||
SlotAlreadySet: '[prefix] &6The slot §e[slot] §6is already set!'
|
||||
ItemSlot_wrongValue: '[prefix] &cThe specified slot must be between 1 and 9!'
|
||||
DisabledInGameMode: '[prefix] &cThe UseItem is disabled in this GameMode!'
|
||||
DisabledInWorld: '[prefix] &cThe UseItem is disabled in this World!'
|
||||
Cost:
|
||||
Buy_msg: '[prefix] &2You bought [itemname] &2for &6[price]&2.'
|
||||
No_money: '[prefix] &cYou don''t have enough money!'
|
||||
NoInventorySpace: '[prefix] &cYou have no room in your inventory!'
|
||||
ServerChange:
|
||||
onServerChange: '[prefix] &2You will be connected to the server &e[server]§2.'
|
||||
GUI:
|
||||
GUInotFound: '[prefix] &cThe GUI chosen by the does not exist.'
|
||||
GUIisDisabled: '[prefix] &cThe GUI [gui] &cis currently Disabled!'
|
||||
Give:
|
||||
Sender: '[prefix] &2You have given &6[player] &2an [item] &2!'
|
||||
Receiver: '[prefix] &2You got &2, [item] &2from &6[sender]!'
|
||||
Player:
|
||||
PlayerNotFond: '[prefix] &cThe player &6[player] &cwas not found or is not online!'
|
||||
PlayerNoInventorySpace: '[prefix] &6[player] &chas no free space in his inventory!'
|
||||
Help:
|
||||
CGUI: '&8''''&b/commandgui &8| &b/cgui&8'''' &eOpen the default GUI &7(&r[gui]&7)&e.'
|
||||
Help: '&8''''&b/commandguihelp&8'''' &eOpen this help.'
|
||||
Info: '&8''''&b/commandgui admin info&8'''' &eCall the info from &4Command&9GUI
|
||||
&e.'
|
||||
Open: '&8''''&b/commandgui [gui]&8'''' &eOpen the GUI: &6[guiname]&e.'
|
||||
Give: '&8''''&b/commandgui admin give &7<player>&8'''' &eGive a player the GUI item.'
|
||||
CreateDefaultGUI: '&8''''&b/commandgui admin createdefaultgui&8'''' &eCreate a default
|
||||
GUI &7([directory])&e.'
|
||||
Reload: '&8''''&b/commandgui admin reload&8'''' &eReload the plugin.'
|
||||
UseItem_On: '&8''''&b/gui-item on&8'''' &eActivate the GUIItem for you.'
|
||||
UseItem_Off: '&8''''&b/gui-item off&8'''' &eDisable the GUIItem for yourself.'
|
||||
UseItem_Slot: '&8''''&b/gui-item slot [slot]&8'''' &eSet the slot for GUIItem for
|
||||
you.'
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue