T2CodeLib -> 13.0

This commit is contained in:
JaTiTV 2022-11-01 13:20:53 +01:00
parent 8826ca9b6e
commit 38b644bb27
55 changed files with 300 additions and 1511 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId>
<version>2.8.10</version>
<version>2.8.11</version>
<packaging>jar</packaging>
<name>CommandGUI</name>
@ -76,7 +76,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>DEV-13.0</version>
<classifier>dev-3</classifier>
<classifier>dev-5</classifier>
</dependency>
<dependency>
<groupId>net.t2code</groupId>

View File

@ -1,84 +0,0 @@
package de.jatitv.commandguiv2.Bungee;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ProxyServer;
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 java.io.*;
import java.util.logging.Logger;
public class BListener implements Listener {
@EventHandler
public void onPluginmessage(PluginMessageEvent event) {
if (event.getTag().equalsIgnoreCase("cgui:bungee")) {
event.setCancelled(true);
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
try {
String channel = stream.readUTF();
String input = stream.readUTF();
if (channel.equals("cgui-Console")) {
ProxyServer.getInstance().getConsole().sendMessage("Command Console: " + input);
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
} else {
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
if (player != null) {
ProxyServer.getInstance().getConsole().sendMessage("Command " + player + ": " + input);
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
@EventHandler
public void onJoin(PostLoginEvent e) {
ProxiedPlayer player = e.getPlayer();
sendToSpigotPlayer(player.getName(), true);
}
@EventHandler
public void onDisconnect(PlayerDisconnectEvent e) {
ProxiedPlayer player = e.getPlayer();
sendToSpigotPlayer(e.getPlayer().getName(), 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:onlinepl", 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:onlinepl", stream.toByteArray());
});
}
}

View File

@ -1,99 +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 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.getRequiredT2CodeLibVersion())) 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);
plugin.getProxy().registerChannel("cgui:bungee");
plugin.getProxy().getPluginManager().registerListener(plugin, new BListener());
BListener.sendToSpigotDeleteAll();
BMetrics.Bstats();
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, String 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 {
String plVer = ProxyServer.getInstance().getPluginManager().getPlugin(pl).getDescription().getVersion();
if (ver.contains("_")) {
if (!plVer.equals(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().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");
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!");
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.onDisable();
return true;
}
return false;
}
}
}

View File

@ -1,864 +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 de.jatitv.commandguiv2.Util;
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 {
public static void Bstats() {
int pluginId = Util.getBstatsID(); // <-- Replace with the id of your plugin!
BMetrics metrics = new BMetrics(BMain.plugin, pluginId);
}
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;
}
}
}
}

View File

@ -1,105 +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 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);
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());
}
});
}
}

View File

@ -1,10 +1,10 @@
package de.jatitv.commandguiv2.Spigot;
package net.t2code.commandguiv2.Spigot;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.system.Load;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.database.MySQL;
import de.jatitv.commandguiv2.Util;
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;
@ -57,14 +57,14 @@ public final class Main extends JavaPlugin {
}
if (T2CpluginCheck.pluginCheck("CommandGUI")) {
T2Csend.error( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
T2Csend.error( "");
T2Csend.error( "An older version of the plugin T2C-CommandGUI was found!");
T2Csend.error( "This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
T2Csend.error( "Please remove the older version (CommandGUI)!");
T2Csend.error( this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
T2Csend.error( "");
T2Csend.error( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
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;
}
@ -131,7 +131,7 @@ public final class Main extends JavaPlugin {
}
public static void sendTryCatch(Class c, StackTraceElement line) {
T2Csend.error(c.getName() + " Line: " + line.getLineNumber());
T2Csend.error(plugin,c.getName() + " Line: " + line.getLineNumber());
}
@Override

View File

@ -1,11 +1,11 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
package net.t2code.commandguiv2.Spigot.cmdManagement;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Util;
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;
@ -90,7 +90,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>() {{
@ -105,34 +104,9 @@ 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, SelectConfig.getAdminSubCommand(), 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;
}

View File

@ -1,9 +1,9 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
package net.t2code.commandguiv2.Spigot.cmdManagement;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
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;
@ -24,7 +24,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
if (args.length == 0) {
if (SelectConfig.getUseItem_AllowToggle()) {
Help.sendGUIItemHelp(sender);
} else send.sender(sender, "§4UseItem toggle is disabled!");// todo
} else T2Csend.sender(sender, "§4UseItem toggle is disabled!");// todo
} else {
if (args.length == 1 || args.length == 2) {
if (sender instanceof Player) {
@ -41,17 +41,17 @@ 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);
}
}

View File

@ -1,6 +1,6 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
package net.t2code.commandguiv2.Spigot.cmdManagement;
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;

View File

@ -1,25 +1,22 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
package net.t2code.commandguiv2.Spigot.cmdManagement;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.useItem.UseItem;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.LanguagesCreate;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.sound.Sound;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
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.api.update.T2CupdateAPI;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -28,36 +25,7 @@ import java.util.Objects;
public class Commands {
public static void info(CommandSender sender) {
T2Ctemplate.sendInfo(sender,Util.getPrefix(),Util.getSpigot(),Util.getDiscord(),Main.autor,);
T2Ctemplate.sendInfo();
//if (sender instanceof Player) {
// Player player = (Player) sender;
// send.player(player, Util.getPrefix() + "§4======= §8[§4Command§9GUI§8] §4=======");
// send.player(player, Util.getPrefix() + " §2Autor: §6" + String.valueOf(Main.autor).replace("[", "").replace("]", ""));
//
// if (UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion.equalsIgnoreCase(Main.version)) {
// send.player(player, Util.getPrefix() + " §2Version: §6" + Main.version);
// } else {
// UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion, player);
// }
//
// send.player(player, Util.getPrefix() + " §2Spigot: §6" + Util.getSpigot());
// send.player(player, Util.getPrefix() + " §2Discord: §6" + Util.getDiscord());
// send.player(player, Util.getPrefix() + "§4======= §8[§4Command§9GUI§8] §4=======");
//} else {
// send.sender(sender, Util.getPrefix() + "§4======= §8[§4Command§9GUI§8] §4=======");
// send.sender(sender, Util.getPrefix() + " §2String.valueOf(Main.autor): §6" + String.valueOf(String.valueOf(Main.autor)).replace("[", "").replace("]", ""));
//
// if (T2CupdateAPI.pluginVersions.get(Main.getPlugin().getName()).publicVersion.equalsIgnoreCase(Main.version)) {
// send.sender(sender, Util.getPrefix() + " §2Version: §6" + Main.version);
// } else {
// T2CupdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion);
// }
//
// T2Csend.sender(sender, Util.getPrefix() + " §2Spigot: §6" + Util.getSpigot());
// T2Csend.sender(sender, Util.getPrefix() + " §2Discord: §6" + Util.getDiscord());
// T2Csend.sender(sender, Util.getPrefix() + "§4======= §8[§4Command§9GUI§8] §4=======");
//}
T2Ctemplate.sendInfo(sender, Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText());
}
public static void reload(CommandSender sender) {
@ -107,8 +75,8 @@ public class Commands {
public static void give(CommandSender sender, Player target) {
if (Bukkit.getPlayer(target.getName()) != null) {
UseItem.giveUseItem(target);
send.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
send.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
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()));
@ -124,7 +92,7 @@ public class Commands {
} else {
slot = Events.useItemSlotHashMap.get(player.getName());
}
send.debug(Main.getPlugin(), String.valueOf(slot));
T2Csend.debug(Main.getPlugin(), String.valueOf(slot));
if (player.getInventory().getItem(slot - 1) == null) {
SelectDatabase.setItemStatusTrue(player);
UseItem.giveUseItem(player);
@ -139,10 +107,10 @@ public class Commands {
if (empty) {
SelectDatabase.setItemStatusTrue(player);
UseItem.addUseItem(player);
send.player(player, SelectMessages.ItemON);
T2Csend.player(player, SelectMessages.ItemON);
} else {
send.player(player, SelectMessages.NoInventorySpace);
Sound.play(player,SoundEnum.NoInventorySpace);
T2Csend.player(player, SelectMessages.NoInventorySpace);
Sound.play(player, SoundEnum.NoInventorySpace);
}
}
}
@ -150,33 +118,33 @@ public class Commands {
public static void itemOff(Player player) {
SelectDatabase.setItemStatusFalse(player);
UseItem.removeItem(player);
send.player(player, SelectMessages.ItemOFF);
T2Csend.player(player, SelectMessages.ItemOFF);
}
public static void onSetSlot(Player player, Integer setSlot) {
if (!SelectConfig.getUseItem_AllowSetSlot()) {
send.player(player, Util.getPrefix() + " §4Function disabled");
T2Csend.player(player, Util.getPrefix() + " §4Function disabled");
return;
}
if (setSlot < 1) {
send.player(player, SelectMessages.ItemSlot_wrongValue);
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
return;
}
if (setSlot > 9) {
send.player(player, SelectMessages.ItemSlot_wrongValue);
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
return;
}
if (Events.useItemHashMap.get(player.getName())) {
if (Objects.equals(Events.useItemSlotHashMap.get(player.getName()), setSlot)) {
send.player(player, SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
T2Csend.player(player, SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
return;
}
}
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(setSlot - 1) != null) {
send.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
T2Csend.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
return;
}
@ -188,7 +156,7 @@ public class Commands {
UseItem.giveUseItem(player);
}
send.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
T2Csend.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
}
public static void gui(Player player) {
@ -197,9 +165,9 @@ public class Commands {
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 send.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
.replace("[perm]", "commandgui.command"));
} else send.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
}
}
@ -209,9 +177,9 @@ public class Commands {
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 send.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.key)
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.key)
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
} else send.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.key));
} else send.player(player, SelectMessages.guiNotFound);
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.key));
} else T2Csend.player(player, SelectMessages.guiNotFound);
}
}

View File

@ -1,10 +1,10 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
package net.t2code.commandguiv2.Spigot.cmdManagement;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,22 +1,21 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement.register;
package net.t2code.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.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.io.File;
import java.lang.reflect.Field;
public class AliasRegister {
public static void onRegister() {
Plugin plugin = Main.getPlugin();
send.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
T2Csend.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
if (Main.allAliases.toString().equals("[]")) {
send.console(Util.getPrefix() + " §4No GUI files available");
T2Csend.console(Util.getPrefix() + " §4No GUI files available");
return;
}
for (String alias : Main.allAliases) {

View File

@ -1,11 +1,11 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement.register;
package net.t2code.commandguiv2.Spigot.cmdManagement.register;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.lib.Spigot.Lib.messages.send;
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;
@ -27,9 +27,9 @@ public class RegisterCommand extends Command {
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 send.player(player,SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
.replace("[perm]", "commandgui.command." + alias));
} else send.player(player,SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
} 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;
}

View File

@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.config.config;
package net.t2code.commandguiv2.Spigot.config.config;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,9 +1,9 @@
package de.jatitv.commandguiv2.Spigot.config.config;
package net.t2code.commandguiv2.Spigot.config.config;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Util;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
@ -37,6 +37,7 @@ public class SelectConfig {
language = yamlConfiguration.getString("Plugin.language");
Currency = yamlConfiguration.getString("Plugin.Currency");
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");
storage = yamlConfiguration.getString("Storage.Type").toUpperCase();
mysqlIp = yamlConfiguration.getString("Storage.MySQL.IP");

View File

@ -1,10 +1,10 @@
package de.jatitv.commandguiv2.Spigot.config.configConverter;
package net.t2code.commandguiv2.Spigot.config.configConverter;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.functions.CreateFunctions;
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,9 +1,9 @@
package de.jatitv.commandguiv2.Spigot.config.functions;
package net.t2code.commandguiv2.Spigot.config.functions;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.config.gui;
package net.t2code.commandguiv2.Spigot.config.gui;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.config.languages;
package net.t2code.commandguiv2.Spigot.config.languages;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -9,7 +9,7 @@
// \_____\_____|\____/|_____|
// -----------------------------
package de.jatitv.commandguiv2.Spigot.config.languages;
package net.t2code.commandguiv2.Spigot.config.languages;
public class MSG {

View File

@ -1,8 +1,8 @@
package de.jatitv.commandguiv2.Spigot.config.languages;
package net.t2code.commandguiv2.Spigot.config.languages;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,10 +1,10 @@
package de.jatitv.commandguiv2.Spigot.database;
package net.t2code.commandguiv2.Spigot.database;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Util;
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.*;

View File

@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.database;
package net.t2code.commandguiv2.Spigot.database;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Util;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.Bukkit;

View File

@ -1,8 +1,8 @@
package de.jatitv.commandguiv2.Spigot.database;
package net.t2code.commandguiv2.Spigot.database;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.enums.StorageEnum;
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;

View File

@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.database;
package net.t2code.commandguiv2.Spigot.database;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
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;

View File

@ -1,4 +1,4 @@
package de.jatitv.commandguiv2.Spigot.enums;
package net.t2code.commandguiv2.Spigot.enums;
public enum EcoEnum {
VAULT, MONEY,

View File

@ -1,5 +1,5 @@
package de.jatitv.commandguiv2.Spigot.enums;
package net.t2code.commandguiv2.Spigot.enums;
public enum FunctionItemEnum {
REMOVE, ADD

View File

@ -1,4 +1,4 @@
package de.jatitv.commandguiv2.Spigot.enums;
package net.t2code.commandguiv2.Spigot.enums;
public enum FunctionVoteEnum {
REMOVE, ADD

View File

@ -1,4 +1,4 @@
package de.jatitv.commandguiv2.Spigot.enums;
package net.t2code.commandguiv2.Spigot.enums;
public enum SoundEnum {
OpenInventory,

View File

@ -1,4 +1,4 @@
package de.jatitv.commandguiv2.Spigot.enums;
package net.t2code.commandguiv2.Spigot.enums;
public enum StorageEnum {
MYSQL,

View File

@ -1,19 +1,19 @@
package de.jatitv.commandguiv2.Spigot.gui;
package net.t2code.commandguiv2.Spigot.gui;
import de.jatitv.commandguiv2.Spigot.listener.ServerChange;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.system.Placeholder;
import de.jatitv.commandguiv2.Spigot.sound.Sound;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,14 +1,14 @@
package de.jatitv.commandguiv2.Spigot.gui;
package net.t2code.commandguiv2.Spigot.gui;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.system.Placeholder;
import de.jatitv.commandguiv2.Util;
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.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;

View File

@ -1,16 +1,16 @@
package de.jatitv.commandguiv2.Spigot.gui;
package net.t2code.commandguiv2.Spigot.gui;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.sound.Sound;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -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 net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@ -16,12 +16,12 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
DataOutputStream output = new DataOutputStream(stream);
try {
if (console) {
output.writeUTF("cgui-Console");
output.writeUTF("T2Code-Console");
} else {
if (sender instanceof Player) {
output.writeUTF(sender.getName());
} else {
output.writeUTF("cgui-Console");
output.writeUTF("T2Code-Console");
}
}
output.writeUTF(information);
@ -30,10 +30,10 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
}
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendPluginMessage(Main.getPlugin(), "cgui:bungee", stream.toByteArray());
player.sendPluginMessage(Main.getPlugin(), "t2c:bcmd", stream.toByteArray());
}else {
for(Player player : Bukkit.getOnlinePlayers()){
player.sendPluginMessage(Main.getPlugin(), "cgui:bungee", stream.toByteArray());
player.sendPluginMessage(Main.getPlugin(), "t2c:bcmd", stream.toByteArray());
return;
}
}

View File

@ -1,11 +1,11 @@
// This claas was created by JaTiTV
package de.jatitv.commandguiv2.Spigot.listener;
package net.t2code.commandguiv2.Spigot.listener;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -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;

View File

@ -1,14 +1,14 @@
package de.jatitv.commandguiv2.Spigot.objects;
package net.t2code.commandguiv2.Spigot.objects;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.enums.EcoEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
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;

View File

@ -1,8 +1,8 @@
package de.jatitv.commandguiv2.Spigot.objects.functions;
package net.t2code.commandguiv2.Spigot.objects.functions;
import de.jatitv.commandguiv2.Spigot.enums.EcoEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
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;

View File

@ -1,6 +1,6 @@
package de.jatitv.commandguiv2.Spigot.objects.guis;
package net.t2code.commandguiv2.Spigot.objects.guis;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
import java.util.ArrayList;
@ -11,7 +11,6 @@ public class Gui {
public Boolean guiFillItemEnable;
public String guiFillItemItem;
public String key;
public Boolean commandAliasEnable;
public Boolean commandPermissionEnable;

View File

@ -1,4 +1,4 @@
package de.jatitv.commandguiv2.Spigot.objects.slots;
package net.t2code.commandguiv2.Spigot.objects.slots;
public class Slot {

View File

@ -1,12 +1,12 @@
package de.jatitv.commandguiv2.Spigot.sound;
package net.t2code.commandguiv2.Spigot.sound;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,6 +1,6 @@
package de.jatitv.commandguiv2.Spigot.system;
package net.t2code.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;

View File

@ -1,27 +1,27 @@
package de.jatitv.commandguiv2.Spigot.system;
package net.t2code.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import de.jatitv.commandguiv2.Spigot.gui.GUIListener;
import de.jatitv.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
import de.jatitv.commandguiv2.Spigot.useItem.EventsFrom110;
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.config.functions.CreateFunctions;
import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI;
import de.jatitv.commandguiv2.Spigot.config.languages.LanguagesCreate;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.database.MySQL;
import de.jatitv.commandguiv2.Spigot.listener.PluginEvent;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
import de.jatitv.commandguiv2.Spigot.config.config.ConfigCreate;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.database.SQLITE;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.enums.StorageEnum;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
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.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
@ -96,13 +96,13 @@ public class Load {
SelectConfig.setConfigVersion();
if (SelectConfig.getBungee()) {
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "cgui:bungee")) {
T2Csend.debug(plugin, "registerOutgoingPluginChannel §ecgui:bungee");
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "cgui:bungee");
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "t2c:bcmd")) {
T2Csend.debug(plugin, "registerOutgoingPluginChannel §et2c:bcmd");
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
}
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "cgui:onlinepl")) {
T2Csend.debug(plugin, "registerIncomingPluginChannel §ecgui:onlinepl");
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "cgui:onlinepl", new Bungee_Sender_Reciver());
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:cguiopl")) {
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:cguiopl");
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "t2c:cguiopl", new Bungee_Sender_Reciver());
}
}
@ -132,7 +132,7 @@ public class Load {
e.printStackTrace();
}
try {
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), Permissions.admin+";"+Permissions.giveItemOther+";"+Permissions.info);
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), Permissions.admin + ";" + Permissions.giveItemOther + ";" + Permissions.info);
} catch (Exception e) {
e.printStackTrace();
}
@ -187,8 +187,8 @@ public class Load {
try {
SelectDatabase.setStorage(StorageEnum.valueOf(SelectConfig.getStorage()));
} catch (Exception ignored) {
T2Csend.error( "The storage medium " + SelectConfig.getStorage() + " is not supported!");
T2Csend.error("Storage medium " + StorageEnum.SQLITE + " is used.");
T2Csend.error(plugin, "The storage medium " + SelectConfig.getStorage() + " is not supported!");
T2Csend.error(plugin, "Storage medium " + StorageEnum.SQLITE + " is used.");
SelectDatabase.setStorage(StorageEnum.SQLITE);
}

View File

@ -1,11 +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.database.SelectDatabase;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,8 +1,8 @@
// 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 net.t2code.commandguiv2.Spigot.Main;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player;

View File

@ -1,8 +1,8 @@
package de.jatitv.commandguiv2.Spigot.system;
package net.t2code.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
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;

View File

@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.system;
package net.t2code.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.commandguiv2.Spigot.useItem.Events;
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
import org.bukkit.entity.Player;
import java.util.ArrayList;

View File

@ -1,12 +1,12 @@
package de.jatitv.commandguiv2.Spigot.useItem;
package net.t2code.commandguiv2.Spigot.useItem;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.api.CGuiAPI;
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;

View File

@ -1,6 +1,6 @@
package de.jatitv.commandguiv2.Spigot.useItem;
package net.t2code.commandguiv2.Spigot.useItem;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;

View File

@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.useItem;
package net.t2code.commandguiv2.Spigot.useItem;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;

View File

@ -1,11 +1,11 @@
package de.jatitv.commandguiv2.Spigot.useItem;
package net.t2code.commandguiv2.Spigot.useItem;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Util;
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.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
@ -48,7 +48,7 @@ public class UseItem {
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("Playerheads for UseItem are only available from version 1.13!");
T2Csend.error(Main.getPlugin(),"Playerheads for UseItem are only available from version 1.13!");
} else {
item = T2CitemVersion.getHeadIS();
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();

View File

@ -1,6 +1,10 @@
package de.jatitv.commandguiv2;
package net.t2code.commandguiv2;
public class Util {
public static String getInfoText() {
return "";
}
private static Integer configVersion = 5;
private static String requiredT2CodeLibVersion = "13.0";
private static String Prefix = "§8[§4C§9GUI§8]";

View File

@ -1,16 +1,16 @@
package de.jatitv.commandguiv2.api;
package net.t2code.commandguiv2.api;
import de.jatitv.commandguiv2.Spigot.useItem.ItemChange;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
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.config.gui.CreateGUI;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Util;
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;

View File

@ -1,4 +0,0 @@
name: T2C-CommandGUI
version: ${project.version}
main: de.jatitv.commandguiv2.Bungee.BMain
author: JaTiTV

View File

@ -1,6 +1,6 @@
name: T2C-CommandGUI
version: ${project.version}
main: de.jatitv.commandguiv2.Spigot.Main
main: net.t2code.commandguiv2.Spigot.Main
api-version: 1.13
prefix: T2C-CommandGUI
authors: [ JaTiTV ]