35 Commits

Author SHA1 Message Date
893f99c3e5 2.8.9
Bugfix: If the plugin was already converted to T2C-CommandGUI but still a plugin folder named CommandGUI was present, the original folder was overwritten.
Bugfix: If T2CodeLib was not installed, an unwanted error occurred
Bugfix: The permission 'commandgui.updatemsg' was wrongly registered as 'commandgui.updatemsgupdatemsg' and thus also recognized by Luckperm.
2022-07-29 15:16:52 +02:00
JaTiTV
16e6af2fd4 „README.md“ ändern 2022-07-27 20:41:34 +02:00
fa1af88777 2.8.8
This update fixes a security vulnerability where players with modified clients could intercept all commands.
This bug affects the proxy (Bungee, Waterfall etc.)!
2022-07-19 18:25:48 +02:00
JaTiTV
abe9cfbe76 Merge pull request '2.8.5_DEV' (#13) from 2.8.5_DEV into main
Reviewed-on: JaTiTV/CommandGUI#13
2022-07-19 18:20:24 +02:00
f947025afa 2.8.7 No Permission Lore, Function load fix 2022-07-09 17:25:59 +02:00
da4bd4975a 2.8.6
Bugfix: If in a function the CustomSound was deactivated, the message came that the CustomSound does not exist, if none was specified and if one was specified, the CustomSound was played additionally. This has been fixed.
2022-07-09 10:50:47 +02:00
621f626707 quick fix 2022-07-09 10:50:19 +02:00
78a0bd5f7e 2.8.5
- With this update the plugin has been renamed from 'CommandGUI' to 'T2C-CommandGUI'.
- The plugin folder is now called 'T2C-CommandGUI'.
- The commands 't2c-commandgui', 't2c-commandguihelp' and 't2c-commandgui-item' have been added
- A new tab 'NoPermission' has been added to the functions, where it is adjustable:
- Whether a message should be displayed if you click on the function but don't have permission for it.
- CustomNoPermMessage
- Whether a custom lore should be displayed if you don't have a permission for this function.
2022-07-09 09:13:10 +02:00
bdb6711907 Update pom.xml 2022-07-09 04:42:29 +02:00
2f114cca41 Update guiDeclaration.yml 2022-06-28 13:25:38 +02:00
d0277deeb8 Update guiDeclaration.yml 2022-06-28 13:25:19 +02:00
a6dff7e243 2.8.4 | Minor code changes
In this update minor code changes were made to better structure the interaction with T2CodeLib
2022-06-28 08:25:23 +02:00
e2e649aef2 Revert "„README.md“ ändern"
This reverts commit 7c7cd51cec.
2022-06-10 03:20:24 +02:00
JaTiTV
7c7cd51cec „README.md“ ändern 2022-06-10 03:20:08 +02:00
e7f5b00b31 Bugfix 2022-06-09 04:06:26 +02:00
57ba6e6687 add new defaultconfigs 2022-06-08 06:01:47 +02:00
d168a7afec fix 2022-06-08 05:56:05 +02:00
92d3e9a2d8 files with explanations
NEW: In case of a new installation, files with explanations are now also created in the plugin folder
2022-06-08 05:50:18 +02:00
b45895dff8 Update Util.java 2022-06-08 05:14:56 +02:00
c43a5fd90c 2.8.2
Changes:
- The structure of config.yml has been slightly changed (nothing needs to be changed as the settings paths remain the same)
- The code structure has been rebuilt / improved

Fix:
- Fixed an error that occurred when a player joined the sever and immediately left.
2022-06-08 05:11:26 +02:00
48c06696ef 2.8.1
Bugfix for the AdminSubCommand option
2022-06-07 20:20:26 +02:00
16123ec578 2.8.1
Bugfix for the AdminSubCommand option
2022-06-07 20:16:50 +02:00
JaTiTV
7f2b346f7b Merge pull request '2.8.0-Voting' (#12) from 2.8.0-Voting into main
Reviewed-on: JaTiTV/CommandGUI#12
2022-06-07 20:16:33 +02:00
c590255d38 Update pom.xml
Development status in the version removed
2022-06-07 06:10:48 +02:00
5d646fce48 2.8.0 | VotePoints for payment, Items for payment and other new features
In this update more options to pay for the functions like Vote Points (VotingPlugin) and Items have been added.
Also, 2 completely new functions have been added to give or remove both Vote Points and Items to the player.
2022-06-07 06:09:37 +02:00
5b089a57d8 rename folder 2022-06-06 17:28:43 +02:00
87d0f75a4c Merge branch 'main' of https://git.t2code.net/JaTiTV/CommandGUI 2022-06-02 12:30:31 +02:00
6f3da3e3f4 2.7.7
Fixed a bug that prevented the plugin from loading on the bungee.
2022-06-02 12:29:53 +02:00
JaTiTV
80255a60eb Merge pull request 'mysql-crash' (#11) from mysql-crash into main
Reviewed-on: JaTiTV/CommandGUI#11
2022-06-02 12:29:17 +02:00
f6860e9ab5 2.7.6
Critical bugfix: MySQL had a server crash
Fix: The message when disabling the GUIItem was not displayed
2022-06-01 13:32:53 +02:00
ebbec1f660 2.7.6_DEV 2022-06-01 13:23:53 +02:00
JaTiTV
5674b54593 Merge pull request '2.7.5' (#10) from 2.7.5 into main
Reviewed-on: JaTiTV/CommandGUI#10
2022-06-01 00:15:35 +02:00
381afeba89 2.7.5
Added the option for hover & clickable messages for players.
2022-06-01 00:01:15 +02:00
19822f7024 2.7.4 | MySQL Bugfix
MySQL Bugfix
```
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS `Slot` INT(1) NULL DEFAULT NULL AFTER `Status`' at line 1
```
And minor code changes
2022-05-28 21:46:04 +02:00
ed810f31d7 Update pom.xml 2022-05-17 21:25:53 +02:00
71 changed files with 3525 additions and 1537 deletions

View File

@@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId>
<version>2.7.3</version>
<version>2.8.9</version>
<packaging>jar</packaging>
<name>CommandGUI</name>
@@ -53,10 +53,7 @@
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<!-- repo.t2code / T2Code -->
<repository>
<id>Builders-Paradise</id>
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
@@ -65,6 +62,7 @@
<id>T2Code</id>
<url>https://repo.t2code.net/repository/T2Code/</url>
</repository>
<!-- placeholderAPI -->
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
@@ -72,26 +70,12 @@
</repositories>
<dependencies>
<!-- repo.t2code / T2Code -->
<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>11.6</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>LuckyBox-API</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_16.r2</groupId>
<artifactId>spigot</artifactId>
@@ -107,6 +91,29 @@
<artifactId>spigot</artifactId>
<version>1.8r1</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>PlugmanGUI</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>12.4</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>LuckyBox-API</artifactId>
<version>4.2.2</version>
</dependency>
<!-- placeholderAPI -->
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
@@ -122,11 +129,6 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.22</version>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@@ -1,40 +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 java.io.File;
import java.io.IOException;
public class BConfig {
public static void create() throws IOException {
File config = new File(BMain.plugin.getDataFolder(), "config.yml");
if (!BMain.plugin.getDataFolder().exists()) BMain.plugin.getDataFolder().mkdir();
if (!config.exists()) {
config.createNewFile();
}
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
configuration.set("MySQL.Enable", false);
configuration.set("MySQL.IP", "localhost");
configuration.set("MySQL.Port", 3306);
configuration.set("MySQL.Database", "database");
configuration.set("MySQL.User", "user");
configuration.set("MySQL.Password", "");
configuration.set("MySQL.SSL", false);
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config);
BMySQL.Enable = configuration.getBoolean("MySQL.Enable");
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");
}
}

View File

@@ -8,7 +8,6 @@ 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;
@@ -17,7 +16,7 @@ public class BListener implements Listener {
@EventHandler
public void onPluginmessage(PluginMessageEvent event) {
if (event.getTag().equalsIgnoreCase("cgui:bungee")) {
event.setCancelled(true);
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
try {
String channel = stream.readUTF();
@@ -42,25 +41,12 @@ public class BListener implements Listener {
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) {

View File

@@ -5,7 +5,6 @@ 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.util.logging.Level;
public final class BMain extends Plugin {
@@ -42,31 +41,11 @@ public final class BMain extends Plugin {
Bsend.console(prefix + " §2Version: §6" + version);
Bsend.console(prefix + " §2Spigot: §6" + spigot);
Bsend.console(prefix + " §2Discord: §6" + discord);
/* try {
BConfig.create();
} catch (IOException e) {
e.printStackTrace();
}
*/
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" +
";");
}
*/
BMetrics.Bstats();
Bsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
Bsend.console(prefix + "§4==============================================================================");
@@ -90,7 +69,7 @@ public final class BMain extends Plugin {
Bsend.console(prefix + "§4==============================================================================");
}
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
if (ProxyServer.getInstance().getPluginManager().getPlugin(pl) == null) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
@@ -99,10 +78,19 @@ public final class BMain extends Plugin {
BMain.plugin.onDisable();
return true;
} else {
if (Double.parseDouble(ProxyServer.getInstance().getPluginManager().getPlugin(pl).getDescription().getVersion()) < ver) {
String plVer = ProxyServer.getInstance().getPluginManager().getPlugin(pl).getDescription().getVersion();
if (ver.contains("_")) {
if (!plVer.equals(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2" + ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
return true;
}
return false;
}
String[] split = plVer.split("_");
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().sendMessage(prefix + " §e" + pl + " §4is out of date! This plugin requires at least version §2" + ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to use this version of " + plugin.getDescription().getName() + ".");
// BMain.plugin.getPluginLoader().disablePlugin(BMain.plugin);
BMain.plugin.onDisable();
return true;
}

View File

@@ -27,6 +27,8 @@ import java.util.logging.Level;
import java.util.stream.Collectors;
import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HttpsURLConnection;
import de.jatitv.commandguiv2.Util;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
@@ -34,6 +36,11 @@ import net.md_5.bungee.config.YamlConfiguration;
public class BMetrics {
public static void Bstats() {
int pluginId = Util.getBstatsID(); // <-- Replace with the id of your plugin!
BMetrics metrics = new BMetrics(BMain.plugin, pluginId);
}
private final Plugin plugin;
private final MetricsBase metricsBase;

View File

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

View File

@@ -1,279 +0,0 @@
package de.jatitv.commandguiv2.Spigot.Listener;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.system.Bungee_Sender_Reciver;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.system.Papi;
import de.jatitv.commandguiv2.Spigot.system.Placeholder;
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.replace.Replace;
import net.t2code.lib.Spigot.Lib.vault.Vault;
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.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
import java.io.IOException;
public class GUIListener implements Listener {
private static String prefix = Util.getPrefix();
public static String GUICode;
private static Plugin plugin = Main.plugin;
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
Player player = (Player) e.getWhoClicked();
JavaPlugin plugin = Main.plugin;
if (e.getInventory() == null) return;
if (e.getCurrentItem() == null) return;
for (Gui gui : Main.guiHashMap.values()) {
if (player.getOpenInventory().getTitle().equals(Replace.replace(prefix, GUICode + gui.guiName))
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(Replace.replace(prefix, player, GUICode + gui.guiName)))) {
e.setCancelled(true);
for (Slot slot : gui.slots) {
Function function = Main.functionHashMap.get(slot.function);
if (e.getSlot() != slot.slot) continue;
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name))
.replace("[perm]", slot.permissionToUse));
continue;
}
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == ItemVersion.getGreenWool().getType() ||
e.getCurrentItem().getType() == ItemVersion.getRedWool().getType() ||
e.getCurrentItem().getType() == Material.valueOf(function.item.toUpperCase().replace(".", "_"))) {
if (!slot.enable) continue;
if (function.cost_Enable) {
if (function.command_Enable || function.message_Enable || function.openGUI_Enable || function.serverChange) {
if (!Vault.buy(prefix, player, function.price)) {
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 {
player.sendMessage(SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
.replace("[price]", function.price + " " + SelectConfig.Currency));
execute(function, slot, player, e, gui);
}
}
} else {
execute(function, slot, player, e, gui);
}
}
}
}
}
}
private static void execute(Function function, Slot slot, Player player, InventoryClickEvent e, Gui gui) {
if (function.togglePermission) togglePerm(function, gui, player);
if (function.toggleUseItem) toggleUseItem(player, gui);
if (function.command_Enable) command(function, player);
if (function.openGUI_Enable) openGUI(function, player);
if (function.message_Enable) message(function, player);
if (function.serverChange) serverChange(function, player);
if (function.setConfigEnable) setConfig(function, player, e);
if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) sound(function, slot, player, gui);
}
private static void command(Function slot, Player player) {
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, cmd.replace("[player]", player.getName()), slot.commandAsConsole);
}
} 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 {
for (String cmd : slot.command) {
if (slot.commandAsConsole) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
} else player.chat("/" + cmd.replace("[player]", player.getName()));
}
}
}
}.runTaskLater(plugin, 2L);
}
private static void openGUI(Function slot, Player player) {
player.closeInventory();
new BukkitRunnable() {
@Override
public void run() {
OpenGUI.openGUI(player, slot.openGUI, true);
}
}.runTaskLater(plugin, 1L);
}
private static void message(Function slot, Player player) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
for (String msg : slot.message) {
if (Main.PaPi) {
if (slot.cost_Enable) {
player.sendMessage(Replace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.Currency));
} else player.sendMessage(Replace.replace(prefix, player, Placeholder.replace(msg, player)));
} else {
if (slot.cost_Enable) {
player.sendMessage(Replace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.Currency));
} else player.sendMessage(Replace.replace(prefix, Placeholder.replace(msg, player)));
}
}
}
private static void serverChange(Function slot, Player player) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
send.player(player, SelectMessages.onServerChange.replace("[server]", slot.serverChangeServer));
new BukkitRunnable() {
@Override
public void run() {
ServerChange.send(player, slot.serverChangeServer);
}
}.runTaskLater(Main.plugin, 20L);
}
private static void setConfig(Function slot, Player player, InventoryClickEvent e) {
File config = new File(slot.configFilePath);
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (e.getClick() == ClickType.LEFT) {
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.getClick() == ClickType.RIGHT) {
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);
}
private static void sound(Function function, Slot slot, Player player, Gui gui) {
if (function.customSound_Enable) {
if (!function.customSound_NoSound) {
try {
player.playSound(player.getLocation(), Sound.valueOf(function.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.guiName) + "§r §6Slot: §e" + slot.slot + " §6CustomSound: §9" + function.customSound_Sound));
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
}
}
} else player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
}
private static void togglePerm(Function function, Gui gui, Player player) {
if (player.hasPermission(function.togglePermissionPerm)) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.togglePermFalse.replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
OpenGUI.openGUI(player, gui.key, false);
}
}.runTaskLater(plugin, 4L);
} else
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.togglePermTrue.replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
OpenGUI.openGUI(player, gui.key, false);
}
}.runTaskLater(plugin, 4L);
}
private static void toggleUseItem(Player player, Gui gui) {
if (Events.useItemHashMap.get(player.getName())) {
Commands.itemOff(player);
} else {
Commands.itemOn(player);
}
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
OpenGUI.openGUI(player, gui.key, false);
}
}.runTaskLater(plugin, 2L);
}
}

View File

@@ -1,79 +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.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import de.jatitv.commandguiv2.Util;
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();
SelectDatabase.nameCheck(player);
UpdateAPI.join(Main.plugin,prefix, "commandgui.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord());
}
@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, false);
}
}

View File

@@ -4,7 +4,7 @@ package de.jatitv.commandguiv2.Spigot;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.system.Load;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
import de.jatitv.commandguiv2.Spigot.database.MySQL;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send;
@@ -18,7 +18,6 @@ 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 {
@@ -31,16 +30,12 @@ public final class Main extends JavaPlugin {
private static Boolean enable = false;
public static Boolean legacy = false;
public static String prefix = "§8[§4C§9GUI§8]";
public static String version;
public static List<String> autor;
public static Main plugin;
public static List plugins;
private static Main plugin;
public static String update_version = null;
public static Boolean PaPi = false;
public static Boolean PlotSquaredGUI = false;
public static Boolean LuckyBox = false;
@@ -53,34 +48,46 @@ public final class Main extends JavaPlugin {
@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();
autor = this.getDescription().getAuthors();
version = this.getDescription().getVersion();
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
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 || NMSVersion.v1_16_R1) {
legacy = true;
}
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
if (PluginCheck.pluginCheck("CommandGUI")) {
send.error(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.error(this, "");
send.error(this, "An older version of the plugin T2C-CommandGUI was found!");
send.error(this, "This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
send.error(this, "Please remove the older version (CommandGUI)!");
send.error(this, this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
send.error(this, "");
send.error(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
return;
}
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
if (PluginCheck.papi()) {
PaPi = true;
}
Load.onLoad(prefix, autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
enable = true;
}
public static void addonLoad() {
if (PluginCheck.plotSquaredGUI()) {
PlotSquaredGUI = true;
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
}if (PluginCheck.luckyBox()) {
}
if (PluginCheck.luckyBox()) {
LuckyBox = true;
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
}
if (PluginCheck.plugManGUI()) {
PlugManGUI = true;
addonEnable(Bukkit.getPluginManager().getPlugin("PlugManGUI"));
@@ -88,30 +95,35 @@ public final class Main extends JavaPlugin {
}
public static void addonEnable(Plugin plugin) {
send.console(prefix + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
send.console(Util.getPrefix() + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
}
public static Boolean pluginNotFound(String pl, Integer spigotID) {
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
Bukkit.getConsoleSender().sendMessage(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.");
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
+ "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
return true;
} else {
if (Double.parseDouble(Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion()) < ver) {
String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
if (ver.contains("_")) {
if (!plVer.equals(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
Bukkit.getConsoleSender().sendMessage(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() + ".");
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
+ ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
+ pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
return true;
}
return false;
}
String[] split = plVer.split("_");
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2"
+ ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID
+ " §4to use this version of " + plugin.getDescription().getName() + ".");
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
return true;
}
@@ -119,10 +131,18 @@ public final class Main extends JavaPlugin {
}
}
public static void sendTryCatch(Class c, StackTraceElement line) {
send.error(plugin, c.getName() + " Line: " + line.getLineNumber());
}
@Override
public void onDisable() {
// Plugin shutdown logic
if (enable) T2CodeTemplate.onDisable(prefix, autor, version, Util.getSpigot(), Util.getDiscord());
if (enable) T2CodeTemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
MySQL.close();
}
public static Main getPlugin() {
return plugin;
}
}

View File

@@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.system.Debug;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Util;
@@ -17,7 +17,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
private static String prefix = Util.getPrefix();
@Override
@@ -30,7 +30,7 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
Player player = (Player) sender;
Commands.gui(player);
} else {
if (args[0].equals("admin")) {
if (args[0].equals(SelectConfig.getAdminSubCommand())) {
if (args.length == 1) {
Help.sendHelp(sender, prefix);
return false;
@@ -61,24 +61,6 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
} 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")) {
@@ -124,7 +106,7 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
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, 0, SelectConfig.getAdminSubCommand(), 1, args, arg2);
Tab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
// if (args.length == 1) {
@@ -154,18 +136,5 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
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;
}
}

View File

@@ -22,13 +22,13 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
Player player = (Player) sender;
if (sender.hasPermission("commandgui.useitem.toggle")) {
if (args.length == 0) {
if (SelectConfig.UseItem_AllowToggle) {
Help.sendGUIItemHelp(sender, prefix);
if (SelectConfig.getUseItem_AllowToggle()) {
Help.sendGUIItemHelp(sender);
} else send.sender(sender, "§4UseItem toggle is disabled!");// todo
} else {
if (args.length == 1 || args.length == 2) {
if (sender instanceof Player) {
if (SelectConfig.UseItem_AllowToggle) {
if (SelectConfig.getUseItem_AllowToggle()) {
switch (args[0].toLowerCase()) {
case "on":
Commands.itemOn(player);
@@ -65,7 +65,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
put("on", "commandgui.useitem.toggle");
put("off", "commandgui.useitem.toggle");
if (SelectConfig.UseItem_AllowSetSlot) {
if (SelectConfig.getUseItem_AllowSetSlot()) {
put("slot", "commandgui.useitem.toggle");
}
}};
@@ -74,7 +74,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
List<String> list = new ArrayList<>();
if (sender instanceof Player) {
if (SelectConfig.UseItem_AllowToggle) {
if (SelectConfig.getUseItem_AllowToggle()) {
Player p = (Player) sender;
if (args.length == 1) {
for (String command : arg1.keySet()) {

View File

@@ -1,27 +1,25 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.system.UseItem;
import de.jatitv.commandguiv2.Spigot.config.config.ConfigCreate;
import de.jatitv.commandguiv2.Spigot.useItem.UseItem;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.LanguagesCreate;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.sound.Sound;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
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 java.util.Objects;
@@ -32,10 +30,10 @@ public class Commands {
send.player(player, Util.getPrefix() + "§4======= §8[§4Command§9GUI§8] §4=======");
send.player(player, Util.getPrefix() + " §2Autor: §6" + String.valueOf(Main.autor).replace("[", "").replace("]", ""));
if (UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion.equalsIgnoreCase(Main.version)) {
if (UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion.equalsIgnoreCase(Main.version)) {
send.player(player, Util.getPrefix() + " §2Version: §6" + Main.version);
} else {
UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion, player);
UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion, player);
}
send.player(player, Util.getPrefix() + " §2Spigot: §6" + Util.getSpigot());
@@ -45,10 +43,10 @@ public class Commands {
send.sender(sender, Util.getPrefix() + "§4======= §8[§4Command§9GUI§8] §4=======");
send.sender(sender, Util.getPrefix() + " §2String.valueOf(Main.autor): §6" + String.valueOf(String.valueOf(Main.autor)).replace("[", "").replace("]", ""));
if (UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion.equalsIgnoreCase(Main.version)) {
if (UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion.equalsIgnoreCase(Main.version)) {
send.sender(sender, Util.getPrefix() + " §2Version: §6" + Main.version);
} else {
UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion);
}
send.sender(sender, Util.getPrefix() + " §2Spigot: §6" + Util.getSpigot());
@@ -62,15 +60,15 @@ public class Commands {
send.console(Util.getPrefix() + "§8-------------------------------");
send.console(Util.getPrefix() + " §6Plugin reload...");
send.console(Util.getPrefix() + "§8-------------------------------");
CmdExecuter_GUITab.arg1.clear();
CmdExecuter_GUITab.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
SelectConfig.onSelect();
Main.plugin.reloadConfig();
if (!Objects.equals(SelectDatabase.getStorage().toString(), SelectConfig.storage)) {
Main.getPlugin().reloadConfig();
CmdExecuter_GUI.arg1.clear();
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
if (!Objects.equals(SelectDatabase.getStorage().toString(), SelectConfig.getStorage())) {
if (sender instanceof Player) send.sender(sender, "You have changed the storage medium! To apply this change, you must restart the server!");
send.console("You have changed the storage medium! To apply this change, you must restart the server!");
send.warning(Main.getPlugin(), "You have changed the storage medium! To apply this change, you must restart the server!");
}
LanguagesCreate.langCreate();
@@ -90,8 +88,8 @@ public class Commands {
e.printStackTrace();
}
if (SelectConfig.Bungee) {
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "commandgui:bungee");
if (SelectConfig.getBungee()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.getPlugin(), "commandgui:bungee");
}
@@ -104,29 +102,24 @@ public class Commands {
public static void give(CommandSender sender, Player target) {
if (Bukkit.getPlayer(target.getName()) != null) {
UseItem.giveUseItem(target);
send.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", SelectConfig.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);
}
send.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
send.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
Sound.play(target, SoundEnum.Give);
} 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);
}
if (sender instanceof Player) Sound.play((Player) sender, SoundEnum.PlayerNotFound);
}
}
public static void itemOn(Player player) {
UseItem.removeItem(player);
Integer slot = null;
if (SelectConfig.UseItem_InventorySlotEnforce) {
slot = SelectConfig.UseItem_InventorySlot;
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
slot = SelectConfig.getUseItem_InventorySlot();
} else {
slot = Events.useItemSlotHashMap.get(player.getName());
}
send.debug(Main.plugin, String.valueOf(slot));
send.debug(Main.getPlugin(), String.valueOf(slot));
if (player.getInventory().getItem(slot - 1) == null) {
SelectDatabase.setItemStatusTrue(player);
UseItem.giveUseItem(player);
@@ -143,10 +136,8 @@ public class Commands {
UseItem.addUseItem(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);
}
send.player(player, SelectMessages.NoInventorySpace);
Sound.play(player,SoundEnum.NoInventorySpace);
}
}
}
@@ -154,11 +145,12 @@ public class Commands {
public static void itemOff(Player player) {
SelectDatabase.setItemStatusFalse(player);
UseItem.removeItem(player);
send.player(player, SelectMessages.ItemOFF);
}
public static void onSetSlot(Player player, Integer setSlot) {
if (!SelectConfig.UseItem_AllowSetSlot) {
player.sendMessage(Util.getPrefix() + " §4Function disabled");
if (!SelectConfig.getUseItem_AllowSetSlot()) {
send.player(player, Util.getPrefix() + " §4Function disabled");
return;
}
@@ -173,12 +165,12 @@ public class Commands {
if (Events.useItemHashMap.get(player.getName())) {
if (Objects.equals(Events.useItemSlotHashMap.get(player.getName()), setSlot)) {
player.sendMessage(SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
send.player(player, SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
return;
}
}
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(setSlot - 1) != null) {
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(setSlot - 1) != null) {
send.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
return;
}
@@ -195,14 +187,14 @@ public class Commands {
}
public static void gui(Player player) {
if (Main.guiHashMap.containsKey(SelectConfig.DefaultGUI)) {
Gui gui = Main.guiHashMap.get(SelectConfig.DefaultGUI);
if (Main.guiHashMap.containsKey(SelectConfig.getDefaultGUI())) {
Gui gui = Main.guiHashMap.get(SelectConfig.getDefaultGUI());
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, SelectConfig.DefaultGUI, true);
} else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
OpenGUI.openGUI(player, SelectConfig.getDefaultGUI(), true);
} else send.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
.replace("[perm]", "commandgui.command"));
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
} else send.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
}
}
@@ -212,9 +204,9 @@ public class Commands {
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, arg, true);
} else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.key)
} else send.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.key)
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.key));
} else player.sendMessage(SelectMessages.GUInotFound);
} else send.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.key));
} else send.player(player, SelectMessages.guiNotFound);
}
}

View File

@@ -8,43 +8,104 @@ 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;
import org.bukkit.entity.Player;
public class Help {
private static String prefix = Util.getPrefix();
public static void sendHelp(CommandSender sender, String Prefix) {
Gui gui = Main.guiHashMap.get(SelectConfig.getDefaultGUI());
send.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
if (sender.hasPermission("commandgui.command")) {
Gui gui = Main.guiHashMap.get(SelectConfig.DefaultGUI);
send.sender(sender, Prefix + " " + SelectMessages.HelpCgui.replace("[gui]", Replace.replace(prefix,gui.guiName)));
for (String alias : Main.allAliases) {
if (Main.guiHashMap.get(alias).guiEnable || sender.hasPermission("commandgui.bypass")) {
send.sender(sender, Prefix + " " + SelectMessages.HelpOpen.replace("[gui]", alias).replace("[guiname]", Replace.replace(prefix,Main.guiHashMap.get(alias).guiName)));
}
}
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.admin")) {
send.sender(sender, Prefix + " " + SelectMessages.HelpCreateDefaultGUI.replace("[directory]", Main.getPath()+ "\\GUIs\\default.yml"));
send.sender(sender, Prefix + " " + SelectMessages.HelpReload);
}
cgui(sender, gui);
open(sender);
help(sender);
gUIItemHelp(sender);
info(sender);
give(sender);
createDefaultGUI(sender);
reload(sender);
send.sender(sender, Prefix + " §8-------------------------");
}
public static void sendGUIItemHelp(CommandSender sender, String Prefix) {
private static void cgui(CommandSender sender, Gui gui) {
if (!sender.hasPermission("commandgui.command")) return;
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpCgui.replace("[gui]", Replace.replace(prefix, gui.guiName)));
} else send.sender(sender, prefix + " " + SelectMessages.HelpCgui.replace("[gui]", Replace.replace(prefix, gui.guiName)));
}
private static void open(CommandSender sender) {
if (!sender.hasPermission("commandgui.command")) return;
for (String alias : Main.allAliases) {
if (Main.guiHashMap.get(alias).guiEnable || sender.hasPermission("commandgui.bypass")) {
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpOpen.replace("[gui]", alias).replace("[guiname]", Replace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
} else
send.sender(sender, prefix + " " + SelectMessages.HelpOpen.replace("[gui]", alias).replace("[guiname]", Replace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
}
}
}
private static void help(CommandSender sender) {
if (!sender.hasPermission("commandgui.command")) return;
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpHelp);
} else send.sender(sender, prefix + " " + SelectMessages.HelpHelp);
}
private static void info(CommandSender sender) {
if (!sender.hasPermission("commandgui.command.info")) return;
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpInfo);
} else send.sender(sender, prefix + " " + SelectMessages.HelpInfo);
}
private static void give(CommandSender sender) {
if (!sender.hasPermission("commandgui.admin")) return;
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpGive);
} else send.sender(sender, prefix + " " + SelectMessages.HelpGive);
}
private static void createDefaultGUI(CommandSender sender) {
if (!sender.hasPermission("commandgui.admin")) return;
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpCreateDefaultGUI.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
} else send.sender(sender, prefix + " " + SelectMessages.HelpCreateDefaultGUI.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
}
private static void reload(CommandSender sender) {
if (!sender.hasPermission("commandgui.admin")) return;
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpReload);
} else send.sender(sender, prefix + " " + SelectMessages.HelpReload);
}
public static void gUIItemHelp(CommandSender sender) {
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerGUIItemHelp_on);
} else send.sender(sender, prefix + " " + SelectMessages.GUIItemHelp_on);
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerGUIItemHelp_off);
} else send.sender(sender, prefix + " " + SelectMessages.GUIItemHelp_off);
if (sender instanceof Player) {
send.player((Player) sender, prefix + " " + SelectMessages.PlayerGUIItemHelp_Slot);
} else send.sender(sender, prefix + " " + SelectMessages.GUIItemHelp_Slot);
}
public static void sendGUIItemHelp(CommandSender sender) {
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------------------------------");
send.sender(sender, prefix + " §8------ §4Command§9GUI§2Item §chelp §8------");
gUIItemHelp(sender);
send.sender(sender, prefix + " §8------------------------------");
}
}
}

View File

@@ -13,12 +13,10 @@ import java.lang.reflect.Field;
public class AliasRegister {
public static void onRegister() {
Plugin plugin = Main.plugin;
Plugin plugin = Main.getPlugin();
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.getSpigot() + " §4No GUI files available");
send.console(Util.getPrefix() + " §4No GUI files available");
return;
}
for (String alias : Main.allAliases) {
@@ -26,15 +24,12 @@ public class AliasRegister {
if (Main.guiHashMap.get(alias).commandAliasEnable) {
try {
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
bukkitCommandMap.setAccessible(true);
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
commandMap.register(alias, new RegisterCommand(alias));
} catch(Exception e) {
e.printStackTrace();
}
//Register.register(alias, plugin);
}
}
}

View File

@@ -5,6 +5,7 @@ import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -26,9 +27,9 @@ public class RegisterCommand extends Command {
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, alias, true);
} else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
} else send.player(player,SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
.replace("[perm]", "commandgui.command." + alias));
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
} else send.player(player,SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
} else sender.sendMessage("§8[§6Command§9GUI§8] §cThis command is only for players!");
return true;
}

View File

@@ -22,8 +22,8 @@ public class ConfigCreate {
public static void configCreate() {
long long_ = 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...");
if (Main.getPlugin().getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
} else send.console(Util.getPrefix() + " §4config.yml are created...");
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
@@ -32,6 +32,7 @@ public class ConfigCreate {
Config.set("Plugin.Debug", false, yamlConfiguration);
Config.set("Plugin.HelpAlias", true, yamlConfiguration);
Config.set("Plugin.AdminSubCommand", "admin", yamlConfiguration);
Config.set("Plugin.language", "english", yamlConfiguration);
Config.set("Plugin.Currency", "$", yamlConfiguration);
Config.set("Plugin.DefaultGUI", "default", yamlConfiguration);
@@ -92,47 +93,6 @@ public class ConfigCreate {
Config.set("UseItem.Join.Cursor.ToGUIItem.Spigot.OnOnlyFirstLogin", true, yamlConfiguration);
Config.set("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", false, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Change.Enable", true, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Change.DelayInTicks", 1, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.Enable", false, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.Mode", "blacklist", yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.List", Arrays.asList("CREATIVE", "Spectator"), yamlConfiguration);
Config.set("Advanced.UseItem.World.Change.Enable", true, yamlConfiguration);
Config.set("Advanced.UseItem.World.Change.DelayInTicks", 1, yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.Enable", false, yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.Mode", "blacklist", yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), yamlConfiguration);
/*
Config.set("Advanced.UseItem.ItemBlockBlacklist", Arrays.asList("CHEST", "TRAPPED_CHEST", "FURNACE", "NOTE_BLOCK",
"CRAFTING_TABLE", "ENDER_CHEST", "ANVIL", "LOOM", "COMPOSTER", "BARREL", "SMOKER",
"BLAST_FURNACE", "CARTOGRAPHY_TABLE", "FLETCHING_TABLE", "GRINDSTONE", "SMITHING_TABLE", "STONECUTTER",
"HOPPER", "DISPENSER", "DROPPER", "REPEATER", "COMPARATOR", "LEVER", "DAYLIGHT_DETECTOR",
"STONE_BUTTON", "OAK_BUTTON", "SPRUCE_BUTTON", "BIRCH_BUTTON", "JUNGLE_BUTTON", "ACACIA_BUTTON", "DARK_OAK_BUTTON", "CRIMSON_BUTTON",
"IRON_DOOR", "OAK_DOOR", "SPRUCE_DOOR", "BIRCH_DOOR", "JUNGLE_DOOR", "ACACIA_DOOR", "DARK_OAK_DOOR", "CRIMSON_DOOR", "WARPED_DOOR",
"OAK_FENCE", "SPRUCE_FENCE", "BIRCH_FENCE", "JUNGLE_FENCE", "ACACIA_FENCE", "DARK_OAK_FENCE", "CRIMSON_FENCE", "WARPED_FENCE", "NETHER_BRICK_FENCE"), yamlConfiguration);
*/
if (!yamlConfiguration.contains("Advanced.UseItem.ItemBlockBlacklist")) {
List<String> materialList = Arrays.asList("BUTTON", "DOOR", "FENCE", "CHEST", "FURNACE", "NOTE_BLOCK", "CRAFTING_TABLE", "WORKBENCH",
"ANVIL", "LOOM", "COMPOSTER", "BARREL", "SMOKER", "BLAST_FURNACE", "CARTOGRAPHY_TABLE", "FLETCHING_TABLE", "GRINDSTONE",
"SMITHING_TABLE", "STONECUTTER", "HOPPER", "DISPENSER", "DROPPER", "REPEATER", "COMPARATOR", "LEVER", "DAYLIGHT_DETECTOR", "BREWING_STAND", "TRAPDOOR", "BEACON"
);
List<String> materialBlacklist = new ArrayList<>();
for (Material material : Material.values()) {
for (String target : materialList) {
if (material.toString().contains(target)) materialBlacklist.add(material.toString());
}
}
Config.set("Advanced.UseItem.ItemBlockBlacklist", materialBlacklist, yamlConfiguration);
}
Config.set("Toggle.Items.OnOrYes.Item.Base64.Enable", false, yamlConfiguration);
Config.set("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", yamlConfiguration);
if (Main.legacy) {
@@ -191,11 +151,40 @@ public class ConfigCreate {
Config.set("Sound.PlayerNotFound.Sound", "BLOCK_NOTE_HARP", yamlConfiguration);
} else Config.set("Sound.PlayerNotFound.Sound", "BLOCK_NOTE_BLOCK_HARP", yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Change.Enable", true, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Change.DelayInTicks", 1, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.Enable", false, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.Mode", "blacklist", yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.List", Arrays.asList("CREATIVE", "Spectator"), yamlConfiguration);
Config.set("Advanced.UseItem.World.Change.Enable", true, yamlConfiguration);
Config.set("Advanced.UseItem.World.Change.DelayInTicks", 1, yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.Enable", false, yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.Mode", "blacklist", yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), yamlConfiguration);
if (!yamlConfiguration.contains("Advanced.UseItem.ItemBlockBlacklist")) {
List<String> materialList = Arrays.asList("BUTTON", "DOOR", "FENCE", "CHEST", "FURNACE", "NOTE_BLOCK", "CRAFTING_TABLE", "WORKBENCH",
"ANVIL", "LOOM", "COMPOSTER", "BARREL", "SMOKER", "BLAST_FURNACE", "CARTOGRAPHY_TABLE", "FLETCHING_TABLE", "GRINDSTONE",
"SMITHING_TABLE", "STONECUTTER", "HOPPER", "DISPENSER", "DROPPER", "REPEATER", "COMPARATOR", "LEVER", "DAYLIGHT_DETECTOR", "BREWING_STAND", "TRAPDOOR", "BEACON"
);
List<String> materialBlacklist = new ArrayList<>();
for (Material material : Material.values()) {
for (String target : materialList) {
if (material.toString().contains(target)) materialBlacklist.add(material.toString());
}
}
Config.set("Advanced.UseItem.ItemBlockBlacklist", materialBlacklist, 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_) + "ms");
send.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}

View File

@@ -3,7 +3,6 @@ package de.jatitv.commandguiv2.Spigot.config.config;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
@@ -17,101 +16,6 @@ import java.util.ArrayList;
import java.util.List;
public class SelectConfig {
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 Boolean UseItemGameModeChangeEnable;
public static int UseItemGameModeChangeDelayInTicks;
public static Boolean UseItemGameModeProtection;
public static Boolean UseItemGameModeRemoveItemWhenItIsDisabled;
public static String UseItemGameModeMode;
public static List<String> UseItemGameModeList;
public static Boolean UseItemWorldChangeEnable;
public static int UseItemWorldChangeDelayInTicks;
public static Boolean UseItemWorldProtection;
public static Boolean UseItemWorldRemoveItemWhenItIsDisabled;
public static String UseItemWorldMode;
public static List<String> UseItemWorldList;
public static List<String> UseItemItemBlockBlacklist;
public static Boolean disableInfoBySneak = false;
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<String> UseItem_Lore;
public static Boolean toggleItemOnOrYesBase64;
public static String toggleItemOnOrYesBase64Value;
public static String toggleItemOnOrYesMaterial;
public static Boolean toggleItemOffOrNoBase64;
public static String toggleItemOffOrNoBase64Value;
public static String toggleItemOffOrNoMaterial;
public static String togglePermTrue;
public static String togglePermFalse;
public static String placeholderTrue;
public static String placeholderFalse;
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);
@@ -129,17 +33,18 @@ public class SelectConfig {
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
HelpAlias = yamlConfiguration.getBoolean("Plugin.HelpAlias");
adminSubCommand = yamlConfiguration.getString("Plugin.AdminSubCommand").toLowerCase();
language = yamlConfiguration.getString("Plugin.language");
Currency = yamlConfiguration.getString("Plugin.Currency");
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");
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");
mysqlIp = yamlConfiguration.getString("Storage.MySQL.IP");
mysqlPort = yamlConfiguration.getInt("Storage.MySQL.Port");
mysqlDatabase = yamlConfiguration.getString("Storage.MySQL.Database");
mysqlUser = yamlConfiguration.getString("Storage.MySQL.User");
mysqlPassword = yamlConfiguration.getString("Storage.MySQL.Password");
mysqlSSL = yamlConfiguration.getBoolean("Storage.MySQL.SSL");
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
@@ -170,31 +75,6 @@ public class SelectConfig {
Cursor_ToGUIItem_OnlyOnFirstLogin = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin");
UseItem_ServerChange = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange");
UseItemGameModeChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Change.Enable");
UseItemGameModeChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.GameMode.Change.DelayInTicks");
UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable");
UseItemGameModeRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
UseItemGameModeMode = yamlConfiguration.getString("Advanced.UseItem.GameMode.Protection.Mode");
List<String> gml = new ArrayList<>();
for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")) {
gml.add(gm.toUpperCase());
}
UseItemGameModeList = gml;
UseItemWorldChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.World.Change.Enable");
UseItemWorldChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.World.Change.DelayInTicks");
UseItemWorldProtection = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.Enable");
UseItemWorldRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
UseItemWorldList = yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
if (yamlConfiguration.get("Advanced.UseItem.DisableInfoBySneak") != null) {
disableInfoBySneak = yamlConfiguration.getBoolean("Advanced.UseItem.DisableInfoBySneak");
}
UseItemItemBlockBlacklist = yamlConfiguration.getStringList("Advanced.UseItem.ItemBlockBlacklist");
toggleItemOnOrYesBase64 = yamlConfiguration.getBoolean("Toggle.Items.OnOrYes.Item.Base64.Enable");
toggleItemOnOrYesBase64Value = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Base64.Base64Value");
toggleItemOnOrYesMaterial = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Material");
@@ -223,6 +103,31 @@ public class SelectConfig {
Sound_Give_input = (yamlConfiguration.getString("Sound.Give.Sound").toUpperCase().replace(".", "_"));
Sound_PlayerNotFound_Enable = yamlConfiguration.getBoolean("Sound.PlayerNotFound.Enable");
Sound_PlayerNotFound_input = (yamlConfiguration.getString("Sound.PlayerNotFound.Sound").toUpperCase().replace(".", "_"));
UseItemGameModeChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Change.Enable");
UseItemGameModeChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.GameMode.Change.DelayInTicks");
UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable");
UseItemGameModeRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
UseItemGameModeMode = yamlConfiguration.getString("Advanced.UseItem.GameMode.Protection.Mode");
List<String> gml = new ArrayList<>();
for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")) {
gml.add(gm.toUpperCase());
}
UseItemGameModeList = gml;
UseItemWorldChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.World.Change.Enable");
UseItemWorldChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.World.Change.DelayInTicks");
UseItemWorldProtection = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.Enable");
UseItemWorldRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
UseItemWorldList = yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
if (yamlConfiguration.get("Advanced.UseItem.DisableInfoBySneak") != null) {
disableInfoBySneak = yamlConfiguration.getBoolean("Advanced.UseItem.DisableInfoBySneak");
}
UseItemItemBlockBlacklist = yamlConfiguration.getStringList("Advanced.UseItem.ItemBlockBlacklist");
}
@@ -356,4 +261,431 @@ public class SelectConfig {
e.printStackTrace();
}
}
private static Boolean Debug;
private static Boolean HelpAlias;
private static String adminSubCommand;
private static String language;
private static String Currency;
private static String storage;
private static String mysqlIp;
private static Integer mysqlPort;
private static String mysqlDatabase;
private static String mysqlUser;
private static String mysqlPassword;
private static Boolean mysqlSSL;
private static Boolean Bungee;
private static String thisServer;
private static String DefaultGUI;
private static Boolean UseItem_Enable;
private static Boolean UseItem_AllowToggle;
private static Boolean UseItem_AllowSetSlot;
private static Boolean UseItem_GiveOnEveryJoin;
private static Boolean UseItem_GiveOnlyOnFirstJoin;
private static Boolean UseItem_ServerChange;
private static Boolean Cursor_ToGUIItem_OnLogin;
private static Boolean Cursor_ToGUIItem_OnlyOnFirstLogin;
private static Boolean UseItem_BlockMoveAndDrop;
private static String UseItem_OpenGUI;
private static Boolean UseItem_Permission;
private static Boolean UseItem_KeepAtCommandClear;
private static Boolean UseItemGameModeChangeEnable;
private static int UseItemGameModeChangeDelayInTicks;
private static Boolean UseItemGameModeProtection;
private static Boolean UseItemGameModeRemoveItemWhenItIsDisabled;
private static String UseItemGameModeMode;
private static List<String> UseItemGameModeList;
private static Boolean UseItemWorldChangeEnable;
private static int UseItemWorldChangeDelayInTicks;
private static Boolean UseItemWorldProtection;
private static Boolean UseItemWorldRemoveItemWhenItIsDisabled;
private static String UseItemWorldMode;
private static List<String> UseItemWorldList;
private static List<String> UseItemItemBlockBlacklist;
private static Boolean disableInfoBySneak = false;
private static Boolean UseItem_InventorySlot_FreeSlot;
private static Integer UseItem_InventorySlot;
private static Boolean UseItem_InventorySlotEnforce;
private static String UseItem_Material;
private static Boolean UseItem_PlayerHead_Enable;
private static Boolean UseItem_Base64_Enable;
private static String UseItem_Base64value;
private static Boolean UseItem_PlayerWhoHasOpenedTheGUI;
private static String UseItem_PlayerName;
private static String UseItem_Name;
private static List<String> UseItem_Lore;
private static Boolean toggleItemOnOrYesBase64;
private static String toggleItemOnOrYesBase64Value;
private static String toggleItemOnOrYesMaterial;
private static Boolean toggleItemOffOrNoBase64;
private static String toggleItemOffOrNoBase64Value;
private static String toggleItemOffOrNoMaterial;
private static String togglePermTrue;
private static String togglePermFalse;
private static String placeholderTrue;
private static String placeholderFalse;
private static Boolean Sound_Enable = true;
private static Boolean Sound_OpenInventory_Enable = true;
private static Sound Sound_OpenInventory;
private static String Sound_OpenInventory_input;
private static Boolean Sound_Click_Enable = true;
private static Sound Sound_Click;
private static String Sound_Click_input;
private static Boolean Sound_NoMoney_Enable = true;
private static Sound Sound_NoMoney;
private static String Sound_NoMoney_input;
private static Boolean Sound_NoInventorySpace_Enable = true;
private static Sound Sound_NoInventorySpace;
private static String Sound_NoInventorySpace_input;
private static Boolean Sound_Give_Enable = true;
private static Sound Sound_Give;
private static String Sound_Give_input;
private static Boolean Sound_PlayerNotFound_Enable = true;
private static Sound Sound_PlayerNotFound;
private static String Sound_PlayerNotFound_input;
public static Boolean getDebug() {
return Debug;
}
public static Boolean getHelpAlias() {
return HelpAlias;
}
public static String getAdminSubCommand() {
return adminSubCommand;
}
public static String getLanguage() {
return language;
}
public static String getCurrency() {
return Currency;
}
public static String getStorage() {
return storage;
}
public static String getMysqlIp() {
return mysqlIp;
}
public static Integer getMysqlPort() {
return mysqlPort;
}
public static String getMysqlDatabase() {
return mysqlDatabase;
}
public static String getMysqlUser() {
return mysqlUser;
}
public static String getMysqlPassword() {
return mysqlPassword;
}
public static Boolean getMysqlSSL() {
return mysqlSSL;
}
public static Boolean getBungee() {
return Bungee;
}
public static String getThisServer() {
return thisServer;
}
public static String getDefaultGUI() {
return DefaultGUI;
}
public static Boolean getUseItem_Enable() {
return UseItem_Enable;
}
public static Boolean getUseItem_AllowToggle() {
return UseItem_AllowToggle;
}
public static Boolean getUseItem_AllowSetSlot() {
return UseItem_AllowSetSlot;
}
public static Boolean getUseItem_GiveOnEveryJoin() {
return UseItem_GiveOnEveryJoin;
}
public static Boolean getUseItem_GiveOnlyOnFirstJoin() {
return UseItem_GiveOnlyOnFirstJoin;
}
public static Boolean getUseItem_ServerChange() {
return UseItem_ServerChange;
}
public static Boolean getCursor_ToGUIItem_OnLogin() {
return Cursor_ToGUIItem_OnLogin;
}
public static Boolean getCursor_ToGUIItem_OnlyOnFirstLogin() {
return Cursor_ToGUIItem_OnlyOnFirstLogin;
}
public static Boolean getUseItem_BlockMoveAndDrop() {
return UseItem_BlockMoveAndDrop;
}
public static String getUseItem_OpenGUI() {
return UseItem_OpenGUI;
}
public static Boolean getUseItem_Permission() {
return UseItem_Permission;
}
public static Boolean getUseItem_KeepAtCommandClear() {
return UseItem_KeepAtCommandClear;
}
public static Boolean getUseItemGameModeChangeEnable() {
return UseItemGameModeChangeEnable;
}
public static int getUseItemGameModeChangeDelayInTicks() {
return UseItemGameModeChangeDelayInTicks;
}
public static Boolean getUseItemGameModeProtection() {
return UseItemGameModeProtection;
}
public static Boolean getUseItemGameModeRemoveItemWhenItIsDisabled() {
return UseItemGameModeRemoveItemWhenItIsDisabled;
}
public static String getUseItemGameModeMode() {
return UseItemGameModeMode;
}
public static List<String> getUseItemGameModeList() {
return UseItemGameModeList;
}
public static Boolean getUseItemWorldChangeEnable() {
return UseItemWorldChangeEnable;
}
public static int getUseItemWorldChangeDelayInTicks() {
return UseItemWorldChangeDelayInTicks;
}
public static Boolean getUseItemWorldProtection() {
return UseItemWorldProtection;
}
public static Boolean getUseItemWorldRemoveItemWhenItIsDisabled() {
return UseItemWorldRemoveItemWhenItIsDisabled;
}
public static String getUseItemWorldMode() {
return UseItemWorldMode;
}
public static List<String> getUseItemWorldList() {
return UseItemWorldList;
}
public static List<String> getUseItemItemBlockBlacklist() {
return UseItemItemBlockBlacklist;
}
public static Boolean getDisableInfoBySneak() {
return disableInfoBySneak;
}
public static Boolean getUseItem_InventorySlot_FreeSlot() {
return UseItem_InventorySlot_FreeSlot;
}
public static Integer getUseItem_InventorySlot() {
return UseItem_InventorySlot;
}
public static Boolean getUseItem_InventorySlotEnforce() {
return UseItem_InventorySlotEnforce;
}
public static String getUseItem_Material() {
return UseItem_Material;
}
public static Boolean getUseItem_PlayerHead_Enable() {
return UseItem_PlayerHead_Enable;
}
public static Boolean getUseItem_Base64_Enable() {
return UseItem_Base64_Enable;
}
public static String getUseItem_Base64value() {
return UseItem_Base64value;
}
public static Boolean getUseItem_PlayerWhoHasOpenedTheGUI() {
return UseItem_PlayerWhoHasOpenedTheGUI;
}
public static String getUseItem_PlayerName() {
return UseItem_PlayerName;
}
public static String getUseItem_Name() {
return UseItem_Name;
}
public static List<String> getUseItem_Lore() {
return UseItem_Lore;
}
public static Boolean getToggleItemOnOrYesBase64() {
return toggleItemOnOrYesBase64;
}
public static String getToggleItemOnOrYesBase64Value() {
return toggleItemOnOrYesBase64Value;
}
public static String getToggleItemOnOrYesMaterial() {
return toggleItemOnOrYesMaterial;
}
public static Boolean getToggleItemOffOrNoBase64() {
return toggleItemOffOrNoBase64;
}
public static String getToggleItemOffOrNoBase64Value() {
return toggleItemOffOrNoBase64Value;
}
public static String getToggleItemOffOrNoMaterial() {
return toggleItemOffOrNoMaterial;
}
public static String getTogglePermTrue() {
return togglePermTrue;
}
public static String getTogglePermFalse() {
return togglePermFalse;
}
public static String getPlaceholderTrue() {
return placeholderTrue;
}
public static String getPlaceholderFalse() {
return placeholderFalse;
}
public static Boolean getSound_Enable() {
return Sound_Enable;
}
public static Boolean getSound_OpenInventory_Enable() {
return Sound_OpenInventory_Enable;
}
public static Sound getSound_OpenInventory() {
return Sound_OpenInventory;
}
public static String getSound_OpenInventory_input() {
return Sound_OpenInventory_input;
}
public static Boolean getSound_Click_Enable() {
return Sound_Click_Enable;
}
public static Sound getSound_Click() {
return Sound_Click;
}
public static String getSound_Click_input() {
return Sound_Click_input;
}
public static Boolean getSound_NoMoney_Enable() {
return Sound_NoMoney_Enable;
}
public static Sound getSound_NoMoney() {
return Sound_NoMoney;
}
public static String getSound_NoMoney_input() {
return Sound_NoMoney_input;
}
public static Boolean getSound_NoInventorySpace_Enable() {
return Sound_NoInventorySpace_Enable;
}
public static Sound getSound_NoInventorySpace() {
return Sound_NoInventorySpace;
}
public static String getSound_NoInventorySpace_input() {
return Sound_NoInventorySpace_input;
}
public static Boolean getSound_Give_Enable() {
return Sound_Give_Enable;
}
public static Sound getSound_Give() {
return Sound_Give;
}
public static String getSound_Give_input() {
return Sound_Give_input;
}
public static Boolean getSound_PlayerNotFound_Enable() {
return Sound_PlayerNotFound_Enable;
}
public static Sound getSound_PlayerNotFound() {
return Sound_PlayerNotFound;
}
public static String getSound_PlayerNotFound_input() {
return Sound_PlayerNotFound_input;
}
}

View File

@@ -2,18 +2,63 @@ package de.jatitv.commandguiv2.Spigot.config.configConverter;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.functions.CreateFunctions;
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import org.apache.commons.io.FileUtils;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
public class ConfigConverterUnderV5 {
public static void renameMainFolder() {
if (new File("plugins/CommandGUI").exists() && !Main.getPath().exists()) {
File oldF = new File("plugins/CommandGUI");
File newF = new File("plugins/T2C-CommandGUI");
if (oldF.renameTo(newF)) {
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.error(Main.getPlugin(), "");
send.warning(Main.getPlugin(), "File renamed successfully");
send.warning(Main.getPlugin(), "The plugin folder has been renamed from 'CommandGUI' to 'T2C-CommandGUI");
send.error(Main.getPlugin(), "");
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
} else {
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.error(Main.getPlugin(), "");
send.error(Main.getPlugin(), "Failed to rename file");
send.error(Main.getPlugin(), "An error occurred while renaming the plugin folder from 'CommandGUI' to 'T2C-CommandGUI'! Please report on our Discord: " + Util.getDiscord());
send.error(Main.getPlugin(), "");
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
}
}
public static void noPermLore(YamlConfiguration yamlConfiguration, File config) {
yamlConfiguration.set("Slots.Function.NoPermission.Message.Enable", true);
yamlConfiguration.set("Slots.Function.NoPermission.Message.CustomNoPermMessage", "");
yamlConfiguration.set("Slots.Function.NoPermission.Item.Lore.Enable", true);
yamlConfiguration.set("Slots.Function.NoPermission.Item.Lore.Lore", Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"));
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.error(Main.getPlugin(), "");
send.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Message.Enable' was added to the function " + config.getName() + "!");
send.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Message.CustomNoPermMessage' was added to the function " + config.getName() + "!");
send.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Item.Lore.Enable' was added to the function " + config.getName() + "!");
send.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Item.Lore.Lore' was added to the function " + config.getName() + "!");
send.error(Main.getPlugin(), "");
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
public static void convert() {
renameFolder();
send.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
@@ -84,7 +129,6 @@ public class ConfigConverterUnderV5 {
String configFilePath = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.File.Path");
String configOptionPath = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Option.Path");
String configOptionPremat = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Option.Premat");
// Boolean ConfigChatInput = ;
String configStringValueLeft = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Value.LeftClick.String");
Boolean configBooleanValueLeft = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.Value.LeftClick.Boolean");
@@ -103,10 +147,12 @@ public class ConfigConverterUnderV5 {
setNew(key, slotNumber, slotEnable, key, permRequired, yamlConfiguration);
CreateFunctions.createFunction(key, empty, itemAmount, playerHeadEnable, base64Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, itemMaterial, itemName, lore,
customSoundEnable, customSoundNoSound, customSoundSound, costEnable, price, commandEnable, commandBungeeCommand, commandAsConsole, command, serverChange,
true, "", true, Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"),
customSoundEnable, customSoundNoSound, customSoundSound, costEnable, "vault", "DIRT;5", 0, price, commandEnable, commandBungeeCommand, commandAsConsole, command, serverChange,
serverChangeServer, openGUIEnable, openGUI, togglePermission, togglePermissionPerm, toggleUseItem, messageEnable, message, setConfigEnable, configFilePath,
configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft, configDoubleValueLeft, configListValueLeft,
configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight, configListValueRight, pluginReloadEnable, pluginReloadCommand);
configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight, configListValueRight, pluginReloadEnable, pluginReloadCommand,
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
}
try {

View File

@@ -1,8 +1,10 @@
package de.jatitv.commandguiv2.Spigot.config.functions;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
@@ -13,34 +15,38 @@ import java.util.List;
public class CreateFunctions {
public static void create() {
createFunction("UseItem", false, 1, false, false, "", false, "", "",
"&6Toggle UseItem", Arrays.asList("&bYou currently have the UseItem set to: %commandgui_useitem%"), false, false,
"", false, 0.0, false, false, false, Arrays.asList(), false,
"&6Toggle UseItem", Arrays.asList("&bYou currently have the UseItem set to: %commandgui_useitem%"), true, "", true,
Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"), false, false,
"", false, "VAULT", "DIRT;5", 0, 0.0, false, false, false, Arrays.asList(), false,
"", false, "", false, "", true, true,
Arrays.asList("&bYour UseItem was set to: %commandgui_useitem%&b."), false, "", "", "String",
"", false, 0, 0.0, Arrays.asList(), "", false,
0, 0.0, Arrays.asList(), false, "");
0, 0.0, Arrays.asList(), false, "",
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
createFunction("SupportDiscord", false, 1, true, true, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19",
false, "", "",
"&3Support Discord", Arrays.asList("&8-----------------", "&bIf you need help setting up the plugin,", "&bfeel free to contact me on the Suport Discord.",
"&8-----------------", "&eIf you find any errors or bugs,", "&eplease contact me so I can fix them.", "&8-----------------", "&5Discord: §7http://dc.t2code.net"),
false, false, "", false, 0.0, false, false,
true, "", true, Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"),
false, false, "", false, "VAULT", "DIRT;5", 0, 0.0, false, false,
false, Arrays.asList(), false, "", false, "", false, "",
false, true, Arrays.asList("&6You can find more information on Discord: &ehttp://dc.t2code.net"), false, "",
"", "String", "", false, 0, 0.0, Arrays.asList(),
"", false, 0, 0.0, Arrays.asList(), false, "");
"", false, 0, 0.0, Arrays.asList(), false, "",
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
}
public static void createFunction(String fileName, Boolean empty, Integer itemAmount, Boolean playerHeadEnable, Boolean base64Enable, String base64Value, Boolean playerWhoHasOpenedTheGUI,
String playerName, String itemMaterial, String name, List<String> lore, Boolean customSoundEnable, Boolean customSoundNoSound, String customSoundSound,
Boolean costEnable, Double price, Boolean commandEnable, Boolean commandBungeeCommand, Boolean commandAsConsole, List<String> command,
Boolean serverChange, String serverChangeServer, Boolean openGUIEnable, String openGUI, Boolean togglePermission, String togglePermissionPerm,
Boolean toggleUseItem, Boolean messageEnable, List<String> message, Boolean setConfigEnable, String configFilePath, String configOptionPath,
String configOptionPremat, String configStringValueLeft, Boolean configBooleanValueLeft, Integer configIntegerValueLeft, Double configDoubleValueLeft,
List<String> configListValueLeft, String configStringValueRight, Boolean configBooleanValueRight, Integer configIntegerValueRight, Double configDoubleValueRight,
List<String> configListValueRight, Boolean pluginReloadEnable, String pluginReloadCommand) {
String playerName, String itemMaterial, String name, List<String> lore, Boolean noPermMessageEnable, String customNoPermMessage, Boolean noPermLoreEnable, List<String> noPermLore, Boolean customSoundEnable, Boolean customSoundNoSound, String customSoundSound,
Boolean costEnable, String ecoModule, String ecoItem, Integer ecoVotePoints, Double ecoPrice, Boolean commandEnable, Boolean commandBungeeCommand,
Boolean commandAsConsole, List<String> command, Boolean serverChange, String serverChangeServer, Boolean openGUIEnable, String openGUI,
Boolean togglePermission, String togglePermissionPerm, Boolean toggleUseItem, Boolean messageEnable, List<String> message, Boolean setConfigEnable,
String configFilePath, String configOptionPath, String configOptionPremat, String configStringValueLeft, Boolean configBooleanValueLeft,
Integer configIntegerValueLeft, Double configDoubleValueLeft, List<String> configListValueLeft, String configStringValueRight,
Boolean configBooleanValueRight, Integer configIntegerValueRight, Double configDoubleValueRight, List<String> configListValueRight,
Boolean pluginReloadEnable, String pluginReloadCommand, Boolean functionVotePoints, FunctionVoteEnum functionVotePointsMode,
Integer functionVotePointsAmount, Boolean functionItem, FunctionItemEnum functionItemMode, String functionItemItem) {
long long_ = System.currentTimeMillis();
File config = new File(Main.getPath(), "Functions/" + fileName + ".yml");
@@ -50,7 +56,7 @@ public class CreateFunctions {
i++;
}
send.console(Main.prefix + " §4Function GUI file (Functions/" + config.getName() + ") is loaded...");
send.console(Util.getPrefix() + " §4Function GUI file (Functions/" + config.getName() + ") is loaded...");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
@@ -66,11 +72,18 @@ public class CreateFunctions {
set("Slots.Function.Item.Material", itemMaterial == null ? "" : itemMaterial, yamlConfiguration);
set("Slots.Function.Item.Name", name == null ? "" : name, yamlConfiguration);
set("Slots.Function.Item.Lore", lore, yamlConfiguration);
set("Slots.Function.NoPermission.Message.Enable", noPermMessageEnable, yamlConfiguration);
set("Slots.Function.NoPermission.Message.CustomNoPermMessage", customNoPermMessage, yamlConfiguration);
set("Slots.Function.NoPermission.Item.Lore.Enable", noPermLoreEnable, yamlConfiguration);
set("Slots.Function.NoPermission.Item.Lore.Lore", noPermLore, yamlConfiguration);
set("Slots.Function.CustomSound.Enable", customSoundEnable, yamlConfiguration);
set("Slots.Function.CustomSound.NoSound", customSoundNoSound, yamlConfiguration);
set("Slots.Function.CustomSound.Sound", customSoundSound == null ? "" : customSoundSound, yamlConfiguration);
set("Slots.Function.Cost.Enable", costEnable, yamlConfiguration);
set("Slots.Function.Cost.Price", price, yamlConfiguration);
set("Slots.Function.Cost.EcoModule", ecoModule, yamlConfiguration);
set("Slots.Function.Cost.Item", ecoItem, yamlConfiguration);
set("Slots.Function.Cost.VotePoints", ecoVotePoints, yamlConfiguration);
set("Slots.Function.Cost.Price", ecoPrice, yamlConfiguration);
set("Slots.Function.Command.Enable", commandEnable, yamlConfiguration);
set("Slots.Function.Command.BungeeCommand", commandBungeeCommand, yamlConfiguration);
set("Slots.Function.Command.CommandAsConsole", commandAsConsole, yamlConfiguration);
@@ -104,12 +117,20 @@ public class CreateFunctions {
set("Slots.Function.SetConfig.PluginReload.Enable", pluginReloadEnable, yamlConfiguration);
set("Slots.Function.SetConfig.PluginReload.Command", pluginReloadCommand == null ? "" : pluginReloadCommand, yamlConfiguration);
set("Slots.Function.FunctionVotePoints.Enable", functionVotePoints, yamlConfiguration);
set("Slots.Function.FunctionVotePoints.Mode", functionVotePointsMode.toString(), yamlConfiguration);
set("Slots.Function.FunctionVotePoints.Amount", functionVotePointsAmount, yamlConfiguration);
set("Slots.Function.FunctionItem.Enable", functionItem, yamlConfiguration);
set("Slots.Function.FunctionItem.Mode", functionItemMode.toString(), yamlConfiguration);
set("Slots.Function.FunctionItem.Item", functionItemItem, yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
send.console(Main.prefix + " §2Function file (Functions/" + config.getName() + ") was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
send.console(Util.getPrefix() + " §2Function file (Functions/" + config.getName() + ") was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}

View File

@@ -1,6 +1,7 @@
package de.jatitv.commandguiv2.Spigot.config.gui;
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 org.bukkit.configuration.file.YamlConfiguration;
@@ -14,7 +15,7 @@ import java.util.List;
public class CreateGUI {
public static void configCreate() {
long long_ = System.currentTimeMillis();
send.console(Main.prefix + " §4Default GUI file (GUIs/default.yml) is loaded...");
send.console(Util.getPrefix() + " §4Default GUI file (GUIs/default.yml) is loaded...");
File config = new File(Main.getPath(), "GUIs/default.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
@@ -49,7 +50,7 @@ public class CreateGUI {
} catch (IOException e) {
e.printStackTrace();
}
send.console(Main.prefix + " §2Default GUI file (GUIs/default.yml) was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
send.console(Util.getPrefix() + " §2Default GUI file (GUIs/default.yml) was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
private static void set(String path, String value, YamlConfiguration config) {

View File

@@ -1,6 +1,7 @@
package de.jatitv.commandguiv2.Spigot.config.languages;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
@@ -9,7 +10,7 @@ import java.io.File;
import java.io.IOException;
public class LanguagesCreate {
private static Plugin plugin = Main.plugin;
private static Plugin plugin = Main.getPlugin();
public static void langCreate() {
send.debug(plugin,"§4Language files are created / updated...");
@@ -46,7 +47,9 @@ public class LanguagesCreate {
set("UseItem.DisabledInWorld", MSG.EN_UseItemDisabledInWorld, yamlConfigurationEN);
set("Cost.Buy_msg", MSG.EN_Buy_msg, yamlConfigurationEN);
set("Cost.No_money", MSG.EN_No_money, yamlConfigurationEN);
set("Cost.No.Money", MSG.EN_No_money, yamlConfigurationEN);
set("Cost.No.Item", MSG.EN_No_moneyItem, yamlConfigurationEN);
set("Cost.No.Vote", MSG.EN_No_moneyVote, yamlConfigurationEN);
set("Cost.NoInventorySpace", MSG.EN_NoInventorySpace, yamlConfigurationEN);
set("ServerChange.onServerChange", MSG.EN_onServerChange, yamlConfigurationEN);
@@ -60,6 +63,14 @@ public class LanguagesCreate {
set("Player.PlayerNotFond", MSG.EN_PlayerNotFond, yamlConfigurationEN);
set("Player.PlayerNoInventorySpace", MSG.EN_PlayerNoInventorySpace, yamlConfigurationEN);
set("FunctionItem.Add", MSG.EN_FunctionItemAdd,yamlConfigurationEN);
set("FunctionItem.Remove", MSG.EN_FunctionItemRemove,yamlConfigurationEN);
set("FunctionItem.RemoveError", MSG.EN_FunctionItemRemoveError,yamlConfigurationEN);
set("FunctionVote.Add", MSG.EN_FunctionVoteAdd,yamlConfigurationEN);
set("FunctionVote.Remove", MSG.EN_FunctionVoteRemove,yamlConfigurationEN);
set("FunctionVote.RemoveError", MSG.EN_FunctionVoteRemoveError,yamlConfigurationEN);
set("Help.CGUI", MSG.EN_Help_CGUI, yamlConfigurationEN);
set("Help.Help", MSG.EN_Help_Help, yamlConfigurationEN);
set("Help.Info", MSG.EN_Help_Info, yamlConfigurationEN);
@@ -71,6 +82,17 @@ public class LanguagesCreate {
set("Help.UseItem_Off", MSG.EN_GUIItemHelp_off, yamlConfigurationEN);
set("Help.UseItem_Slot", MSG.EN_GUIItemHelp_Slot, yamlConfigurationEN);
set("Help.Player.CGUI", MSG.EN_PlayerHelp_CGUI, yamlConfigurationEN);
set("Help.Player.Help", MSG.EN_PlayerHelp_Help, yamlConfigurationEN);
set("Help.Player.Info", MSG.EN_PlayerHelp_Info, yamlConfigurationEN);
set("Help.Player.Open", MSG.EN_PlayerHelp_Open, yamlConfigurationEN);
set("Help.Player.Give", MSG.EN_PlayerHelp_Give, yamlConfigurationEN);
set("Help.Player.CreateDefaultGUI", MSG.EN_PlayerHelp_CreateDefaultGUI, yamlConfigurationEN);
set("Help.Player.Reload", MSG.EN_PlayerHelp_Reload, yamlConfigurationEN);
set("Help.Player.UseItem_On", MSG.EN_GUIItemPlayerHelp_on, yamlConfigurationEN);
set("Help.Player.UseItem_Off", MSG.EN_GUIItemPlayerHelp_off, yamlConfigurationEN);
set("Help.Player.UseItem_Slot", MSG.EN_GUIItemPlayerHelp_Slot, yamlConfigurationEN);
try {
yamlConfigurationEN.save(messagesEN);
} catch (IOException e) {
@@ -110,7 +132,9 @@ public class LanguagesCreate {
set("UseItem.DisabledInWorld", MSG.DE_UseItemDisabledInWorld, yamlConfigurationDE);
set("Cost.Buy_msg", MSG.DE_Buy_msg, yamlConfigurationDE);
set("Cost.No_money", MSG.DE_No_money, yamlConfigurationDE);
set("Cost.No.Money", MSG.DE_No_money, yamlConfigurationDE);
set("Cost.No.Item", MSG.DE_No_moneyItem, yamlConfigurationDE);
set("Cost.No.Vote", MSG.DE_No_moneyVote, yamlConfigurationDE);
set("Cost.NoInventorySpace", MSG.DE_NoInventorySpace, yamlConfigurationDE);
set("ServerChange.onServerChange", MSG.DE_onServerChange, yamlConfigurationDE);
@@ -124,6 +148,14 @@ public class LanguagesCreate {
set("Player.PlayerNotFond", MSG.DE_PlayerNotFond, yamlConfigurationDE);
set("Player.PlayerNoInventorySpace", MSG.DE_PlayerNoInventorySpace, yamlConfigurationDE);
set("FunctionItem.Add", MSG.DE_FunctionItemAdd,yamlConfigurationDE);
set("FunctionItem.Remove", MSG.DE_FunctionItemRemove,yamlConfigurationDE);
set("FunctionItem.RemoveError", MSG.DE_FunctionItemRemoveError,yamlConfigurationDE);
set("FunctionVote.Add", MSG.DE_FunctionVoteAdd,yamlConfigurationDE);
set("FunctionVote.Remove", MSG.DE_FunctionVoteRemove,yamlConfigurationDE);
set("FunctionVote.RemoveError", MSG.DE_FunctionVoteRemoveError,yamlConfigurationDE);
set("Help.CGUI", MSG.DE_Help_CGUI, yamlConfigurationDE);
set("Help.Help", MSG.DE_Help_Help, yamlConfigurationDE);
set("Help.Info", MSG.DE_Help_Info, yamlConfigurationDE);
@@ -135,6 +167,17 @@ public class LanguagesCreate {
set("Help.UseItem_Off", MSG.DE_GUIItemHelp_off, yamlConfigurationDE);
set("Help.UseItem_Slot", MSG.DE_GUIItemHelp_Slot, yamlConfigurationDE);
set("Help.Player.CGUI", MSG.DE_PlayerHelp_CGUI, yamlConfigurationDE);
set("Help.Player.Help", MSG.DE_PlayerHelp_Help, yamlConfigurationDE);
set("Help.Player.Info", MSG.DE_PlayerHelp_Info, yamlConfigurationDE);
set("Help.Player.Open", MSG.DE_PlayerHelp_Open, yamlConfigurationDE);
set("Help.Player.Give", MSG.DE_PlayerHelp_Give, yamlConfigurationDE);
set("Help.Player.CreateDefaultGUI", MSG.DE_PlayerHelp_CreateDefaultGUI, yamlConfigurationDE);
set("Help.Player.Reload", MSG.DE_PlayerHelp_Reload, yamlConfigurationDE);
set("Help.Player.UseItem_On", MSG.DE_GUIItemPlayerHelp_on, yamlConfigurationDE);
set("Help.Player.UseItem_Off", MSG.DE_GUIItemPlayerHelp_off, yamlConfigurationDE);
set("Help.Player.UseItem_Slot", MSG.DE_GUIItemPlayerHelp_Slot, yamlConfigurationDE);
try {
yamlConfigurationDE.save(messagesDE);
} catch (IOException e) {
@@ -175,7 +218,9 @@ public class LanguagesCreate {
set("UseItem.DisabledInWorld", MSG.NO_UseItemDisabledInWorld, yamlConfigurationNO);
set("Cost.Buy_msg", MSG.NO_Buy_msg, yamlConfigurationNO);
set("Cost.No_money", MSG.NO_No_money, yamlConfigurationNO);
set("Cost.No.Money", MSG.NO_No_money, yamlConfigurationNO);
set("Cost.No.Item", MSG.NO_No_moneyItem, yamlConfigurationNO);
set("Cost.No.Vote", MSG.NO_No_moneyVote, yamlConfigurationNO);
set("Cost.NoInventorySpace", MSG.NO_NoInventorySpace, yamlConfigurationNO);
set("ServerChange.onServerChange", MSG.NO_onServerChange, yamlConfigurationNO);
@@ -189,6 +234,14 @@ public class LanguagesCreate {
set("Player.PlayerNotFond", MSG.NO_PlayerNotFond, yamlConfigurationNO);
set("Player.PlayerNoInventorySpace", MSG.NO_PlayerNoInventorySpace, yamlConfigurationNO);
set("FunctionItem.Add", MSG.NO_FunctionItemAdd,yamlConfigurationNO);
set("FunctionItem.Remove", MSG.NO_FunctionItemRemove,yamlConfigurationNO);
set("FunctionItem.RemoveError", MSG.NO_FunctionItemRemoveError,yamlConfigurationNO);
set("FunctionVote.Add", MSG.NO_FunctionVoteAdd,yamlConfigurationNO);
set("FunctionVote.Remove", MSG.NO_FunctionVoteRemove,yamlConfigurationNO);
set("FunctionVote.RemoveError", MSG.NO_FunctionVoteRemoveError,yamlConfigurationNO);
set("Help.CGUI", MSG.NO_Help_CGUI, yamlConfigurationNO);
set("Help.Help", MSG.NO_Help_Help, yamlConfigurationNO);
set("Help.Info", MSG.NO_Help_Info, yamlConfigurationNO);
@@ -200,6 +253,17 @@ public class LanguagesCreate {
set("Help.UseItem_Off", MSG.NO_GUIItemHelp_off, yamlConfigurationNO);
set("Help.UseItem_Slot", MSG.NO_GUIItemHelp_Slot, yamlConfigurationNO);
set("Help.Player.CGUI", MSG.NO_PlayerHelp_CGUI, yamlConfigurationNO);
set("Help.Player.Help", MSG.NO_PlayerHelp_Help, yamlConfigurationNO);
set("Help.Player.Info", MSG.NO_PlayerHelp_Info, yamlConfigurationNO);
set("Help.Player.Open", MSG.NO_PlayerHelp_Open, yamlConfigurationNO);
set("Help.Player.Give", MSG.NO_PlayerHelp_Give, yamlConfigurationNO);
set("Help.Player.CreateDefaultGUI", MSG.NO_PlayerHelp_CreateDefaultGUI, yamlConfigurationNO);
set("Help.Player.Reload", MSG.NO_PlayerHelp_Reload, yamlConfigurationNO);
set("Help.Player.UseItem_On", MSG.NO_GUIItemPlayerHelp_on, yamlConfigurationNO);
set("Help.Player.UseItem_Off", MSG.NO_GUIItemPlayerHelp_off, yamlConfigurationNO);
set("Help.Player.UseItem_Slot", MSG.NO_GUIItemPlayerHelp_Slot, yamlConfigurationNO);
try {
yamlConfigurationNO.save(messagesNO);
} catch (IOException e) {
@@ -208,7 +272,7 @@ public class LanguagesCreate {
}
send.console(Main.prefix + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
send.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
}
private static void set(String path, String value, YamlConfiguration config) {

View File

@@ -27,7 +27,9 @@ public class MSG {
public static String EN_NoPermissionForItem = "[prefix] &cFor &b[item] &cyou lack the permission &6[perm]&c!";
public static String EN_Buy_msg = "[prefix] &2You bought [itemname] &2for &6[price]&2.";
public static String EN_No_money = "[prefix] &cYou don't have enough money!";
public static String EN_No_money = "[prefix] &cYou don't have enough money!/*/&cYou need: &6[price]&c.";
public static String EN_No_moneyItem = "[prefix] &cYou don't have enough items of &6[item] &cin your inventory!/*/&cYou need: &6[amount]&c.";
public static String EN_No_moneyVote = "[prefix] &cYou do not have enough vote points!/*/&cYou need: &6[amount]&c.";
public static String EN_NoInventorySpace = "[prefix] &cYou have no room in your inventory!";
public static String EN_onServerChange = "[prefix] &2You will be connected to the server &e[server]§2.";
@@ -50,6 +52,14 @@ public class MSG {
public static String EN_PlayerNotFond = "[prefix] &cThe player &6[player] &cwas not found or is not online!";
public static String EN_PlayerNoInventorySpace = "[prefix] &6[player] &chas no free space in his inventory!";
public static String EN_FunctionItemAdd = "[prefix] &2You have &6[amount] [item] &2placed in your inventory.";
public static String EN_FunctionItemRemove = "[prefix] &2You have been &6[amount] [item] &2removed.";
public static String EN_FunctionItemRemoveError = "[prefix] &cYou don't have so many items!/*/&cYou need &6[amount] [item]&c!";
public static String EN_FunctionVoteAdd = "[prefix] &2You were given &6[amount] &2Vote points.";
public static String EN_FunctionVoteRemove = "[prefix] &2You have been removed &6[amount] &2Vote points.";
public static String EN_FunctionVoteRemoveError = "[prefix] &cYou don't have so many VotePoints!/*/&cYou need &6[amount]&c!";
public static String EN_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &eOpen the default GUI &7(&r[gui]&7)&e.";
public static String EN_Help_Open = "&8''&b/commandgui [gui]&8'' &eOpen the GUI: &6[guiname]&e.";
public static String EN_Help_Help = "&8''&b/commandguihelp&8'' &eOpen this help.";
@@ -60,7 +70,18 @@ public class MSG {
public static String EN_GUIItemHelp_on = "&8''&b/gui-item on&8'' &eActivate the GUIItem for you.";
public static String EN_GUIItemHelp_off = "&8''&b/gui-item off&8'' &eDisable the GUIItem for yourself.";
public static String EN_GUIItemHelp_Slot = "&8''&b/gui-item slot [slot]&8'' &eSet the slot for GUIItem for you.";
public static String EN_GUIItemHelp_Slot = "&8''&b/gui-item slot &7<slot>&8'' &eSet the slot where you want to have the GUIItem.";
public static String EN_PlayerHelp_CGUI = "&b/commandgui &8| &b/cgui/*/&eOpen the default GUI &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui";
public static String EN_PlayerHelp_Open = "&b/commandgui [gui]/*/&eOpen the GUI: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui ";
public static String EN_PlayerHelp_Help = "&b/commandguihelp/*/&eOpen this help./*/SUGGEST_COMMAND/*//commandguihelp";
public static String EN_PlayerHelp_Info = "&b/commandgui admin info/*/&eCall the info from &4Command&9GUI &e./*/SUGGEST_COMMAND/*//commandgui admin info";
public static String EN_PlayerHelp_Give = "&b/commandgui admin give &7<player>/*/&eGive a player the GUI item./*/SUGGEST_COMMAND/*//commandgui admin give ";
public static String EN_PlayerHelp_CreateDefaultGUI = "&b/commandgui admin createdefaultgui/*/&eCreate a default GUI &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui";
public static String EN_PlayerHelp_Reload = "&b/commandgui admin reload/*/&eReload the plugin./*/SUGGEST_COMMAND/*//commandgui admin reload";
public static String EN_GUIItemPlayerHelp_on = "&b/gui-item on/*/&eActivate the GUIItem for you./*/SUGGEST_COMMAND/*//gui-item on";
public static String EN_GUIItemPlayerHelp_off = "&b/gui-item off/*/&eDisable the GUIItem for yourself./*/SUGGEST_COMMAND/*//gui-item off";
public static String EN_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eSet the slot where you want to have the GUIItem./*/SUGGEST_COMMAND/*//gui-item slot ";
// DE
public static String DE_VaultNotSetUp = "[prefix] &4Vault / Economy nicht eingerichtet!";
@@ -85,7 +106,9 @@ public class MSG {
public static String DE_UseItemDisabledInWorld = "[prefix] &cDas UseItem ist in dieser Welt deaktiviert!";
public static String DE_Buy_msg = "[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft.";
public static String DE_No_money = "[prefix] &cDu hast nicht gen[ue]gend Geld!";
public static String DE_No_money = "[prefix] &cDu hast nicht gen[ue]gend Geld!/*/&cDu ben[oe]tigst [price].";
public static String DE_No_moneyItem = "[prefix] &cDu hast nicht gen[ue]gent Items von &6[item] &cim Inventar!/*/&cDu ben[oe]tigst: &6[amount]&c.";
public static String DE_No_moneyVote = "[prefix] &cDu hast nicht gen[ue]gent Vote Punkte!/*/&cDu ben[oe]tigst: &6[amount]&c.";
public static String DE_NoInventorySpace = "[prefix] &cDu hast keinen Platz in deinem Inventar!";
public static String DE_onServerChange = "[prefix] &2Du wirst auf den Server §e[server] §2verbunden.";
@@ -99,6 +122,14 @@ public class MSG {
public static String DE_PlayerNotFond = "[prefix] &cDer Spieler &6[player] &cwurde nicht gefunden oder ist nicht Online!";
public static String DE_PlayerNoInventorySpace = "[prefix] &6[player] &chat keinen freien Platz in seinem Inventar!";
public static String DE_FunctionItemAdd = "[prefix] &2Dir wurden &6[amount] [item] &2in dein Inventar gelegt.";
public static String DE_FunctionItemRemove = "[prefix] &2Dir wurden &6[amount] [item] &2entfernt.";
public static String DE_FunctionItemRemoveError = "[prefix] &cDu hast nicht so viele Items!/*/&cDu benötigets &6[amount] [item]&c!";
public static String DE_FunctionVoteAdd = "[prefix] &2Dir wurden &6[amount] &2Vote Punkte gegeben.";
public static String DE_FunctionVoteRemove = "[prefix] &2Dir wurden &6[amount] &2Vote Punkte entfernt.";
public static String DE_FunctionVoteRemoveError = "[prefix] &cDu hast nicht so viele VotePunkte!/*/&cDu benötigets &6[amount]&c!";
public static String DE_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &e[OE]ffne die default GUI &7(&r[gui]&7)&e.";
public static String DE_Help_Open = "&8''&b/commandgui [gui]&8'' &e[OE]ffne die GUI: &6[guiname]&e.";
public static String DE_Help_Help = "&8''&b/commandguihelp&8'' &e[OE]ffne diese help.";
@@ -109,7 +140,21 @@ public class MSG {
public static String DE_GUIItemHelp_on = "&8''&b/gui-item on&8'' &eAktiviere f[ue]r dich das GUIItem.";
public static String DE_GUIItemHelp_off = "&8''&b/gui-item off&8'' &eDeaktiviere f[ue]r dich das GUIItem.";
public static String DE_GUIItemHelp_Slot = "&8''&b/gui-item slot [slot]&8'' &eSetze den Slot für GUIItem für Sie einstellen.";
public static String DE_GUIItemHelp_Slot = "&8''&b/gui-item slot &7<slot>&8'' &eStelle den Slot ein, auf den du das GUIItem haben möchtest.";
public static String DE_PlayerHelp_CGUI = "&b/commandgui &8| &b/cgui/*/&e[OE]ffne die default GUI &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui";
public static String DE_PlayerHelp_Open = "&b/commandgui [gui]/*/&e[OE]ffne die GUI: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui ";
public static String DE_PlayerHelp_Help = "&b/commandguihelp/*/&e[OE]ffne diese help./*/SUGGEST_COMMAND/*//commandguihelp";
public static String DE_PlayerHelp_Info = "&b/commandgui admin info/*/&eRufe die Infos von &4Command&9GUI &eauf./*/SUGGEST_COMMAND/*//commandgui admin info";
public static String DE_PlayerHelp_Give = "&b/commandgui admin give &7<player>/*/&eGebe einem Spieler das GUI-Item./*/SUGGEST_COMMAND/*//commandgui admin give ";
public static String DE_PlayerHelp_CreateDefaultGUI = "&b/commandgui admin createdefaultgui/*/&eLasse eine default GUI erstellen &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui";
public static String DE_PlayerHelp_Reload = "&b/commandgui admin reload/*/&eLade das Plugin neu./*/SUGGEST_COMMAND/*//commandgui admin reload";
public static String DE_GUIItemPlayerHelp_on = "&b/gui-item on/*/&eAktiviere f[ue]r dich das GUIItem./*/SUGGEST_COMMAND/*//gui-item on";
public static String DE_GUIItemPlayerHelp_off = "&b/gui-item off/*/&eDeaktiviere f[ue]r dich das GUIItem./*/SUGGEST_COMMAND/*//gui-item off";
public static String DE_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eStelle den Slot ein, auf den du das GUIItem haben möchtest./*/SUGGEST_COMMAND/*//gui-item slot ";
// FR
@@ -138,7 +183,9 @@ public class MSG {
public static String NO_UseItemDisabledInWorld = "[prefix] &cUseItem er deaktivert i denne verden!";
public static String NO_Buy_msg = "[prefix] &2Du kjøpte [itemname] &2for &6[price]&2.";
public static String NO_No_money = "[prefix] &cDu har ikke nok penger!";
public static String NO_No_money = "[prefix] &cDu har ikke nok penger!/*/&cDu trenger &6[price]&c.";
public static String NO_No_moneyItem = "[prefix] &cDu har ikke nok varer av &6[item] &ci inventaret ditt!/*/&cDu trenger: &6[amount]&c.";
public static String NO_No_moneyVote = "[prefix] &cDu har ikke nok stemmepoeng!/*/&cDu trenger: &6[amount]&c.";
public static String NO_NoInventorySpace = "[prefix] &cDu har ikke nok plass i inventaret ditt!";
public static String NO_onServerChange = "[prefix] &2Du vil bli tilkoblet serveren &e[server]&2.";
@@ -152,6 +199,14 @@ public class MSG {
public static String NO_PlayerNotFond = "[prefix] &cSpilleren &6[player] &cble ikke funnet eller er ikke pålogget!";
public static String NO_PlayerNoInventorySpace = "[prefix] &6[player] &char ikke nok plass i inventaret sitt!";
public static String NO_FunctionItemAdd = "[prefix] &2Du har &6[amount] [item] &2plassert i beholdningen din.";
public static String NO_FunctionItemRemove = "[prefix] &2Du har blitt &6[amount] [item] &2fjernet.";
public static String NO_FunctionItemRemoveError = "[prefix] &cDu har ikke så mange varer!/*/&cDu trenger &6[amount] [item]&c!";
public static String NO_FunctionVoteAdd = "[prefix] &2Du fikk &6[amount] &2stemmepoeng.";
public static String NO_FunctionVoteRemove = "[prefix] &2Du har blitt fjernet &6[amount] &2Stemmepoeng.";
public static String NO_FunctionVoteRemoveError = "[prefix] &cDu har ikke så mange stemmepoeng!/*/&cDu trenger &6[amount]&c!";
public static String NO_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &eÅpne default GUIen &7(&r[gui]&7)&e.";
public static String NO_Help_Open = "&8''&b/commandgui [gui]&8'' &eÅpne GUIen: &6[guiname]&e.";
public static String NO_Help_Help = "&8''&b/commandguihelp&8'' &eSender denne hjelpe meldingen.";
@@ -162,5 +217,17 @@ public class MSG {
public static String NO_GUIItemHelp_on = "&8''&b/gui-item on&8'' &eAktiverer en GUI gjenstand for deg.";
public static String NO_GUIItemHelp_off = "&8''&b/gui-item off&8'' &eDeaktiverer en GUI gjenstand for deg.";
public static String NO_GUIItemHelp_Slot = "&8''&b/gui-item slot [slot]&8'' &eSett sporet for GUIItem for deg.";
public static String NO_GUIItemHelp_Slot = "&8''&b/gui-item slot &7<slot>&8'' &eSett sporet for GUIItem for deg.";
public static String NO_PlayerHelp_CGUI = "&b/commandgui &8| &b/cgui/*/&eÅpne default GUIen &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui";
public static String NO_PlayerHelp_Open = "&b/commandgui [gui]/*/&eÅpne GUIen: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui ";
public static String NO_PlayerHelp_Help = "&b/commandguihelp/*/&eSender denne hjelpe meldingen./*/SUGGEST_COMMAND/*//commandguihelp";
public static String NO_PlayerHelp_Info = "&b/commandgui admin info/*/&eKall informasjon fra &4Command&9GUI&e./*/SUGGEST_COMMAND/*//commandgui admin info";
public static String NO_PlayerHelp_Give = "&b/commandgui admin give &7<player>/*/&eGi en spiller GUI gjenstanden./*/SUGGEST_COMMAND/*//commandgui admin give ";
public static String NO_PlayerHelp_CreateDefaultGUI = "&b/commandgui admin createdefaultgui/*/&eLag en normalverdi GUI &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui";
public static String NO_PlayerHelp_Reload = "&b/commandgui admin reload/*/&eLast inn pluginet på nytt./*/SUGGEST_COMMAND/*//commandgui admin reload";
public static String NO_GUIItemPlayerHelp_on = "&b/gui-item on/*/&eAktiverer en GUI gjenstand for deg./*/SUGGEST_COMMAND/*//gui-item on";
public static String NO_GUIItemPlayerHelp_off = "&b/gui-item off/*/&eDeaktiverer en GUI gjenstand for deg./*/SUGGEST_COMMAND/*//gui-item off";
public static String NO_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eSett sporet for GUIItem for deg./*/SUGGEST_COMMAND/*//gui-item slot ";
}

View File

@@ -8,6 +8,7 @@ import net.t2code.lib.Spigot.Lib.replace.Replace;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.util.Objects;
public class SelectMessages {
@@ -36,12 +37,14 @@ public class SelectMessages {
public static String UseItemDisabledInWorld;
public static String Buy_msg;
public static String No_money;
public static String noMoney;
public static String noMoneyItem;
public static String noMoneyVote;
public static String NoInventorySpace;
public static String onServerChange;
public static String GUInotFound;
public static String guiNotFound;
public static String GUIIsDisabled;
public static String Give_Sender;
@@ -50,6 +53,13 @@ public class SelectMessages {
public static String PlayerNotFond;
public static String PlayerNoInventorySpace;
public static String functionItemAdd;
public static String functionItemRemove;
public static String functionItemRemoveError;
public static String functionVoteAdd;
public static String functionVoteRemove;
public static String functionVoteRemoveError;
public static String HelpCgui;
public static String HelpHelp;
public static String HelpInfo;
@@ -60,25 +70,35 @@ public class SelectMessages {
public static String GUIItemHelp_on;
public static String GUIItemHelp_off;
public static String GUIItemHelp_Slot;
public static String PlayerHelpCgui;
public static String PlayerHelpHelp;
public static String PlayerHelpInfo;
public static String PlayerHelpOpen;
public static String PlayerHelpGive;
public static String PlayerHelpCreateDefaultGUI;
public static String PlayerHelpReload;
public static String PlayerGUIItemHelp_on;
public static String PlayerGUIItemHelp_off;
public static String PlayerGUIItemHelp_Slot;
public static void onSelect(String Prefix) {
send.debug(Main.plugin, "§4Select language...");
Long long_ = Long.valueOf(System.currentTimeMillis());
send.debug(Main.getPlugin(), "§4Select language...");
long long_ = System.currentTimeMillis();
File msg;
msg = new File(Main.getPath(), "languages/" + SelectConfig.language + "_messages.yml");
msg = new File(Main.getPath(), "languages/" + SelectConfig.getLanguage() + "_messages.yml");
if (!msg.isFile()) {
send.console(Prefix);
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.console(Prefix + " §4The selected §c" + SelectConfig.language + " §4language file was not found.");
send.console(Prefix + " §4The selected §c" + SelectConfig.getLanguage() + " §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;
} else selectMSG = SelectConfig.getLanguage();
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
VaultNotSetUp = select("Plugin.VaultNotSetUp", yamlConfiguration_msg);
@@ -103,12 +123,15 @@ public class SelectMessages {
UseItemDisabledInWorld = select("UseItem.DisabledInWorld", yamlConfiguration_msg);
Buy_msg = select("Cost.Buy_msg", yamlConfiguration_msg);
No_money = select("Cost.No_money", yamlConfiguration_msg);
noMoney = select("Cost.No.Money", yamlConfiguration_msg);
noMoneyItem = select("Cost.No.Item", yamlConfiguration_msg);
noMoneyVote = select("Cost.No.Vote", yamlConfiguration_msg);
NoInventorySpace = select("Cost.NoInventorySpace", yamlConfiguration_msg);
onServerChange = select("ServerChange.onServerChange", yamlConfiguration_msg);
GUInotFound = select("GUI.GUInotFound", yamlConfiguration_msg);
guiNotFound = select("GUI.GUInotFound", yamlConfiguration_msg);
GUIIsDisabled = select("GUI.GUIisDisabled", yamlConfiguration_msg);
Give_Sender = select("Give.Sender", yamlConfiguration_msg);
@@ -117,6 +140,14 @@ public class SelectMessages {
PlayerNotFond = select("Player.PlayerNotFond", yamlConfiguration_msg);
PlayerNoInventorySpace = select("Player.PlayerNoInventorySpace", yamlConfiguration_msg);
functionItemAdd = select("FunctionItem.Add", yamlConfiguration_msg);
functionItemRemove = select("FunctionItem.Remove", yamlConfiguration_msg);
functionItemRemoveError = select("FunctionItem.RemoveError", yamlConfiguration_msg);
functionVoteAdd = select("FunctionVote.Add", yamlConfiguration_msg);
functionVoteRemove = select("FunctionVote.Remove", yamlConfiguration_msg);
functionVoteRemoveError = select("FunctionVote.RemoveError", yamlConfiguration_msg);
HelpCgui = select("Help.CGUI", yamlConfiguration_msg);
HelpHelp = select("Help.Help", yamlConfiguration_msg);
HelpInfo = select("Help.Info", yamlConfiguration_msg);
@@ -128,11 +159,22 @@ public class SelectMessages {
GUIItemHelp_off = select("Help.UseItem_Off", yamlConfiguration_msg);
GUIItemHelp_Slot = select("Help.UseItem_Slot", yamlConfiguration_msg);
PlayerHelpCgui = select("Help.Player.CGUI", yamlConfiguration_msg);
PlayerHelpHelp = select("Help.Player.Help", yamlConfiguration_msg);
PlayerHelpInfo = select("Help.Player.Info", yamlConfiguration_msg);
PlayerHelpOpen = select("Help.Player.Open", yamlConfiguration_msg);
PlayerHelpGive = select("Help.Player.Give", yamlConfiguration_msg);
PlayerHelpCreateDefaultGUI = select("Help.Player.CreateDefaultGUI", yamlConfiguration_msg);
PlayerHelpReload = select("Help.Player.Reload", yamlConfiguration_msg);
PlayerGUIItemHelp_on = select("Help.Player.UseItem_On", yamlConfiguration_msg);
PlayerGUIItemHelp_off = select("Help.Player.UseItem_Off", yamlConfiguration_msg);
PlayerGUIItemHelp_Slot = select("Help.Player.UseItem_Slot", yamlConfiguration_msg);
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
private static String select(String path, YamlConfiguration yamlConfiguration) {
return Replace.replace(Util.getPrefix(),yamlConfiguration.getString(path));
return Replace.replace(Util.getPrefix(), Objects.requireNonNull(yamlConfiguration.getString(path)));
}
}

View File

@@ -1,8 +1,10 @@
package de.jatitv.commandguiv2.Spigot.system.database;
package de.jatitv.commandguiv2.Spigot.database;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import java.sql.*;
@@ -12,13 +14,7 @@ import java.util.Calendar;
import java.util.HashMap;
public class MySQL {
public static String ip = "localhost";
public static Integer port = 3306;
public static String database;
public static String user = "root";
public static String password = "";
protected static String url;
public static Boolean SSL;
private static final HikariConfig config = new HikariConfig();
private static HikariDataSource ds;
@@ -26,56 +22,60 @@ public class MySQL {
long long_ = System.currentTimeMillis();
Calendar now = Calendar.getInstance();
ZoneId timeZone = now.getTimeZone().toZoneId();
send.debug(Main.plugin, "Server TimeZone is : " + timeZone);
send.debug(Main.getPlugin(), "Server TimeZone is : " + timeZone);
try {
config.setJdbcUrl("jdbc:mysql://" + ip + ":" + port + "/" + database + "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone + "&useSSL=" + SSL);
config.setUsername(user);
config.setPassword(password);
config.setJdbcUrl("jdbc:mysql://" + SelectConfig.getMysqlIp() + ":" + SelectConfig.getMysqlPort() + "/" + SelectConfig.getMysqlDatabase()
+ "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone
+ "&useSSL=" + SelectConfig.getMysqlSSL());
config.setUsername(SelectConfig.getMysqlUser());
config.setPassword(SelectConfig.getMysqlPassword());
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
ds = new HikariDataSource(config);
send.console(Main.prefix + " §2MYSQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
send.console(Util.getPrefix() + " §2MYSQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} catch (Exception ex) {
send.console(Main.prefix + " §4MYSQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
send.error(Main.plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
send.console(Util.getPrefix() + " §4MYSQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
send.error(Main.getPlugin(), ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
}
if (SelectConfig.getDebug() || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
try {
send.error(Main.getPlugin(), "MySQL DEBUG:");
Connection con = ds.getConnection();
DatabaseMetaData dbmd = con.getMetaData();
send.debugmsg(Main.getPlugin(), "§6Metadata of the database:");
send.debugmsg(Main.getPlugin(), "§6DB: §e" + dbmd.getDatabaseProductName());
send.debugmsg(Main.getPlugin(), "§6Version: §e" + dbmd.getDatabaseProductVersion());
send.debugmsg(Main.getPlugin(), "§6Driver: §e" + dbmd.getDriverName());
send.debugmsg(Main.getPlugin(), "§6Driver MajorVersion: §e" + dbmd.getDriverMajorVersion() + "." + dbmd.getDriverMinorVersion());
send.debugmsg(Main.getPlugin(), "§6Driver Version: §e" + dbmd.getDriverVersion());
con.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
//Bukkit.getConsoleSender().sendMessage((System.currentTimeMillis() - long_) + "ms");
}
public static void query(String query) {
public static void query(String query) throws SQLException {
if (ds == null) {
return;
}
send.debug(Main.plugin, query);
try (Connection con = ds.getConnection()) {
send.debug(Main.getPlugin(), query);
Connection con = ds.getConnection();
Statement stmt = con.createStatement();
stmt.execute(query);
stmt.close();
} catch (SQLException e) {
System.err.println(e.getMessage());
}
}
public static void query(ArrayList<String> queryList) {
try (Connection con = ds.getConnection()) {
Statement stmt = con.createStatement();
for (String query : queryList) {
send.debug(Main.plugin, query);
stmt.addBatch(query);
}
stmt.executeBatch();
stmt.close();
} catch (SQLException e) {
System.err.println(e.getMessage());
}
con.close();
}
public static HashMap<String, ArrayList<String>> selectAll(String query) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
HashMap<String, ArrayList<String>> Result = new HashMap<>();
try (Connection con = ds.getConnection()) {
Statement stmt = con.createStatement();
@@ -97,7 +97,7 @@ public class MySQL {
}
public static String select(String query) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
String Ausgabe = "";
try (Connection con = ds.getConnection()) {
Statement stmt = con.createStatement();
@@ -114,7 +114,7 @@ public class MySQL {
}
public static int count(String query) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
int count = 0;
try (Connection con = ds.getConnection()) {
Statement stmt = con.createStatement();
@@ -131,7 +131,7 @@ public class MySQL {
}
public static ArrayList<String> selectRow(String query) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
ArrayList<String> Result = new ArrayList<>();
try (Connection con = ds.getConnection()) {
Statement stmt = con.createStatement();

View File

@@ -1,4 +1,4 @@
package de.jatitv.commandguiv2.Spigot.system.database;
package de.jatitv.commandguiv2.Spigot.database;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Util;
@@ -20,7 +20,7 @@ public class SQLITE {
if (!directory.exists()) {
directory.mkdir();
}
url = "jdbc:sqlite:" + Main.plugin.getDataFolder() + "/Storage/data.db";
url = "jdbc:sqlite:" + Main.getPlugin().getDataFolder() + "/Storage/data.db";
con = DriverManager.getConnection(url);
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2SQLITE successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
DatabaseMetaData dbmd = con.getMetaData();
@@ -28,7 +28,7 @@ public class SQLITE {
public static void query(String query) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
try {
Statement stmt = con.createStatement();
stmt.execute(query);
@@ -42,7 +42,7 @@ public class SQLITE {
try {
Statement stmt = con.createStatement();
for (String query : queryList) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
stmt.addBatch(query);
}
stmt.executeBatch();
@@ -54,7 +54,7 @@ public class SQLITE {
public static HashMap<String, ArrayList<String>> selectAll(String query) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
HashMap<String, ArrayList<String>> Result = new HashMap<>();
try {
Statement stmt = con.createStatement();
@@ -76,7 +76,7 @@ public class SQLITE {
}
public static String select(String query) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
String Ausgabe = "";
try {
Statement stmt = con.createStatement();
@@ -93,7 +93,7 @@ public class SQLITE {
}
public static int count(String query) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
int count = 0;
try {
Statement stmt = con.createStatement();
@@ -110,7 +110,7 @@ public class SQLITE {
}
public static ArrayList<String> selectRow(String query) {
send.debug(Main.plugin, query);
send.debug(Main.getPlugin(), query);
ArrayList<String> Result = new ArrayList<>();
try {
Statement stmt = con.createStatement();

View File

@@ -1,25 +1,33 @@
package de.jatitv.commandguiv2.Spigot.system.database;
package de.jatitv.commandguiv2.Spigot.database;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.enums.StorageEnum;
import org.bukkit.entity.Player;
import java.sql.SQLException;
public class SelectDatabase {
private static StorageType Storage;
private static StorageEnum Storage;
public static StorageType getStorage() {
public static StorageEnum getStorage() {
return Storage;
}
public static void setStorage(StorageType storage) {
public static void setStorage(StorageEnum storage) {
Storage = storage;
}
public static void nameCheck(Player player) {
switch (Storage) {
case MYSQL:
try {
MySQL.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
} catch (SQLException e) {
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
e.printStackTrace();
}
break;
case YML:
@@ -34,8 +42,13 @@ public class SelectDatabase {
public static void setSlot(Player player, Integer slot) {
switch (Storage) {
case MYSQL:
try {
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Slot`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
+ "','" + slot + "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Slot` = '" + slot + "';");
} catch (SQLException e) {
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
e.printStackTrace();
}
break;
case YML:
YML.setGuiitemSlot(player, slot);
@@ -52,8 +65,13 @@ public class SelectDatabase {
Events.useItemHashMap.replace(player.getName(), true);
switch (Storage) {
case MYSQL:
try {
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
+ "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '1';");
} catch (SQLException e) {
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
e.printStackTrace();
}
break;
case YML:
YML.setGuiitemOn(player);
@@ -70,8 +88,13 @@ public class SelectDatabase {
Events.useItemHashMap.replace(player.getName(), false);
switch (Storage) {
case MYSQL:
try {
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
+ "', '0') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '0';");
} catch (SQLException e) {
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
e.printStackTrace();
}
break;
case YML:
YML.setGuiitemOff(player);

View File

@@ -1,6 +1,7 @@
package de.jatitv.commandguiv2.Spigot.system.database;
package de.jatitv.commandguiv2.Spigot.database;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
@@ -11,7 +12,7 @@ import java.io.IOException;
public class YML {
private static final Plugin plugin = Main.plugin;
private static final Plugin plugin = Main.getPlugin();
public static File storage = new File(Main.getPath(), "Storage/gui-item.yml");
public static YamlConfiguration yamlConfigurationStorage = YamlConfiguration.loadConfiguration(storage);
@@ -45,6 +46,7 @@ public class YML {
try {
yamlConfigurationStorage.save(storage);
} catch (IOException e) {
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
e.printStackTrace();
}
}

View File

@@ -0,0 +1,7 @@
package de.jatitv.commandguiv2.Spigot.enums;
public enum EcoEnum {
VAULT, MONEY,
ITEM,
VOTEPOINTS
}

View File

@@ -0,0 +1,6 @@
package de.jatitv.commandguiv2.Spigot.enums;
public enum FunctionItemEnum {
REMOVE, ADD
}

View File

@@ -0,0 +1,5 @@
package de.jatitv.commandguiv2.Spigot.enums;
public enum FunctionVoteEnum {
REMOVE, ADD
}

View File

@@ -0,0 +1,10 @@
package de.jatitv.commandguiv2.Spigot.enums;
public enum SoundEnum {
OpenInventory,
Click,
NoMoney,
NoInventorySpace,
Give,
PlayerNotFound
}

View File

@@ -0,0 +1,7 @@
package de.jatitv.commandguiv2.Spigot.enums;
public enum StorageEnum {
MYSQL,
SQLITE,
YML
}

View File

@@ -0,0 +1,366 @@
package de.jatitv.commandguiv2.Spigot.gui;
import de.jatitv.commandguiv2.Spigot.listener.ServerChange;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.system.Placeholder;
import de.jatitv.commandguiv2.Spigot.sound.Sound;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.eco.Eco;
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 org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
import java.io.IOException;
public class GUIListener implements Listener {
private static String prefix = Util.getPrefix();
public static String GUICode;
private static Plugin plugin = Main.getPlugin();
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
Player player = (Player) e.getWhoClicked();
if (e.getInventory() == null) return;
if (e.getCurrentItem() == null) return;
for (Gui gui : Main.guiHashMap.values()) {
if (player.getOpenInventory().getTitle().equals(Replace.replace(prefix, GUICode + gui.guiName))
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(Replace.replace(prefix, player, GUICode + gui.guiName)))) {
e.setCancelled(true);
for (Slot slot : gui.slots) {
execute(e, slot, player, gui);
}
}
}
}
private static void execute(InventoryClickEvent e, Slot slot, Player player, Gui gui) {
if (e.getSlot() != slot.slot) return;
Function function = Main.functionHashMap.get(slot.function);
if (slot.permission && !player.hasPermission(slot.permissionToSee)) return;
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
if (function.noPermMessageEnable) {
if (function.customNoPermMessage == null || function.customNoPermMessage.equals("")) {
send.player(player, SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name))
.replace("[perm]", slot.permissionToUse));
} else send.player(player, function.customNoPermMessage.replace("[item]", Replace.replace(prefix, function.name))
.replace("[perm]", slot.permissionToUse));
}
return;
}
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == ItemVersion.getGreenWool().getType() ||
e.getCurrentItem().getType() == ItemVersion.getRedWool().getType() ||
e.getCurrentItem().getType() == Material.valueOf(function.item.toUpperCase().replace(".", "_"))) {
if (!slot.enable) return;
if (function.cost_Enable) {
if (functions(function)) {
eco(e, slot, player, gui, function);
}
} else {
execute(function, slot, player, e, gui);
}
}
}
private static boolean functions(Function function) {
if (function.togglePermission) return true;
if (function.toggleUseItem) return true;
if (function.command_Enable) return true;
if (function.openGUI_Enable) return true;
if (function.message_Enable) return true;
if (function.serverChange) return true;
if (function.setConfigEnable) return true;
if (function.functionVotePoints) return true;
return function.functionItem;
}
private static void execute(Function function, Slot slot, Player player, InventoryClickEvent e, Gui gui) {
if (function.togglePermission) togglePerm(function, gui, player);
if (function.toggleUseItem) toggleUseItem(player, gui);
if (function.command_Enable) command(function, player);
if (function.openGUI_Enable) openGUI(function, player);
if (function.message_Enable) message(function, player);
if (function.serverChange) serverChange(function, player);
if (function.setConfigEnable) setConfig(function, player, e);
if (function.functionVotePoints) votePoints(e, function, player);
if (function.functionItem) item(function, player);
Sound.play(player, SoundEnum.Click, function, slot, gui);
}
private static void command(Function slot, Player player) {
player.closeInventory();
new BukkitRunnable() {
@Override
public void run() {
if (slot.command_BungeeCommand) {
if (SelectConfig.getBungee()) {
for (String cmd : slot.command) {
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.commandAsConsole);
}
} 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 {
for (String cmd : slot.command) {
if (slot.commandAsConsole) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
} else player.chat("/" + cmd.replace("[player]", player.getName()));
}
}
}
}.runTaskLater(plugin, 2L);
}
private static void openGUI(Function slot, Player player) {
player.closeInventory();
new BukkitRunnable() {
@Override
public void run() {
OpenGUI.openGUI(player, slot.openGUI, true);
}
}.runTaskLater(plugin, 1L);
}
private static void message(Function slot, Player player) {
player.closeInventory();
for (String msg : slot.message) {
if (Main.PaPi) {
if (slot.cost_Enable) {
send.player(player, Replace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.getCurrency()));
} else send.player(player, Replace.replace(prefix, player, Placeholder.replace(msg, player)));
} else {
if (slot.cost_Enable) {
send.player(player, Replace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.getCurrency()));
} else send.player(player, Replace.replace(prefix, Placeholder.replace(msg, player)));
}
}
}
private static void serverChange(Function slot, Player player) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
send.player(player, SelectMessages.onServerChange.replace("[server]", slot.serverChangeServer));
new BukkitRunnable() {
@Override
public void run() {
ServerChange.send(player, slot.serverChangeServer);
}
}.runTaskLater(Main.getPlugin(), 20L);
}
private static void setConfig(Function slot, Player player, InventoryClickEvent e) {
File config = new File(slot.configFilePath);
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (e.getClick() == ClickType.LEFT) {
switch (slot.configOptionPremat) {
case "String":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueLeft);
break;
case "Boolean":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueLeft);
break;
case "Integer":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueLeft);
break;
case "Double":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueLeft);
break;
case "List":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueLeft);
break;
default:
send.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
break;
}
}
if (e.getClick() == ClickType.RIGHT) {
switch (slot.configOptionPremat) {
case "String":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueRight);
break;
case "Boolean":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueRight);
break;
case "Integer":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueRight);
break;
case "Double":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueRight);
break;
case "List":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueRight);
break;
default:
send.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
break;
}
}
try {
yamlConfiguration.save(config);
} catch (IOException tac) {
tac.printStackTrace();
}
if (slot.pluginReloadEnable) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), slot.pluginReloadCommand);
}
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
}
private static void togglePerm(Function function, Gui gui, Player player) {
if (player.hasPermission(function.togglePermissionPerm)) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.getTogglePermFalse().replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
OpenGUI.openGUI(player, gui.key, false);
}
}.runTaskLater(plugin, 4L);
} else
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.getTogglePermTrue().replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
OpenGUI.openGUI(player, gui.key, false);
}
}.runTaskLater(plugin, 4L);
}
private static void toggleUseItem(Player player, Gui gui) {
if (Events.useItemHashMap.get(player.getName())) {
Commands.itemOff(player);
} else {
Commands.itemOn(player);
}
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
OpenGUI.openGUI(player, gui.key, false);
}
}.runTaskLater(plugin, 2L);
}
private static void votePoints(InventoryClickEvent e, Function function, Player player) {
player.closeInventory();
switch (function.functionVotePointsMode) {
case ADD:
Eco.votePointsAdd(prefix, player, function.functionVotePointsAmount);
send.player(player, SelectMessages.functionVoteAdd.replace("[amount]", function.functionVotePointsAmount.toString()));
break;
case REMOVE:
if (Eco.votePointsRemove(prefix, player, function.functionVotePointsAmount)) {
send.player(player, SelectMessages.functionVoteRemove.replace("[amount]", function.functionVotePointsAmount.toString()));
} else send.player(player, SelectMessages.functionVoteRemoveError.replace("[amount]", function.functionVotePointsAmount.toString()));
break;
}
}
private static void item(Function function, Player player) {
String[] item = function.functionItemItem.split(";");
player.closeInventory();
switch (function.functionItemMode) {
case ADD:
Eco.itemAdd(player, item[0], Integer.parseInt(item[1]));
send.player(player, SelectMessages.functionItemAdd.replace("[amount]", item[1]).replace("[item]", item[0]));
break;
case REMOVE:
if (Eco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
send.player(player, SelectMessages.functionItemRemove.replace("[amount]", item[1]).replace("[item]", item[0]));
} else send.player(player, SelectMessages.functionItemRemoveError.replace("[amount]", item[1]));
break;
}
}
private static void eco(InventoryClickEvent e, Slot slot, Player player, Gui gui, Function function) {
switch (function.ecoModule) {
case ITEM:
String[] item = function.ecoItem.split(";");
if (!Eco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
send.player(player, SelectMessages.noMoneyItem.replace("[item]", item[0]).replace("[amount]", item[1]));
Sound.play(player, SoundEnum.NoMoney);
} else {
send.player(player, SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
.replace("[price]", item[1] + " " + item[0]));
execute(function, slot, player, e, gui);
}
break;
case VOTEPOINTS:
if (!Eco.votePointsRemove(prefix, player, function.votePoints)) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
send.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
Sound.play(player, SoundEnum.NoMoney);
} else {
send.player(player, SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
.replace("[price]", function.votePoints + " VotePoints"));
execute(function, slot, player, e, gui);
}
break;
case VAULT:
case MONEY:
if (!Eco.moneyRemove(prefix, player, function.price)) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
send.player(player, Replace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
Sound.play(player, SoundEnum.NoMoney);
} else {
send.player(player, SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
.replace("[price]", function.price + " " + SelectConfig.getCurrency()));
execute(function, slot, player, e, gui);
}
break;
}
}
}

View File

@@ -6,7 +6,7 @@ import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.system.Papi;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.system.Placeholder;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
@@ -26,63 +26,71 @@ public class GuiBuilder {
private static String prefix = Util.getPrefix();
protected static void item(Function function, Integer slot, Player player, Inventory inventory) {
protected static void item(Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);
ItemStack item;
if (Main.legacy && function.item.toUpperCase().contains(",")) {
String[] split = function.item.toUpperCase().split(",");
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
} else item = new ItemStack(Material.valueOf(function.item.toUpperCase().replace(".", "_")));
ItemMeta itemMeta = item.getItemMeta();
setDisplayNameAndLore(itemMeta, player, function);
setDisplayNameAndLore(itemMeta, player, slot);
item.setItemMeta(itemMeta);
Integer am;
if (function.itemAmount == 0) {
am = 1;
} else am = function.itemAmount;
item.setAmount(am);
inventory.setItem(slot, item);
inventory.setItem(slot.slot, item);
}
protected static void item(String material, Function function, Integer slot, Player player, Inventory inventory) {
protected static void item(String material, Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);
ItemStack item;
if (Main.legacy && material.contains(",")) {
String[] split = material.split(",");
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
} else item = new ItemStack(Material.valueOf(material));
ItemMeta itemMeta = item.getItemMeta();
setDisplayNameAndLore(itemMeta, player, function);
setDisplayNameAndLore(itemMeta, player, slot);
item.setItemMeta(itemMeta);
Integer am;
if (function.itemAmount == 0) {
am = 1;
} else am = function.itemAmount;
item.setAmount(am);
inventory.setItem(slot, item);
inventory.setItem(slot.slot, item);
}
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Function slot) {
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Slot slot) {
Function function = Main.functionHashMap.get(slot.function);
if (Main.PaPi) {
itemMeta.setDisplayName(Replace.replace(prefix, player, Placeholder.replace(slot.name, player)));
itemMeta.setLore(Replace.replacePrice(prefix, player, Placeholder.replace(slot.lore, player), slot.price + " " + SelectConfig.Currency));
itemMeta.setDisplayName(Replace.replace(prefix, player, Placeholder.replace(function.name, player)));
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
itemMeta.setLore(Replace.replacePrice(prefix, player, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
} else itemMeta.setLore(Replace.replacePrice(prefix, player, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
} else {
itemMeta.setDisplayName(Replace.replace(prefix, Placeholder.replace(slot.name,player)));
itemMeta.setLore(Replace.replacePrice(prefix, Placeholder.replace(slot.lore,player), slot.price + " " + SelectConfig.Currency));
itemMeta.setDisplayName(Replace.replace(prefix, Placeholder.replace(function.name, player)));
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
itemMeta.setLore(Replace.replacePrice(prefix, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
} else itemMeta.setLore(Replace.replacePrice(prefix, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
}
}
protected static void base64(String base64Value, Function function, Integer slot, Player player, Inventory inventory) {
protected static void base64(String base64Value, Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);
ItemStack item = ItemVersion.getHeadIS();
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
setBase64(itemMeta, base64Value);
setDisplayNameAndLore(itemMeta, player, function);
setDisplayNameAndLore(itemMeta, player, slot);
item.setItemMeta(itemMeta);
Integer am;
if (function.itemAmount == 0) {
am = 1;
} else am = function.itemAmount;
item.setAmount(am);
inventory.setItem(slot, item);
inventory.setItem(slot.slot, item);
}
private static void setBase64(ItemMeta itemMeta, String base64Value) {
@@ -98,14 +106,16 @@ public class GuiBuilder {
}
}
protected static void base64(Function function, Integer slot, Player player, Inventory inventory) {
base64(function.base64Value, function, slot, player, inventory);
protected static void base64(Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);
base64(function.base64Value, slot, player, inventory);
}
protected static void playerHead(Function function, Integer slot, Player player, Inventory inventory, String skullName) {
protected static void playerHead(Slot slot, Player player, Inventory inventory, String skullName) {
Function function = Main.functionHashMap.get(slot.function);
ItemStack item = ItemVersion.getHeadIS();
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
setDisplayNameAndLore(itemMeta, player, function);
setDisplayNameAndLore(itemMeta, player, slot);
itemMeta.setOwner(skullName);
item.setItemMeta(itemMeta);
Integer am;
@@ -113,7 +123,7 @@ public class GuiBuilder {
am = 1;
} else am = function.itemAmount;
item.setAmount(am);
inventory.setItem(slot, item);
inventory.setItem(slot.slot, item);
}
public static void fillItem(Inventory inventory, Gui gui) {

View File

@@ -1,13 +1,15 @@
package de.jatitv.commandguiv2.Spigot.gui;
import de.jatitv.commandguiv2.Spigot.Listener.GUIListener;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.sound.Sound;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
import io.github.solyze.plugmangui.inventories.PluginListGUI;
import net.t2code.lib.Spigot.Lib.messages.send;
@@ -23,7 +25,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
public class OpenGUI {
private static Plugin plugin = Main.plugin;
private static Plugin plugin = Main.getPlugin();
private static String prefix = Util.getPrefix();
public static void openGUI(Player player, String guiString, Boolean sound) {
@@ -44,7 +46,7 @@ public class OpenGUI {
if (Main.PlugManGUI) {
player.openInventory((new PluginListGUI(54, 1)).getInventory());
} else {
if (player.hasPermission("commandgui.admin")) {
if (player.hasPermission(Permissions.admin)) {
send.player(player, prefix + " §4PlugManGUI could not be found! §9Please download it here: " +
"§6https://spigotmc.org/resources/plugmangui.87599/");
}
@@ -54,7 +56,7 @@ public class OpenGUI {
if (Main.LuckyBox) {
LuckyBoxAPI.openShop(player);
} else {
if (player.hasPermission("commandgui.admin")) {
if (player.hasPermission(Permissions.admin)) {
send.player(player, prefix + " §4T2C-LuckyBox could not be found! §9Please download it here: " +
"§6https://www.spigotmc.org/resources/luckybox.98154/");
}
@@ -65,7 +67,7 @@ public class OpenGUI {
if (MCVersion.minecraft1_13) {
GUIListener.GUICode = "";
} else GUIListener.GUICode = "§6§8§9§r";
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (gui.guiEnable || player.hasPermission(Permissions.updatemsg)) {
Inventory inventory;
if (Main.PaPi) {
inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (Replace.replace(prefix, player, GUIListener.GUICode + gui.guiName)));
@@ -75,9 +77,10 @@ public class OpenGUI {
GuiBuilder.fillItem(inventory, gui);
}
for (Slot slot : gui.slots) {
try {
Function function = Main.functionHashMap.get(slot.function);
if (function == null) {
send.error(Main.plugin, "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
send.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
continue;
}
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
@@ -90,54 +93,57 @@ public class OpenGUI {
} else {
if (function.togglePermission) {
if (player.hasPermission(function.togglePermissionPerm)) {
toggleOn(function, slot.slot, player, inventory);
toggleOn(function, slot, player, inventory);
} else {
toggleOff(function, slot.slot, player, inventory);
toggleOff(function, slot, player, inventory);
}
} else if (function.toggleUseItem) {
if (Events.useItemHashMap.get(player.getName())) {
toggleOn(function, slot.slot, player, inventory);
toggleOn(function, slot, player, inventory);
} else {
toggleOff(function, slot.slot, player, inventory);
toggleOff(function, slot, player, inventory);
}
} else {
if (function.playerHead_Enable) {
if (function.base64_Enable) {
GuiBuilder.base64(function, slot.slot, player, inventory);
GuiBuilder.base64(slot, player, inventory);
} else {
if (function.playerWhoHasOpenedTheGUI) {
GuiBuilder.playerHead(function, slot.slot, player, inventory, player.getName());
GuiBuilder.playerHead(slot, player, inventory, player.getName());
} else {
GuiBuilder.playerHead(function, slot.slot, player, inventory, function.playerName);
GuiBuilder.playerHead(slot, player, inventory, function.playerName);
}
}
} else {
GuiBuilder.item(function, slot.slot, player, inventory);
GuiBuilder.item(slot, player, inventory);
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
ItemStack air = new ItemStack(Material.AIR);
inventory.setItem(slot.slot, air);
}
}
}
if (sound) {
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
}
Sound.play(player, SoundEnum.OpenInventory);
}
player.openInventory(inventory);
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.guiName)));
} else send.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.guiName)));
}
private static void toggleOn(Function function, Integer slot, Player player, Inventory inventory) {
if (SelectConfig.toggleItemOnOrYesBase64) {
GuiBuilder.base64(SelectConfig.toggleItemOnOrYesBase64Value, function, slot, player, inventory);
} else GuiBuilder.item(SelectConfig.toggleItemOnOrYesMaterial, function, slot, player, inventory);
private static void toggleOn(Function function, Slot slot, Player player, Inventory inventory) {
if (SelectConfig.getToggleItemOnOrYesBase64()) {
GuiBuilder.base64(SelectConfig.getToggleItemOnOrYesBase64Value(), slot, player, inventory);
} else GuiBuilder.item(SelectConfig.getToggleItemOnOrYesMaterial(), slot, player, inventory);
}
private static void toggleOff(Function function, Integer slot, Player player, Inventory inventory) {
if (SelectConfig.toggleItemOffOrNoBase64) {
GuiBuilder.base64(SelectConfig.toggleItemOffOrNoBase64Value, function, slot, player, inventory);
} else GuiBuilder.item(SelectConfig.toggleItemOffOrNoMaterial, function, slot, player, inventory);
private static void toggleOff(Function function, Slot slot, Player player, Inventory inventory) {
if (SelectConfig.getToggleItemOffOrNoBase64()) {
GuiBuilder.base64(SelectConfig.getToggleItemOffOrNoBase64Value(), slot, player, inventory);
} else GuiBuilder.item(SelectConfig.getToggleItemOffOrNoMaterial(), slot, player, inventory);
}
}

View File

@@ -1,4 +1,4 @@
package de.jatitv.commandguiv2.Spigot.system;
package de.jatitv.commandguiv2.Spigot.listener;
import de.jatitv.commandguiv2.Spigot.Main;
import net.t2code.lib.Spigot.Lib.messages.send;
@@ -30,10 +30,10 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
}
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
player.sendPluginMessage(Main.getPlugin(), "cgui:bungee", stream.toByteArray());
}else {
for(Player player : Bukkit.getOnlinePlayers()){
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
player.sendPluginMessage(Main.getPlugin(), "cgui:bungee", stream.toByteArray());
return;
}
}
@@ -42,12 +42,12 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
send.debug(Main.plugin,"stream: "+stream.toString());
send.debug(Main.getPlugin(),"stream: "+stream.toString());
try {
String subChannel = stream.readUTF();
String input = stream.readUTF();
send.debug(Main.plugin,"subChannel: " +subChannel);
send.debug(Main.plugin,"input: " +input);
send.debug(Main.getPlugin(),"subChannel: " +subChannel);
send.debug(Main.getPlugin(),"input: " +input);
switch (subChannel) {
case "join":
Main.bungeejoinplayers.add(input);

View File

@@ -0,0 +1,23 @@
// This claas was created by JaTiTV
package de.jatitv.commandguiv2.Spigot.listener;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
public class PluginEvent implements Listener {
private static String prefix = Util.getPrefix();
@EventHandler
public void onJoinEvent(PlayerLoginEvent event) {
Player player = event.getPlayer();
SelectDatabase.nameCheck(player);
UpdateAPI.join(Main.getPlugin(),prefix, "commandgui.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord());
}
}

View File

@@ -1,4 +1,4 @@
package de.jatitv.commandguiv2.Spigot.Listener;
package de.jatitv.commandguiv2.Spigot.listener;
import de.jatitv.commandguiv2.Spigot.Main;
import org.bukkit.entity.Player;
@@ -8,7 +8,6 @@ import java.io.DataOutputStream;
import java.io.IOException;
public class ServerChange {
public static void send(Player player, String server){
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
@@ -18,6 +17,6 @@ public class ServerChange {
} catch (IOException i) {
i.printStackTrace();
}
player.sendPluginMessage(Main.plugin, "BungeeCord", b.toByteArray());
player.sendPluginMessage(Main.getPlugin(), "BungeeCord", b.toByteArray());
}
}

View File

@@ -1,10 +1,14 @@
package de.jatitv.commandguiv2.Spigot.objects;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUITab;
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.enums.EcoEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -13,7 +17,6 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class Obj_Select {
public static void onSelect() {
@@ -27,12 +30,14 @@ public class Obj_Select {
File f = new File(Main.getPath() + "/GUIs/");
File[] fileArray = f.listFiles();
for (File config_gui : fileArray) {
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
for (File config : fileArray) {
try {
if (config.getName().equals("guiDeclaration.yml")) continue;
String sub = config.getName().substring(config.getName().length() - 4);
if (sub.equals(".yml")) {
String key = config_gui.getName().replace(".yml", "");
String key = config.getName().replace(".yml", "");
Main.allAliases.add(key);
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config_gui);
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config);
Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable");
Integer guiLines = yamlConfiguration_gui.getInt("GUI.Lines");
@@ -60,16 +65,16 @@ public class Obj_Select {
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
Function functionCheck = Main.functionHashMap.get(function);
if (functionCheck == null) {
send.error(Main.plugin, "The Function " + function + " in the GUI " + key + " does not exist!");
send.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
}
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Permission.Required");
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
String permUse = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.Use");
Slot slot = new Slot(slotNumber, enable, function, permRequired,
Objects.requireNonNull(permSee).replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
permSee.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
.replace("[slotname]", slotKey.toLowerCase()),
Objects.requireNonNull(permUse).replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
permUse.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
.replace("[slotname]", slotKey.toLowerCase()));
slots.add(slot);
}
@@ -77,14 +82,15 @@ public class Obj_Select {
key, commandAliasEnable, commandPermission, slots);
Main.guiHashMap.put(key, gui);
CmdExecuter_GUITab.arg1.put(config_gui.getName()
CmdExecuter_GUI.arg1.put(config.getName()
.replace(".yml", ""), "commandgui.gui." + key);
try {
yamlConfiguration_gui.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
yamlConfiguration_gui.save(config);
}
} catch (Exception e) {
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
e.printStackTrace();
}
}
}
@@ -95,6 +101,7 @@ public class Obj_Select {
File[] fileArray = f.listFiles();
for (File config : fileArray) {
if (config.getName().equals("functionDeclaration.yml")) continue;
String sub = config.getName().substring(config.getName().length() - 4);
if (sub.equals(".yml")) {
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
@@ -110,10 +117,29 @@ public class Obj_Select {
String item = yamlConfiguration.getString("Slots.Function.Item.Material");
String name = yamlConfiguration.getString("Slots.Function.Item.Name");
List<String> lore = yamlConfiguration.getStringList("Slots.Function.Item.Lore");
if (yamlConfiguration.get("Slots.Function.NoPermission") == null) {
ConfigConverterUnderV5.noPermLore(yamlConfiguration, config);
}
Boolean noPermMessageEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Message.Enable");
String customNoPermMessage = yamlConfiguration.getString("Slots.Function.NoPermission.Message.CustomNoPermMessage");
Boolean noPermLoreEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Item.Lore.Enable");
List<String> noPermLore = yamlConfiguration.getStringList("Slots.Function.NoPermission.Item.Lore.Lore");
Boolean customSound_Enable = yamlConfiguration.getBoolean("Slots.Function.CustomSound.Enable");
Boolean customSound_NoSound = yamlConfiguration.getBoolean("Slots.Function.CustomSound.NoSound");
String customSound_Sound = yamlConfiguration.getString("Slots.Function.CustomSound.Sound");
Boolean cost_Enable = yamlConfiguration.getBoolean("Slots.Function.Cost.Enable");
EcoEnum ecoModule = null;
if (yamlConfiguration.get("Slots.Function.Cost.EcoModule") != null) {
try {
ecoModule = EcoEnum.valueOf(yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase());
} catch (Exception ex) {
send.error(Main.getPlugin(), "The EcoModule " + yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase() + " in the function file "
+ config.getName() + " does not exist. Please use one of the supported modules. (VAULT, ITEM, VOTEPOINTS)");
}
} else ecoModule = EcoEnum.VAULT;
String ecoItem = yamlConfiguration.getString("Slots.Function.Cost.Item");
Integer votePoints = yamlConfiguration.getInt("Slots.Function.Cost.VotePoints");
Double price = yamlConfiguration.getDouble("Slots.Function.Cost.Price");
Boolean command_Enable = yamlConfiguration.getBoolean("Slots.Function.Command.Enable");
Boolean command_BungeeCommand = yamlConfiguration.getBoolean("Slots.Function.Command.BungeeCommand");
@@ -150,13 +176,38 @@ public class Obj_Select {
Boolean pluginReloadEnable = yamlConfiguration.getBoolean("Slots.Function.SetConfig.PluginReload.Enable");
String pluginReloadCommand = yamlConfiguration.getString("Slots.Function.SetConfig.PluginReload.Command");
Boolean functionVotePoints = yamlConfiguration.getBoolean("Slots.Function.FunctionVotePoints.Enable");
FunctionVoteEnum functionVotePointsMode = null;
if (yamlConfiguration.get("Slots.Function.FunctionVotePoints.Mode") != null) {
try {
functionVotePointsMode = FunctionVoteEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase());
} catch (Exception ex) {
send.error(Main.getPlugin(), "The VotePoints Mode " + yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase() + " in the function file "
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
}
}
Integer functionVotePointsAmount = yamlConfiguration.getInt("Slots.Function.FunctionVotePoints.Amount");
Boolean functionItem = yamlConfiguration.getBoolean("Slots.Function.FunctionItem.Enable");
FunctionItemEnum functionItemMode = null;
if (yamlConfiguration.get("Slots.Function.FunctionItem.Mode") != null) {
try {
functionItemMode = FunctionItemEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase());
} catch (Exception ex) {
send.error(Main.getPlugin(), "The Item Mode " + yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase() + " in the function file "
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
}
}
String functionItemItem = yamlConfiguration.getString("Slots.Function.FunctionItem.Item");
Function function = new Function(key, empty, itemAmount, playerHead_Enable, base64_Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, item, name, lore,
customSound_Enable, customSound_NoSound, customSound_Sound, cost_Enable, price, command_Enable, command_BungeeCommand, commandAsConsole, command,
serverChange, serverChangeServer, openGUI_Enable, openGUI, togglePermission, togglePermissionPerm, toggleUseItem, message_Enable, message,
setConfigEnable, configFilePath, configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft,
noPermMessageEnable, customNoPermMessage, noPermLoreEnable, noPermLore,
customSound_Enable, customSound_NoSound, customSound_Sound, cost_Enable, ecoModule, ecoItem, votePoints, price, command_Enable, command_BungeeCommand,
commandAsConsole, command, serverChange, serverChangeServer, openGUI_Enable, openGUI, togglePermission, togglePermissionPerm, toggleUseItem, message_Enable,
message, setConfigEnable, configFilePath, configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft,
configDoubleValueLeft, configListValueLeft, configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight,
configListValueRight, pluginReloadEnable, pluginReloadCommand);
configListValueRight, pluginReloadEnable, pluginReloadCommand, functionVotePoints, functionVotePointsMode, functionVotePointsAmount,
functionItem, functionItemMode, functionItemItem);
Main.functionHashMap.put(key, function);
try {

View File

@@ -1,5 +1,9 @@
package de.jatitv.commandguiv2.Spigot.objects.functions;
import de.jatitv.commandguiv2.Spigot.enums.EcoEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
import java.util.List;
public class Function {
@@ -14,11 +18,18 @@ public class Function {
public String playerName;
public String item;
public String name;
public List lore;
public List<String> lore;
public Boolean noPermMessageEnable;
public String customNoPermMessage;
public Boolean noPermLoreEnable;
public List<String> noPermLore;
public Boolean customSound_Enable;
public Boolean customSound_NoSound;
public String customSound_Sound;
public Boolean cost_Enable;
public EcoEnum ecoModule;
public String ecoItem;
public Integer votePoints;
public Double price;
public Boolean command_Enable;
public Boolean command_BungeeCommand;
@@ -37,7 +48,6 @@ public class Function {
public String configFilePath;
public String configOptionPath;
public String configOptionPremat;
// public Boolean ConfigChatInput;
public String configStringValueLeft;
public Boolean configBooleanValueLeft;
@@ -54,6 +64,12 @@ public class Function {
public Boolean pluginReloadEnable;
public String pluginReloadCommand;
public Boolean functionVotePoints;
public FunctionVoteEnum functionVotePointsMode;
public Integer functionVotePointsAmount;
public Boolean functionItem;
public FunctionItemEnum functionItemMode;
public String functionItemItem;
public Function(String key,
Boolean empty,
@@ -66,10 +82,17 @@ public class Function {
String item,
String name,
List<String> lore,
Boolean noPermMessageEnable,
String customNoPermMessage,
Boolean noPermLoreEnable,
List<String> noPermLore,
Boolean customSound_Enable,
Boolean customSound_NoSound,
String customSound_Sound,
Boolean cost_Enable,
EcoEnum ecoModule,
String ecoItem,
Integer votePoints,
Double price,
Boolean command_Enable,
Boolean command_BungeeCommand,
@@ -102,7 +125,13 @@ public class Function {
List<String> configListValueRight,
Boolean pluginReloadEnable,
String pluginReloadCommand) {
String pluginReloadCommand,
Boolean functionVotePoints,
FunctionVoteEnum functionVotePointsMode,
Integer functionVotePointsAmount,
Boolean functionItem,
FunctionItemEnum functionItemMode,
String functionItemItem) {
this.key = key;
this.empty = empty;
this.itemAmount = itemAmount;
@@ -114,10 +143,17 @@ public class Function {
this.item = item;
this.name = name;
this.lore = lore;
this.noPermMessageEnable = noPermMessageEnable;
this.customNoPermMessage = customNoPermMessage;
this.noPermLoreEnable = noPermLoreEnable;
this.noPermLore = noPermLore;
this.customSound_Enable = customSound_Enable;
this.customSound_NoSound = customSound_NoSound;
this.customSound_Sound = customSound_Sound;
this.cost_Enable = cost_Enable;
this.ecoModule = ecoModule;
this.ecoItem = ecoItem;
this.votePoints = votePoints;
this.price = price;
this.command_Enable = command_Enable;
this.command_BungeeCommand = command_BungeeCommand;
@@ -154,6 +190,13 @@ public class Function {
this.pluginReloadEnable = pluginReloadEnable;
this.pluginReloadCommand = pluginReloadCommand;
this.functionVotePoints = functionVotePoints;
this.functionVotePointsMode = functionVotePointsMode;
this.functionVotePointsAmount = functionVotePointsAmount;
this.functionItem = functionItem;
this.functionItemMode = functionItemMode;
this.functionItemItem = functionItemItem;
}
}

View File

@@ -0,0 +1,63 @@
package de.jatitv.commandguiv2.Spigot.sound;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.replace.Replace;
import org.bukkit.entity.Player;
public class Sound {
private static String prefix = Util.getPrefix();
public static void play(Player player, SoundEnum soundEnum) {
if (!SelectConfig.getSound_Enable()) return;
play(player, soundEnum, null, null, null);
}
public static void play(Player player, SoundEnum soundEnum, Function function, Slot slot, Gui gui) {
if (!SelectConfig.getSound_Enable()) return;
switch (soundEnum) {
case OpenInventory:
if (!SelectConfig.getSound_OpenInventory_Enable()) return;
player.playSound(player.getLocation(), SelectConfig.getSound_OpenInventory(), 3, 1);
break;
case Click:
if (!SelectConfig.getSound_Click_Enable()) return;
if (!function.customSound_Enable) {
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
return;
}
if (function.customSound_NoSound) return;
try {
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(function.customSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
} catch (Exception e1) {
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
}
break;
case NoMoney:
if (!SelectConfig.getSound_NoMoney_Enable()) return;
player.playSound(player.getLocation(), SelectConfig.getSound_NoMoney(), 3, 1);
break;
case NoInventorySpace:
if (!SelectConfig.getSound_NoInventorySpace_Enable()) return;
player.playSound(player.getLocation(), SelectConfig.getSound_NoInventorySpace(), 3, 1);
break;
case Give:
if (!SelectConfig.getSound_Give_Enable()) return;
player.playSound(player.getLocation(), SelectConfig.getSound_Give(), 3, 1);
break;
case PlayerNotFound:
if (!SelectConfig.getSound_PlayerNotFound_Enable()) return;
player.playSound(player.getLocation(), SelectConfig.getSound_PlayerNotFound(), 3, 1);
break;
}
}
}

View File

@@ -10,22 +10,22 @@ import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
public class Debug {
private static Plugin plugin = Main.plugin;
private static final Plugin plugin = Main.getPlugin();
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, String.valueOf(Arrays.asList(Main.getPlugin().getServer().getPluginManager().getPlugins())));
send.debug(plugin, "§5----------------------------------");
if (new File(Main.getPath(), "config.yml").exists()) {
File f = new File(String.valueOf(Main.getPath()));
@@ -34,63 +34,24 @@ public class Debug {
File[] fileArray = f.listFiles();
File[] fileArray2 = f2.listFiles();
File[] fileArray3 = f3.listFiles();
if (fileArray != null) {
for (File config : fileArray) {
send.debug(plugin, String.valueOf(config).replace("plugins/CommandGUI/", ""));
}
}
if (fileArray2 != null) {
for (File config2 : fileArray2) {
send.debug(plugin, String.valueOf(config2).replace("plugins/CommandGUI/", ""));
}
} else send.debug(plugin, "No GUI files available");
if (fileArray3 != null) {
for (File config3 : fileArray3) {
send.debug(plugin, String.valueOf(config3).replace("plugins/CommandGUI/", ""));
}
} else send.debug(plugin, "No language files available");
}
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);
}
}
}

View File

@@ -1,8 +1,10 @@
package de.jatitv.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.Listener.GUIListener;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.EventsFrom110;
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUITab;
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import de.jatitv.commandguiv2.Spigot.gui.GUIListener;
import de.jatitv.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
import de.jatitv.commandguiv2.Spigot.useItem.EventsFrom110;
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
@@ -10,16 +12,16 @@ import de.jatitv.commandguiv2.Spigot.config.functions.CreateFunctions;
import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI;
import de.jatitv.commandguiv2.Spigot.config.languages.LanguagesCreate;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
import de.jatitv.commandguiv2.Spigot.Listener.PluginEvent;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.database.MySQL;
import de.jatitv.commandguiv2.Spigot.listener.PluginEvent;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
import de.jatitv.commandguiv2.Spigot.config.config.ConfigCreate;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.system.database.SQLITE;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.system.database.StorageType;
import de.jatitv.commandguiv2.Spigot.database.SQLITE;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.enums.StorageEnum;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
@@ -33,9 +35,9 @@ import java.sql.SQLException;
import java.util.List;
public class Load {
static Plugin plugin = Main.plugin;
static Plugin plugin = Main.getPlugin();
public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
try {
@@ -45,8 +47,19 @@ public class Load {
}
send.console(prefix + " §8-------------------------------");
try {
ConfigConverterUnderV5.renameMainFolder();
} catch (Exception e) {
e.printStackTrace();
}
if (!new File(Main.getPath(), "config.yml").exists()) {
try {
plugin.saveResource("configDeclaration.yml", false);
} catch (Exception e) {
e.printStackTrace();
}
try {
CreateGUI.configCreate();
} catch (Exception e) {
@@ -58,6 +71,7 @@ public class Load {
e.printStackTrace();
}
}
try {
ConfigCreate.configCreate();
} catch (Exception e) {
@@ -68,10 +82,20 @@ public class Load {
} catch (Exception e) {
e.printStackTrace();
}
try {
plugin.saveResource("GUIs/guiDeclaration.yml", true);
} catch (Exception e) {
e.printStackTrace();
}
try {
plugin.saveResource("Functions/functionDeclaration.yml", true);
} catch (Exception e) {
e.printStackTrace();
}
SelectConfig.setConfigVersion();
if (SelectConfig.Bungee) {
if (SelectConfig.getBungee()) {
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "cgui:bungee")) {
send.debug(plugin, "registerOutgoingPluginChannel §ecgui:bungee");
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "cgui:bungee");
@@ -96,11 +120,7 @@ public class Load {
} catch (Exception e) {
e.printStackTrace();
}
try {
CmdExecuter_GUITab.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
} catch (Exception e) {
e.printStackTrace();
}
try {
SelectMessages.onSelect(prefix);
} catch (Exception e) {
@@ -111,6 +131,11 @@ public class Load {
} catch (Exception e) {
e.printStackTrace();
}
try {
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), Permissions.admin+";"+Permissions.giveItemOther+";"+Permissions.info);
} catch (Exception e) {
e.printStackTrace();
}
send.console(prefix + " §8-------------------------------");
loadStorage(prefix);
@@ -128,13 +153,13 @@ public class Load {
e.printStackTrace();
}
if (SelectConfig.HelpAlias) {
Main.plugin.getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
if (SelectConfig.getHelpAlias()) {
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
send.debug(plugin, "CommandRegister: commandguihelp");
}
Main.plugin.getCommand("commandgui").setExecutor(new CmdExecuter_GUITab());
Main.getPlugin().getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
send.debug(plugin, "CommandRegister: commandgui");
Main.plugin.getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
Main.getPlugin().getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
send.debug(plugin, "CommandRegister: commandgui-item");
try {
@@ -146,7 +171,7 @@ public class Load {
Bukkit.getServer().getPluginManager().registerEvents(new GUIListener(), plugin);
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.plugin);
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.getPlugin());
if (!MCVersion.minecraft1_8 && !MCVersion.minecraft1_9) {
Bukkit.getServer().getPluginManager().registerEvents(new EventsFrom110(), plugin);
@@ -160,11 +185,11 @@ public class Load {
private static void loadStorage(String prefix) {
try {
SelectDatabase.setStorage(StorageType.valueOf(SelectConfig.storage));
SelectDatabase.setStorage(StorageEnum.valueOf(SelectConfig.getStorage()));
} catch (Exception ignored) {
send.error(Main.plugin, "The storage medium " + SelectConfig.storage + " is not supported!");
send.error(Main.plugin, "Storage medium " + StorageType.SQLITE + " is used.");
SelectDatabase.setStorage(StorageType.SQLITE);
send.error(Main.getPlugin(), "The storage medium " + SelectConfig.getStorage() + " is not supported!");
send.error(Main.getPlugin(), "Storage medium " + StorageEnum.SQLITE + " is used.");
SelectDatabase.setStorage(StorageEnum.SQLITE);
}
switch (SelectDatabase.getStorage()) {
@@ -182,10 +207,14 @@ public class Load {
"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) {
Main.sendTryCatch(Load.class, e.getStackTrace()[0]);
e.printStackTrace();
}
try {
MySQL.query("ALTER TABLE `gui-item` ADD COLUMN `Slot` INT(1) NULL DEFAULT NULL AFTER `Status`;");
} catch (SQLException e) {
}
break;
case YML:
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");

View File

@@ -4,9 +4,7 @@
package de.jatitv.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.system.database.StorageType;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Util;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -35,7 +33,7 @@ public class Metrics {
public static void Bstats() {
int pluginId = Util.getBstatsID(); // <-- Replace with the id of your plugin!
Metrics metrics = new Metrics(Main.plugin, pluginId);
Metrics metrics = new Metrics(Main.getPlugin(), pluginId);
metrics.addCustomChart(new DrilldownPie("storage_type_mysql", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
String storage = SelectDatabase.getStorage().toString();

View File

@@ -2,15 +2,10 @@
package de.jatitv.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class Papi extends PlaceholderExpansion {
@Override
@@ -20,12 +15,12 @@ public class Papi extends PlaceholderExpansion {
@Override
public String getAuthor() {
return Main.plugin.getDescription().getAuthors().toString();
return Main.getPlugin().getDescription().getAuthors().toString();
}
@Override
public String getVersion() {
return Main.plugin.getDescription().getVersion();
return Main.getPlugin().getDescription().getVersion();
}
@Override

View File

@@ -8,7 +8,7 @@ import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.Plugin;
public class Permissions {
private static final Plugin plugin = Main.plugin;
private static final Plugin plugin = Main.getPlugin();
public static final String key = "commandgui.";
public static final String command = key + "command";
@@ -17,7 +17,8 @@ public class Permissions {
public static final String useitemToggle = key + "useitem.toggle";
public static final String useitem = key + "useitem";
public static final String getGuiItemAtLogin = key + "get.guiitem.at.login";
public static final String updatemsg = key + "updatemsgupdatemsg";
public static final String giveItemOther = key + "giveitem.other";
public static final String updatemsg = key + "updatemsg";
public static final String player = key + "player";
public static final String admin = key + "admin";
@@ -30,6 +31,7 @@ public class Permissions {
Register.permissionDescription(command, "Required permission to open GUIs via command", plugin);
Register.permission(getGuiItemAtLogin, op, plugin);
Register.permission(giveItemOther, op, plugin);
Register.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
Register.permission(useitem, op, plugin);
@@ -45,27 +47,28 @@ public class Permissions {
Register.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
Register.permission(info, notOp, plugin);
Register.permissionDescription(info, "Permission to view CommandGUI info", plugin);
Register.permissionDescription(info, "Permission to view T2C-CommandGUI info", plugin);
Register.permission(player, op, command, true, plugin);
Register.permission(player, op, getGuiItemAtLogin, true, plugin);
Register.permission(player, op, useitem, true, plugin);
Register.permission(player, op, useitemToggle, true, plugin);
Register.permissionDescription(player, "All permissions from CommandGUI for Player", plugin);
Register.permissionDescription(player, "All permissions from T2C-CommandGUI for Player", plugin);
Register.permission(admin, op, command, true, plugin);
Register.permission(admin, op, getGuiItemAtLogin, true, plugin);
Register.permission(admin, op, giveItemOther, true, plugin);
Register.permission(admin, op, useitem, true, plugin);
Register.permission(admin, op, useitemToggle, true, plugin);
Register.permission(admin, op, updatemsg, true, plugin);
Register.permission(admin, op, bypass, true, plugin);
Register.permission(admin, op, info, true, plugin);
Register.permissionDescription(admin, "All permissions from CommandGUI", plugin);
Register.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
for (Gui gui : Main.guiHashMap.values()) {
Register.permission("commandgui.command." + gui.key, op, plugin);
Register.permission(admin, op, "commandgui.command." + gui.key, true, plugin);
Register.permission(command + "." + gui.key, op, plugin);
Register.permission(admin, op, command + "." + gui.key, true, plugin);
for (Slot slot : gui.slots) {
Register.permission(slot.permissionToUse, op, plugin);
Register.permission(admin, op, slot.permissionToUse, true, plugin);

View File

@@ -1,6 +1,6 @@
package de.jatitv.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import org.bukkit.entity.Player;
@@ -10,8 +10,8 @@ import java.util.List;
public class Placeholder {
public static String useitem(Player p) {
if (Events.useItemHashMap.get(p.getName())) {
return SelectConfig.placeholderTrue;
} else return SelectConfig.placeholderFalse;
return SelectConfig.getPlaceholderTrue();
} else return SelectConfig.getPlaceholderFalse();
}
public static String useitem_boolean(Player p) {

View File

@@ -1,7 +0,0 @@
package de.jatitv.commandguiv2.Spigot.system.database;
public enum StorageType {
MYSQL,
SQLITE,
YML
}

View File

@@ -1,18 +1,15 @@
package de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener;
package de.jatitv.commandguiv2.Spigot.useItem;
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.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.system.UseItem;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.api.CGuiAPI;
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.minecraftVersion.NMSVersion;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -25,6 +22,7 @@ import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
@@ -42,21 +40,21 @@ public class Events implements Listener {
useItemHashMap.put(e.getPlayer().getName(), SelectDatabase.selectItemStatus(e.getPlayer()));
Integer i = SelectDatabase.selectSlot(e.getPlayer());
if (i == null) {
useItemSlotHashMap.put(e.getPlayer().getName(), SelectConfig.UseItem_InventorySlot);
useItemSlotHashMap.put(e.getPlayer().getName(), SelectConfig.getUseItem_InventorySlot());
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
if (CGuiAPI.JoinDisable) {
send.debug(Main.plugin, "JoinDisable");
send.debug(Main.getPlugin(), "JoinDisable");
return;
}
if (e.getPlayer().hasPermission("commandgui.get.guiitem.at.login")) {
new BukkitRunnable() {
@Override
public void run() {
send.debug(Main.plugin, "itemChange: " + e.getPlayer().getName());
send.debug(Main.getPlugin(), "itemChange: " + e.getPlayer().getName());
ItemChange.itemChange(e.getPlayer(), true);
}
}.runTaskLater(Main.plugin, 20L * 1);
}.runTaskLater(Main.getPlugin(), 20L * 1);
}
}
@@ -65,6 +63,8 @@ public class Events implements Listener {
useItemHashMap.remove(e.getPlayer().getName());
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onDeathDrop(PlayerDeathEvent e) {
Player player = e.getEntity().getPlayer();
@@ -74,7 +74,7 @@ public class Events implements Listener {
while (var3.hasNext()) {
ItemStack items = (ItemStack) var3.next();
if (items != null && items.hasItemMeta() && items.getItemMeta().hasDisplayName()
&& items.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& items.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
e.getDrops().remove(items);
}
}
@@ -84,17 +84,17 @@ public class Events implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onRespawn(PlayerRespawnEvent e) {
Player player = e.getPlayer();
if (SelectConfig.UseItem_Enable) {
if (SelectConfig.getUseItem_Enable()) {
ItemChange.itemChange(player, false);
//if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
// if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
//if (!SelectConfig.getUseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
// if (SelectConfig.getUseItem_GiveOnlyOnFirstJoin) {
// if (!player.hasPlayedBefore()) {
// new BukkitRunnable() {
// @Override
// public void run() {
// Give_UseItem.onGive(player);
// }
// }.runTaskLater(Main.plugin, 20L * 1);
// }.runTaskLater(Main.getPlugin(), 20L * 1);
// }
// } else {
// new BukkitRunnable() {
@@ -102,7 +102,7 @@ public class Events implements Listener {
// public void run() {
// Give_UseItem.onGive(player);
// }
// }.runTaskLater(Main.plugin, 20L * 1);
// }.runTaskLater(Main.getPlugin(), 20L * 1);
// }
//}
}
@@ -111,7 +111,7 @@ public class Events implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onGameModeChange(PlayerGameModeChangeEvent e) {
Player player = e.getPlayer();
if (!SelectConfig.UseItemGameModeChangeEnable) {
if (!SelectConfig.getUseItemGameModeChangeEnable()) {
return;
}
new BukkitRunnable() {
@@ -119,13 +119,13 @@ public class Events implements Listener {
public void run() {
ItemChange.itemChange(player, false);
}
}.runTaskLater(Main.plugin, SelectConfig.UseItemGameModeChangeDelayInTicks * 1L);
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemGameModeChangeDelayInTicks() * 1L);
}
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent e) {
Player player = e.getPlayer();
if (!SelectConfig.UseItemWorldChangeEnable) {
if (!SelectConfig.getUseItemWorldChangeEnable()) {
return;
}
new BukkitRunnable() {
@@ -133,30 +133,30 @@ public class Events implements Listener {
public void run() {
ItemChange.itemChange(player, false);
}
}.runTaskLater(Main.plugin, SelectConfig.UseItemWorldChangeDelayInTicks * 1L);
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemWorldChangeDelayInTicks() * 1L);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (!p.isSneaking()) {
for (String material : SelectConfig.UseItemItemBlockBlacklist) {
for (String material : SelectConfig.getUseItemItemBlockBlacklist()) {
if (e.getClickedBlock() != null) {
if (e.getClickedBlock().getType() == Material.valueOf(material)) return;
}
}
}
if (SelectConfig.UseItem_Enable) {
if (SelectConfig.UseItem_PlayerHead_Enable) {
if (SelectConfig.getUseItem_Enable()) {
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
if (e.getItem() != null && p.getItemInHand().getType() == ItemVersion.getHead()) {
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
openGUI(e, p);
}
}
} else {
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(SelectConfig.UseItem_Material)) {
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(SelectConfig.getUseItem_Material())) {
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
openGUI(e, p);
}
}
@@ -167,7 +167,7 @@ public class Events implements Listener {
private static void openGUI(PlayerInteractEvent e, Player player) {
e.setCancelled(true);
if ((!SelectConfig.disableInfoBySneak) && player.isSneaking()) {
if ((!SelectConfig.getDisableInfoBySneak()) && player.isSneaking()) {
Commands.info(player);
return;
}
@@ -178,45 +178,45 @@ public class Events implements Listener {
if (UseItem.protection(player, true)) return;
if (SelectConfig.UseItemGameModeProtection) {
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
if (SelectConfig.getUseItemGameModeProtection()) {
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
e.setCancelled(true);
send.player(player, SelectMessages.UseItemDisabledInGameMode);
return;
}
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
e.setCancelled(true);
send.player(player, SelectMessages.UseItemDisabledInGameMode);
return;
}
}
if (SelectConfig.UseItemWorldProtection) {
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
if (SelectConfig.getUseItemWorldProtection()) {
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
e.setCancelled(true);
send.player(player, SelectMessages.UseItemDisabledInWorld);
return;
}
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
e.setCancelled(true);
send.player(player, SelectMessages.UseItemDisabledInWorld);
return;
}
}
if (!SelectConfig.UseItem_Permission || player.hasPermission("commandgui.useitem")) {
OpenGUI.openGUI(player, SelectConfig.UseItem_OpenGUI, true);
if (!SelectConfig.getUseItem_Permission() || player.hasPermission("commandgui.useitem")) {
OpenGUI.openGUI(player, SelectConfig.getUseItem_OpenGUI(), true);
} else {
player.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
.replace("[gui]", SelectConfig.UseItem_OpenGUI));
send.player(player,SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
.replace("[gui]", SelectConfig.getUseItem_OpenGUI()));
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onItemMoveEvent(InventoryMoveItemEvent e) {
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
&& e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
e.setCancelled(true);
}
}
@@ -224,19 +224,19 @@ public class Events implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onItemMove(InventoryDragEvent e) {
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
if (e.getWhoClicked() instanceof Player) {
Player p = (Player) e.getWhoClicked();
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
p.closeInventory();
e.setCancelled(true);
ItemChange.itemChange(p, false);
}
if (e.getOldCursor() != null && e.getOldCursor().hasItemMeta() && e.getOldCursor().getItemMeta().hasDisplayName()
&& e.getOldCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getOldCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
p.closeInventory();
e.setCancelled(true);
ItemChange.itemChange(p, false);
@@ -246,14 +246,14 @@ public class Events implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onItemMove(InventoryClickEvent e) {
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
e.setCancelled(true);
}
if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
e.setCancelled(true);
}
@@ -261,12 +261,12 @@ public class Events implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onItemMove(InventoryPickupItemEvent e) {
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
if (e.getItem() != null && e.getItem().getItemStack() != null) {
ItemStack item = e.getItem().getItemStack();
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
&& item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
e.setCancelled(true);
}
}
@@ -274,22 +274,21 @@ public class Events implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlace(BlockPlaceEvent e) {
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
&& e.getItemInHand().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getItemInHand().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onDrop(PlayerDropItemEvent e) {
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
ItemStack item = e.getItemDrop().getItemStack();
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
&& item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
e.setCancelled(true);
}
}
@@ -298,4 +297,54 @@ public class Events implements Listener {
private static boolean topInventoryIsEmpty(Player p) {
return p.getOpenInventory().getTopInventory().isEmpty();
}
@EventHandler
public void onClearServer(ServerCommandEvent event) {
if (SelectConfig.getUseItem_KeepAtCommandClear()) {
if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) {
new BukkitRunnable() {
@Override
public void run() {
try {
Player player = Bukkit.getPlayer(event.getCommand().replace("/", "").replace("clear ", ""));
if (player == null){
return;
}
clearGive(player);
} catch (Exception ex){
ex.printStackTrace();
return;
}
}
}.runTaskLater(Main.getPlugin(), 1L);
}
}
}
@EventHandler
public void onClearPlayer(PlayerCommandPreprocessEvent event) {
if (SelectConfig.getUseItem_KeepAtCommandClear()) {
if (event.getMessage().toLowerCase().contains("clear")) {
new BukkitRunnable() {
@Override
public void run() {
clearGive(event.getPlayer());
}
}.runTaskLater(Main.getPlugin(), 1L);
}
if (event.getMessage().toLowerCase().contains("clear " + event.getMessage().toLowerCase().replace("/", "").replace("clear ", ""))) {
new BukkitRunnable() {
@Override
public void run() {
clearGive(Bukkit.getPlayer(event.getMessage().toLowerCase().replace("/", "").replace("clear ", "")));
}
}.runTaskLater(Main.getPlugin(), 1L);
}
}
}
private static void clearGive(Player player) {
ItemChange.itemChange(player, false);
}
}

View File

@@ -1,4 +1,4 @@
package de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener;
package de.jatitv.commandguiv2.Spigot.useItem;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
@@ -12,29 +12,27 @@ public class EventsFrom110 implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onHandSwap(PlayerSwapHandItemsEvent e) {
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9) return;
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
}
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onItemMove(PlayerSwapHandItemsEvent e) {
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9) return;
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
Player p = e.getPlayer();
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
p.closeInventory();
e.setCancelled(true);
}
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
p.closeInventory();
e.setCancelled(true);
}

View File

@@ -1,10 +1,7 @@
package de.jatitv.commandguiv2.Spigot.Listener;
package de.jatitv.commandguiv2.Spigot.useItem;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.system.UseItem;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@@ -12,19 +9,19 @@ import org.bukkit.scheduler.BukkitRunnable;
public class ItemChange {
public static void itemChange(Player player, Boolean setCursor) {
Integer slot;
if (SelectConfig.UseItem_InventorySlotEnforce) {
slot = SelectConfig.UseItem_InventorySlot;
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
slot = SelectConfig.getUseItem_InventorySlot();
} else {
slot = Events.useItemSlotHashMap.get(player.getName());
}
if (!SelectConfig.UseItem_Enable) {
if (!SelectConfig.getUseItem_Enable()) {
return;
}
UseItem.removeItem(player);
if (UseItem.protection(player, false)) return;
if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
if (!SelectConfig.UseItem_AllowToggle || Events.useItemHashMap.get(player.getName())) {
if (SelectConfig.getUseItem_GiveOnlyOnFirstJoin()) {
if (!SelectConfig.getUseItem_AllowToggle() || Events.useItemHashMap.get(player.getName())) {
if (!player.hasPlayedBefore()) {
new BukkitRunnable() {
@Override
@@ -34,30 +31,32 @@ public class ItemChange {
setCursor(player, slot);
}
}
}.runTaskLater(Main.plugin, 1L * 1);
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin || SelectConfig.Cursor_ToGUIItem_OnLogin) {
}.runTaskLater(Main.getPlugin(), 1L * 1);
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin() || SelectConfig.getCursor_ToGUIItem_OnLogin()) {
player.getInventory().setHeldItemSlot(slot - 1);
}
}
}
send.debug(Main.plugin, "GiveOnlyOnFirstJoin: " + player.getName());
send.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
return;
}
if (!SelectConfig.UseItem_GiveOnEveryJoin) {
send.debug(Main.plugin, "!GiveOnEveryJoin: " + player.getName());
if (!SelectConfig.getUseItem_GiveOnEveryJoin()) {
send.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
return;
}
new BukkitRunnable() {
@Override
public void run() {
if (!SelectConfig.UseItem_AllowToggle || Events.useItemHashMap.get(player.getName())) {
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
send.debug(Main.plugin, "Give: " + player.getName());
Boolean pln = Events.useItemHashMap.get(player.getName());
if (pln == null) return;
if (!SelectConfig.getUseItem_AllowToggle() || pln) {
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(slot - 1) == null) {
send.debug(Main.getPlugin(), "Give: " + player.getName());
UseItem.giveUseItem(player);
if (setCursor) {
setCursor(player, slot);
}
} else if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
} else if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
boolean empty = false;
for (int i = 0; i < 9; i++) {
if (player.getInventory().getItem(i) == null) {
@@ -71,42 +70,42 @@ public class ItemChange {
}
}
}
}.runTaskLater(Main.plugin, 1L * 1);
}.runTaskLater(Main.getPlugin(), 1L * 1);
}
private static void setCursor(Player player, int slot) {
send.debug(Main.plugin, "setCursor 1 Player: " + player.getName());
send.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
if (!SelectConfig.Cursor_ToGUIItem_OnLogin) {
if (!SelectConfig.getCursor_ToGUIItem_OnLogin()) {
return;
}
send.debug(Main.plugin, "setCursor 2 Player: " + player.getName());
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {
send.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin()) {
if (!player.hasPlayedBefore()) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin, "setCursor 3 Player: " + player.getName());
send.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
}
return;
}
send.debug(Main.plugin, "setCursor 4 Player: " + player.getName());
if (!SelectConfig.Bungee) {
send.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
if (!SelectConfig.getBungee()) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin, "setCursor 5 Player: " + player.getName());
send.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
return;
}
send.debug(Main.plugin, "setCursor 6 Player: " + player.getName());
if (SelectConfig.UseItem_ServerChange) {
send.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
if (SelectConfig.getUseItem_ServerChange()) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin, "setCursor 7 Player: " + player.getName());
send.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
return;
}
send.debug(Main.plugin, "setCursor 8 Player: " + player.getName());
send.debug(Main.plugin, "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
send.debug(Main.plugin, "setCursor Player: " + player.getName());
send.debug(Main.getPlugin(), "setCursor 8 Player: " + player.getName());
send.debug(Main.getPlugin(), "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
send.debug(Main.getPlugin(), "setCursor Player: " + player.getName());
if (Main.bungeejoinplayers.contains(player.getName())) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin, "setCursor 9 Player: " + player.getName());
send.debug(Main.getPlugin(), "setCursor 9 Player: " + player.getName());
Main.bungeejoinplayers.remove(player.getName());
}
}

View File

@@ -1,8 +1,8 @@
package de.jatitv.commandguiv2.Spigot.system;
package de.jatitv.commandguiv2.Spigot.useItem;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
@@ -21,47 +21,45 @@ import java.lang.reflect.Field;
import java.util.UUID;
public class UseItem {
public static void giveUseItem(Player player) {
Integer slot;
if (protection(player, false)) return;
if (SelectConfig.UseItem_InventorySlotEnforce) {
slot = SelectConfig.UseItem_InventorySlot;
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
slot = SelectConfig.getUseItem_InventorySlot();
} else {
slot = Events.useItemSlotHashMap.get(player.getName());
}
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
player.getInventory().addItem(itemStack(player));
} else {
send.debug(Main.plugin, "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
send.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
player.getInventory().setItem(slot - 1, itemStack(player));
}
}
public static void addUseItem(Player player) {
if (protection(player, false)) return;
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
player.getInventory().addItem(itemStack(player));
} else player.getInventory().addItem(itemStack(player));
}
private static ItemStack itemStack(Player player) {
ItemStack item = null;
if (SelectConfig.UseItem_PlayerHead_Enable) {
if (SelectConfig.getUseItem_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!");
send.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
send.error(Main.getPlugin(), "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) {
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
if (SelectConfig.getUseItem_Base64_Enable()) {
if (Main.PaPi) {
playerheadmeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.UseItem_Lore));
} else playerheadmeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.UseItem_Lore));
playerheadmeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else playerheadmeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
profile.getProperties().put("textures", new Property("textures", SelectConfig.UseItem_Base64value));
profile.getProperties().put("textures", new Property("textures", SelectConfig.getUseItem_Base64value()));
Field profileField = null;
try {
profileField = playerheadmeta.getClass().getDeclaredField("profile");
@@ -72,23 +70,23 @@ public class UseItem {
}
} else {
String p;
if (SelectConfig.UseItem_PlayerWhoHasOpenedTheGUI) {
if (SelectConfig.getUseItem_PlayerWhoHasOpenedTheGUI()) {
p = player.getName();
} else p = SelectConfig.UseItem_PlayerName;
} else p = SelectConfig.getUseItem_PlayerName();
playerheadmeta.setOwner(p);
if (Main.PaPi) {
playerheadmeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.UseItem_Lore));
} else playerheadmeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.UseItem_Lore));
playerheadmeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else playerheadmeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
}
item.setItemMeta(playerheadmeta);
}
} else {
item = new ItemStack(Material.valueOf(SelectConfig.UseItem_Material));
item = new ItemStack(Material.valueOf(SelectConfig.getUseItem_Material()));
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(SelectConfig.UseItem_Name);
itemMeta.setDisplayName(SelectConfig.getUseItem_Name());
if (Main.PaPi) {
itemMeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.UseItem_Lore));
} else itemMeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.UseItem_Lore));
itemMeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else itemMeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
item.setItemMeta(itemMeta);
item.setAmount(1);
}
@@ -96,31 +94,31 @@ public class UseItem {
}
public static boolean protection(Player player, Boolean interact) {
if (SelectConfig.UseItemGameModeProtection) {
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
if (SelectConfig.getUseItemGameModeProtection()) {
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
if (interact) {
send.player(player, SelectMessages.UseItemDisabledInGameMode);
} else if (!SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled) removeItem(player);
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
return true;
}
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
if (interact) {
send.player(player, SelectMessages.UseItemDisabledInGameMode);
} else if (!SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled) removeItem(player);
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
return true;
}
}
if (SelectConfig.UseItemWorldProtection) {
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
if (SelectConfig.getUseItemWorldProtection()) {
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
if (interact) {
send.player(player, SelectMessages.UseItemDisabledInWorld);
} else if (!SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled) removeItem(player);
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
return true;
}
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
if (interact) {
send.player(player, SelectMessages.UseItemDisabledInWorld);
} else if (!SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled) removeItem(player);
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
return true;
}
}
@@ -128,12 +126,12 @@ public class UseItem {
}
public static void removeItem(Player player) {
send.debug(Main.plugin, "World disabled: " + player.getName() + " " + player.getWorld().toString());
send.debug(Main.getPlugin(), "World disabled: " + player.getName() + " " + player.getWorld().toString());
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
ItemStack itm = player.getInventory().getItem(iam);
if (itm != null) {
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
if (itm.getType() == Material.valueOf(SelectConfig.getUseItem_Material()) || itm.getType() == ItemVersion.getHead()) {
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
player.getInventory().remove(itm);
player.updateInventory();
break;

View File

@@ -1,15 +1,16 @@
package de.jatitv.commandguiv2;
import net.t2code.lib.Spigot.system.T2CodeMain;
public class Util {
private static Integer configVersion = 5;
private static double requiredT2CodeLibVersion = 11.8;
private static String requiredT2CodeLibVersion = "12.4";
private static String Prefix = "§8[§4C§9GUI§8]";
private static Integer SpigotID = 90671;
private static Integer BstatsID = 10840;
private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
private static String Discord = "http://dc.t2code.net";
public static double getRequiredT2CodeLibVersion() {
public static String getRequiredT2CodeLibVersion() {
return requiredT2CodeLibVersion;
}
@@ -30,7 +31,7 @@ public class Util {
}
public static String getDiscord() {
return Discord;
return T2CodeMain.getDiscord();
}
public static Integer getConfigVersion() {

View File

@@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.api;
import de.jatitv.commandguiv2.Spigot.Listener.ItemChange;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.useItem.ItemChange;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
import de.jatitv.commandguiv2.Spigot.cmdManagement.Help;
@@ -9,7 +9,8 @@ import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -25,13 +26,13 @@ public class CGuiAPI {
public static boolean hasUseItemInMainHand(Player player) {
ItemStack item = player.getInventory().getItemInMainHand();
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
&& item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name);
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name());
}
public static boolean hasUseItemInOffHand(Player player) {
ItemStack item = player.getInventory().getItemInOffHand();
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
&& item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name);
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name());
}
public static void onItemChange(Player player, Boolean setCursor) {
@@ -39,7 +40,7 @@ public class CGuiAPI {
}
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
send.debug(Main.plugin, "CGuiAPI: " + disableItemGiveOnJoin);
send.debug(Main.getPlugin(), "CGuiAPI: " + disableItemGiveOnJoin);
JoinDisable = disableItemGiveOnJoin;
}
@@ -70,7 +71,7 @@ public class CGuiAPI {
}
public static void sendHelp(CommandSender sender) {
Help.sendHelp(sender, Main.prefix);
Help.sendHelp(sender, Util.getPrefix());
}
public static void sendPluginInfo(CommandSender sender) {

View File

@@ -0,0 +1,211 @@
#####################################################
## To add another Function just create a new file. ##
#####################################################
Slots:
Function:
Item:
# Here you can create an empty slot.
# Note: When this is enabled, no functions will work.
Empty: false
# Here you can set the number of items
Amount: 1
PlayerHead:
# Here you can set if the item should be a player head
Enable: false
Base64:
# Here you can specify whether a Base64 player header should be used
Enable: false
# Here you can set the Base64 Value.
# You can find the Base64 Value for example on https://minecraft-heads.com.
Base64Value: ''
# Here you can set whether the player head should be used by the player who has opened the GUI.
PlayerWhoHasOpenedTheGUI: false
# Here you can set a specific player from which the player head should be used
PlayerName: ''
# Here you can set a Minecraft material to be used. This is ignored when PlayerHead is used
Material: 'DIRT'
# Here you set the DisplayName of the item
Name: 'Item Title'
# Here you set the lore of the item
Lore:
- '&8-----------------'
- '&bLine 1'
- '&bLine 2'
- '&8-----------------'
NoPermission:
Message:
# Here you can define if a message should be displayed when clicking on the function but not having a permission
Enable: true
# Here you can set a custom No Permission message for this function. If you want to use the default message, just leave this blank.
#
# You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes
# You can use the hover module from T2Code:
# You can add a hover and/or clickable feature to all messages sent to players.
# Use /*/ to separate the message.
# Use [nl] to set a line break in a message or hover.
# Hover message: <message >/*/<hover>
# Message with hover and click function: <message >/*/<hover>/*/<action>/*/<actionValue>
# Message only with click function: <message >/*//*/<action>/*/<actionValue>
# Action:
# - OPEN_URL - Opens a URL under the path specified in ActionValue.
# - OPEN_FILE - Opens a file under the path specified by ActionValue.
# - RUN_COMMAND - Runs the command specified by ActionValue.
# - SUGGEST_COMMAND - Inserts the string specified in ActionValue into the player text box.
# - CHANGE_PAGE - Changes to the page number in a book specified by ActionValue.
# - COPY_TO_CLIPBOARD - Copies the string specified by ActionValue to the player's clipboard.
# You can also use MiniMessage:
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html
# WebUI: https://webui.adventure.kyori.net
CustomNoPermMessage: ''
Item:
Lore:
# Here you can select whether an extra lore should be displayed if you do not have permission for this function.
Enable: true
# Here you can set an extra lore that will be displayed if you do not have permission for this action.
Lore:
- '&8-----------------'
- '&4No Permission for this Function'
- '&8-----------------'
CustomSound:
# Here you can set whether a specific sound or the default sound from the config.yml should be used.
Enable: false
# Here you can deactivate the sound for this item. CustomSound must be activated for this!
NoSound: false
# Here you set the custom sound
Sound: ''
Cost:
# Here you can specify whether the function should cost or not
Enable: false
# Here you set which economy mode should be used.
# Use 'VAULT' / 'MONEY' for money via vault.
# Use 'ITEM' to pay with items.
# Use 'VOTEPOINTS' to pay with vote points from VotingPlugin (https://spigotmc.org/resources/votingplugin.15358/).
EcoModule: VAULT
# Set the item and the quantity for the ITEM mode here. (ITEM;AMOUNT)
Item: DIRT;5
# Set here the VotePoints for the VOTEPOINTS mode.
VotePoints: 0
# Set the money here for the mode VAULT or MONEY
Price: 0.0
Command:
# Here you can enable or disable the Command function
# Placeholder: [player] = PlayerName
Enable: false
# Here you can specify if this command should be executed on the bugee
BungeeCommand: false
# Here you can set if the command should be executed from the console
# Example: You can also create a store with this command.
# /give [player] stone | So all commands can be executed even those for which the player has no permission.
CommandAsConsole: false
# Here you can set commands. Several commands are also possible.
# They are processed from top to bottom and executed one after the other!
Command:
- 'command 1'
- 'command 2'
ServerChange:
# Here you can enable or disable the function ServerChange
# To use this function the function BungeeCord must be activated in the conig.yml and the plugin must be installed on the proxy!
Enable: false
# # Here you can say which server the player should be moved to.
Server: ''
OpenGUI:
# Here you can enable or disable the OpenGUI feature
Enable: false
# Here you can set which GUI should be opened.
# Use the file name of the GUI without .yml
GUI: ''
Toggle:
# Here you can enable a feature that allows players to give or remove permissions to each other
# The commands for the permission plugin can be set in the config (default for LuckPerms)
Permission:
# Activate this function here
Enable: false
# Set the permission here
Permission: ''
UseItem:
# When this function is enabled, players can toggle the UseItem on and off.
# For this function 'UseItem.AllowToggle' must be activated in config.yml!
Enable: false
Message:
# Here you can enable or disable the Message function
Enable: false
# Here you can set the messages to be sent to the player
# Placeholder: [player] = PlayerName | [prefix] = PluginPrefix | [price] = price if function Cost is activated
#
# You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes
# You can use the hover module from T2Code:
# You can add a hover and/or clickable feature to all messages sent to players.
# Use /*/ to separate the message.
# Use [nl] to set a line break in a message or hover.
# Hover message: <message >/*/<hover>
# Message with hover and click function: <message >/*/<hover>/*/<action>/*/<actionValue>
# Message only with click function: <message >/*//*/<action>/*/<actionValue>
# Action:
# - OPEN_URL - Opens a URL under the path specified in ActionValue.
# - OPEN_FILE - Opens a file under the path specified by ActionValue.
# - RUN_COMMAND - Runs the command specified by ActionValue.
# - SUGGEST_COMMAND - Inserts the string specified in ActionValue into the player text box.
# - CHANGE_PAGE - Changes to the page number in a book specified by ActionValue.
# - COPY_TO_CLIPBOARD - Copies the string specified by ActionValue to the player's clipboard.
# You can also use MiniMessage:
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html
# WebUI: https://webui.adventure.kyori.net
Message:
- 'Message line 1'
- 'Message line 2'
SetConfig:
# Here you can enable or disable the SetConfig function
Enable: false
File:
# Here you define in which file something should be changed
# Example at this file: 'plugins/CommandGUI/GUIs/default.yml'.
Path: ''
Option:
# Here you set the option to be changed
# Example on the option of this example slots: 'Slots.Example.Slot'
Path: ''
# Here you set which format should be set
# String = text in one line
# Boolean = true / false
# Integer = numbers without comma
# Double = number with comma | Please use . as comma
# List = text with multiple lines (- 'hi')
Premat: String
Value:
# Here you can set which value should be set when you click with the left mouse button.
LeftClick:
String: ''
Boolean: false
Integer: 0
Double: 0.0
List: []
# Here you set which value should be set when clicking with the right mouse button
RightClick:
String: ''
Boolean: false
Integer: 0
Double: 0.0
List: []
PluginReload:
# Here you can set if the plugin to which a file was changed should be reloaded directly
Enable: false
# Here you set the reload command to be used
# The command is executed by the console! No / is needed!
Command: ''
FunctionVotePoints:
# With this function you can give or subtract VotePoints from VotingPlugin to a player.
Enable: false
# Use to add: ADD
# Use to subtract: REMOVE
Mode: ADD
# Set the number of vote points to be subtracted / added here
Amount: 0
FunctionItem:
# With this function you can give or remove items to a player
Enable: false
# Use to add: ADD
# Use to subtract: REMOVE
Mode: REMOVE
# Enter the item (material) and the number behind it. Separate them with ; (ITEM;AMOUNT)
Item: DIRT;5

View File

@@ -0,0 +1,51 @@
################################################
## To add another GUI just create a new file. ##
################################################
GUI:
# Enable or disable the GUI
Enable: true
# Set the lines of the GUI here (1-6)
Lines: 1
# Here you set the display name of the GUI
Name: '&5default &9GUI'
FillItem:
# Activate or deactivate the FillItem here
Enable: true
# Here you can set the FillItem
Item: BLACK_STAINED_GLASS_PANE
# Here you set the settings for the alias
Command:
# Here you can enable or disable the alias of the GUI. The alias is the file name without .yml
Alias: true
Permission:
# Set here if a permission is needed for the alias or not. | Permission: commandgui.command.<alias>
Required: true
# Here you set the functions and slots
Slots:
# Here is an example of a slot
# To add another slot just copy the block. IMPORTANT: The slot name must not be duplicated (Slots.<name>).
function1:
# Here you set which slot the item / function should be in
Slot: 4
# Here you can activate and deactivate the slot
Enable: true
# Here you specify which function this slot should perform
Function: function1
Permission:
# Here you can set if a permission is needed to use this function.
Required: false
# Placeholder: [function] which function is used | [slot] is the slot number | [slotname] is the name of the key (Slots.KEY)
See: commandgui.gui.[function].slot.[slot].see
Use: commandgui.gui.[function].slot.[slot].use
function2:
Slot: 6
Enable: true
Function: function2
Permission:
Required: false
See: commandgui.gui.[function].slot.[slot].see
Use: commandgui.gui.[function].slot.[slot].use

View File

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

View File

@@ -0,0 +1,313 @@
#########################################
## Please do not change ConfigVersion! ##
#########################################
ConfigVersion: 5
Plugin:
# Here you can set the debug mode of the plugin.
# It is recommended not to activate this on productive systems. Only if it is really needed!
Debug: false
# Here you can set whether the Helpalias command (/commandguihelp) should be activated.
# If this is changed the server MUST be restarted to change this!
HelpAlias: true
# Here you set which subcommand should be for the admin functions.
# (/commandgui 'admin' reload)
AdminSubCommand: admin
# here you set the language to be used
language: english
# Here you set the character or word that will be used as currency
Currency: $
# Here you set which GUI should be opened at '/commandgui' / '/gui'.
DefaultGUI: default
Storage:
# Set here if MySQL, SQLITE or YML should be used as storage.
Type: SQLITE
# Enter here the access data to the database you want to use, if you use MySQL
MySQL:
IP: localhost
Port: 3306
Database: database
User: root
Password: password
SSL: false
BungeeCord:
# Set here if the plugin runs in a BungeeCord subserver.
# The plugin file must then be installed on the proxy (BungeeCord, Waterfall) and on the servers.
Enable: false
# Set here the server name of the server
ThisServer: server
UseItem:
# Set here if the UseItem is to be used in use
Enable: true
# Set here if players are allowed to enable or disable the UseItem with '/gui-item <on/off>'.
# Permission 'commandgui.useitem.toggle' is additionally required
AllowToggle: true
# Set here if players are allowed to change the slot in the inventory where the UseItem is located with '/gui-item <slot>'.
# Permission 'commandgui.useitem.toggle' is additionally required
AllowSetSlot: true
# Set here if the dropping of the UseItem should be blocked
BlockMoveAndDrop: true
# Set here which GUI should open the UseItem
OpenGUI: default
Permission:
# Set here if the permission 'commandgui.useitem' is required to use the UseItem
NeededToUse: true
# Set here if the UseItem should stay in the inventory with the '/clear' command
KeepAtCommandClear: true
InventorySlot:
# Set here on which slot the UseItem should be located by default
Slot: 1
# Set here if the slot should be forced even if another item is on this slot (also the set slot of the player).
# NOTE: The item that was on this slot before will be deleted.
SlotEnforce: false
# Set here if the UseItem should be placed on another free slot, if the selected slot (also the set slot of the player) is occupied.
FreeSlot: false
# Set here the item that should be used as UseItem
Item:
# Set here which material should be used as UseItem
Material: paper
PlayerHead:
# Set here if a PlayerHead should be used as UseItem
Enable: false
Base64:
# Set here if a Base64 PlayerHead should be used as UseItem
Enable: false
# Here you can set the Base64 Value.
# You can find the Base64 Value for example on https://minecraft-heads.com.
Base64Value: ''
# Here you can set whether the player head should be used as a UseItem by the player
PlayerWhoHasOpenedTheGUI: false
# Here you can set a player name whose head should be used as UseItem
Playername: ''
# Set the DisplayName of the UseItem here
Name: '&6GUI UseItem'
# Set the lore of the UseItem here
Lore:
- 'Lore line 1'
- 'Lore line 2'
Join:
# Set here if the UseItem should be given at every server join
GiveOnEveryJoin: true
# Set here if the UseItem should only be given to the server at the first join of the player.
GiveOnlyOnFirstJoin: false
Cursor:
ToGUIItem:
OnLogin:
# Here you define whether the UseItem should be selected when joining the server.
Enable: true
Spigot:
# Set here if the UseItem should only be selected at the first join
OnOnlyFirstLogin: true
Bungee:
# Set here if the UseItem should be selected even if you change the server of the bungee network.
# The option BungeeCord must be activated for this!
OnServerChange: false
Toggle:
# Set the items to be used with the Toggle function here
Items:
# Set here the item that should be used if you have the permission or the UseItem is active.
OnOrYes:
Item:
Base64:
# Set here if a Base64 head should be used
Enable: false
# Here you can set the Base64 Value.
# You can find the Base64 Value for example on https://minecraft-heads.com.
Base64Value: ''
# Set the material to be used here
Material: GREEN_WOOL
# Set here the item to be used if you have the permission or the UseItem is disabled
OffOrNo:
Item:
Base64:
# Set here if a Base64 head should be used
Enable: false
# Here you can set the Base64 Value.
# You can find the Base64 Value for example on https://minecraft-heads.com.
Base64Value: ''
# Set the material to be used here
Material: RED_WOOL
Permission:
# Set here the commands to be used for Toggle.Permission
Commands:
'True': luckperms user [player] permission set [perm] true
'False': luckperms user [player] permission set [perm] false
# Set the design of the placeholders here
Placeholder:
# Placeholder for true / enabled
'True': '&2true'
# Placeholder for false / disabled
'False': '&4false'
Sound:
# Here you can disable all sounds
Enable: true
# Set here At which action which sound should be played or none at all
OpenInventory:
Enable: true
Sound: BLOCK_CHEST_OPEN
Click:
Enable: true
Sound: BLOCK_NOTE_BLOCK_HAT
NoMoney:
Enable: true
Sound: BLOCK_NOTE_BLOCK_HARP
NoInventorySpace:
Enable: true
Sound: BLOCK_NOTE_BLOCK_HARP
Give:
Enable: true
Sound: ENTITY_PLAYER_LEVELUP
PlayerNotFound:
Enable: true
Sound: BLOCK_NOTE_BLOCK_HARP
Advanced:
UseItem:
GameMode:
Change:
# Set here if the UseItem should be reset when the GameMode is changed.
Enable: true
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
DelayInTicks: 1
Protection:
# Set here in which gamemode the UseItem may be used
Enable: false
# Set here if the UseItem should be removed if you are in a not allowed Gamemode
RemoveItemWhenItIsDisabled: false
# Set here if a 'blacklist' or 'whitelist' should be used
Mode: blacklist
# Set the GameMode list here
List:
- CREATIVE
- Spectator
World:
Change:
# This specifies whether the UseItem should be reset when the world is changed.
Enable: true
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
DelayInTicks: 1
Protection:
# Set here in which world the UseItem may be used
Enable: false
# Here you specify whether the UseItem should be removed if you are in a world that is not permitted
RemoveItemWhenItIsDisabled: false
# Set here if a 'blacklist' or 'whitelist' should be used
Mode: blacklist
# Set the worlds here
List:
- World1
- World2
# Set here for which blocks the UseItem is blocked and the function of the block you are looking at should be used.
ItemBlockBlacklist:
- CHEST
- CRAFTING_TABLE
- FURNACE
- OAK_FENCE
- SPRUCE_FENCE
- BIRCH_FENCE
- JUNGLE_FENCE
- ACACIA_FENCE
- DARK_OAK_FENCE
- MANGROVE_FENCE
- CRIMSON_FENCE
- WARPED_FENCE
- NETHER_BRICK_FENCE
- ENDER_CHEST
- BEACON
- ANVIL
- CHIPPED_ANVIL
- DAMAGED_ANVIL
- REPEATER
- COMPARATOR
- HOPPER
- DISPENSER
- DROPPER
- LEVER
- DAYLIGHT_DETECTOR
- TRAPPED_CHEST
- NOTE_BLOCK
- STONE_BUTTON
- POLISHED_BLACKSTONE_BUTTON
- OAK_BUTTON
- SPRUCE_BUTTON
- BIRCH_BUTTON
- JUNGLE_BUTTON
- ACACIA_BUTTON
- DARK_OAK_BUTTON
- MANGROVE_BUTTON
- CRIMSON_BUTTON
- WARPED_BUTTON
- IRON_DOOR
- OAK_DOOR
- SPRUCE_DOOR
- BIRCH_DOOR
- JUNGLE_DOOR
- ACACIA_DOOR
- DARK_OAK_DOOR
- MANGROVE_DOOR
- CRIMSON_DOOR
- WARPED_DOOR
- IRON_TRAPDOOR
- IRON_TRAPDOOR
- OAK_TRAPDOOR
- OAK_TRAPDOOR
- SPRUCE_TRAPDOOR
- SPRUCE_TRAPDOOR
- BIRCH_TRAPDOOR
- BIRCH_TRAPDOOR
- JUNGLE_TRAPDOOR
- JUNGLE_TRAPDOOR
- ACACIA_TRAPDOOR
- ACACIA_TRAPDOOR
- DARK_OAK_TRAPDOOR
- DARK_OAK_TRAPDOOR
- MANGROVE_TRAPDOOR
- MANGROVE_TRAPDOOR
- CRIMSON_TRAPDOOR
- CRIMSON_TRAPDOOR
- WARPED_TRAPDOOR
- WARPED_TRAPDOOR
- OAK_FENCE_GATE
- SPRUCE_FENCE_GATE
- BIRCH_FENCE_GATE
- JUNGLE_FENCE_GATE
- ACACIA_FENCE_GATE
- DARK_OAK_FENCE_GATE
- MANGROVE_FENCE_GATE
- CRIMSON_FENCE_GATE
- WARPED_FENCE_GATE
- CHEST_MINECART
- FURNACE_MINECART
- HOPPER_MINECART
- OAK_CHEST_BOAT
- SPRUCE_CHEST_BOAT
- BIRCH_CHEST_BOAT
- JUNGLE_CHEST_BOAT
- ACACIA_CHEST_BOAT
- DARK_OAK_CHEST_BOAT
- MANGROVE_CHEST_BOAT
- LEATHER_CHESTPLATE
- CHAINMAIL_CHESTPLATE
- IRON_CHESTPLATE
- DIAMOND_CHESTPLATE
- GOLDEN_CHESTPLATE
- NETHERITE_CHESTPLATE
- BREWING_STAND
- LOOM
- COMPOSTER
- BARREL
- SMOKER
- BLAST_FURNACE
- BLAST_FURNACE
- CARTOGRAPHY_TABLE
- FLETCHING_TABLE
- GRINDSTONE
- SMITHING_TABLE
- STONECUTTER

View File

@@ -1,16 +1,11 @@
name: CommandGUI
name: T2C-CommandGUI
version: ${project.version}
main: de.jatitv.commandguiv2.Spigot.Main
api-version: 1.13
prefix: CommandGUI
prefix: T2C-CommandGUI
authors: [ JaTiTV ]
softdepend:
- T2CodeLib
- Vault
- PlaceholderAPI
- PlotSquaredGUI
- PlugManGUI
commands:
commandgui:
@@ -20,53 +15,4 @@ commands:
description: CommandGUI Help
aliases: [cguihelp, guihelp]
commandgui-item:
aliases: [gui-item]
#permissions:
# commandgui.admin:
# 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: true
# commandgui.bypass: true
# commandgui.command.info: true
# commandgui.command.give: true
#
# commandgui.player:
# description: All permissions from CommandGUI
# default: op
# children:
# commandgui.command: true
# commandgui.get.guiitem.at.login: true
# commandgui.useitem: true
# commandgui.useitem.toggle: true
#
# commandgui.updatemsg:
# description: Players with this permission get the update message when joining if an update is available
# default: op
# commandgui.command:
# description: Required permission to open GUIs via command
# default: op
# commandgui.get.guiitem.at.login:
# description: Only players with this permission will receive the GUI item
# default: op
# commandgui.useitem:
# description: Required permission to use the GUI Item
# default: op
# commandgui.useitem.toggle:
# description: Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)
# default: op
# commandgui.bypass:
# description: Bypass to open disabled GUIs
# default: op
# commandgui.command.info:
# description: Permission to view CommandGUI info
# default: not op
# commandgui.command.give:
# description: Kommend in V2.1.0
# default: op
aliases: [gui-item, useitem]

View File

@@ -27,6 +27,9 @@ Slots:
Sound: ''
Cost:
Enable: false
EcoModule: VAULT
Item: DIRT;5
VotePoints: 0
Price: 0.0
Command:
Enable: false
@@ -72,3 +75,11 @@ Slots:
PluginReload:
Enable: false
Command: ''
FunctionVotePoints:
Enable: false
Mode: ADD
Amount: 0
FunctionItem:
Enable: false
Mode: REMOVE
Item: DIRT;5

View File

@@ -20,6 +20,9 @@ Slots:
Sound: ''
Cost:
Enable: false
EcoModule: VAULT
Item: DIRT;5
VotePoints: 0
Price: 0.0
Command:
Enable: false
@@ -65,3 +68,11 @@ Slots:
PluginReload:
Enable: false
Command: ''
FunctionVotePoints:
Enable: false
Mode: ADD
Amount: 0
FunctionItem:
Enable: false
Mode: REMOVE
Item: DIRT;5

View File

@@ -0,0 +1,158 @@
#####################################################
## To add another Function just create a new file. ##
#####################################################
Slots:
Function:
Item:
# Here you can create an empty slot.
# Note: When this is enabled, no functions will work.
Empty: false
# Here you can set the number of items
Amount: 1
PlayerHead:
# Here you can set if the item should be a player head
Enable: false
Base64:
# Here you can specify whether a Base64 player header should be used
Enable: false
# Here you can set the Base64 Value.
# You can find the Base64 Value for example on https://minecraft-heads.com.
Base64Value: ''
# Here you can set whether the player head should be used by the player who has opened the GUI.
PlayerWhoHasOpenedTheGUI: false
# Here you can set a specific player from which the player head should be used
PlayerName: ''
# Here you can set a Minecraft material to be used. This is ignored when PlayerHead is used
Material: 'DIRT'
# Here you set the DisplayName of the item
Name: 'Item Title'
# Here you set the lore of the item
Lore:
- '&8-----------------'
- '&bLine 1'
- '&bLine 2'
- '&8-----------------'
CustomSound:
# Here you can set whether a specific sound or the default sound from the config.yml should be used.
Enable: false
# Here you can deactivate the sound for this item. CustomSound must be activated for this!
NoSound: false
# Here you set the custom sound
Sound: ''
Cost:
# Here you can specify whether the function should cost or not
Enable: false
# Here you set which economy mode should be used.
# Use 'VAULT' / 'MONEY' for money via vault.
# Use 'ITEM' to pay with items.
# Use 'VOTEPOINTS' to pay with vote points from VotingPlugin (https://spigotmc.org/resources/votingplugin.15358/).
EcoModule: VAULT
# Set the item and the quantity for the ITEM mode here. (ITEM;AMOUNT)
Item: DIRT;5
# Set here the VotePoints for the VOTEPOINTS mode.
VotePoints: 0
# Set the money here for the mode VAULT or MONEY
Price: 0.0
Command:
# Here you can enable or disable the Command function
# Placeholder: [player] = PlayerName
Enable: false
# Here you can specify if this command should be executed on the bugee
BungeeCommand: false
# Here you can set if the command should be executed from the console
# Example: You can also create a store with this command.
# /give [player] stone | So all commands can be executed even those for which the player has no permission.
CommandAsConsole: false
# Here you can set commands. Several commands are also possible.
# They are processed from top to bottom and executed one after the other!
Command:
- 'command 1'
- 'command 2'
ServerChange:
# Here you can enable or disable the function ServerChange
# To use this function the function BungeeCord must be activated in the conig.yml and the plugin must be installed on the proxy!
Enable: false
# # Here you can say which server the player should be moved to.
Server: ''
OpenGUI:
# Here you can enable or disable the OpenGUI feature
Enable: false
# Here you can set which GUI should be opened.
# Use the file name of the GUI without .yml
GUI: ''
Toggle:
# Here you can enable a feature that allows players to give or remove permissions to each other
# The commands for the permission plugin can be set in the config (default for LuckPerms)
Permission:
# Activate this function here
Enable: false
# Set the permission here
Permission: ''
UseItem:
# When this function is enabled, players can toggle the UseItem on and off.
# For this function 'UseItem.AllowToggle' must be activated in config.yml!
Enable: false
Message:
# Here you can enable or disable the Message function
Enable: false
# Here you can set the messages to be sent to the player
# Placeholder: [player] = PlayerName | [prefix] = PluginPrefix | [price] = price if function Cost is activated
Message:
- 'Message line 1'
- 'Message line 2'
SetConfig:
# Here you can enable or disable the SetConfig function
Enable: false
File:
# Here you define in which file something should be changed
# Example at this file: 'plugins/CommandGUI/GUIs/default.yml'.
Path: ''
Option:
# Here you set the option to be changed
# Example on the option of this example slots: 'Slots.Example.Slot'
Path: ''
# Here you set which format should be set
# String = text in one line
# Boolean = true / false
# Integer = numbers without comma
# Double = number with comma | Please use . as comma
# List = text with multiple lines (- 'hi')
Premat: String
Value:
# Here you can set which value should be set when you click with the left mouse button.
LeftClick:
String: ''
Boolean: false
Integer: 0
Double: 0.0
List: []
# Here you set which value should be set when clicking with the right mouse button
RightClick:
String: ''
Boolean: false
Integer: 0
Double: 0.0
List: []
PluginReload:
# Here you can set if the plugin to which a file was changed should be reloaded directly
Enable: false
# Here you set the reload command to be used
# The command is executed by the console! No / is needed!
Command: ''
FunctionVotePoints:
# With this function you can give or subtract VotePoints from VotingPlugin to a player.
Enable: false
# Use to add: ADD
# Use to subtract: REMOVE
Mode: ADD
# Set the number of vote points to be subtracted / added here
Amount: 0
FunctionItem:
# With this function you can give or remove items to a player
Enable: false
# Use to add: ADD
# Use to subtract: REMOVE
Mode: REMOVE
# Enter the item (material) and the number behind it. Separate them with ; (ITEM;AMOUNT)
Item: DIRT;5

View File

@@ -16,13 +16,13 @@ Slots:
Function: SupportDiscord
Permission:
Required: false
See: commandgui.gui.[guiname].slot.[slot].see
Use: commandgui.gui.[guiname].slot.[slot].use
See: commandgui.gui.[function].slot.[slot].see
Use: commandgui.gui.[function].slot.[slot].use
UseItem:
Slot: 6
Enable: true
Function: UseItem
Permission:
Required: false
See: commandgui.gui.[guiname].slot.[slot].see
Use: commandgui.gui.[guiname].slot.[slot].use
See: commandgui.gui.[function].slot.[slot].see
Use: commandgui.gui.[function].slot.[slot].use

View File

@@ -0,0 +1,51 @@
################################################
## To add another GUI just create a new file. ##
################################################
GUI:
# Enable or disable the GUI
Enable: true
# Set the lines of the GUI here (1-6)
Lines: 1
# Here you set the display name of the GUI
Name: '&5default &9GUI'
FillItem:
# Activate or deactivate the FillItem here
Enable: true
# Here you can set the FillItem
Item: BLACK_STAINED_GLASS_PANE
# Here you set the settings for the alias
Command:
# Here you can enable or disable the alias of the GUI. The alias is the file name without .yml
Alias: true
Permission:
# Set here if a permission is needed for the alias or not. | Permission: commandgui.command.<alias>
Required: true
# Here you set the functions and slots
Slots:
# Here is an example of a slot
# To add another slot just copy the block. IMPORTANT: The slot name must not be duplicated (Slots.<name>).
function1:
# Here you set which slot the item / function should be in
Slot: 4
# Here you can activate and deactivate the slot
Enable: true
# Here you specify which function this slot should perform
Function: function1
Permission:
# Here you can set if a permission is needed to use this function.
Required: false
# Placeholder: [function] which function is used | [slot] is the slot number | [slotname] is the name of the key (Slots.KEY)
See: commandgui.gui.[function].slot.[slot].see
Use: commandgui.gui.[function].slot.[slot].use
function2:
Slot: 6
Enable: true
Function: function2
Permission:
Required: false
See: commandgui.gui.[function].slot.[slot].see
Use: commandgui.gui.[function].slot.[slot].use

Binary file not shown.

View File

@@ -1,13 +1,13 @@
ConfigVersion: 5
Plugin:
UpdateCheckOnJoin: true
Debug: false
HelpAlias: true
AdminSubCommand: admin
language: english
Currency: $
DefaultGUI: default
Storage:
Type: YML
Type: SQLITE
MySQL:
IP: localhost
Port: 3306
@@ -54,30 +54,6 @@ UseItem:
OnOnlyFirstLogin: true
Bungee:
OnServerChange: false
Advanced:
UseItem:
GameMode:
Change:
Enable: true
DelayInTicks: 1
Protection:
Enable: false
RemoveItemWhenItIsDisabled: false
Mode: blacklist
List:
- CREATIVE
- Spectator
World:
Change:
Enable: true
DelayInTicks: 1
Protection:
Enable: false
RemoveItemWhenItIsDisabled: false
Mode: blacklist
List:
- World1
- World2
Toggle:
Items:
OnOrYes:
@@ -119,3 +95,133 @@ Sound:
PlayerNotFound:
Enable: true
Sound: BLOCK_NOTE_BLOCK_HARP
Advanced:
UseItem:
GameMode:
Change:
Enable: true
DelayInTicks: 1
Protection:
Enable: false
RemoveItemWhenItIsDisabled: false
Mode: blacklist
List:
- CREATIVE
- Spectator
World:
Change:
Enable: true
DelayInTicks: 1
Protection:
Enable: false
RemoveItemWhenItIsDisabled: false
Mode: blacklist
List:
- World1
- World2
ItemBlockBlacklist:
- CHEST
- CRAFTING_TABLE
- FURNACE
- OAK_FENCE
- SPRUCE_FENCE
- BIRCH_FENCE
- JUNGLE_FENCE
- ACACIA_FENCE
- DARK_OAK_FENCE
- MANGROVE_FENCE
- CRIMSON_FENCE
- WARPED_FENCE
- NETHER_BRICK_FENCE
- ENDER_CHEST
- BEACON
- ANVIL
- CHIPPED_ANVIL
- DAMAGED_ANVIL
- REPEATER
- COMPARATOR
- HOPPER
- DISPENSER
- DROPPER
- LEVER
- DAYLIGHT_DETECTOR
- TRAPPED_CHEST
- NOTE_BLOCK
- STONE_BUTTON
- POLISHED_BLACKSTONE_BUTTON
- OAK_BUTTON
- SPRUCE_BUTTON
- BIRCH_BUTTON
- JUNGLE_BUTTON
- ACACIA_BUTTON
- DARK_OAK_BUTTON
- MANGROVE_BUTTON
- CRIMSON_BUTTON
- WARPED_BUTTON
- IRON_DOOR
- OAK_DOOR
- SPRUCE_DOOR
- BIRCH_DOOR
- JUNGLE_DOOR
- ACACIA_DOOR
- DARK_OAK_DOOR
- MANGROVE_DOOR
- CRIMSON_DOOR
- WARPED_DOOR
- IRON_TRAPDOOR
- IRON_TRAPDOOR
- OAK_TRAPDOOR
- OAK_TRAPDOOR
- SPRUCE_TRAPDOOR
- SPRUCE_TRAPDOOR
- BIRCH_TRAPDOOR
- BIRCH_TRAPDOOR
- JUNGLE_TRAPDOOR
- JUNGLE_TRAPDOOR
- ACACIA_TRAPDOOR
- ACACIA_TRAPDOOR
- DARK_OAK_TRAPDOOR
- DARK_OAK_TRAPDOOR
- MANGROVE_TRAPDOOR
- MANGROVE_TRAPDOOR
- CRIMSON_TRAPDOOR
- CRIMSON_TRAPDOOR
- WARPED_TRAPDOOR
- WARPED_TRAPDOOR
- OAK_FENCE_GATE
- SPRUCE_FENCE_GATE
- BIRCH_FENCE_GATE
- JUNGLE_FENCE_GATE
- ACACIA_FENCE_GATE
- DARK_OAK_FENCE_GATE
- MANGROVE_FENCE_GATE
- CRIMSON_FENCE_GATE
- WARPED_FENCE_GATE
- CHEST_MINECART
- FURNACE_MINECART
- HOPPER_MINECART
- OAK_CHEST_BOAT
- SPRUCE_CHEST_BOAT
- BIRCH_CHEST_BOAT
- JUNGLE_CHEST_BOAT
- ACACIA_CHEST_BOAT
- DARK_OAK_CHEST_BOAT
- MANGROVE_CHEST_BOAT
- LEATHER_CHESTPLATE
- CHAINMAIL_CHESTPLATE
- IRON_CHESTPLATE
- DIAMOND_CHESTPLATE
- GOLDEN_CHESTPLATE
- NETHERITE_CHESTPLATE
- BREWING_STAND
- LOOM
- COMPOSTER
- BARREL
- SMOKER
- BLAST_FURNACE
- BLAST_FURNACE
- CARTOGRAPHY_TABLE
- FLETCHING_TABLE
- GRINDSTONE
- SMITHING_TABLE
- STONECUTTER

View File

@@ -0,0 +1,313 @@
#########################################
## Please do not change ConfigVersion! ##
#########################################
ConfigVersion: 5
Plugin:
# Here you can set the debug mode of the plugin.
# It is recommended not to activate this on productive systems. Only if it is really needed!
Debug: false
# Here you can set whether the Helpalias command (/commandguihelp) should be activated.
# If this is changed the server MUST be restarted to change this!
HelpAlias: true
# Here you set which subcommand should be for the admin functions.
# (/commandgui 'admin' reload)
AdminSubCommand: admin
# here you set the language to be used
language: english
# Here you set the character or word that will be used as currency
Currency: $
# Here you set which GUI should be opened at '/commandgui' / '/gui'.
DefaultGUI: default
Storage:
# Set here if MySQL, SQLITE or YML should be used as storage.
Type: SQLITE
# Enter here the access data to the database you want to use, if you use MySQL
MySQL:
IP: localhost
Port: 3306
Database: database
User: root
Password: password
SSL: false
BungeeCord:
# Set here if the plugin runs in a BungeeCord subserver.
# The plugin file must then be installed on the proxy (BungeeCord, Waterfall) and on the servers.
Enable: false
# Set here the server name of the server
ThisServer: server
UseItem:
# Set here if the UseItem is to be used in use
Enable: true
# Set here if players are allowed to enable or disable the UseItem with '/gui-item <on/off>'.
# Permission 'commandgui.useitem.toggle' is additionally required
AllowToggle: true
# Set here if players are allowed to change the slot in the inventory where the UseItem is located with '/gui-item <slot>'.
# Permission 'commandgui.useitem.toggle' is additionally required
AllowSetSlot: true
# Set here if the dropping of the UseItem should be blocked
BlockMoveAndDrop: true
# Set here which GUI should open the UseItem
OpenGUI: default
Permission:
# Set here if the permission 'commandgui.useitem' is required to use the UseItem
NeededToUse: true
# Set here if the UseItem should stay in the inventory with the '/clear' command
KeepAtCommandClear: true
InventorySlot:
# Set here on which slot the UseItem should be located by default
Slot: 1
# Set here if the slot should be forced even if another item is on this slot (also the set slot of the player).
# NOTE: The item that was on this slot before will be deleted.
SlotEnforce: false
# Set here if the UseItem should be placed on another free slot, if the selected slot (also the set slot of the player) is occupied.
FreeSlot: false
# Set here the item that should be used as UseItem
Item:
# Set here which material should be used as UseItem
Material: paper
PlayerHead:
# Set here if a PlayerHead should be used as UseItem
Enable: false
Base64:
# Set here if a Base64 PlayerHead should be used as UseItem
Enable: false
# Here you can set the Base64 Value.
# You can find the Base64 Value for example on https://minecraft-heads.com.
Base64Value: ''
# Here you can set whether the player head should be used as a UseItem by the player
PlayerWhoHasOpenedTheGUI: false
# Here you can set a player name whose head should be used as UseItem
Playername: ''
# Set the DisplayName of the UseItem here
Name: '&6GUI UseItem'
# Set the lore of the UseItem here
Lore:
- 'Lore line 1'
- 'Lore line 2'
Join:
# Set here if the UseItem should be given at every server join
GiveOnEveryJoin: true
# Set here if the UseItem should only be given to the server at the first join of the player.
GiveOnlyOnFirstJoin: false
Cursor:
ToGUIItem:
OnLogin:
# Here you define whether the UseItem should be selected when joining the server.
Enable: true
Spigot:
# Set here if the UseItem should only be selected at the first join
OnOnlyFirstLogin: true
Bungee:
# Set here if the UseItem should be selected even if you change the server of the bungee network.
# The option BungeeCord must be activated for this!
OnServerChange: false
Toggle:
# Set the items to be used with the Toggle function here
Items:
# Set here the item that should be used if you have the permission or the UseItem is active.
OnOrYes:
Item:
Base64:
# Set here if a Base64 head should be used
Enable: false
# Here you can set the Base64 Value.
# You can find the Base64 Value for example on https://minecraft-heads.com.
Base64Value: ''
# Set the material to be used here
Material: GREEN_WOOL
# Set here the item to be used if you have the permission or the UseItem is disabled
OffOrNo:
Item:
Base64:
# Set here if a Base64 head should be used
Enable: false
# Here you can set the Base64 Value.
# You can find the Base64 Value for example on https://minecraft-heads.com.
Base64Value: ''
# Set the material to be used here
Material: RED_WOOL
Permission:
# Set here the commands to be used for Toggle.Permission
Commands:
'True': luckperms user [player] permission set [perm] true
'False': luckperms user [player] permission set [perm] false
# Set the design of the placeholders here
Placeholder:
# Placeholder for true / enabled
'True': '&2true'
# Placeholder for false / disabled
'False': '&4false'
Sound:
# Here you can disable all sounds
Enable: true
# Set here At which action which sound should be played or none at all
OpenInventory:
Enable: true
Sound: BLOCK_CHEST_OPEN
Click:
Enable: true
Sound: BLOCK_NOTE_BLOCK_HAT
NoMoney:
Enable: true
Sound: BLOCK_NOTE_BLOCK_HARP
NoInventorySpace:
Enable: true
Sound: BLOCK_NOTE_BLOCK_HARP
Give:
Enable: true
Sound: ENTITY_PLAYER_LEVELUP
PlayerNotFound:
Enable: true
Sound: BLOCK_NOTE_BLOCK_HARP
Advanced:
UseItem:
GameMode:
Change:
# Set here if the UseItem should be reset when the GameMode is changed.
Enable: true
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
DelayInTicks: 1
Protection:
# Set here in which gamemode the UseItem may be used
Enable: false
# Set here if the UseItem should be removed if you are in a not allowed Gamemode
RemoveItemWhenItIsDisabled: false
# Set here if a 'blacklist' or 'whitelist' should be used
Mode: blacklist
# Set the GameMode list here
List:
- CREATIVE
- Spectator
World:
Change:
# This specifies whether the UseItem should be reset when the world is changed.
Enable: true
# Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second).
DelayInTicks: 1
Protection:
# Set here in which world the UseItem may be used
Enable: false
# Here you specify whether the UseItem should be removed if you are in a world that is not permitted
RemoveItemWhenItIsDisabled: false
# Set here if a 'blacklist' or 'whitelist' should be used
Mode: blacklist
# Set the worlds here
List:
- World1
- World2
# Set here for which blocks the UseItem is blocked and the function of the block you are looking at should be used.
ItemBlockBlacklist:
- CHEST
- CRAFTING_TABLE
- FURNACE
- OAK_FENCE
- SPRUCE_FENCE
- BIRCH_FENCE
- JUNGLE_FENCE
- ACACIA_FENCE
- DARK_OAK_FENCE
- MANGROVE_FENCE
- CRIMSON_FENCE
- WARPED_FENCE
- NETHER_BRICK_FENCE
- ENDER_CHEST
- BEACON
- ANVIL
- CHIPPED_ANVIL
- DAMAGED_ANVIL
- REPEATER
- COMPARATOR
- HOPPER
- DISPENSER
- DROPPER
- LEVER
- DAYLIGHT_DETECTOR
- TRAPPED_CHEST
- NOTE_BLOCK
- STONE_BUTTON
- POLISHED_BLACKSTONE_BUTTON
- OAK_BUTTON
- SPRUCE_BUTTON
- BIRCH_BUTTON
- JUNGLE_BUTTON
- ACACIA_BUTTON
- DARK_OAK_BUTTON
- MANGROVE_BUTTON
- CRIMSON_BUTTON
- WARPED_BUTTON
- IRON_DOOR
- OAK_DOOR
- SPRUCE_DOOR
- BIRCH_DOOR
- JUNGLE_DOOR
- ACACIA_DOOR
- DARK_OAK_DOOR
- MANGROVE_DOOR
- CRIMSON_DOOR
- WARPED_DOOR
- IRON_TRAPDOOR
- IRON_TRAPDOOR
- OAK_TRAPDOOR
- OAK_TRAPDOOR
- SPRUCE_TRAPDOOR
- SPRUCE_TRAPDOOR
- BIRCH_TRAPDOOR
- BIRCH_TRAPDOOR
- JUNGLE_TRAPDOOR
- JUNGLE_TRAPDOOR
- ACACIA_TRAPDOOR
- ACACIA_TRAPDOOR
- DARK_OAK_TRAPDOOR
- DARK_OAK_TRAPDOOR
- MANGROVE_TRAPDOOR
- MANGROVE_TRAPDOOR
- CRIMSON_TRAPDOOR
- CRIMSON_TRAPDOOR
- WARPED_TRAPDOOR
- WARPED_TRAPDOOR
- OAK_FENCE_GATE
- SPRUCE_FENCE_GATE
- BIRCH_FENCE_GATE
- JUNGLE_FENCE_GATE
- ACACIA_FENCE_GATE
- DARK_OAK_FENCE_GATE
- MANGROVE_FENCE_GATE
- CRIMSON_FENCE_GATE
- WARPED_FENCE_GATE
- CHEST_MINECART
- FURNACE_MINECART
- HOPPER_MINECART
- OAK_CHEST_BOAT
- SPRUCE_CHEST_BOAT
- BIRCH_CHEST_BOAT
- JUNGLE_CHEST_BOAT
- ACACIA_CHEST_BOAT
- DARK_OAK_CHEST_BOAT
- MANGROVE_CHEST_BOAT
- LEATHER_CHESTPLATE
- CHAINMAIL_CHESTPLATE
- IRON_CHESTPLATE
- DIAMOND_CHESTPLATE
- GOLDEN_CHESTPLATE
- NETHERITE_CHESTPLATE
- BREWING_STAND
- LOOM
- COMPOSTER
- BARREL
- SMOKER
- BLAST_FURNACE
- BLAST_FURNACE
- CARTOGRAPHY_TABLE
- FLETCHING_TABLE
- GRINDSTONE
- SMITHING_TABLE
- STONECUTTER

View File

@@ -26,7 +26,11 @@ UseItem:
DisabledInWorld: '[prefix] &cThe UseItem is disabled in this World!'
Cost:
Buy_msg: '[prefix] &2You bought [itemname] &2for &6[price]&2.'
No_money: '[prefix] &cYou don''t have enough money!'
'No':
Money: '[prefix] &cYou don''t have enough money!/*/&cYou need: &6[price]&c.'
Item: '[prefix] &cYou don''t have enough items of &6[item] &cin your inventory!/*/&cYou
need: &6[amount]&c.'
Vote: '[prefix] &cYou do not have enough vote points!/*/&cYou need: &6[amount]&c.'
NoInventorySpace: '[prefix] &cYou have no room in your inventory!'
ServerChange:
onServerChange: '[prefix] &2You will be connected to the server &e[server]§2.'
@@ -39,6 +43,15 @@ Give:
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!'
FunctionItem:
Add: '[prefix] &2You have &6[amount] [item] &2placed in your inventory.'
Remove: '[prefix] &2You have been &6[amount] [item] &2removed.'
RemoveError: '[prefix] &cYou don''t have so many items!/*/&cYou need &6[amount]
[item]&c!'
FunctionVote:
Add: '[prefix] &2You were given &6[amount] &2Vote points.'
Remove: '[prefix] &2You have been removed &6[amount] &2Vote points.'
RemoveError: '[prefix] &cYou don''t have so many VotePoints!/*/&cYou need &6[amount]&c!'
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.'
@@ -51,5 +64,23 @@ Help:
Reload: '&8''''&b/commandgui admin reload&8'''' &eReload the plugin.'
UseItem_On: '&8''''&b/gui-item on&8'''' &eActivate the GUIItem for you.'
UseItem_Off: '&8''''&b/gui-item off&8'''' &eDisable the GUIItem for yourself.'
UseItem_Slot: '&8''''&b/gui-item slot [slot]&8'''' &eSet the slot for GUIItem for
you.'
UseItem_Slot: '&8''''&b/gui-item slot &7<slot>&8'''' &eSet the slot where you want
to have the GUIItem.'
Player:
CGUI: '&b/commandgui &8| &b/cgui/*/&eOpen the default GUI &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui'
Help: '&b/commandguihelp/*/&eOpen this help./*/SUGGEST_COMMAND/*//commandguihelp'
Info: '&b/commandgui admin info/*/&eCall the info from &4Command&9GUI &e./*/SUGGEST_COMMAND/*//commandgui
admin info'
Open: '&b/commandgui [gui]/*/&eOpen the GUI: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui '
Give: '&b/commandgui admin give &7<player>/*/&eGive a player the GUI item./*/SUGGEST_COMMAND/*//commandgui
admin give '
CreateDefaultGUI: '&b/commandgui admin createdefaultgui/*/&eCreate a default GUI
&7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui'
Reload: '&b/commandgui admin reload/*/&eReload the plugin./*/SUGGEST_COMMAND/*//commandgui
admin reload'
UseItem_On: '&b/gui-item on/*/&eActivate the GUIItem for you./*/SUGGEST_COMMAND/*//gui-item
on'
UseItem_Off: '&b/gui-item off/*/&eDisable the GUIItem for yourself./*/SUGGEST_COMMAND/*//gui-item
off'
UseItem_Slot: '&b/gui-item slot &7<slot>/*/&eSet the slot where you want to have
the GUIItem./*/SUGGEST_COMMAND/*//gui-item slot '

View File

@@ -26,7 +26,12 @@ UseItem:
DisabledInWorld: '[prefix] &cDas UseItem ist in dieser Welt deaktiviert!'
Cost:
Buy_msg: '[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft.'
No_money: '[prefix] &cDu hast nicht gen[ue]gend Geld!'
'No':
Money: '[prefix] &cDu hast nicht gen[ue]gend Geld!/*/&cDu ben[oe]tigst [price].'
Item: '[prefix] &cDu hast nicht gen[ue]gent Items von &6[item] &cim Inventar!/*/&cDu
ben[oe]tigst: &6[amount]&c.'
Vote: '[prefix] &cDu hast nicht gen[ue]gent Vote Punkte!/*/&cDu ben[oe]tigst:
&6[amount]&c.'
NoInventorySpace: '[prefix] &cDu hast keinen Platz in deinem Inventar!'
ServerChange:
onServerChange: '[prefix] &2Du wirst auf den Server §e[server] §2verbunden.'
@@ -41,6 +46,15 @@ Player:
nicht Online!'
PlayerNoInventorySpace: '[prefix] &6[player] &chat keinen freien Platz in seinem
Inventar!'
FunctionItem:
Add: '[prefix] &2Dir wurden &6[amount] [item] &2in dein Inventar gelegt.'
Remove: '[prefix] &2Dir wurden &6[amount] [item] &2entfernt.'
RemoveError: '[prefix] &cDu hast nicht so viele Items!/*/&cDu benötigets &6[amount]
[item]&c!'
FunctionVote:
Add: '[prefix] &2Dir wurden &6[amount] &2Vote Punkte gegeben.'
Remove: '[prefix] &2Dir wurden &6[amount] &2Vote Punkte entfernt.'
RemoveError: '[prefix] &cDu hast nicht so viele VotePunkte!/*/&cDu benötigets &6[amount]&c!'
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.'
@@ -54,5 +68,23 @@ Help:
Reload: '&8''''&b/commandgui admin 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.'
UseItem_Slot: '&8''''&b/gui-item slot &7<slot>&8'''' &eStelle den Slot ein, auf
den du das GUIItem haben möchtest.'
Player:
CGUI: '&b/commandgui &8| &b/cgui/*/&e[OE]ffne die default GUI &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui'
Help: '&b/commandguihelp/*/&e[OE]ffne diese help./*/SUGGEST_COMMAND/*//commandguihelp'
Info: '&b/commandgui admin info/*/&eRufe die Infos von &4Command&9GUI &eauf./*/SUGGEST_COMMAND/*//commandgui
admin info'
Open: '&b/commandgui [gui]/*/&e[OE]ffne die GUI: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui '
Give: '&b/commandgui admin give &7<player>/*/&eGebe einem Spieler das GUI-Item./*/SUGGEST_COMMAND/*//commandgui
admin give '
CreateDefaultGUI: '&b/commandgui admin createdefaultgui/*/&eLasse eine default
GUI erstellen &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui'
Reload: '&b/commandgui admin reload/*/&eLade das Plugin neu./*/SUGGEST_COMMAND/*//commandgui
admin reload'
UseItem_On: '&b/gui-item on/*/&eAktiviere f[ue]r dich das GUIItem./*/SUGGEST_COMMAND/*//gui-item
on'
UseItem_Off: '&b/gui-item off/*/&eDeaktiviere f[ue]r dich das GUIItem./*/SUGGEST_COMMAND/*//gui-item
off'
UseItem_Slot: '&b/gui-item slot &7<slot>/*/&eStelle den Slot ein, auf den du das
GUIItem haben möchtest./*/SUGGEST_COMMAND/*//gui-item slot '

View File

@@ -25,7 +25,11 @@ UseItem:
DisabledInWorld: '[prefix] &cUseItem er deaktivert i denne verden!'
Cost:
Buy_msg: '[prefix] &2Du kjøpte [itemname] &2for &6[price]&2.'
No_money: '[prefix] &cDu har ikke nok penger!'
'No':
Money: '[prefix] &cDu har ikke nok penger!/*/&cDu trenger &6[price]&c.'
Item: '[prefix] &cDu har ikke nok varer av &6[item] &ci inventaret ditt!/*/&cDu
trenger: &6[amount]&c.'
Vote: '[prefix] &cDu har ikke nok stemmepoeng!/*/&cDu trenger: &6[amount]&c.'
NoInventorySpace: '[prefix] &cDu har ikke nok plass i inventaret ditt!'
ServerChange:
onServerChange: '[prefix] &2Du vil bli tilkoblet serveren &e[server]&2.'
@@ -39,6 +43,14 @@ 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!'
FunctionItem:
Add: '[prefix] &2Du har &6[amount] [item] &2plassert i beholdningen din.'
Remove: '[prefix] &2Du har blitt &6[amount] [item] &2fjernet.'
RemoveError: '[prefix] &cDu har ikke så mange varer!/*/&cDu trenger &6[amount] [item]&c!'
FunctionVote:
Add: '[prefix] &2Du fikk &6[amount] &2stemmepoeng.'
Remove: '[prefix] &2Du har blitt fjernet &6[amount] &2Stemmepoeng.'
RemoveError: '[prefix] &cDu har ikke så mange stemmepoeng!/*/&cDu trenger &6[amount]&c!'
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.'
@@ -50,5 +62,23 @@ Help:
Reload: '&8''''&b/commandgui admin 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
UseItem_Slot: '&8''''&b/gui-item slot &7<slot>&8'''' &eSett sporet for GUIItem for
deg.'
Player:
CGUI: '&b/commandgui &8| &b/cgui/*/&eÅpne default GUIen &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui'
Help: '&b/commandguihelp/*/&eSender denne hjelpe meldingen./*/SUGGEST_COMMAND/*//commandguihelp'
Info: '&b/commandgui admin info/*/&eKall informasjon fra &4Command&9GUI&e./*/SUGGEST_COMMAND/*//commandgui
admin info'
Open: '&b/commandgui [gui]/*/&eÅpne GUIen: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui '
Give: '&b/commandgui admin give &7<player>/*/&eGi en spiller GUI gjenstanden./*/SUGGEST_COMMAND/*//commandgui
admin give '
CreateDefaultGUI: '&b/commandgui admin createdefaultgui/*/&eLag en normalverdi
GUI &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui'
Reload: '&b/commandgui admin reload/*/&eLast inn pluginet på nytt./*/SUGGEST_COMMAND/*//commandgui
admin reload'
UseItem_On: '&b/gui-item on/*/&eAktiverer en GUI gjenstand for deg./*/SUGGEST_COMMAND/*//gui-item
on'
UseItem_Off: '&b/gui-item off/*/&eDeaktiverer en GUI gjenstand for deg./*/SUGGEST_COMMAND/*//gui-item
off'
UseItem_Slot: '&b/gui-item slot &7<slot>/*/&eSett sporet for GUIItem for deg./*/SUGGEST_COMMAND/*//gui-item
slot '

View File

@@ -54,4 +54,4 @@ Optional:
---
<img src="https://bstats.org/signatures/bukkit/CGUI.svg" width="600">
<img src="https://i.imgur.com/tVLZGZg.png" width="600">
<img src="https://i.imgur.com/HoZSt7c.png" width="600">