Set only old code
This commit is contained in:
parent
c395d2fa67
commit
4a8354489b
113
CommandGUI V2/.gitignore
vendored
113
CommandGUI V2/.gitignore
vendored
@ -1,113 +0,0 @@
|
||||
# User-specific stuff
|
||||
.idea/
|
||||
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
target/
|
||||
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
.flattened-pom.xml
|
||||
|
||||
# Common working directory
|
||||
run/
|
@ -1,172 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>CommandGUI_V2</artifactId>
|
||||
<version>2.5.15</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandGUI</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>Builders-Paradise</id>
|
||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||
</repository>
|
||||
<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>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>bungee</artifactId>
|
||||
<version>1615</version>
|
||||
</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>
|
||||
<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>
|
||||
</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>
|
||||
</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>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_8.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8r1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,86 +0,0 @@
|
||||
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
|
||||
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: §7https://discord.gg/vRyXFFterJ'
|
||||
CustomSound:
|
||||
Enable: false
|
||||
NoSound: false
|
||||
Sound: ''
|
||||
Cost:
|
||||
Enable: false
|
||||
Price: 0.0
|
||||
Command:
|
||||
Enable: false
|
||||
BungeeCommand: false
|
||||
CommandAsConsole: false
|
||||
Command:
|
||||
- ''
|
||||
OpenGUI:
|
||||
Enable: false
|
||||
GUI: ''
|
||||
Message:
|
||||
Enable: true
|
||||
Message:
|
||||
- '&6You can find more information on Discord: &ehttps://discord.gg/vRyXFFterJ'
|
||||
Permission:
|
||||
Required: false
|
||||
ServerChange:
|
||||
Enable: false
|
||||
Server: ''
|
||||
SetConfig:
|
||||
Enable: false
|
||||
File:
|
||||
Path: ''
|
||||
Option:
|
||||
Path: ''
|
||||
Premat: String
|
||||
Value:
|
||||
LeftClick:
|
||||
ChatInput: false
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
RightClick:
|
||||
ChatInput: false
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
PluginReload:
|
||||
Enable: false
|
||||
Command: ''
|
@ -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,95 +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 (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,23 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Spigot.Listener;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
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);
|
||||
try {
|
||||
out.writeUTF("Connect");
|
||||
out.writeUTF(server);
|
||||
} catch (IOException i) {
|
||||
i.printStackTrace();
|
||||
}
|
||||
player.sendPluginMessage(Main.plugin, "BungeeCord", b.toByteArray());
|
||||
}
|
||||
}
|
@ -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,42 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
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 {
|
||||
|
||||
@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 (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
}
|
||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_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;
|
||||
Player p = e.getPlayer();
|
||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_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)) {
|
||||
p.closeInventory();
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -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,114 +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.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) {
|
||||
|
||||
Main.allAliases.add(config_gui.getName().replace(".yml", ""));
|
||||
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
|
||||
if (sub.equals(".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,168 +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 net.t2code.lib.Bungee.Lib.commands.BTab;
|
||||
import net.t2code.lib.Spigot.Lib.commands.Tab;
|
||||
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.List;
|
||||
|
||||
public class CmdExecuter_GUI 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) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(SelectMessages.OnlyForPlayer);
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
Commands.gui(player);
|
||||
} else {
|
||||
if (args[0].equals("admin")) {
|
||||
if (args.length == 1) {
|
||||
Help.sendHelp(sender, prefix);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (args[1].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 == 3) {
|
||||
if (sender.hasPermission("commandgui.giveitem.other")) {
|
||||
Player target = Bukkit.getPlayer(args[2]);
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Commands.gui(player, args[0]);
|
||||
return false;
|
||||
}
|
||||
Help.sendHelp(sender, prefix);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//TabCompleter
|
||||
|
||||
|
||||
public static HashMap<String, String> arg1 = new HashMap<String, String>();
|
||||
|
||||
private static HashMap<String, String> arg2 = 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<>();
|
||||
|
||||
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);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
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,113 +0,0 @@
|
||||
package de.jatitv.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 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.List;
|
||||
|
||||
public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
||||
private static String prefix = Util.Prefix;
|
||||
|
||||
@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) {
|
||||
Help.sendGUIItemHelp(sender, prefix);
|
||||
} else {
|
||||
if (args.length == 1 || args.length == 2) {
|
||||
if (sender instanceof Player) {
|
||||
if (SelectConfig.UseItem_AllowToggle) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "on":
|
||||
Commands.itemOn(player);
|
||||
break;
|
||||
case "off":
|
||||
Commands.itemOff(player);
|
||||
break;
|
||||
case "slot":
|
||||
if (args.length == 2) {
|
||||
try {
|
||||
Commands.onSetSlot(player, Integer.valueOf(args[1]));
|
||||
} catch (Exception e5) {
|
||||
send.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
}
|
||||
|
||||
} else send.player(player, "§4Use: §7/gui-item slot [slot]");
|
||||
|
||||
break;
|
||||
default:
|
||||
Help.sendHelp(player, prefix);
|
||||
|
||||
}
|
||||
}
|
||||
} else sender.sendMessage(SelectMessages.OnlyForPlayer);
|
||||
}
|
||||
}
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui-item").replace("[perm]", "commandgui.useitem.toggle"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//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) {
|
||||
put("slot", "commandgui.useitem.toggle");
|
||||
}
|
||||
}};
|
||||
|
||||
@Override
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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,22 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.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;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (args.length == 0) {
|
||||
Help.sendHelp(sender, prefix);
|
||||
} else Help.sendHelp(sender, prefix);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,248 +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 (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,93 +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 (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,850 +0,0 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
|
||||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
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;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
private final Plugin plugin;
|
||||
|
||||
private final MetricsBase metricsBase;
|
||||
|
||||
/**
|
||||
* 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 Metrics(JavaPlugin plugin, int serviceId) {
|
||||
this.plugin = plugin;
|
||||
// Get the config file
|
||||
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
|
||||
File configFile = new File(bStatsFolder, "config.yml");
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
|
||||
if (!config.isSet("serverUuid")) {
|
||||
config.addDefault("enabled", true);
|
||||
config.addDefault("serverUuid", UUID.randomUUID().toString());
|
||||
config.addDefault("logFailedRequests", false);
|
||||
config.addDefault("logSentData", false);
|
||||
config.addDefault("logResponseStatusText", false);
|
||||
// Inform the server owners about bStats
|
||||
config
|
||||
.options()
|
||||
.header(
|
||||
"bStats (https://bStats.org) collects some basic information for plugin authors, like how\n"
|
||||
+ "many people use their plugin and their total player count. It's recommended to keep bStats\n"
|
||||
+ "enabled, but if you're not comfortable with this, you can turn this setting off. There is no\n"
|
||||
+ "performance penalty associated with having metrics enabled, and data sent to bStats is fully\n"
|
||||
+ "anonymous.")
|
||||
.copyDefaults(true);
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
// Load the data
|
||||
boolean enabled = config.getBoolean("enabled", true);
|
||||
String serverUUID = config.getString("serverUuid");
|
||||
boolean logErrors = config.getBoolean("logFailedRequests", false);
|
||||
boolean logSentData = config.getBoolean("logSentData", false);
|
||||
boolean logResponseStatusText = config.getBoolean("logResponseStatusText", false);
|
||||
metricsBase =
|
||||
new MetricsBase(
|
||||
"bukkit",
|
||||
serverUUID,
|
||||
serviceId,
|
||||
enabled,
|
||||
this::appendPlatformData,
|
||||
this::appendServiceData,
|
||||
submitDataTask -> Bukkit.getScheduler().runTask(plugin, submitDataTask),
|
||||
plugin::isEnabled,
|
||||
(message, error) -> this.plugin.getLogger().log(Level.WARNING, message, error),
|
||||
(message) -> this.plugin.getLogger().log(Level.INFO, message),
|
||||
logErrors,
|
||||
logSentData,
|
||||
logResponseStatusText);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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", getPlayerAmount());
|
||||
builder.appendField("onlineMode", Bukkit.getOnlineMode() ? 1 : 0);
|
||||
builder.appendField("bukkitVersion", Bukkit.getVersion());
|
||||
builder.appendField("bukkitName", Bukkit.getName());
|
||||
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());
|
||||
}
|
||||
|
||||
private int getPlayerAmount() {
|
||||
try {
|
||||
// Around MC 1.8 the return type was changed from an array to a collection,
|
||||
// This fixes java.lang.NoSuchMethodError:
|
||||
// org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
|
||||
Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
|
||||
return onlinePlayersMethod.getReturnType().equals(Collection.class)
|
||||
? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
|
||||
: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
|
||||
} catch (Exception e) {
|
||||
// Just use the new method if the reflection failed
|
||||
return Bukkit.getOnlinePlayers().size();
|
||||
}
|
||||
}
|
||||
|
||||
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,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,213 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system.config.languages;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class LanguagesCreate {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
|
||||
public static void langCreate() {
|
||||
send.debug(plugin,"§4Language files are created / updated...");
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
|
||||
/**
|
||||
*
|
||||
* ENGLISH
|
||||
*
|
||||
*/
|
||||
|
||||
File messagesEN = new File(Main.getPath(), "languages/english_messages.yml");
|
||||
YamlConfiguration yamlConfigurationEN = YamlConfiguration.loadConfiguration(messagesEN);
|
||||
|
||||
set("Plugin.VaultNotSetUp", MSG.EN_VaultNotSetUp, yamlConfigurationEN);
|
||||
set("Plugin.SoundNotFound", MSG.EN_SoundNotFound, yamlConfigurationEN);
|
||||
set("Plugin.OnlyForPlayer", MSG.EN_OnlyForPlayer, yamlConfigurationEN);
|
||||
set("Plugin.DefaultGUI.create", MSG.EN_DefaultGUI, yamlConfigurationEN);
|
||||
set("Plugin.Reload.Start", MSG.EN_ReloadStart, yamlConfigurationEN);
|
||||
set("Plugin.Reload.End", MSG.EN_ReloadEnd, yamlConfigurationEN);
|
||||
|
||||
set("NoPermission.ForCommandGUI", MSG.EN_NoPermission, yamlConfigurationEN);
|
||||
set("NoPermission.ForCommand", MSG.EN_NoPermissionForCommand, yamlConfigurationEN);
|
||||
set("NoPermission.ForUseItem", MSG.EN_NoPermissionForUseItem, yamlConfigurationEN);
|
||||
set("NoPermission.ForItem", MSG.EN_NoPermissionForItem, yamlConfigurationEN);
|
||||
|
||||
set("UseItem.UseItem_ON", MSG.EN_ItemON, yamlConfigurationEN);
|
||||
set("UseItem.UseItem_OFF", MSG.EN_ItemOFF, yamlConfigurationEN);
|
||||
set("UseItem.Change_Slot", MSG.EN_ItemSlot, yamlConfigurationEN);
|
||||
set("UseItem.SlotNotEmpty", MSG.EN_ItemSlotNotEmpty, yamlConfigurationEN);
|
||||
set("UseItem.SlotAlreadySet", MSG.EN_ItemSlotAlreadySet, yamlConfigurationEN);
|
||||
set("UseItem.ItemSlot_wrongValue", MSG.EN_ItemSlot_wrongValue, yamlConfigurationEN);
|
||||
|
||||
set("Cost.Buy_msg", MSG.EN_Buy_msg, yamlConfigurationEN);
|
||||
set("Cost.No_money", MSG.EN_No_money, yamlConfigurationEN);
|
||||
set("Cost.NoInventorySpace", MSG.EN_NoInventorySpace, yamlConfigurationEN);
|
||||
|
||||
set("ServerChange.onServerChange", MSG.EN_onServerChange, yamlConfigurationEN);
|
||||
|
||||
set("GUI.GUInotFound", MSG.EN_GUInotFound, yamlConfigurationEN);
|
||||
set("GUI.GUIisDisabled", MSG.EN_GUIisDisabled, yamlConfigurationEN);
|
||||
|
||||
set("Give.Sender", MSG.EN_GiveSender, yamlConfigurationEN);
|
||||
set("Give.Receiver", MSG.EN_GiveReceiver, yamlConfigurationEN);
|
||||
|
||||
set("Player.PlayerNotFond", MSG.EN_PlayerNotFond, yamlConfigurationEN);
|
||||
set("Player.PlayerNoInventorySpace", MSG.EN_PlayerNoInventorySpace, 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);
|
||||
set("Help.Open", MSG.EN_Help_Open, yamlConfigurationEN);
|
||||
set("Help.Give", MSG.EN_Help_Give, yamlConfigurationEN);
|
||||
set("Help.CreateDefaultGUI", MSG.EN_Help_CreateDefaultGUI, yamlConfigurationEN);
|
||||
set("Help.Reload", MSG.EN_Help_Reload, yamlConfigurationEN);
|
||||
set("Help.UseItem_On", MSG.EN_GUIItemHelp_on, yamlConfigurationEN);
|
||||
set("Help.UseItem_Off", MSG.EN_GUIItemHelp_off, yamlConfigurationEN);
|
||||
set("Help.UseItem_Slot", MSG.EN_GUIItemHelp_Slot, yamlConfigurationEN);
|
||||
|
||||
try {
|
||||
yamlConfigurationEN.save(messagesEN);
|
||||
} catch (IOException e) {
|
||||
send.warning(plugin,e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* GERMAN
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
File messagesDE = new File(Main.getPath(), "languages/german_messages.yml");
|
||||
YamlConfiguration yamlConfigurationDE = YamlConfiguration.loadConfiguration(messagesDE);
|
||||
|
||||
set("Plugin.VaultNotSetUp", MSG.DE_VaultNotSetUp, yamlConfigurationDE);
|
||||
set("Plugin.SoundNotFound", MSG.DE_SoundNotFound, yamlConfigurationDE);
|
||||
set("Plugin.OnlyForPlayer", MSG.DE_OnlyForPlayer, yamlConfigurationDE);
|
||||
set("Plugin.DefaultGUI.create", MSG.DE_DefaultGUI, yamlConfigurationDE);
|
||||
set("Plugin.Reload.Start", MSG.DE_ReloadStart, yamlConfigurationDE);
|
||||
set("Plugin.Reload.End", MSG.DE_ReloadEnd, yamlConfigurationDE);
|
||||
|
||||
set("NoPermission.ForCommandGUI", MSG.DE_NoPermission, yamlConfigurationDE);
|
||||
set("NoPermission.ForCommand", MSG.DE_NoPermissionForCommand, yamlConfigurationDE);
|
||||
set("NoPermission.ForUseItem", MSG.DE_NoPermissionForUseItem, yamlConfigurationDE);
|
||||
set("NoPermission.ForItem", MSG.DE_NoPermissionForItem, yamlConfigurationDE);
|
||||
|
||||
set("UseItem.UseItem_ON", MSG.DE_ItemON, yamlConfigurationDE);
|
||||
set("UseItem.UseItem_OFF", MSG.DE_ItemOFF, yamlConfigurationDE);
|
||||
set("UseItem.Change_Slot", MSG.DE_ItemSlot, yamlConfigurationDE);
|
||||
set("UseItem.SlotNotEmpty", MSG.DE_ItemSlotNotEmpty, yamlConfigurationDE);
|
||||
set("UseItem.SlotAlreadySet", MSG.DE_ItemSlotAlreadySet, yamlConfigurationDE);
|
||||
set("UseItem.ItemSlot_wrongValue", MSG.DE_ItemSlot_wrongValue, yamlConfigurationDE);
|
||||
|
||||
set("Cost.Buy_msg", MSG.DE_Buy_msg, yamlConfigurationDE);
|
||||
set("Cost.No_money", MSG.DE_No_money, yamlConfigurationDE);
|
||||
set("Cost.NoInventorySpace", MSG.DE_NoInventorySpace, yamlConfigurationDE);
|
||||
|
||||
set("ServerChange.onServerChange", MSG.DE_onServerChange, yamlConfigurationDE);
|
||||
|
||||
set("GUI.GUInotFound", MSG.DE_GUInotFound, yamlConfigurationDE);
|
||||
set("GUI.GUIisDisabled", MSG.DE_GUIisDisabled, yamlConfigurationDE);
|
||||
|
||||
set("Give.Sender", MSG.DE_GiveSender, yamlConfigurationDE);
|
||||
set("Give.Receiver", MSG.DE_GiveReceiver, yamlConfigurationDE);
|
||||
|
||||
set("Player.PlayerNotFond", MSG.DE_PlayerNotFond, yamlConfigurationDE);
|
||||
set("Player.PlayerNoInventorySpace", MSG.DE_PlayerNoInventorySpace, 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);
|
||||
set("Help.Open", MSG.DE_Help_Open, yamlConfigurationDE);
|
||||
set("Help.Give", MSG.DE_Help_Give, yamlConfigurationDE);
|
||||
set("Help.CreateDefaultGUI", MSG.DE_Help_CreateDefaultGUI, yamlConfigurationDE);
|
||||
set("Help.Reload", MSG.DE_Help_Reload, yamlConfigurationDE);
|
||||
set("Help.UseItem_On", MSG.DE_GUIItemHelp_on, yamlConfigurationDE);
|
||||
set("Help.UseItem_Off", MSG.DE_GUIItemHelp_off, yamlConfigurationDE);
|
||||
set("Help.UseItem_Slot", MSG.DE_GUIItemHelp_Slot, yamlConfigurationDE);
|
||||
|
||||
try {
|
||||
yamlConfigurationDE.save(messagesDE);
|
||||
} catch (IOException e) {
|
||||
send.warning(plugin,e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* norwegian
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
File messagesNO = new File(Main.getPath(), "languages/norwegian_messages.yml");
|
||||
YamlConfiguration yamlConfigurationNO = YamlConfiguration.loadConfiguration(messagesNO);
|
||||
|
||||
set("Plugin.VaultNotSetUp", MSG.NO_VaultNotSetUp, yamlConfigurationNO);
|
||||
set("Plugin.SoundNotFound", MSG.NO_SoundNotFound, yamlConfigurationNO);
|
||||
set("Plugin.OnlyForPlayer", MSG.NO_OnlyForPlayer, yamlConfigurationNO);
|
||||
set("Plugin.DefaultGUI.create", MSG.NO_DefaultGUI, yamlConfigurationNO);
|
||||
set("Plugin.Reload.Start", MSG.NO_ReloadStart, yamlConfigurationNO);
|
||||
set("Plugin.Reload.End", MSG.NO_ReloadEnd, yamlConfigurationNO);
|
||||
|
||||
set("NoPermission.ForCommandGUI", MSG.NO_NoPermission, yamlConfigurationNO);
|
||||
set("NoPermission.ForCommand", MSG.NO_NoPermissionForCommand, yamlConfigurationNO);
|
||||
set("NoPermission.ForUseItem", MSG.NO_NoPermissionForUseItem, yamlConfigurationNO);
|
||||
set("NoPermission.ForItem", MSG.NO_NoPermissionForItem, yamlConfigurationNO);
|
||||
|
||||
set("UseItem.UseItem_ON", MSG.NO_ItemON, yamlConfigurationNO);
|
||||
set("UseItem.UseItem_OFF", MSG.NO_ItemOFF, yamlConfigurationNO);
|
||||
set("UseItem.Change_Slot", MSG.NO_ItemSlot, yamlConfigurationNO);
|
||||
set("UseItem.SlotNotEmpty", MSG.NO_ItemSlotNotEmpty, yamlConfigurationNO);
|
||||
set("UseItem.SlotAlreadySet", MSG.NO_ItemSlotAlreadySet, yamlConfigurationNO);
|
||||
set("UseItem.ItemSlot_wrongValue", MSG.NO_ItemSlot_wrongValue, yamlConfigurationNO);
|
||||
|
||||
set("Cost.Buy_msg", MSG.NO_Buy_msg, yamlConfigurationNO);
|
||||
set("Cost.No_money", MSG.NO_No_money, yamlConfigurationNO);
|
||||
set("Cost.NoInventorySpace", MSG.NO_NoInventorySpace, yamlConfigurationNO);
|
||||
|
||||
set("ServerChange.onServerChange", MSG.NO_onServerChange, yamlConfigurationNO);
|
||||
|
||||
set("GUI.GUInotFound", MSG.NO_GUInotFound, yamlConfigurationNO);
|
||||
set("GUI.GUIisDisabled", MSG.NO_GUIisDisabled, yamlConfigurationNO);
|
||||
|
||||
set("Give.Sender", MSG.NO_GiveSender, yamlConfigurationNO);
|
||||
set("Give.Receiver", MSG.NO_GiveReceiver, yamlConfigurationNO);
|
||||
|
||||
set("Player.PlayerNotFond", MSG.NO_PlayerNotFond, yamlConfigurationNO);
|
||||
set("Player.PlayerNoInventorySpace", MSG.NO_PlayerNoInventorySpace, 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);
|
||||
set("Help.Open", MSG.NO_Help_Open, yamlConfigurationNO);
|
||||
set("Help.Give", MSG.NO_Help_Give, yamlConfigurationNO);
|
||||
set("Help.CreateDefaultGUI", MSG.NO_Help_CreateDefaultGUI, yamlConfigurationNO);
|
||||
set("Help.Reload", MSG.NO_Help_Reload, yamlConfigurationNO);
|
||||
set("Help.UseItem_On", MSG.NO_GUIItemHelp_on, yamlConfigurationNO);
|
||||
set("Help.UseItem_Off", MSG.NO_GUIItemHelp_off, yamlConfigurationNO);
|
||||
set("Help.UseItem_Slot", MSG.NO_GUIItemHelp_Slot, yamlConfigurationNO);
|
||||
|
||||
try {
|
||||
yamlConfigurationNO.save(messagesNO);
|
||||
} catch (IOException e) {
|
||||
send.warning(plugin,e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
send.console(Main.prefix + " §2Language files were successfully created / updated." + " §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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,160 +0,0 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
// -----------------------------
|
||||
// _____ _____ _ _ _____
|
||||
// / ____/ ____| | | |_ _|
|
||||
// | | | | __| | | | | |
|
||||
// | | | | |_ | | | | | |
|
||||
// | |___| |__| | |__| |_| |_
|
||||
// \_____\_____|\____/|_____|
|
||||
// -----------------------------
|
||||
|
||||
package de.jatitv.commandguiv2.Spigot.system.config.languages;
|
||||
|
||||
public class MSG {
|
||||
|
||||
// EN
|
||||
public static String EN_VaultNotSetUp = "[prefix] &4Vault / Economy not set up!";
|
||||
public static String EN_SoundNotFound = "[prefix] &4The sound &6[sound] &4was not found! Please check the settings.";
|
||||
public static String EN_OnlyForPlayer = "[prefix] &cThis command is for players only!";
|
||||
public static String EN_DefaultGUI = "[prefix] &2DefaultGUI was created. You can find it in the directory: &e[directory]&2!";
|
||||
public static String EN_ReloadStart = "[prefix] &6Plugin is reloaded...";
|
||||
public static String EN_ReloadEnd = "[prefix] &2Plugin was successfully reloaded.";
|
||||
|
||||
public static String EN_NoPermission = "[prefix] &cYou do not have permission for &4Command&9GUI&c!";
|
||||
public static String EN_NoPermissionForCommand = "[prefix] &cFor &b[cmd] &cyou lack the permission &6[perm]&c!";
|
||||
public static String EN_NoPermissionForUseItem = "[prefix] &cYou lack the permission &6[perm] &cto use the item for the GUI: &6[gui].";
|
||||
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_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.";
|
||||
|
||||
public static String EN_ItemON = "[prefix] &2You have activated the GUI item.";
|
||||
public static String EN_ItemOFF = "[prefix] &2You have disabled the GUI item.";
|
||||
public static String EN_ItemSlot = "[prefix] &2You have changed the GUI item to slot: &6[slot]&2.";
|
||||
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_GUInotFound = "[prefix] &cThe GUI chosen by the does not exist.";
|
||||
public static String EN_GUIisDisabled = "[prefix] &cThe GUI [gui] &cis currently Disabled!";
|
||||
|
||||
public static String EN_GiveSender = "[prefix] &2You have given &6[player] &2an [item] &2!";
|
||||
public static String EN_GiveReceiver = "[prefix] &2You got &2, [item] &2from &6[sender]!";
|
||||
|
||||
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_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.";
|
||||
public static String EN_Help_Info = "&8''&b/commandgui admin info&8'' &eCall the info from &4Command&9GUI &e.";
|
||||
public static String EN_Help_Give = "&8''&b/commandgui admin give &7<player>&8'' &eGive a player the GUI item.";
|
||||
public static String EN_Help_CreateDefaultGUI = "&8''&b/commandgui admin createdefaultgui&8'' &eCreate a default GUI &7([directory])&e.";
|
||||
public static String EN_Help_Reload = "&8''&b/commandgui admin reload&8'' &eReload the plugin.";
|
||||
|
||||
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.";
|
||||
|
||||
// DE
|
||||
public static String DE_VaultNotSetUp = "[prefix] &4Vault / Economy nicht eingerichtet!";
|
||||
public static String DE_SoundNotFound = "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte [ue]berpr[ue]fe die Einstellungen.";
|
||||
public static String DE_OnlyForPlayer = "[prefix] &cDieser Command ist nur f[ue]r Spieler!";
|
||||
public static String DE_DefaultGUI = "[prefix] &2DefaultGUI wurde erstellt. Du findst sie im Verzeichnis: &e[directory]&2!";
|
||||
public static String DE_ReloadStart = "[prefix] &6Plugin wird neu geladen...";
|
||||
public static String DE_ReloadEnd = "[prefix] &2Plugin wurde erfolgreich neu geladen.";
|
||||
|
||||
public static String DE_NoPermission = "[prefix] &cDu hast keine Permission f[ue]r &4Command&9GUI&c!";
|
||||
public static String DE_NoPermissionForCommand = "[prefix] &cF[ue]r &b[cmd] &cfehlt dir die Permission &6[perm]&c!";
|
||||
public static String DE_NoPermissionForUseItem = "[prefix] &cDir fehlt die Permission &6[perm] &cum das Item f[ue]r die GUI: &6[gui] &cnutzen zu k[oe]nnen.";
|
||||
public static String DE_NoPermissionForItem = "[prefix] &cF[ue]r &b[item] &cfehlt dir die Permission &6[perm]&c!";
|
||||
|
||||
public static String DE_ItemON = "[prefix] &2Du hast das GUI-Item aktiviert.";
|
||||
public static String DE_ItemOFF = "[prefix] &2Du hast das GUI-Item deaktiviert.";
|
||||
public static String DE_ItemSlot = "[prefix] &2Du hast das GUI-Item auf Slot &6[slot] &2umgestellt.";
|
||||
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_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_NoInventorySpace = "[prefix] &cDu hast keinen Platz in deinem Inventar!";
|
||||
|
||||
public static String DE_onServerChange = "[prefix] &2Du wirst auf den Server §e[server] §2verbunden.";
|
||||
|
||||
public static String DE_GUInotFound = "[prefix] &cDie von die gew[ae]hlte GUI gibt es nicht.";
|
||||
public static String DE_GUIisDisabled = "[prefix] &cDie GUI [gui] &cist derzeit Deaktiviert!";
|
||||
|
||||
public static String DE_GiveSender = "[prefix] &2Du hast &6[player] &2ein [item] &2gegeben!";
|
||||
public static String DE_GiveReceiver = "[prefix] &2Du hast von &6[sender] &2, [item] &2bekommen!";
|
||||
|
||||
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_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.";
|
||||
public static String DE_Help_Info = "&8''&b/commandgui admin info&8'' &eRufe die Infos von &4Command&9GUI &eauf.";
|
||||
public static String DE_Help_Give = "&8''&b/commandgui admin give &7<player>&8'' &eGebe einem Spieler das GUI-Item.";
|
||||
public static String DE_Help_CreateDefaultGUI = "&8''&b/commandgui admin createdefaultgui&8'' &eLasse eine default GUI erstellen &7([directory])&e.";
|
||||
public static String DE_Help_Reload = "&8''&b/commandgui admin reload&8'' &eLade das Plugin neu.";
|
||||
|
||||
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.";
|
||||
|
||||
|
||||
// FR
|
||||
|
||||
|
||||
// NO
|
||||
public static String NO_VaultNotSetUp = "[prefix] &4Vault / Økonomi har ikke blitt satt opp!";
|
||||
public static String NO_SoundNotFound = "[prefix] &4Lyden &6[sound] &4ble ikke bli funnet! Vennligst sjekk innstillingene.";
|
||||
public static String NO_OnlyForPlayer = "[prefix] &cDenne kommandoen er for spillere kun!";
|
||||
public static String NO_DefaultGUI = "[prefix] &2DefaultGUI har blitt laget. Du kan finne den i mappen: &e[directory]&2!";
|
||||
public static String NO_ReloadStart = "[prefix] &6Pluginet blir relastet...";
|
||||
public static String NO_ReloadEnd = "[prefix] &2Pluginet har blitt lastet inn på nytt.";
|
||||
|
||||
public static String NO_NoPermission = "[prefix] &cDu har ikke tilgang til &4Command&9GUI&c!";
|
||||
public static String NO_NoPermissionForCommand = "[prefix] &cFor &b[cmd] &cmangler du tillatelsen &6[perm]&c!";
|
||||
public static String NO_NoPermissionForUseItem = "[prefix] &cDu mangler tillatelsen &6[perm] &cfor å bruke gjenstanden i GUI: &6[gui].";
|
||||
public static String NO_NoPermissionForItem = "[prefix] &cFor &b[item] &cmangler du tillatelsen &6[perm]&c!";
|
||||
|
||||
public static String NO_ItemON = "[prefix] &2You have activated the GUI item.";
|
||||
public static String NO_ItemOFF = "[prefix] &2You have disabled the GUI item.";
|
||||
public static String NO_ItemSlot = "[prefix] &2You have changed the GUI item to slot: &6[slot]&2.";
|
||||
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_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_NoInventorySpace = "[prefix] &cDu har ikke nok plass i inventaret ditt!";
|
||||
|
||||
public static String NO_onServerChange = "[prefix] &2Du vil bli tilkoblet serveren &e[server]&2.";
|
||||
|
||||
public static String NO_GUInotFound = "[prefix] &cGUIen som ble spesifisert finnes ikke.";
|
||||
public static String NO_GUIisDisabled = "[prefix] &cGUIen [gui] &cer slått av for øyeblikket!";
|
||||
|
||||
public static String NO_GiveSender = "[prefix] &2Du har gitt &6[player] &2en [item]&2!";
|
||||
public static String NO_GiveReceiver = "[prefix] &2Du fikk &2, [item] &2fra &6[sender]!";
|
||||
|
||||
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_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.";
|
||||
public static String NO_Help_Info = "&8''&b/commandgui admin info&8'' &eKall informasjon fra &4Command&9GUI&e.";
|
||||
public static String NO_Help_Give = "&8''&b/commandgui admin give &7<player>&8'' &eGi en spiller GUI gjenstanden.";
|
||||
public static String NO_Help_CreateDefaultGUI = "&8''&b/commandgui admin createdefaultgui&8'' &eLag en normalverdi GUI &7([directory])&e.";
|
||||
public static String NO_Help_Reload = "&8''&b/commandgui admin reload&8'' &eLast inn pluginet på nytt.";
|
||||
|
||||
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.";
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system.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 org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SelectMessages {
|
||||
private static String prefix = Util.Prefix;
|
||||
|
||||
public static String selectMSG;
|
||||
|
||||
public static String VaultNotSetUp;
|
||||
public static String SoundNotFound;
|
||||
public static String OnlyForPlayer;
|
||||
public static String DefaultGUIcreate;
|
||||
public static String ReloadStart;
|
||||
public static String ReloadEnd;
|
||||
|
||||
public static String NoPermission;
|
||||
public static String NoPermissionForCommand;
|
||||
public static String NoPermissionForUseItem;
|
||||
public static String NoPermissionForItem;
|
||||
|
||||
public static String ItemON;
|
||||
public static String ItemOFF;
|
||||
public static String ItemSlot;
|
||||
public static String ItemSlotNotEmpty;
|
||||
public static String ItemSlotAlreadySet;
|
||||
public static String ItemSlot_wrongValue;
|
||||
|
||||
public static String Buy_msg;
|
||||
public static String No_money;
|
||||
public static String NoInventorySpace;
|
||||
|
||||
public static String onServerChange;
|
||||
|
||||
public static String GUInotFound;
|
||||
public static String GUIIsDisabled;
|
||||
|
||||
public static String Give_Sender;
|
||||
public static String Give_Receiver;
|
||||
|
||||
public static String PlayerNotFond;
|
||||
public static String PlayerNoInventorySpace;
|
||||
|
||||
public static String HelpCgui;
|
||||
public static String HelpHelp;
|
||||
public static String HelpInfo;
|
||||
public static String HelpOpen;
|
||||
public static String HelpGive;
|
||||
public static String HelpCreateDefaultGUI;
|
||||
public static String HelpReload;
|
||||
public static String GUIItemHelp_on;
|
||||
public static String GUIItemHelp_off;
|
||||
public static String GUIItemHelp_Slot;
|
||||
|
||||
public static void onSelect(String Prefix) {
|
||||
|
||||
send.debug(Main.plugin, "§4Select language...");
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
|
||||
File msg;
|
||||
|
||||
msg = new File(Main.getPath(), "languages/" + SelectConfig.language + "_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);
|
||||
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||
selectMSG = "english";
|
||||
} else selectMSG = SelectConfig.language;
|
||||
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
||||
|
||||
VaultNotSetUp = select("Plugin.VaultNotSetUp", yamlConfiguration_msg);
|
||||
SoundNotFound = select("Plugin.SoundNotFound", yamlConfiguration_msg);
|
||||
OnlyForPlayer = select("Plugin.OnlyForPlayer", yamlConfiguration_msg);
|
||||
DefaultGUIcreate = select("Plugin.DefaultGUI.create", yamlConfiguration_msg);
|
||||
ReloadStart = select("Plugin.Reload.Start", yamlConfiguration_msg);
|
||||
ReloadEnd = select("Plugin.Reload.End", yamlConfiguration_msg);
|
||||
|
||||
NoPermission = select("NoPermission.ForCommandGUI", yamlConfiguration_msg);
|
||||
NoPermissionForCommand = select("NoPermission.ForCommand", yamlConfiguration_msg);
|
||||
NoPermissionForUseItem = select("NoPermission.ForUseItem", yamlConfiguration_msg);
|
||||
NoPermissionForItem = select("NoPermission.ForItem", yamlConfiguration_msg);
|
||||
|
||||
ItemON = select("UseItem.UseItem_ON", yamlConfiguration_msg);
|
||||
ItemOFF = select("UseItem.UseItem_OFF", yamlConfiguration_msg);
|
||||
ItemSlot = select("UseItem.Change_Slot", yamlConfiguration_msg);
|
||||
ItemSlotNotEmpty = select("UseItem.SlotNotEmpty", yamlConfiguration_msg);
|
||||
ItemSlotAlreadySet = select("UseItem.SlotAlreadySet", yamlConfiguration_msg);
|
||||
ItemSlot_wrongValue = select("UseItem.ItemSlot_wrongValue", yamlConfiguration_msg);
|
||||
|
||||
Buy_msg = select("Cost.Buy_msg", yamlConfiguration_msg);
|
||||
No_money = select("Cost.No_money", yamlConfiguration_msg);
|
||||
NoInventorySpace = select("Cost.NoInventorySpace", yamlConfiguration_msg);
|
||||
|
||||
onServerChange = select("ServerChange.onServerChange", yamlConfiguration_msg);
|
||||
|
||||
GUInotFound = select("GUI.GUInotFound", yamlConfiguration_msg);
|
||||
GUIIsDisabled = select("GUI.GUIisDisabled", yamlConfiguration_msg);
|
||||
|
||||
Give_Sender = select("Give.Sender", yamlConfiguration_msg);
|
||||
Give_Receiver = select("Give.Receiver", yamlConfiguration_msg);
|
||||
|
||||
PlayerNotFond = select("Player.PlayerNotFond", yamlConfiguration_msg);
|
||||
PlayerNoInventorySpace = select("Player.PlayerNoInventorySpace", yamlConfiguration_msg);
|
||||
|
||||
HelpCgui = select("Help.CGUI", yamlConfiguration_msg);
|
||||
HelpHelp = select("Help.Help", yamlConfiguration_msg);
|
||||
HelpInfo = select("Help.Info", yamlConfiguration_msg);
|
||||
HelpOpen = select("Help.Open", yamlConfiguration_msg);
|
||||
HelpGive = select("Help.Give", yamlConfiguration_msg);
|
||||
HelpCreateDefaultGUI = select("Help.CreateDefaultGUI", yamlConfiguration_msg);
|
||||
HelpReload = select("Help.Reload", yamlConfiguration_msg);
|
||||
GUIItemHelp_on = select("Help.UseItem_On", yamlConfiguration_msg);
|
||||
GUIItemHelp_off = select("Help.UseItem_Off", yamlConfiguration_msg);
|
||||
GUIItemHelp_Slot = select("Help.UseItem_Slot", yamlConfiguration_msg);
|
||||
|
||||
|
||||
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
|
||||
private static String select(String path, YamlConfiguration yamlConfiguration){
|
||||
return Replace.replace(prefix,yamlConfiguration.getString(path));
|
||||
}
|
||||
}
|
@ -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,66 +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.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class YML {
|
||||
|
||||
private static Plugin plugin = Main.plugin;
|
||||
|
||||
public static File storage = new File(Main.getPath(), "Storage/gui-item.yml");
|
||||
public static YamlConfiguration yamlConfigurationStorage = YamlConfiguration.loadConfiguration(storage);
|
||||
|
||||
public static void setGuiitemOn(Player player) {
|
||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Playername", player.getName());
|
||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Status", true);
|
||||
|
||||
try {
|
||||
yamlConfigurationStorage.save(storage);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setGuiitemOff(Player player) {
|
||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Playername", player.getName());
|
||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Status", false);
|
||||
|
||||
try {
|
||||
yamlConfigurationStorage.save(storage);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setGuiitemSlot(Player player, Integer slot) {
|
||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Playername", player.getName());
|
||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Slot", slot);
|
||||
|
||||
try {
|
||||
yamlConfigurationStorage.save(storage);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean selectGuiitemOn(Player player){
|
||||
if (!yamlConfigurationStorage.contains(String.valueOf(player.getUniqueId()))) return true;
|
||||
return yamlConfigurationStorage.getBoolean(player.getUniqueId() + ".Status");
|
||||
}
|
||||
|
||||
|
||||
public static Integer selectSlot(Player player) {
|
||||
send.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")));
|
||||
return yamlConfigurationStorage.getInt(player.getUniqueId() + ".Slot");
|
||||
}
|
||||
}
|
@ -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"));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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
|
@ -1,74 +0,0 @@
|
||||
name: CommandGUI
|
||||
version: ${project.version}
|
||||
main: de.jatitv.commandguiv2.Spigot.Main
|
||||
api-version: 1.13
|
||||
prefix: CommandGUI
|
||||
authors: [ JaTiTV ]
|
||||
|
||||
softdepend:
|
||||
- T2CodeLib
|
||||
- Vault
|
||||
- PlaceholderAPI
|
||||
- PlotSquaredGUI
|
||||
- PlugManGUI
|
||||
|
||||
commands:
|
||||
commandgui:
|
||||
description: Open the CGUI
|
||||
aliases: [cgui, gui]
|
||||
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
|
@ -1,58 +0,0 @@
|
||||
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
|
||||
Item:
|
||||
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: §7https://discord.gg/vRyXFFterJ'
|
||||
CustomSound:
|
||||
Enable: false
|
||||
Sound: ''
|
||||
Cost:
|
||||
Enable: false
|
||||
Price: 0.0
|
||||
Command:
|
||||
Enable: false
|
||||
BungeeCommand: false
|
||||
CommandAsConsole: false
|
||||
Command:
|
||||
- ''
|
||||
ServerChange:
|
||||
Enable: false
|
||||
Server: ''
|
||||
OpenGUI:
|
||||
Enable: false
|
||||
GUI: ''
|
||||
Message:
|
||||
Enable: true
|
||||
Message:
|
||||
- '&6You can find more information on Discord: &ehttps://discord.gg/vRyXFFterJ'
|
||||
Permission:
|
||||
Required: false
|
@ -1,71 +0,0 @@
|
||||
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
|
||||
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:
|
||||
OnEveryLogin: true
|
||||
OnOnlyFirstLogin: true
|
||||
EXPERIMENTELL_ServerChhange: false
|
||||
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
|
@ -1,54 +0,0 @@
|
||||
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.'
|
||||
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!'
|
||||
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!'
|
||||
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/commandguiadmin info&8'''' &eCall the info from &4Command&9GUI &e.'
|
||||
Open: '&8''''&b/commandgui [gui]&8'''' &eOpen the GUI: &6[guiname]&e.'
|
||||
Give: '&8''''&b/commandguiadmin give &7<player>&8'''' &eGive a player the GUI item.'
|
||||
CreateDefaultGUI: '&8''''&b/commandguiadmin createdefaultgui&8'''' &eCreate a default
|
||||
GUI &7([directory])&e.'
|
||||
Reload: '&8''''&b/commandguiadmin 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.'
|
@ -1,56 +0,0 @@
|
||||
Plugin:
|
||||
VaultNotSetUp: '[prefix] &4Vault / Economy nicht eingerichtet!'
|
||||
SoundNotFound: '[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte [ue]berpr[ue]fe
|
||||
die Einstellungen.'
|
||||
OnlyForPlayer: '[prefix] &cDieser Command ist nur f[ue]r Spieler!'
|
||||
DefaultGUI:
|
||||
create: '[prefix] &2DefaultGUI wurde erstellt. Du findst sie im Verzeichnis: &e[directory]&2!'
|
||||
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!'
|
||||
ForUseItem: '[prefix] &cDir fehlt die Permission &6[perm] &cum das Item f[ue]r die
|
||||
GUI: &6[gui] &cnutzen zu k[oe]nnen.'
|
||||
ForItem: '[prefix] &cF[ue]r &b[item] &cfehlt dir die Permission &6[perm]&c!'
|
||||
UseItem:
|
||||
UseItem_ON: '[prefix] &2Du hast das GUI-Item aktiviert.'
|
||||
UseItem_OFF: '[prefix] &2Du hast das GUI-Item deaktiviert.'
|
||||
Change_Slot: '[prefix] &2Du hast das GUI-Item auf Slot &6[slot] &2umgestellt.'
|
||||
SlotNotEmpty: '[prefix] &6Der Slot §e[slot] §6ist derzeit belegt!.'
|
||||
SlotAlreadySet: '[prefix] &6Der Slot §e[slot] §6ist bereits eingestellt!'
|
||||
ItemSlot_wrongValue: '[prefix] &cDer angegebene Slot muss sich zwischen 1 und 9
|
||||
befinden!'
|
||||
Cost:
|
||||
Buy_msg: '[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft.'
|
||||
No_money: '[prefix] &cDu hast nicht gen[ue]gend Geld!'
|
||||
NoInventorySpace: '[prefix] &cDu hast keinen Platz in deinem Inventar!'
|
||||
ServerChange:
|
||||
onServerChange: '[prefix] &2Du wirst auf den Server §e[server] §2verbunden.'
|
||||
GUI:
|
||||
GUInotFound: '[prefix] &cDie von die gew[ae]hlte GUI gibt es nicht.'
|
||||
GUIisDisabled: '[prefix] &cDie GUI [gui] &cist derzeit Deaktiviert!'
|
||||
Give:
|
||||
Sender: '[prefix] &2Du hast &6[player] &2ein [item] &2gegeben!'
|
||||
Receiver: '[prefix] &2Du hast von &6[sender] &2, [item] &2bekommen!'
|
||||
Player:
|
||||
PlayerNotFond: '[prefix] &cDer Spieler &6[player] &cwurde nicht gefunden oder ist
|
||||
nicht Online!'
|
||||
PlayerNoInventorySpace: '[prefix] &6[player] &chat keinen freien Platz in seinem
|
||||
Inventar!'
|
||||
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.'
|
||||
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.'
|
||||
CreateDefaultGUI: '&8''''&b/commandguiadmin createdefaultgui&8'''' &eLasse eine
|
||||
default GUI erstellen &7([directory])&e.'
|
||||
Reload: '&8''''&b/commandguiadmin reload&8'''' &eLade das Plugin neu.'
|
||||
UseItem_On: '&8''''&b/gui-item on&8'''' &eAktiviere f[ue]r dich das GUIItem.'
|
||||
UseItem_Off: '&8''''&b/gui-item off&8'''' &eDeaktiviere f[ue]r dich das GUIItem.'
|
||||
UseItem_Slot: '&8''''&b/gui-item slot [slot]&8'''' &eSetze den Slot für GUIItem
|
||||
für Sie einstellen.'
|
@ -1,54 +0,0 @@
|
||||
Plugin:
|
||||
VaultNotSetUp: '[prefix] &4Vault / Økonomi har ikke blitt satt opp!'
|
||||
SoundNotFound: '[prefix] &4Lyden &6[sound] &4ble ikke bli funnet! Vennligst sjekk
|
||||
innstillingene.'
|
||||
OnlyForPlayer: '[prefix] &cDenne kommandoen er for spillere kun!'
|
||||
DefaultGUI:
|
||||
create: '[prefix] &2DefaultGUI har blitt laget. Du kan finne den i mappen: &e[directory]&2!'
|
||||
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!'
|
||||
ForUseItem: '[prefix] &cDu mangler tillatelsen &6[perm] &cfor å bruke gjenstanden
|
||||
i GUI: &6[gui].'
|
||||
ForItem: '[prefix] &cFor &b[item] &cmangler du tillatelsen &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] &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!'
|
||||
Cost:
|
||||
Buy_msg: '[prefix] &2Du kjøpte [itemname] &2for &6[price]&2.'
|
||||
No_money: '[prefix] &cDu har ikke nok penger!'
|
||||
NoInventorySpace: '[prefix] &cDu har ikke nok plass i inventaret ditt!'
|
||||
ServerChange:
|
||||
onServerChange: '[prefix] &2Du vil bli tilkoblet serveren &e[server]&2.'
|
||||
GUI:
|
||||
GUInotFound: '[prefix] &cGUIen som ble spesifisert finnes ikke.'
|
||||
GUIisDisabled: '[prefix] &cGUIen [gui] &cer slått av for øyeblikket!'
|
||||
Give:
|
||||
Sender: '[prefix] &2Du har gitt &6[player] &2en [item]&2!'
|
||||
Receiver: '[prefix] &2Du fikk &2, [item] &2fra &6[sender]!'
|
||||
Player:
|
||||
PlayerNotFond: '[prefix] &cSpilleren &6[player] &cble ikke funnet eller er ikke
|
||||
pålogget!'
|
||||
PlayerNoInventorySpace: '[prefix] &6[player] &char ikke nok plass i inventaret sitt!'
|
||||
Help:
|
||||
CGUI: '&8''''&b/commandgui &8| &b/cgui&8'''' &eÅpne default GUIen &7(&r[gui]&7)&e.'
|
||||
Help: '&8''''&b/commandguihelp&8'''' &eSender denne hjelpe meldingen.'
|
||||
Info: '&8''''&b/commandguiadmin info&8'''' &eKall informasjon fra &4Command&9GUI&e.'
|
||||
Open: '&8''''&b/commandgui [gui]&8'''' &eÅpne GUIen: &6[guiname]&e.'
|
||||
Give: '&8''''&b/commandguiadmin give &7<player>&8'''' &eGi en spiller GUI gjenstanden.'
|
||||
CreateDefaultGUI: '&8''''&b/commandguiadmin createdefaultgui&8'''' &eLag en normalverdi
|
||||
GUI &7([directory])&e.'
|
||||
Reload: '&8''''&b/commandguiadmin reload&8'''' &eLast inn pluginet på nytt.'
|
||||
UseItem_On: '&8''''&b/gui-item on&8'''' &eAktiverer en GUI gjenstand for deg.'
|
||||
UseItem_Off: '&8''''&b/gui-item off&8'''' &eDeaktiverer en GUI gjenstand for deg.'
|
||||
UseItem_Slot: '&8''''&b/gui-item slot [slot]&8'''' &eSett sporet for GUIItem for
|
||||
deg.'
|
Loading…
Reference in New Issue
Block a user