Compare commits
33 Commits
2.7.0_Snap
...
2.7.7
Author | SHA1 | Date | |
---|---|---|---|
87d0f75a4c | |||
6f3da3e3f4 | |||
|
80255a60eb | ||
f6860e9ab5 | |||
ebbec1f660 | |||
|
5674b54593 | ||
381afeba89 | |||
19822f7024 | |||
ed810f31d7 | |||
b0286e597f | |||
ddfea4eba6 | |||
|
ed86e7b143 | ||
32c1219bb2 | |||
326dfae0e9 | |||
a05b941aaf | |||
36de2ff0ca | |||
|
777c6876fc | ||
b6347c8fad | |||
f3feddd317 | |||
35a9930017 | |||
fc98f931e2 | |||
cfd07b01f2 | |||
c5bc880ab1 | |||
3bd0662273 | |||
7993dca126 | |||
520df8dc97 | |||
8e90aee0ca | |||
7fda797cae | |||
007d8776b9 | |||
|
dcd524ab3c | ||
|
c3d0990853 | ||
|
04a7d4952e | ||
d96205887c |
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>CommandGUI_V2</artifactId>
|
||||
<version>2.7.0_Snapshot-1</version>
|
||||
<version>2.7.7</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandGUI</name>
|
||||
@@ -67,9 +67,8 @@
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@@ -86,7 +85,7 @@
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>11.4</version>
|
||||
<version>11.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
@@ -113,12 +112,6 @@
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.11.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
@@ -129,5 +122,11 @@
|
||||
<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>
|
||||
|
@@ -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");
|
||||
|
||||
|
||||
}
|
||||
}
|
@@ -1,5 +1,8 @@
|
||||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
@@ -8,7 +11,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;
|
||||
@@ -33,6 +35,7 @@ public class BListener implements Listener {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@@ -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==============================================================================");
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -10,6 +10,8 @@ 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;
|
||||
@@ -31,7 +33,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class GUI_Listener implements Listener {
|
||||
public class GUIListener implements Listener {
|
||||
|
||||
private static String prefix = Util.getPrefix();
|
||||
public static String GUICode;
|
||||
@@ -44,50 +46,57 @@ public class GUI_Listener implements Listener {
|
||||
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.GUI_Name))
|
||||
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(Replace.replace(prefix, player, GUICode + gui.GUI_Name)))) {
|
||||
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 (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.permission || !player.hasPermission(slot.permissionToUse)) {
|
||||
player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name))
|
||||
.replace("[perm]", slot.permissionToUse));
|
||||
continue;
|
||||
}
|
||||
if (!slot.enable) continue;
|
||||
if (!e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, function.name))) 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);
|
||||
}
|
||||
execute(e, slot, player, gui);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void execute(InventoryClickEvent e, Slot slot, Player player, Gui gui) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
if (e.getSlot() != slot.slot) return;
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) return;
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
|
||||
send.player(player,SelectMessages.NoPermissionForItem.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 (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);
|
||||
send.player(player,SelectMessages.No_money);
|
||||
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable)
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
|
||||
} else {
|
||||
send.player(player,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, player);
|
||||
if (function.toggleUseItem) toggleUseItem(player);
|
||||
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);
|
||||
@@ -131,7 +140,7 @@ public class GUI_Listener implements Listener {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
OpenGUI.openGUI(player, slot.openGUI);
|
||||
OpenGUI.openGUI(player, slot.openGUI, true);
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
}
|
||||
@@ -146,12 +155,12 @@ public class GUI_Listener implements Listener {
|
||||
for (String msg : slot.message) {
|
||||
if (Main.PaPi) {
|
||||
if (slot.cost_Enable) {
|
||||
player.sendMessage(Replace.replacePrice(prefix, player, msg, slot.price + " " + SelectConfig.Currency));
|
||||
} else player.sendMessage(Replace.replace(prefix, player, msg.replace("[prefix]", prefix)));
|
||||
send.player(player, Replace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.Currency));
|
||||
} else send.player(player, Replace.replace(prefix, player, Placeholder.replace(msg, player)));
|
||||
} else {
|
||||
if (slot.cost_Enable) {
|
||||
player.sendMessage(Replace.replacePrice(prefix, msg, slot.price + " " + SelectConfig.Currency));
|
||||
} else player.sendMessage(Replace.replace(prefix, msg.replace("[prefix]", prefix)));
|
||||
send.player(player, Replace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.Currency));
|
||||
} else send.player(player, Replace.replace(prefix, Placeholder.replace(msg, player)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,7 +197,7 @@ public class GUI_Listener implements Listener {
|
||||
} else if (slot.configOptionPremat.equals("List")) {
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueLeft);
|
||||
} else {
|
||||
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
send.player(player,"§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
}
|
||||
}
|
||||
if (e.getClick() == ClickType.RIGHT) {
|
||||
@@ -203,7 +212,7 @@ public class GUI_Listener implements Listener {
|
||||
} else if (slot.configOptionPremat.equals("List")) {
|
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueRight);
|
||||
} else {
|
||||
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
send.player(player,"§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
}
|
||||
}
|
||||
try {
|
||||
@@ -227,26 +236,48 @@ public class GUI_Listener implements Listener {
|
||||
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.GUI_Name) + "§r §6Slot: §e" + slot.slot + " §6CustomSound: §9" + function.customSound_Sound));
|
||||
.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 slot, Player player) {
|
||||
if (player.hasPermission(slot.togglePermissionPerm)) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.togglePermFalse.replace("[player]", player.getName()).replace("[perm]", slot.togglePermissionPerm));
|
||||
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]", slot.togglePermissionPerm));
|
||||
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) {
|
||||
if (Events.useItemHashMap.get(player)) {
|
||||
private static void toggleUseItem(Player player, Gui gui) {
|
||||
if (Events.useItemHashMap.get(player.getName())) {
|
||||
Commands.itemOff(player);
|
||||
} else Commands.itemOn(player);
|
||||
} else {
|
||||
Commands.itemOn(player);
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
OpenGUI.openGUI(player, gui.key, false);
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
}
|
@@ -2,14 +2,11 @@ package de.jatitv.commandguiv2.Spigot.Listener;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Give_UseItem;
|
||||
import de.jatitv.commandguiv2.Spigot.system.UseItem;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ItemChange {
|
||||
@@ -18,47 +15,21 @@ public class ItemChange {
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
if (Events.useItemSlotHashMap.get(player) == null) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player);
|
||||
}
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
|
||||
if (!SelectConfig.UseItem_Enable) {
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.UseItemGameModeProtection) {
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
|
||||
if (SelectConfig.UseItemGameModeRemoveItemWhenItIsDisabled) removeItem(player);
|
||||
send.debug(Main.plugin,"GameMode disabled: " +player.getName() +" " +player.getGameMode().toString());
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
|
||||
if (SelectConfig.UseItemGameModeRemoveItemWhenItIsDisabled) removeItem(player);
|
||||
send.debug(Main.plugin,"GameMode disabled: " +player.getName() +" " +player.getGameMode().toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (SelectConfig.UseItemWorldProtection) {
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
|
||||
if (SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled)removeItem(player);
|
||||
send.debug(Main.plugin,"World disabled: " +player.getName() +" " +player.getWorld().toString());
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
|
||||
if (SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled)removeItem(player);
|
||||
send.debug(Main.plugin,"World disabled: " +player.getName() +" " +player.getWorld().toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
UseItem.removeItem(player);
|
||||
if (UseItem.protection(player, false)) return;
|
||||
if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
|
||||
if (!SelectConfig.UseItem_AllowToggle || Events.useItemHashMap.get(player)) {
|
||||
if (!SelectConfig.UseItem_AllowToggle || Events.useItemHashMap.get(player.getName())) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Give_UseItem.onGive(player);
|
||||
UseItem.giveUseItem(player);
|
||||
if (setCursor) {
|
||||
setCursor(player, slot);
|
||||
}
|
||||
@@ -69,21 +40,20 @@ public class ItemChange {
|
||||
}
|
||||
}
|
||||
}
|
||||
send.debug(Main.plugin,"GiveOnlyOnFirstJoin: " +player.getName());
|
||||
send.debug(Main.plugin, "GiveOnlyOnFirstJoin: " + player.getName());
|
||||
return;
|
||||
}
|
||||
if (!SelectConfig.UseItem_GiveOnEveryJoin) {
|
||||
send.debug(Main.plugin,"!GiveOnEveryJoin: " +player.getName());
|
||||
send.debug(Main.plugin, "!GiveOnEveryJoin: " + player.getName());
|
||||
return;
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
removeItem(player);
|
||||
if (!SelectConfig.UseItem_AllowToggle || Events.useItemHashMap.get(player)) {
|
||||
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());
|
||||
Give_UseItem.onGive(player);
|
||||
send.debug(Main.plugin, "Give: " + player.getName());
|
||||
UseItem.giveUseItem(player);
|
||||
if (setCursor) {
|
||||
setCursor(player, slot);
|
||||
}
|
||||
@@ -96,7 +66,7 @@ public class ItemChange {
|
||||
}
|
||||
}
|
||||
if (empty) {
|
||||
Give_UseItem.onGiveADD(player);
|
||||
UseItem.addUseItem(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,54 +76,38 @@ public class ItemChange {
|
||||
}
|
||||
|
||||
private static void setCursor(Player player, int slot) {
|
||||
send.debug(Main.plugin,"setCursor 1 Player: "+player.getName());
|
||||
send.debug(Main.plugin, "setCursor 1 Player: " + player.getName());
|
||||
|
||||
if (!SelectConfig.Cursor_ToGUIItem_OnLogin) {
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin,"setCursor 2 Player: "+player.getName());
|
||||
send.debug(Main.plugin, "setCursor 2 Player: " + player.getName());
|
||||
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
send.debug(Main.plugin,"setCursor 3 Player: "+player.getName());
|
||||
send.debug(Main.plugin, "setCursor 3 Player: " + player.getName());
|
||||
}
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin,"setCursor 4 Player: "+player.getName());
|
||||
send.debug(Main.plugin, "setCursor 4 Player: " + player.getName());
|
||||
if (!SelectConfig.Bungee) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
send.debug(Main.plugin,"setCursor 5 Player: "+player.getName());
|
||||
send.debug(Main.plugin, "setCursor 5 Player: " + player.getName());
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin,"setCursor 6 Player: "+player.getName());
|
||||
send.debug(Main.plugin, "setCursor 6 Player: " + player.getName());
|
||||
if (SelectConfig.UseItem_ServerChange) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
send.debug(Main.plugin,"setCursor 7 Player: "+player.getName());
|
||||
send.debug(Main.plugin, "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.plugin, "setCursor 8 Player: " + player.getName());
|
||||
send.debug(Main.plugin, "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
|
||||
send.debug(Main.plugin, "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.plugin, "setCursor 9 Player: " + player.getName());
|
||||
Main.bungeejoinplayers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private static void removeItem(Player player) {
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ 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.Select_Database;
|
||||
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;
|
||||
@@ -22,7 +22,7 @@ public class PluginEvent implements Listener {
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Select_Database.nameCheck(player);
|
||||
SelectDatabase.nameCheck(player);
|
||||
UpdateAPI.join(Main.plugin,prefix, "commandgui.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord());
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,8 @@ 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.database.Select_Database;
|
||||
import de.jatitv.commandguiv2.Spigot.system.UseItem;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
|
||||
import de.jatitv.commandguiv2.api.CGuiAPI;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
@@ -33,25 +34,26 @@ import java.util.Iterator;
|
||||
|
||||
public class Events implements Listener {
|
||||
|
||||
public static HashMap<Player, Boolean> useItemHashMap = new HashMap<>();
|
||||
public static HashMap<Player, Integer> useItemSlotHashMap = new HashMap<>();
|
||||
public static HashMap<String, Boolean> useItemHashMap = new HashMap<>();
|
||||
public static HashMap<String, Integer> useItemSlotHashMap = new HashMap<>();
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
if (Select_Database.selectItemStatus(e.getPlayer())){
|
||||
useItemHashMap.put(e.getPlayer(), true);
|
||||
} else useItemHashMap.put(e.getPlayer(), false);
|
||||
|
||||
useItemSlotHashMap.put(e.getPlayer(),Select_Database.selectSlot(e.getPlayer()));
|
||||
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);
|
||||
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
|
||||
|
||||
if (CGuiAPI.JoinDisable) {
|
||||
send.debug(Main.plugin,"JoinDisable");
|
||||
send.debug(Main.plugin, "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.plugin, "itemChange: " + e.getPlayer().getName());
|
||||
ItemChange.itemChange(e.getPlayer(), true);
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 20L * 1);
|
||||
@@ -60,24 +62,13 @@ public class Events implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerQuitEvent e) {
|
||||
useItemHashMap.remove(e.getPlayer());
|
||||
useItemHashMap.remove(e.getPlayer().getName());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDeathDrop(PlayerDeathEvent e) {
|
||||
Player player = e.getEntity().getPlayer();
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UseItem.removeItem(player);
|
||||
if (!e.getDrops().isEmpty()) {
|
||||
Iterator var3 = (new ArrayList(e.getDrops())).iterator();
|
||||
while (var3.hasNext()) {
|
||||
@@ -145,10 +136,17 @@ public class Events implements Listener {
|
||||
}.runTaskLater(Main.plugin, SelectConfig.UseItemWorldChangeDelayInTicks * 1L);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInteract(PlayerInteractEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (!p.isSneaking()) {
|
||||
for (String material : SelectConfig.UseItemItemBlockBlacklist) {
|
||||
if (e.getClickedBlock() != null) {
|
||||
if (e.getClickedBlock().getType() == Material.valueOf(material)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectConfig.UseItem_Enable) {
|
||||
if (SelectConfig.UseItem_PlayerHead_Enable) {
|
||||
if (e.getItem() != null && p.getItemInHand().getType() == ItemVersion.getHead()) {
|
||||
@@ -166,47 +164,50 @@ public class Events implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private static void openGUI(PlayerInteractEvent e, Player p) {
|
||||
private static void openGUI(PlayerInteractEvent e, Player player) {
|
||||
e.setCancelled(true);
|
||||
|
||||
if (p.isSneaking()) {
|
||||
Commands.info(p);
|
||||
if ((!SelectConfig.disableInfoBySneak) && player.isSneaking()) {
|
||||
Commands.info(player);
|
||||
return;
|
||||
}
|
||||
if (!legacy()) {
|
||||
if (!topInventoryIsEmpty(p)) return;
|
||||
|
||||
if (!Main.legacy) {
|
||||
if (!topInventoryIsEmpty(player)) return;
|
||||
}
|
||||
|
||||
if (UseItem.protection(player, true)) return;
|
||||
|
||||
if (SelectConfig.UseItemGameModeProtection) {
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(p.getGameMode().toString())) {
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
|
||||
e.setCancelled(true);
|
||||
send.player(p, SelectMessages.UseItemDisabledInGameMode);
|
||||
send.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(p.getGameMode().toString())) {
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
|
||||
e.setCancelled(true);
|
||||
send.player(p, SelectMessages.UseItemDisabledInGameMode);
|
||||
send.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectConfig.UseItemWorldProtection) {
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(p.getWorld().getName())) {
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
|
||||
e.setCancelled(true);
|
||||
send.player(p, SelectMessages.UseItemDisabledInWorld);
|
||||
send.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemWorldList.contains(p.getWorld().getName())) {
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
|
||||
e.setCancelled(true);
|
||||
send.player(p, SelectMessages.UseItemDisabledInWorld);
|
||||
send.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) {
|
||||
OpenGUI.openGUI(p, SelectConfig.UseItem_OpenGUI);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
p.playSound(p.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
|
||||
if (!SelectConfig.UseItem_Permission || player.hasPermission("commandgui.useitem")) {
|
||||
OpenGUI.openGUI(player, SelectConfig.UseItem_OpenGUI, true);
|
||||
} else {
|
||||
p.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
||||
send.player(player,SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
||||
.replace("[gui]", SelectConfig.UseItem_OpenGUI));
|
||||
}
|
||||
}
|
||||
@@ -217,7 +218,6 @@ public class Events implements Listener {
|
||||
if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
|
||||
&& e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.setCancelled(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,7 @@ public class Events implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(InventoryDragEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
|
||||
if (e.getWhoClicked() instanceof Player) {
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||
@@ -246,7 +247,6 @@ public class Events implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemMove(InventoryClickEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
|
||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
@@ -256,13 +256,13 @@ public class Events implements Listener {
|
||||
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
|
||||
e.setCancelled(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(InventoryPickupItemEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
|
||||
if (e.getItem() != null && e.getItem().getItemStack() != null) {
|
||||
ItemStack item = e.getItem().getItemStack();
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
@@ -275,6 +275,7 @@ public class Events implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlace(BlockPlaceEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
|
||||
if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
|
||||
&& e.getItemInHand().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
e.setCancelled(true);
|
||||
@@ -284,6 +285,7 @@ public class Events implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onDrop(PlayerDropItemEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
|
||||
if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
|
||||
ItemStack item = e.getItemDrop().getItemStack();
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
@@ -293,12 +295,6 @@ public class Events implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean legacy() {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15|| NMSVersion.v1_16_R1) {
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
private static boolean topInventoryIsEmpty(Player p) {
|
||||
return p.getOpenInventory().getTopInventory().isEmpty();
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.*;
|
||||
|
||||
public class Events_from1_10 implements Listener {
|
||||
public class EventsFrom110 implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onHandSwap(PlayerSwapHandItemsEvent e) {
|
@@ -8,6 +8,8 @@ import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -27,6 +29,7 @@ public final class Main extends JavaPlugin {
|
||||
}
|
||||
|
||||
private static Boolean enable = false;
|
||||
public static Boolean legacy = false;
|
||||
|
||||
public static String prefix = "§8[§4C§9GUI§8]";
|
||||
|
||||
@@ -57,7 +60,10 @@ public final class Main extends JavaPlugin {
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
version = plugin.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;
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
if (PluginCheck.papi()) {
|
||||
PaPi = true;
|
||||
@@ -113,6 +119,10 @@ 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
|
||||
|
@@ -1,7 +1,6 @@
|
||||
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.gui.CreateGUI;
|
||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
@@ -17,7 +16,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
|
||||
@@ -61,24 +60,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")) {
|
@@ -23,7 +23,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||
if (args.length == 0) {
|
||||
if (SelectConfig.UseItem_AllowToggle) {
|
||||
Help.sendGUIItemHelp(sender, prefix);
|
||||
Help.sendGUIItemHelp(sender);
|
||||
} else send.sender(sender, "§4UseItem toggle is disabled!");// todo
|
||||
} else {
|
||||
if (args.length == 1 || args.length == 2) {
|
||||
|
@@ -6,21 +6,20 @@ 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.Give_UseItem;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.ConfigCreate;
|
||||
import de.jatitv.commandguiv2.Spigot.system.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.database.Select_Database;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Permissions;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
|
||||
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;
|
||||
|
||||
public class Commands {
|
||||
public static void info(CommandSender sender) {
|
||||
@@ -60,11 +59,15 @@ public class Commands {
|
||||
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");
|
||||
ConfigCreate.configCreate();
|
||||
CmdExecuter_GUI.arg1.clear();
|
||||
CmdExecuter_GUI.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
|
||||
SelectConfig.onSelect();
|
||||
Main.plugin.reloadConfig();
|
||||
if (!Objects.equals(SelectDatabase.getStorage().toString(), SelectConfig.storage)) {
|
||||
if (sender instanceof Player) send.sender(sender, "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||
send.warning(Main.plugin, "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||
}
|
||||
|
||||
LanguagesCreate.langCreate();
|
||||
|
||||
@@ -77,6 +80,11 @@ public class Commands {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
Permissions.onPermRegister();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (SelectConfig.Bungee) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "commandgui:bungee");
|
||||
@@ -91,7 +99,7 @@ public class Commands {
|
||||
|
||||
public static void give(CommandSender sender, Player target) {
|
||||
if (Bukkit.getPlayer(target.getName()) != null) {
|
||||
Give_UseItem.onGive(target);
|
||||
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) {
|
||||
@@ -107,32 +115,17 @@ public class Commands {
|
||||
}
|
||||
|
||||
public static void itemOn(Player player) {
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UseItem.removeItem(player);
|
||||
Integer slot = null;
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
if (Events.useItemSlotHashMap.get(player) == null) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player);
|
||||
}
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
send.debug(Main.plugin, String.valueOf(slot));
|
||||
if (player.getInventory().getItem(slot - 1) == null) {
|
||||
Select_Database.setItemStatusTrue(player);
|
||||
Give_UseItem.onGive(player);
|
||||
SelectDatabase.setItemStatusTrue(player);
|
||||
UseItem.giveUseItem(player);
|
||||
} else {
|
||||
boolean empty = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
@@ -142,11 +135,11 @@ public class Commands {
|
||||
}
|
||||
}
|
||||
if (empty) {
|
||||
Select_Database.setItemStatusTrue(player);
|
||||
Give_UseItem.onGiveADD(player);
|
||||
SelectDatabase.setItemStatusTrue(player);
|
||||
UseItem.addUseItem(player);
|
||||
send.player(player, SelectMessages.ItemON);
|
||||
} else {
|
||||
player.sendMessage(SelectMessages.NoInventorySpace);
|
||||
send.player(player,SelectMessages.NoInventorySpace);
|
||||
if (SelectConfig.Sound_NoInventorySpace_Enable && SelectConfig.Sound_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_NoInventorySpace, 3, 1);
|
||||
}
|
||||
@@ -155,91 +148,70 @@ public class Commands {
|
||||
}
|
||||
|
||||
public static void itemOff(Player player) {
|
||||
Select_Database.setItemStatusFalse(player);
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
send.player(player, SelectMessages.ItemOFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SelectDatabase.setItemStatusFalse(player);
|
||||
UseItem.removeItem(player);
|
||||
send.player(player, SelectMessages.ItemOFF);
|
||||
}
|
||||
|
||||
public static void onSetSlot(Player player, Integer setSlot) {
|
||||
if (SelectConfig.UseItem_AllowSetSlot) {
|
||||
if (setSlot < 1) {
|
||||
send.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
if (!SelectConfig.UseItem_AllowSetSlot) {
|
||||
send.player(player,Util.getPrefix() + " §4Function disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
if (setSlot < 1) {
|
||||
send.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
return;
|
||||
}
|
||||
if (setSlot > 9) {
|
||||
send.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Events.useItemHashMap.get(player.getName())) {
|
||||
if (Objects.equals(Events.useItemSlotHashMap.get(player.getName()), setSlot)) {
|
||||
send.player(player,SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
|
||||
return;
|
||||
}
|
||||
if (setSlot > 9) {
|
||||
send.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||
return;
|
||||
}
|
||||
ItemStack itm1 = player.getInventory().getItem(setSlot - 1);
|
||||
if (itm1 != null) {
|
||||
if (itm1.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm1.getType() == ItemVersion.getHead()) {
|
||||
if (itm1.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.sendMessage(SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(setSlot - 1) != null) {
|
||||
send.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
|
||||
return;
|
||||
}
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
|
||||
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Select_Database.setSlot(player, setSlot);
|
||||
if (Events.useItemHashMap.get(player)) {
|
||||
Give_UseItem.onGive(player);
|
||||
}
|
||||
send.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
|
||||
} else player.sendMessage(Util.getPrefix() + " §4Function disabled");
|
||||
}
|
||||
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(setSlot - 1) != null) {
|
||||
send.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
|
||||
return;
|
||||
}
|
||||
|
||||
UseItem.removeItem(player);
|
||||
SelectDatabase.setSlot(player, setSlot);
|
||||
Events.useItemSlotHashMap.replace(player.getName(), setSlot);
|
||||
|
||||
if (Events.useItemHashMap.get(player.getName())) {
|
||||
UseItem.giveUseItem(player);
|
||||
}
|
||||
|
||||
send.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
|
||||
}
|
||||
|
||||
public static void gui(Player player) {
|
||||
if (Main.guiHashMap.containsKey(SelectConfig.DefaultGUI)) {
|
||||
Gui gui = Main.guiHashMap.get(SelectConfig.DefaultGUI);
|
||||
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, SelectConfig.DefaultGUI);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
} else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
|
||||
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 send.player(player,SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
|
||||
.replace("[perm]", "commandgui.command"));
|
||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name));
|
||||
} else send.player(player,SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
|
||||
}
|
||||
}
|
||||
|
||||
public static void gui(Player player, String arg) {
|
||||
if (Main.guiHashMap.containsKey(arg)) {
|
||||
Gui gui = Main.guiHashMap.get(arg);
|
||||
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + gui.Command_Command) || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, arg);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
} else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.Command_Command)
|
||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, arg, true);
|
||||
} else send.player(player,SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.key)
|
||||
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
|
||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.Command_Command));
|
||||
} else player.sendMessage(SelectMessages.GUInotFound);
|
||||
} else send.player(player,SelectMessages.GUIIsDisabled.replace("[gui]", gui.key));
|
||||
} else send.player(player,SelectMessages.GUInotFound);
|
||||
}
|
||||
}
|
||||
|
@@ -8,46 +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.DefaultGUI);
|
||||
|
||||
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.GUI_Name)));
|
||||
for (String alias : Main.allAliases) {
|
||||
if (Main.guiHashMap.get(alias).GUI_Enable || sender.hasPermission("commandgui.bypass")) {
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpOpen.replace("[gui]", alias).replace("[guiname]", Replace.replace(prefix,Main.guiHashMap.get(alias).GUI_Name)));
|
||||
}
|
||||
}
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpHelp);
|
||||
}
|
||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||
send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_on);
|
||||
send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_off);
|
||||
send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_Slot);
|
||||
}
|
||||
if (sender.hasPermission("commandgui.command.info")) {
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpInfo);
|
||||
}
|
||||
// if (sender.hasPermission("commandgui.command.give")) {
|
||||
// send.sender(sender, Prefix + " " + Select_msg.HelpGive);
|
||||
// }
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpCreateDefaultGUI.replace("[directory]", Main.getPath()+ "\\GUIs\\default.yml"));
|
||||
send.sender(sender, Prefix + " " + SelectMessages.HelpReload);
|
||||
}
|
||||
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------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ public class AliasRegister {
|
||||
}
|
||||
for (String alias : Main.allAliases) {
|
||||
if (Main.guiHashMap.get(alias) != null) {
|
||||
if (Main.guiHashMap.get(alias).Command_Alias_Enable) {
|
||||
if (Main.guiHashMap.get(alias).commandAliasEnable) {
|
||||
try {
|
||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
|
||||
|
@@ -4,8 +4,8 @@ package de.jatitv.commandguiv2.Spigot.cmdManagement.register;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
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;
|
||||
@@ -24,15 +24,12 @@ public class RegisterCommand extends Command {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Gui gui = Main.guiHashMap.get(alias);
|
||||
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, alias);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
} else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
|
||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
||||
OpenGUI.openGUI(player, alias, true);
|
||||
} else send.player(player,SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
|
||||
.replace("[perm]", "commandgui.command." + alias));
|
||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name));
|
||||
} 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;
|
||||
}
|
||||
|
@@ -6,15 +6,19 @@ 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.yamlConfiguration.Config;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ConfigCreate {
|
||||
|
||||
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
@@ -26,15 +30,15 @@ public class ConfigCreate {
|
||||
|
||||
if (!config.exists()) Config.set("ConfigVersion", Util.getConfigVersion(), yamlConfiguration);
|
||||
|
||||
|
||||
Config.set("Plugin.UpdateCheckOnJoin", true, yamlConfiguration);
|
||||
Config.set("Plugin.Debug", false, yamlConfiguration);
|
||||
Config.set("Plugin.HelpAlias", true, yamlConfiguration);
|
||||
Config.set("Plugin.language", "english", yamlConfiguration);
|
||||
Config.set("Plugin.Currency", "$", yamlConfiguration);
|
||||
Config.set("Plugin.DefaultGUI", "default", yamlConfiguration);
|
||||
|
||||
Config.set("Storage.Type", "YML", yamlConfiguration);
|
||||
if (Main.legacy){
|
||||
Config.set("Storage.Type", "YML", yamlConfiguration);
|
||||
} else Config.set("Storage.Type", "SQLITE", yamlConfiguration);
|
||||
Config.set("Storage.MySQL.IP", "localhost", yamlConfiguration);
|
||||
Config.set("Storage.MySQL.Port", 3306, yamlConfiguration);
|
||||
Config.set("Storage.MySQL.Database", "database", yamlConfiguration);
|
||||
@@ -101,15 +105,45 @@ public class ConfigCreate {
|
||||
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);
|
||||
Config.set("Toggle.Items.OnOrYes.Item.Material", ItemVersion.getGreenWool().getType().toString(), yamlConfiguration);
|
||||
if (Main.legacy) {
|
||||
Config.set("Toggle.Items.OnOrYes.Item.Material", "WOOL,5", yamlConfiguration);
|
||||
} else Config.set("Toggle.Items.OnOrYes.Item.Material", ItemVersion.getGreenWool().getType().toString(), yamlConfiguration);
|
||||
|
||||
Config.set("Toggle.Items.OffOrNo.Item.Base64.Enable", false, yamlConfiguration);
|
||||
Config.set("Toggle.Items.OffOrNo.Item.Base64.Base64Value", "", yamlConfiguration);
|
||||
Config.set("Toggle.Items.OffOrNo.Item.Material", ItemVersion.getRedWool().getType().toString(), yamlConfiguration);
|
||||
if (Main.legacy) {
|
||||
Config.set("Toggle.Items.OffOrNo.Item.Material", "WOOL,14", yamlConfiguration);
|
||||
} else Config.set("Toggle.Items.OffOrNo.Item.Material", ItemVersion.getRedWool().getType().toString(), yamlConfiguration);
|
||||
|
||||
Config.set("Toggle.Permission.Commands.True", "luckperms user [player] permission set [perm] true", yamlConfiguration);
|
||||
Config.set("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false", yamlConfiguration);
|
||||
|
@@ -17,19 +17,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SelectConfig {
|
||||
|
||||
private static final File config = new File(Main.getPath(), "config.yml");
|
||||
private static final YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
public static Boolean DisableUpdateChecker;
|
||||
public static Boolean UpdateCheckOnJoin;
|
||||
public static Boolean Debug;
|
||||
public static Boolean HelpAlias;
|
||||
public static String language;
|
||||
public static String Currency;
|
||||
public static List<String> mainCommands;
|
||||
|
||||
public static String Storage;
|
||||
public static String storage;
|
||||
|
||||
public static Boolean Bungee;
|
||||
public static String thisServer;
|
||||
@@ -62,6 +55,9 @@ public class SelectConfig {
|
||||
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;
|
||||
@@ -117,6 +113,9 @@ public class SelectConfig {
|
||||
|
||||
|
||||
public static void onSelect() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (yamlConfiguration.getInt("ConfigVersion") < Util.getConfigVersion() && new File(Main.getPath(), "config.yml").exists()) {
|
||||
send.console(Util.getPrefix() + " §4----------------------");
|
||||
send.console(Util.getPrefix() + " ");
|
||||
@@ -128,18 +127,12 @@ public class SelectConfig {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (yamlConfiguration.get("Plugin.DisableUpdateChecker") == null) {
|
||||
DisableUpdateChecker = false;
|
||||
} else DisableUpdateChecker = yamlConfiguration.getBoolean("Plugin.DisableUpdateChecker");
|
||||
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
|
||||
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||
HelpAlias = yamlConfiguration.getBoolean("Plugin.HelpAlias");
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
Currency = yamlConfiguration.getString("Plugin.Currency");
|
||||
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");
|
||||
|
||||
Storage = yamlConfiguration.getString("Storage.Type").toUpperCase();
|
||||
storage = yamlConfiguration.getString("Storage.Type").toUpperCase();
|
||||
|
||||
MySQL.ip = yamlConfiguration.getString("Storage.MySQL.IP");
|
||||
MySQL.port = yamlConfiguration.getInt("Storage.MySQL.Port");
|
||||
@@ -196,6 +189,12 @@ public class SelectConfig {
|
||||
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");
|
||||
@@ -224,7 +223,6 @@ 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(".", "_"));
|
||||
setConfigVersion();
|
||||
}
|
||||
|
||||
|
||||
@@ -348,7 +346,9 @@ public class SelectConfig {
|
||||
|
||||
}
|
||||
|
||||
private static void setConfigVersion() {
|
||||
public static void setConfigVersion() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
yamlConfiguration.set("ConfigVersion", Util.getConfigVersion());
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
|
@@ -152,8 +152,8 @@ public class ConfigConverterUnderV5 {
|
||||
set("Slots." + key + ".Enable", slotEnable, yamlConfiguration);
|
||||
set("Slots." + key + ".Function", function, yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.Required", permRequired, yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.See", "commandgui.gui.[guiname].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.Use", "commandgui.gui.[guiname].slot.[slot].use", yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||
}
|
||||
|
||||
private static void set(String path, String value, YamlConfiguration config) {
|
||||
|
@@ -21,7 +21,7 @@ public class CreateFunctions {
|
||||
0, 0.0, Arrays.asList(), false, "");
|
||||
|
||||
createFunction("SupportDiscord", false, 1, true, true, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19",
|
||||
false, "", (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) ? "TNT" : "",
|
||||
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,
|
||||
|
@@ -33,15 +33,15 @@ public class CreateGUI {
|
||||
set("Slots.SupportDiscord.Enable", true, yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Function", "SupportDiscord", yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Permission.Required", false, yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Permission.See", "commandgui.gui.[guiname].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Permission.Use", "commandgui.gui.[guiname].slot.[slot].use", yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots.SupportDiscord.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||
|
||||
set("Slots.UseItem.Slot", 6, yamlConfiguration);
|
||||
set("Slots.UseItem.Enable", true, yamlConfiguration);
|
||||
set("Slots.UseItem.Function", "UseItem", yamlConfiguration);
|
||||
set("Slots.UseItem.Permission.Required", false, yamlConfiguration);
|
||||
set("Slots.UseItem.Permission.See", "commandgui.gui.[guiname].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots.UseItem.Permission.Use", "commandgui.gui.[guiname].slot.[slot].use", yamlConfiguration);
|
||||
set("Slots.UseItem.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots.UseItem.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||
|
||||
|
||||
try {
|
||||
|
@@ -71,6 +71,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) {
|
||||
@@ -135,6 +146,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) {
|
||||
@@ -200,6 +222,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) {
|
||||
|
@@ -60,7 +60,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!";
|
||||
@@ -109,7 +120,19 @@ 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
|
||||
@@ -162,5 +185,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 ";
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
||||
@@ -60,11 +61,21 @@ 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());
|
||||
long long_ = System.currentTimeMillis();
|
||||
|
||||
File msg;
|
||||
|
||||
@@ -128,11 +139,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)));
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,8 @@ 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.system.Placeholder;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
@@ -25,7 +27,11 @@ public class GuiBuilder {
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
protected static void item(Function function, Integer slot, Player player, Inventory inventory) {
|
||||
ItemStack item = new ItemStack(Material.valueOf(function.item.toUpperCase().replace(".", "_")));
|
||||
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);
|
||||
item.setItemMeta(itemMeta);
|
||||
@@ -37,8 +43,12 @@ public class GuiBuilder {
|
||||
inventory.setItem(slot, item);
|
||||
}
|
||||
|
||||
protected static void item(String material, Function function,Integer slot, Player player, Inventory inventory) {
|
||||
ItemStack item = new ItemStack(Material.valueOf(material));
|
||||
protected static void item(String material, Function function, Integer slot, Player player, Inventory inventory) {
|
||||
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);
|
||||
item.setItemMeta(itemMeta);
|
||||
@@ -53,11 +63,11 @@ public class GuiBuilder {
|
||||
|
||||
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Function slot) {
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.lore, slot.price + " " + SelectConfig.Currency));
|
||||
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));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.lore, slot.price + " " + SelectConfig.Currency));
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, Placeholder.replace(slot.name,player)));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, Placeholder.replace(slot.lore,player), slot.price + " " + SelectConfig.Currency));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,11 +98,11 @@ 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(Function function, Integer slot, Player player, Inventory inventory) {
|
||||
base64(function.base64Value, function, slot, player, inventory);
|
||||
}
|
||||
|
||||
protected static void playerHead(Function function, Integer slot,Player player, Inventory inventory, String skullName) {
|
||||
protected static void playerHead(Function function, Integer slot, Player player, Inventory inventory, String skullName) {
|
||||
ItemStack item = ItemVersion.getHeadIS();
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
setDisplayNameAndLore(itemMeta, player, function);
|
||||
@@ -109,13 +119,13 @@ public class GuiBuilder {
|
||||
public static void fillItem(Inventory inventory, Gui gui) {
|
||||
ItemStack glass;
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.valueOf(gui.GUI_FillItem_Item));
|
||||
} else glass = new ItemStack(Material.valueOf(gui.GUI_FillItem_Item.toUpperCase().replace(".", "_")));
|
||||
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.parseShort(gui.guiFillItemItem));
|
||||
} else glass = new ItemStack(Material.valueOf(gui.guiFillItemItem.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMetaglass = glass.getItemMeta();
|
||||
itemMetaglass.setDisplayName(" ");
|
||||
glass.setItemMeta(itemMetaglass);
|
||||
glass.setAmount(1);
|
||||
for (int i = 0; i < 9 * gui.GUI_Lines; i++) {
|
||||
for (int i = 0; i < 9 * gui.guiLines; i++) {
|
||||
inventory.setItem(i, glass);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package de.jatitv.commandguiv2.Spigot.gui;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.GUI_Listener;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.GUIListener;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
|
||||
@@ -26,7 +26,7 @@ public class OpenGUI {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
public static void openGUI(Player player, String guiString) {
|
||||
public static void openGUI(Player player, String guiString, Boolean sound) {
|
||||
Gui gui = Main.guiHashMap.get(guiString);
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
switch (guiString) {
|
||||
@@ -63,20 +63,26 @@ public class OpenGUI {
|
||||
}
|
||||
|
||||
if (MCVersion.minecraft1_13) {
|
||||
GUI_Listener.GUICode = "";
|
||||
} else GUI_Listener.GUICode = "§6§8§9§r";
|
||||
if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
|
||||
GUIListener.GUICode = "";
|
||||
} else GUIListener.GUICode = "§6§8§9§r";
|
||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||
Inventory inventory;
|
||||
if (Main.PaPi) {
|
||||
inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.GUI_Lines, (Replace.replace(prefix, player, GUI_Listener.GUICode + gui.GUI_Name)));
|
||||
} else inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.GUI_Lines, (Replace.replace(prefix, GUI_Listener.GUICode + gui.GUI_Name)));
|
||||
inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (Replace.replace(prefix, player, GUIListener.GUICode + gui.guiName)));
|
||||
} else inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (Replace.replace(prefix, GUIListener.GUICode + gui.guiName)));
|
||||
|
||||
if (gui.GUI_FillItem_Enable) {
|
||||
if (gui.guiFillItemEnable) {
|
||||
GuiBuilder.fillItem(inventory, gui);
|
||||
}
|
||||
for (Slot slot : gui.slots) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
if (slot.permission || !player.hasPermission(slot.permissionToSee)) continue;
|
||||
if (function == null) {
|
||||
send.error(Main.plugin, "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
||||
continue;
|
||||
}
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
|
||||
if (slot.slot < 0 || slot.slot > gui.guiLines * 9) continue;
|
||||
|
||||
if (slot.enable) {
|
||||
if (function.empty) {
|
||||
ItemStack air = new ItemStack(Material.AIR);
|
||||
@@ -89,28 +95,20 @@ public class OpenGUI {
|
||||
toggleOff(function, slot.slot, player, inventory);
|
||||
}
|
||||
} else if (function.toggleUseItem) {
|
||||
if (Events.useItemHashMap.get(player)) {
|
||||
if (Events.useItemHashMap.get(player.getName())) {
|
||||
toggleOn(function, slot.slot, player, inventory);
|
||||
} else {
|
||||
toggleOff(function, slot.slot, player, inventory);
|
||||
}
|
||||
} else {
|
||||
if (function.playerHead_Enable) {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
send.player(player, prefix + "§c Playerheads are only available from version §61.13§c! §7- §bGUI: §6" +
|
||||
Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.slot + 1) + " §7- " + Replace.replace(prefix, function.name));
|
||||
send.error(plugin, "Playerheads are only available from version 1.13!");
|
||||
send.console(prefix + " §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" +
|
||||
(slot.slot + 1) + " §7- " + Replace.replace(prefix, function.name));
|
||||
if (function.base64_Enable) {
|
||||
GuiBuilder.base64(function, slot.slot, player, inventory);
|
||||
} else {
|
||||
if (function.base64_Enable) {
|
||||
GuiBuilder.base64(function, slot.slot, player, inventory);
|
||||
if (function.playerWhoHasOpenedTheGUI) {
|
||||
GuiBuilder.playerHead(function, slot.slot, player, inventory, player.getName());
|
||||
} else {
|
||||
if (function.playerWhoHasOpenedTheGUI) {
|
||||
GuiBuilder.playerHead(function, slot.slot, player, inventory, player.getName());
|
||||
} else {
|
||||
GuiBuilder.playerHead(function, slot.slot, player, inventory, function.playerName);
|
||||
}
|
||||
GuiBuilder.playerHead(function, slot.slot, player, inventory, function.playerName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -121,9 +119,14 @@ public class OpenGUI {
|
||||
|
||||
}
|
||||
}
|
||||
if (sound) {
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
|
||||
}
|
||||
}
|
||||
player.openInventory(inventory);
|
||||
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.GUI_Name) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.GUI_Name)));
|
||||
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} 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) {
|
||||
|
@@ -1,10 +1,12 @@
|
||||
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.objects.functions.Function;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
|
||||
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;
|
||||
|
||||
@@ -12,12 +14,11 @@ 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() {
|
||||
onSelectGui();
|
||||
onSelectFunction();
|
||||
onSelectGui();
|
||||
}
|
||||
|
||||
public static void onSelectGui() {
|
||||
@@ -27,57 +28,66 @@ public class Obj_Select {
|
||||
File[] fileArray = f.listFiles();
|
||||
|
||||
for (File config_gui : fileArray) {
|
||||
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
Main.allAliases.add(config_gui.getName().replace(".yml", ""));
|
||||
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config_gui);
|
||||
String guiFileName = config_gui.getName().replace(".yml", "");
|
||||
|
||||
Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable");
|
||||
Integer guiLines = yamlConfiguration_gui.getInt("GUI.Lines");
|
||||
if (yamlConfiguration_gui.getInt("GUI.Lines") > 6) {
|
||||
yamlConfiguration_gui.set("GUI.Lines", 6);
|
||||
}
|
||||
if (yamlConfiguration_gui.getInt("GUI.Lines") < 1) {
|
||||
yamlConfiguration_gui.set("GUI.Lines", 1);
|
||||
}
|
||||
try {
|
||||
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
String key = config_gui.getName().replace(".yml", "");
|
||||
Main.allAliases.add(key);
|
||||
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config_gui);
|
||||
|
||||
String guiName = yamlConfiguration_gui.getString("GUI.Name");
|
||||
Boolean guiFillItemEnable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
|
||||
String guiFillItemItem;
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneColor");
|
||||
} else guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.Item");
|
||||
Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable");
|
||||
Integer guiLines = yamlConfiguration_gui.getInt("GUI.Lines");
|
||||
if (yamlConfiguration_gui.getInt("GUI.Lines") > 6) {
|
||||
yamlConfiguration_gui.set("GUI.Lines", 6);
|
||||
}
|
||||
if (yamlConfiguration_gui.getInt("GUI.Lines") < 1) {
|
||||
yamlConfiguration_gui.set("GUI.Lines", 1);
|
||||
}
|
||||
|
||||
Boolean commandAliasEnable = yamlConfiguration_gui.getBoolean("Command.Alias");
|
||||
Boolean commandPermission = yamlConfiguration_gui.getBoolean("Command.Permission.Required");
|
||||
String guiName = yamlConfiguration_gui.getString("GUI.Name");
|
||||
Boolean guiFillItemEnable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
|
||||
String guiFillItemItem;
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneColor");
|
||||
} else guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.Item");
|
||||
|
||||
ArrayList<Slot> slots = new ArrayList<>();
|
||||
for (String key : yamlConfiguration_gui.getConfigurationSection("Slots").getKeys(false)) {
|
||||
Integer slotNumber = yamlConfiguration_gui.getInt("Slots." + key + ".Slot") - 1;
|
||||
Boolean enable = yamlConfiguration_gui.getBoolean("Slots." + key + ".Enable");
|
||||
String function = yamlConfiguration_gui.getString("Slots." + key + ".Function");
|
||||
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + key + ".Permission.Required");
|
||||
String permSee = yamlConfiguration_gui.getString("Slots." + key + ".Permission.See");
|
||||
String permUse = yamlConfiguration_gui.getString("Slots." + key + ".Permission.Use");
|
||||
Boolean commandAliasEnable = yamlConfiguration_gui.getBoolean("Command.Alias");
|
||||
Boolean commandPermission = yamlConfiguration_gui.getBoolean("Command.Permission.Required");
|
||||
|
||||
Slot slot = new Slot(slotNumber, enable, function, permRequired,
|
||||
Objects.requireNonNull(permSee).replace("[guiname]", guiFileName).replace("[slot]", String.valueOf(slotNumber))
|
||||
.replace("[slotname]", key), permUse);
|
||||
slots.add(slot);
|
||||
}
|
||||
Gui gui = new Gui(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,
|
||||
config_gui.getName().replace(".yml", ""), commandAliasEnable, commandPermission, slots);
|
||||
ArrayList<Slot> slots = new ArrayList<>();
|
||||
for (String slotKey : yamlConfiguration_gui.getConfigurationSection("Slots").getKeys(false)) {
|
||||
Integer slotNumber = yamlConfiguration_gui.getInt("Slots." + slotKey + ".Slot") - 1;
|
||||
Boolean enable = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Enable");
|
||||
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
|
||||
Function functionCheck = Main.functionHashMap.get(function);
|
||||
if (functionCheck == null) {
|
||||
send.error(Main.plugin, "The Function " + function + " in the GUI " + key + " does not exist!");
|
||||
}
|
||||
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Permission.Required");
|
||||
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
|
||||
String permUse = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.Use");
|
||||
|
||||
Slot slot = new Slot(slotNumber, enable, function, permRequired,
|
||||
permSee.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
|
||||
.replace("[slotname]", slotKey.toLowerCase()),
|
||||
permUse.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
|
||||
.replace("[slotname]", slotKey.toLowerCase()));
|
||||
slots.add(slot);
|
||||
}
|
||||
Gui gui = new Gui(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,
|
||||
key, commandAliasEnable, commandPermission, slots);
|
||||
|
||||
Main.guiHashMap.put(key, gui);
|
||||
CmdExecuter_GUI.arg1.put(config_gui.getName()
|
||||
.replace(".yml", ""), "commandgui.gui." + key);
|
||||
|
||||
Main.guiHashMap.put(guiFileName, gui);
|
||||
CmdExecuter_GUITab.arg1.put(config_gui.getName()
|
||||
.replace(".yml", ""), "commandgui.gui." + config_gui.getName().replace(".yml", ""));
|
||||
|
||||
try {
|
||||
yamlConfiguration_gui.save(config_gui);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,6 +102,7 @@ public class Obj_Select {
|
||||
if (sub.equals(".yml")) {
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
String key = config.getName().replace(".yml", "");
|
||||
Boolean empty = yamlConfiguration.getBoolean("Slots.Function.Item.Empty");
|
||||
Integer itemAmount = yamlConfiguration.getInt("Slots.Function.Item.Amount");
|
||||
Boolean playerHead_Enable = yamlConfiguration.getBoolean("Slots.Function.Item.PlayerHead.Enable");
|
||||
@@ -143,13 +154,13 @@ public class Obj_Select {
|
||||
String pluginReloadCommand = yamlConfiguration.getString("Slots.Function.SetConfig.PluginReload.Command");
|
||||
|
||||
|
||||
Function function = new Function(empty, itemAmount, playerHead_Enable, base64_Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, item, name, lore,
|
||||
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,
|
||||
configDoubleValueLeft, configListValueLeft, configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight,
|
||||
configListValueRight, pluginReloadEnable, pluginReloadCommand);
|
||||
Main.functionHashMap.put(config.getName().replace(".yml", ""), function);
|
||||
Main.functionHashMap.put(key, function);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
|
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
public class Function {
|
||||
|
||||
public String key;
|
||||
public Boolean empty;
|
||||
public Integer itemAmount;
|
||||
public Boolean playerHead_Enable;
|
||||
@@ -54,7 +55,8 @@ public class Function {
|
||||
public Boolean pluginReloadEnable;
|
||||
public String pluginReloadCommand;
|
||||
|
||||
public Function(Boolean empty,
|
||||
public Function(String key,
|
||||
Boolean empty,
|
||||
Integer itemAmount,
|
||||
Boolean playerHead_Enable,
|
||||
Boolean base64Value_Enable,
|
||||
@@ -101,6 +103,7 @@ public class Function {
|
||||
|
||||
Boolean pluginReloadEnable,
|
||||
String pluginReloadCommand) {
|
||||
this.key = key;
|
||||
this.empty = empty;
|
||||
this.itemAmount = itemAmount;
|
||||
this.playerHead_Enable = playerHead_Enable;
|
||||
@@ -152,6 +155,5 @@ public class Function {
|
||||
this.pluginReloadCommand = pluginReloadCommand;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -5,28 +5,28 @@ import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Gui {
|
||||
public Boolean GUI_Enable;
|
||||
public Integer GUI_Lines;
|
||||
public String GUI_Name;
|
||||
public Boolean GUI_FillItem_Enable;
|
||||
public String GUI_FillItem_Item;
|
||||
public Boolean guiEnable;
|
||||
public Integer guiLines;
|
||||
public String guiName;
|
||||
public Boolean guiFillItemEnable;
|
||||
public String guiFillItemItem;
|
||||
|
||||
|
||||
public String Command_Command;
|
||||
public Boolean Command_Alias_Enable;
|
||||
public Boolean Command_Permission_Enable;
|
||||
public String key;
|
||||
public Boolean commandAliasEnable;
|
||||
public Boolean commandPermissionEnable;
|
||||
public ArrayList<Slot> slots;
|
||||
|
||||
public Gui(Boolean GUI_Enable, Integer GUI_Lines, String GUI_Name, Boolean GUI_FillItem_Enable, String GUI_FillItem_Item,
|
||||
String Command_Command, Boolean Command_Alias_Enable, Boolean Command_Permission_Enable, ArrayList<Slot> slots){
|
||||
this.GUI_Enable = GUI_Enable;
|
||||
this.GUI_Lines = GUI_Lines;
|
||||
this.GUI_Name = GUI_Name;
|
||||
this.GUI_FillItem_Enable = GUI_FillItem_Enable;
|
||||
this.GUI_FillItem_Item = GUI_FillItem_Item;
|
||||
this.Command_Command = Command_Command;
|
||||
this.Command_Alias_Enable = Command_Alias_Enable;
|
||||
this.Command_Permission_Enable = Command_Permission_Enable;
|
||||
public Gui(Boolean guiEnable, Integer guiLines, String guiName, Boolean guiFillitemEnable, String guiFillitemItem,
|
||||
String commandCommand, Boolean commandAliasEnable, Boolean commandPermissionEnable, ArrayList<Slot> slots){
|
||||
this.guiEnable = guiEnable;
|
||||
this.guiLines = guiLines;
|
||||
this.guiName = guiName;
|
||||
this.guiFillItemEnable = guiFillitemEnable;
|
||||
this.guiFillItemItem = guiFillitemItem;
|
||||
this.key = commandCommand;
|
||||
this.commandAliasEnable = commandAliasEnable;
|
||||
this.commandPermissionEnable = commandPermissionEnable;
|
||||
this.slots = slots;
|
||||
}
|
||||
}
|
||||
|
@@ -15,18 +15,17 @@ import java.util.List;
|
||||
|
||||
public class Debug {
|
||||
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static final Plugin plugin = Main.plugin;
|
||||
|
||||
public static void debugmsg() {
|
||||
|
||||
|
||||
send.debug(plugin,"§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.debug(plugin,"§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
|
||||
send.debug(plugin,"§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
|
||||
send.debug(plugin,"§3Version: §e" + Bukkit.getVersion());
|
||||
send.debug(plugin,"§3Java: §e" + System.getProperty("java.version"));
|
||||
send.debug(plugin,"§3Worlds: §e" +String.valueOf(Bukkit.getServer().getWorlds()));
|
||||
send.debug(plugin,String.valueOf(Main.plugins));
|
||||
send.debug(plugin,"§5----------------------------------");
|
||||
send.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.debug(plugin, "§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
|
||||
send.debug(plugin, "§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
|
||||
send.debug(plugin, "§3Version: §e" + Bukkit.getVersion());
|
||||
send.debug(plugin, "§3Java: §e" + System.getProperty("java.version"));
|
||||
send.debug(plugin, "§3Worlds: §e" + String.valueOf(Bukkit.getServer().getWorlds()));
|
||||
send.debug(plugin, String.valueOf(Main.plugins));
|
||||
send.debug(plugin, "§5----------------------------------");
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
File f = new File(String.valueOf(Main.getPath()));
|
||||
File f2 = new File(String.valueOf(Main.getPath() + "/GUIs/"));
|
||||
@@ -34,63 +33,24 @@ public class Debug {
|
||||
File[] fileArray = f.listFiles();
|
||||
File[] fileArray2 = f2.listFiles();
|
||||
File[] fileArray3 = f3.listFiles();
|
||||
for (File config : fileArray) {
|
||||
send.debug(plugin,String.valueOf(config).replace("plugins/CommandGUI/", ""));
|
||||
if (fileArray != null) {
|
||||
for (File config : fileArray) {
|
||||
send.debug(plugin, String.valueOf(config).replace("plugins/CommandGUI/", ""));
|
||||
}
|
||||
}
|
||||
for (File config2 : fileArray2) {
|
||||
send.debug(plugin,String.valueOf(config2).replace("plugins/CommandGUI/", ""));
|
||||
}
|
||||
for (File config3 : fileArray3) {
|
||||
send.debug(plugin,String.valueOf(config3).replace("plugins/CommandGUI/", ""));
|
||||
}
|
||||
}
|
||||
send.debug(plugin,"§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
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");
|
||||
|
||||
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);
|
||||
}
|
||||
send.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.GUI_Listener;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events_from1_10;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUITab;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.GUIListener;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.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;
|
||||
@@ -17,6 +17,10 @@ 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.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
@@ -26,12 +30,13 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
public class Load {
|
||||
static Plugin plugin = Main.plugin;
|
||||
|
||||
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 {
|
||||
@@ -42,7 +47,6 @@ public class Load {
|
||||
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
|
||||
|
||||
if (!new File(Main.getPath(), "config.yml").exists()) {
|
||||
try {
|
||||
CreateGUI.configCreate();
|
||||
@@ -66,6 +70,8 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
SelectConfig.setConfigVersion();
|
||||
|
||||
if (SelectConfig.Bungee) {
|
||||
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "cgui:bungee")) {
|
||||
send.debug(plugin, "registerOutgoingPluginChannel §ecgui:bungee");
|
||||
@@ -78,7 +84,7 @@ public class Load {
|
||||
}
|
||||
|
||||
if (PluginCheck.papi()) {
|
||||
new Placeholder().register();
|
||||
new Papi().register();
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -92,7 +98,7 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CmdExecuter_GUITab.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
CmdExecuter_GUI.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -108,28 +114,9 @@ public class Load {
|
||||
}
|
||||
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.main();
|
||||
send.console(prefix + " §2Storage medium §6MySQL §2is used.");
|
||||
try {
|
||||
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Name` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Status` INT(1) NOT NULL DEFAULT '1'," +
|
||||
" `Slot` INT(1) NULL DEFAULT NULL," +
|
||||
" UNIQUE INDEX `UUID` (`UUID`)" +
|
||||
")" +
|
||||
"COLLATE='utf8mb4_general_ci'" +
|
||||
"ENGINE=InnoDB" +
|
||||
";");
|
||||
MySQL.query("ALTER TABLE `gui-item` ADD COLUMN IF NOT EXISTS `Slot` INT(1) NULL DEFAULT NULL AFTER `Status`;");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
loadStorage(prefix);
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
|
||||
} else {
|
||||
send.console(prefix + " §2Storage medium §6YML §2is used.");
|
||||
}
|
||||
if (Main.PaPi) {
|
||||
send.console(prefix + " §2PlaceholderAPI successfully connected!");
|
||||
} else {
|
||||
@@ -137,7 +124,7 @@ public class Load {
|
||||
}
|
||||
|
||||
try {
|
||||
RegisterPermissions.onPermRegister();
|
||||
Permissions.onPermRegister();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -146,7 +133,7 @@ public class Load {
|
||||
Main.plugin.getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
||||
send.debug(plugin, "CommandRegister: commandguihelp");
|
||||
}
|
||||
Main.plugin.getCommand("commandgui").setExecutor(new CmdExecuter_GUITab());
|
||||
Main.plugin.getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
|
||||
send.debug(plugin, "CommandRegister: commandgui");
|
||||
Main.plugin.getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
||||
send.debug(plugin, "CommandRegister: commandgui-item");
|
||||
@@ -157,13 +144,13 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new GUI_Listener(), plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new GUIListener(), plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.plugin);
|
||||
|
||||
if (!MCVersion.minecraft1_8 && !MCVersion.minecraft1_9) {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Events_from1_10(), plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new EventsFrom110(), plugin);
|
||||
}
|
||||
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
@@ -171,4 +158,59 @@ public class Load {
|
||||
Main.addonLoad();
|
||||
T2CodeTemplate.onLoadFooter(prefix, long_);
|
||||
}
|
||||
|
||||
private static void loadStorage(String prefix) {
|
||||
try {
|
||||
SelectDatabase.setStorage(StorageType.valueOf(SelectConfig.storage));
|
||||
} 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);
|
||||
}
|
||||
|
||||
switch (SelectDatabase.getStorage()) {
|
||||
case MYSQL:
|
||||
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||
MySQL.main();
|
||||
try {
|
||||
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Name` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Status` INT(1) NOT NULL DEFAULT '1'," +
|
||||
" `Slot` INT(1) NULL DEFAULT NULL," +
|
||||
" UNIQUE INDEX `UUID` (`UUID`)" +
|
||||
")" +
|
||||
"COLLATE='utf8mb4_general_ci'" +
|
||||
"ENGINE=InnoDB" +
|
||||
";");
|
||||
} catch (Exception e) {
|
||||
Main.sendTryCatch(Load.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
MySQL.query("ALTER TABLE `gui-item` ADD COLUMN `Slot` INT(1) NULL DEFAULT NULL AFTER `Status`;");
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||
break;
|
||||
default:
|
||||
case SQLITE:
|
||||
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||
try {
|
||||
SQLITE.main();
|
||||
SQLITE.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||
"UUID TEXT NOT NULL," +
|
||||
"Name TEXT NOT NULL," +
|
||||
"Status INTEGER NOT NULL DEFAULT 1," +
|
||||
"Slot INTEGER," +
|
||||
"PRIMARY KEY(UUID)" +
|
||||
");");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,8 @@ 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.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -34,8 +36,13 @@ 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.addCustomChart(new Metrics.SimplePie("updatecheckonjoin", () -> String.valueOf(SelectConfig.UpdateCheckOnJoin)));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("storage_type_mysql", () -> SelectConfig.Storage));
|
||||
metrics.addCustomChart(new DrilldownPie("storage_type_mysql", () -> {
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
String storage = SelectDatabase.getStorage().toString();
|
||||
Map<String, Integer> entry = new HashMap<>();
|
||||
entry.put(storage, 1); map.put(storage, entry);
|
||||
return map;
|
||||
}));
|
||||
}
|
||||
|
||||
private final Plugin plugin;
|
||||
|
@@ -0,0 +1,56 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
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
|
||||
public String getIdentifier() {
|
||||
return "commandgui";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
return Main.plugin.getDescription().getAuthors().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return Main.plugin.getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean persist() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onPlaceholderRequest(Player p, String params) {
|
||||
if (params.contains("useitem_boolean")) {
|
||||
Placeholder.useitem_boolean(p);
|
||||
}
|
||||
|
||||
if (params.contains("useitem")) {
|
||||
Placeholder.useitem(p);
|
||||
}
|
||||
|
||||
if (params.contains("slot")) {
|
||||
Placeholder.slot(p);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
|
||||
import net.t2code.lib.Spigot.Lib.register.Register;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class Permissions {
|
||||
private static final Plugin plugin = Main.plugin;
|
||||
|
||||
public static final String key = "commandgui.";
|
||||
public static final String command = key + "command";
|
||||
public static final String info = key + "command.info";
|
||||
public static final String bypass = key + "bypass";
|
||||
public static final String useitemToggle = key + "useitem.toggle";
|
||||
public static final String useitem = key + "useitem";
|
||||
public static final String getGuiItemAtLogin = key + "get.guiitem.at.login";
|
||||
public static final String updatemsg = key + "updatemsgupdatemsg";
|
||||
|
||||
public static final String player = key + "player";
|
||||
public static final String admin = key + "admin";
|
||||
|
||||
public static final PermissionDefault op = PermissionDefault.OP;
|
||||
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
||||
|
||||
public static void onPermRegister() {
|
||||
Register.permission(command, op, plugin);
|
||||
Register.permissionDescription(command, "Required permission to open GUIs via command", plugin);
|
||||
|
||||
Register.permission(getGuiItemAtLogin, op, plugin);
|
||||
Register.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
|
||||
|
||||
Register.permission(useitem, op, plugin);
|
||||
Register.permissionDescription(useitem, "Required permission to use the GUI Item", plugin);
|
||||
|
||||
Register.permission(useitemToggle, op, plugin);
|
||||
Register.permissionDescription(useitemToggle, "Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)", plugin);
|
||||
|
||||
Register.permission(updatemsg, op, plugin);
|
||||
Register.permissionDescription(updatemsg, "Players with this permission get the update message when joining if an update is available", plugin);
|
||||
|
||||
Register.permission(bypass, op, plugin);
|
||||
Register.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
|
||||
|
||||
Register.permission(info, notOp, plugin);
|
||||
Register.permissionDescription(info, "Permission to view 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.permission(admin, op, command, true, plugin);
|
||||
Register.permission(admin, op, getGuiItemAtLogin, 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);
|
||||
|
||||
|
||||
for (Gui gui : Main.guiHashMap.values()) {
|
||||
Register.permission("commandgui.command." + gui.key, op, plugin);
|
||||
Register.permission(admin, op, "commandgui.command." + gui.key, true, plugin);
|
||||
for (Slot slot : gui.slots) {
|
||||
Register.permission(slot.permissionToUse, op, plugin);
|
||||
Register.permission(admin, op, slot.permissionToUse, true, plugin);
|
||||
Register.permission(slot.permissionToSee, op, plugin);
|
||||
Register.permission(admin, op, slot.permissionToSee, true, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,56 +1,38 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
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;
|
||||
|
||||
public class Placeholder extends PlaceholderExpansion {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "commandgui";
|
||||
public class Placeholder {
|
||||
public static String useitem(Player p) {
|
||||
if (Events.useItemHashMap.get(p.getName())) {
|
||||
return SelectConfig.placeholderTrue;
|
||||
} else return SelectConfig.placeholderFalse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
return Main.plugin.getDescription().getAuthors().toString();
|
||||
public static String useitem_boolean(Player p) {
|
||||
return Events.useItemHashMap.get(p.getName()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return Main.plugin.getDescription().getVersion();
|
||||
public static String slot(Player p) {
|
||||
return Events.useItemSlotHashMap.get(p.getName()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRegister() {
|
||||
return true;
|
||||
public static String replace(String input, Player player) {
|
||||
return input.replace("[player]", player.getName()).replace("%commandgui_useitem%", useitem(player))
|
||||
.replace("%commandgui_useitem_boolean%", useitem_boolean(player)).replace("%commandgui_useitem_slot%", slot(player));
|
||||
}
|
||||
public static List<String> replace(List<String> input, Player player) {
|
||||
ArrayList<String> rp = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
public boolean persist() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onPlaceholderRequest(Player p, String params) {
|
||||
if (params.contains("useitem_boolean")) {
|
||||
return Events.useItemHashMap.get(p).toString();
|
||||
for (String s : input) {
|
||||
rp.add(s.replace("[player]", player.getName()).replace("%commandgui_useitem%", useitem(player))
|
||||
.replace("%commandgui_useitem_boolean%", useitem_boolean(player)).replace("%commandgui_useitem_slot%", slot(player)));
|
||||
}
|
||||
|
||||
if (params.contains("useitem")) {
|
||||
if (Events.useItemHashMap.get(p)) {
|
||||
return SelectConfig.placeholderTrue;
|
||||
} else return SelectConfig.placeholderFalse;
|
||||
}
|
||||
|
||||
if (params.contains("slot")){
|
||||
return Events.useItemSlotHashMap.get(p).toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
return rp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,26 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
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.objects.slots.Slot;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
||||
public class RegisterPermissions {
|
||||
public static void onPermRegister() {
|
||||
for (Gui gui : Main.guiHashMap.values()) {
|
||||
if (Bukkit.getPluginManager().getPermission("commandgui.command." + gui.Command_Command) == null) {
|
||||
Bukkit.getPluginManager().addPermission(new Permission("commandgui.command." + gui.Command_Command));
|
||||
}
|
||||
for (Slot slot : gui.slots) {
|
||||
if (Bukkit.getPluginManager().getPermission(slot.permissionToUse) == null) {
|
||||
Bukkit.getPluginManager().addPermission(new Permission(slot.permissionToUse));
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission(slot.permissionToSee) == null) {
|
||||
Bukkit.getPluginManager().addPermission(new Permission(slot.permissionToSee));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,7 +5,7 @@ import com.mojang.authlib.properties.Property;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
@@ -20,29 +20,27 @@ import org.bukkit.inventory.meta.SkullMeta;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Give_UseItem {
|
||||
public class UseItem {
|
||||
|
||||
|
||||
public static void onGive(Player player) {
|
||||
public static void giveUseItem(Player player) {
|
||||
Integer slot;
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce){
|
||||
if (protection(player, false)) return;
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
if (Events.useItemSlotHashMap.get(player)== null) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player);
|
||||
}
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
if (SelectConfig.UseItem_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.plugin, "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
|
||||
player.getInventory().setItem(slot - 1, itemStack(player));
|
||||
}
|
||||
}
|
||||
|
||||
public static void onGiveADD(Player player) {
|
||||
public static void addUseItem(Player player) {
|
||||
if (protection(player, false)) return;
|
||||
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
|
||||
player.getInventory().addItem(itemStack(player));
|
||||
} else player.getInventory().addItem(itemStack(player));
|
||||
@@ -96,4 +94,52 @@ public class Give_UseItem {
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public static boolean protection(Player player, Boolean interact) {
|
||||
if (SelectConfig.UseItemGameModeProtection) {
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
|
||||
if (interact) {
|
||||
send.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
} else if (!SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
|
||||
if (interact) {
|
||||
send.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||
} else if (!SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (SelectConfig.UseItemWorldProtection) {
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
|
||||
if (interact) {
|
||||
send.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
} else if (!SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
|
||||
if (interact) {
|
||||
send.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||
} else if (!SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled) removeItem(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void removeItem(Player player) {
|
||||
send.debug(Main.plugin, "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)) {
|
||||
player.getInventory().remove(itm);
|
||||
player.updateInventory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,7 +3,9 @@ package de.jatitv.commandguiv2.Spigot.system.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 net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.sql.*;
|
||||
import java.time.ZoneId;
|
||||
@@ -35,42 +37,44 @@ public class MySQL {
|
||||
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(Main.prefix + " §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.console(Main.prefix + " §4MYSQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
send.error(Main.plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
if (SelectConfig.Debug || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
|
||||
try {
|
||||
send.error(Main.plugin, "MySQL DEBUG:");
|
||||
Connection con = ds.getConnection();
|
||||
DatabaseMetaData dbmd = con.getMetaData();
|
||||
send.debugmsg(Main.plugin, "§6Metadata of the database:");
|
||||
send.debugmsg(Main.plugin, "§6DB: §e" + dbmd.getDatabaseProductName());
|
||||
send.debugmsg(Main.plugin, "§6Version: §e" + dbmd.getDatabaseProductVersion());
|
||||
send.debugmsg(Main.plugin, "§6Driver: §e" + dbmd.getDriverName());
|
||||
send.debugmsg(Main.plugin, "§6Driver MajorVersion: §e" + dbmd.getDriverMajorVersion() + "." + dbmd.getDriverMinorVersion());
|
||||
send.debugmsg(Main.plugin, "§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) {
|
||||
|
||||
if (ds == null){
|
||||
public static void query(String query) throws SQLException {
|
||||
if (ds == null) {
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin, query);
|
||||
try (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());
|
||||
}
|
||||
Connection con = ds.getConnection();
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute(query);
|
||||
stmt.close();
|
||||
con.close();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,135 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class SQLITE {
|
||||
protected static String url;
|
||||
private static Connection con;
|
||||
|
||||
public static void main() throws SQLException {
|
||||
long long_ = System.currentTimeMillis();
|
||||
File directory = new File(Main.getPath() + "/Storage");
|
||||
if (!directory.exists()) {
|
||||
directory.mkdir();
|
||||
}
|
||||
url = "jdbc:sqlite:" + Main.plugin.getDataFolder() + "/Storage/data.db";
|
||||
con = DriverManager.getConnection(url);
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2SQLITE successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
DatabaseMetaData dbmd = con.getMetaData();
|
||||
}
|
||||
|
||||
public static void query(String query) {
|
||||
|
||||
send.debug(Main.plugin, query);
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute(query);
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void query(ArrayList<String> queryList) {
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
for (String query : queryList) {
|
||||
send.debug(Main.plugin, query);
|
||||
stmt.addBatch(query);
|
||||
}
|
||||
stmt.executeBatch();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
ArrayList<String> columnList = new ArrayList<>();
|
||||
for (int i = 1; i <= columns; i++) {
|
||||
columnList.add(rs.getString(i));
|
||||
}
|
||||
Result.put(rs.getString(1), columnList);
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static String select(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
String Ausgabe = "";
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
Ausgabe = String.valueOf(rs.getString(1));
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Ausgabe;
|
||||
}
|
||||
|
||||
public static int count(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
int count = 0;
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static ArrayList<String> selectRow(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
ArrayList<String> Result = new ArrayList<>();
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
for (int i = 1; i <= columns; i++) {
|
||||
Result.add(rs.getString(i));
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static void close() throws SQLException {
|
||||
if (con != null) con.close();
|
||||
}
|
||||
}
|
@@ -0,0 +1,153 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Load;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class SelectDatabase {
|
||||
|
||||
private static StorageType Storage;
|
||||
|
||||
public static StorageType getStorage() {
|
||||
return Storage;
|
||||
}
|
||||
|
||||
public static void setStorage(StorageType storage) {
|
||||
Storage = storage;
|
||||
}
|
||||
|
||||
public static void nameCheck(Player player) {
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
try {
|
||||
MySQL.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
|
||||
} catch (SQLException e) {
|
||||
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
|
||||
break;
|
||||
case SQLITE:
|
||||
default:
|
||||
SQLITE.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setSlot(Player player, Integer slot) {
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
try {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Slot`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "','" + slot + "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Slot` = '" + slot + "';");
|
||||
} catch (SQLException e) {
|
||||
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
YML.setGuiitemSlot(player, slot);
|
||||
break;
|
||||
case SQLITE:
|
||||
default:
|
||||
SQLITE.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Slot`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "','" + slot + "') ON CONFLICT(UUID) DO UPDATE SET `Name` = '" + player.getName() + "', `Slot` = '" + slot + "';");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setItemStatusTrue(Player player) {
|
||||
Events.useItemHashMap.replace(player.getName(), true);
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
try {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '1';");
|
||||
} catch (SQLException e) {
|
||||
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
YML.setGuiitemOn(player);
|
||||
break;
|
||||
case SQLITE:
|
||||
default:
|
||||
SQLITE.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "') ON CONFLICT(UUID) DO UPDATE SET `Name` = '" + player.getName() + "', `Status` = '1';");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setItemStatusFalse(Player player) {
|
||||
Events.useItemHashMap.replace(player.getName(), false);
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
try {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', '0') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '0';");
|
||||
} catch (SQLException e) {
|
||||
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YML:
|
||||
YML.setGuiitemOff(player);
|
||||
break;
|
||||
case SQLITE:
|
||||
default:
|
||||
SQLITE.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', '0') ON CONFLICT(UUID) DO UPDATE SET `Name` = '" + player.getName() + "', `Status` = '0';");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean selectItemStatus(Player player) {
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
String result = MySQL.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||
if (result == null || result.equals("")) {
|
||||
return true;
|
||||
}
|
||||
return result.equals("1");
|
||||
case YML:
|
||||
return YML.selectGuiitemOn(player);
|
||||
case SQLITE:
|
||||
default:
|
||||
String result2 = SQLITE.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||
if (result2 == null || result2.equals("")) {
|
||||
return true;
|
||||
}
|
||||
return result2.equals("1");
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer selectSlot(Player player) {
|
||||
switch (Storage) {
|
||||
case MYSQL:
|
||||
String result = MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||
if (result == null || result.equals("") || result.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
return Integer.parseInt(result);
|
||||
case YML:
|
||||
return YML.selectSlot(player);
|
||||
case SQLITE:
|
||||
default:
|
||||
String result2 = SQLITE.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||
if (result2 == null || result2.equals("") || result2.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
return Integer.parseInt(result2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Select_Database {
|
||||
|
||||
public static void nameCheck(Player player) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setSlot(Player player, Integer slot) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Slot`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "','" + slot + "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Slot` = '" + slot + "';");
|
||||
} else {
|
||||
YML.setGuiitemSlot(player, slot);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setItemStatusTrue(Player player) {
|
||||
Events.useItemHashMap.replace(player, true);
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '1';");
|
||||
} else {
|
||||
YML.setGuiitemOn(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setItemStatusFalse(Player player) {
|
||||
Events.useItemHashMap.replace(player, false);
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', '0') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '0';");
|
||||
} else {
|
||||
YML.setGuiitemOff(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean selectItemStatus(Player player) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
if (MySQL.count("SELECT * FROM `gui-item` WHERE BINARY UUID='" + player.getUniqueId() + "'") > 0) {
|
||||
if (MySQL.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';").equals("1")) {
|
||||
return true;
|
||||
} else return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return YML.selectGuiitemOn(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer selectSlot(Player player) {
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
if (MySQL.count("SELECT * FROM `gui-item` WHERE BINARY UUID='" + player.getUniqueId() + "'") > 0) {
|
||||
if (MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';") != "null") {
|
||||
return Integer.valueOf(MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';"));
|
||||
} else return null;
|
||||
} else return null;
|
||||
|
||||
} else {
|
||||
return YML.selectSlot(player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
|
||||
public enum StorageType {
|
||||
MYSQL,
|
||||
SQLITE,
|
||||
YML
|
||||
}
|
@@ -1,6 +1,8 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -45,6 +47,7 @@ public class YML {
|
||||
try {
|
||||
yamlConfigurationStorage.save(storage);
|
||||
} catch (IOException e) {
|
||||
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,10 @@
|
||||
package de.jatitv.commandguiv2;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
|
||||
public class Util {
|
||||
private static Integer configVersion = 5;
|
||||
private static double requiredT2CodeLibVersion = 10.3;
|
||||
private static double requiredT2CodeLibVersion = 11.9;
|
||||
private static String Prefix = "§8[§4C§9GUI§8]";
|
||||
private static Integer SpigotID = 90671;
|
||||
private static Integer BstatsID = 10840;
|
||||
|
@@ -8,7 +8,8 @@ import de.jatitv.commandguiv2.Spigot.cmdManagement.Help;
|
||||
import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Permissions;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -43,21 +44,21 @@ public class CGuiAPI {
|
||||
}
|
||||
|
||||
public static Boolean selectPlayerItemEnable(Player player) {
|
||||
return Events.useItemHashMap.get(player);
|
||||
return Events.useItemHashMap.get(player.getName());
|
||||
}
|
||||
|
||||
public static Integer selectPlayerItemSlot(Player player) {
|
||||
return Events.useItemSlotHashMap.get(player);
|
||||
return Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
|
||||
public static void setPlayerItemEnable(Player player, Boolean value) {
|
||||
if (value) {
|
||||
Select_Database.setItemStatusTrue(player);
|
||||
} else Select_Database.setItemStatusFalse(player);
|
||||
SelectDatabase.setItemStatusTrue(player);
|
||||
} else SelectDatabase.setItemStatusFalse(player);
|
||||
}
|
||||
|
||||
public static void setPlayerItemSlot(Player player, Integer value) {
|
||||
Select_Database.setSlot(player, value);
|
||||
SelectDatabase.setSlot(player, value);
|
||||
}
|
||||
|
||||
public static void openDefaultGUI(Player player) {
|
||||
@@ -73,26 +74,24 @@ public class CGuiAPI {
|
||||
}
|
||||
|
||||
public static void sendPluginInfo(CommandSender sender) {
|
||||
if (sender.hasPermission("commandgui.command.info")) {
|
||||
if (sender.hasPermission(Permissions.info)) {
|
||||
Commands.info(sender);
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.command.info"));
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.info));
|
||||
}
|
||||
|
||||
public static void createDefaultGUI(CommandSender sender) {
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
if (sender.hasPermission(Permissions.admin)) {
|
||||
CreateGUI.configCreate();
|
||||
sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
|
||||
}
|
||||
|
||||
public static void reload(CommandSender sender) {
|
||||
if (sender.hasPermission("commandgui.admin")) {
|
||||
if (sender.hasPermission(Permissions.admin)) {
|
||||
Commands.reload(sender);
|
||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -19,56 +19,5 @@ commands:
|
||||
commandguihelp:
|
||||
description: CommandGUI Help
|
||||
aliases: [cguihelp, guihelp]
|
||||
# commandguiadmin:
|
||||
# aliases: [cguiadmin, cguia]
|
||||
commandgui-item:
|
||||
aliases: [gui-item]
|
||||
|
||||
|
||||
permissions:
|
||||
commandgui.admin:
|
||||
description: All permissions from CommandGUI
|
||||
default: op
|
||||
children:
|
||||
commandgui.updatemsg: true
|
||||
commandgui.command: true
|
||||
commandgui.get.guiitem.at.login: true
|
||||
commandgui.useitem: true
|
||||
commandgui.useitem.toggle: true
|
||||
commandgui.bypass: true
|
||||
commandgui.command.info: true
|
||||
commandgui.command.give: true
|
||||
|
||||
commandgui.player:
|
||||
description: All permissions from CommandGUI
|
||||
default: op
|
||||
children:
|
||||
commandgui.command: true
|
||||
commandgui.get.guiitem.at.login: true
|
||||
commandgui.useitem: true
|
||||
commandgui.useitem.toggle: true
|
||||
|
||||
commandgui.updatemsg:
|
||||
description: Players with this permission get the update message when joining if an update is available
|
||||
default: op
|
||||
commandgui.command:
|
||||
description: Required permission to open GUIs via command
|
||||
default: op
|
||||
commandgui.get.guiitem.at.login:
|
||||
description: Only players with this permission will receive the GUI item
|
||||
default: op
|
||||
commandgui.useitem:
|
||||
description: Required permission to use the GUI Item
|
||||
default: op
|
||||
commandgui.useitem.toggle:
|
||||
description: Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)
|
||||
default: op
|
||||
commandgui.bypass:
|
||||
description: Bypass to open disabled GUIs
|
||||
default: op
|
||||
commandgui.command.info:
|
||||
description: Permission to view CommandGUI info
|
||||
default: not op
|
||||
commandgui.command.give:
|
||||
description: Kommend in V2.1.0
|
||||
default: op
|
||||
aliases: [gui-item]
|
@@ -1,19 +1,8 @@
|
||||
GUI:
|
||||
Enable: true
|
||||
Lines: 1
|
||||
Name: '&5default &9GUI'
|
||||
FillItem:
|
||||
Enable: true
|
||||
Item: BLACK_STAINED_GLASS_PANE
|
||||
Command:
|
||||
Alias: true
|
||||
Permission:
|
||||
Required: true
|
||||
Slots:
|
||||
Example:
|
||||
Slot: 5
|
||||
Enable: true
|
||||
Function:
|
||||
Item:
|
||||
Empty: false
|
||||
Amount: 1
|
||||
PlayerHead:
|
||||
Enable: true
|
||||
Base64:
|
||||
@@ -31,9 +20,10 @@ Slots:
|
||||
- '&eIf you find any errors or bugs,'
|
||||
- '&eplease contact me so I can fix them.'
|
||||
- '&8-----------------'
|
||||
- '&5Discord: §7https://discord.gg/vRyXFFterJ'
|
||||
- '&5Discord: §7http://dc.t2code.net'
|
||||
CustomSound:
|
||||
Enable: false
|
||||
NoSound: false
|
||||
Sound: ''
|
||||
Cost:
|
||||
Enable: false
|
||||
@@ -42,17 +32,43 @@ Slots:
|
||||
Enable: false
|
||||
BungeeCommand: false
|
||||
CommandAsConsole: false
|
||||
Command:
|
||||
- ''
|
||||
Command: []
|
||||
ServerChange:
|
||||
Enable: false
|
||||
Server: ''
|
||||
OpenGUI:
|
||||
Enable: false
|
||||
GUI: ''
|
||||
Toggle:
|
||||
Permission:
|
||||
Enable: false
|
||||
Permission: ''
|
||||
UseItem:
|
||||
Enable: false
|
||||
Message:
|
||||
Enable: true
|
||||
Message:
|
||||
- '&6You can find more information on Discord: &ehttps://discord.gg/vRyXFFterJ'
|
||||
Permission:
|
||||
Required: false
|
||||
- '&6You can find more information on Discord: &ehttp://dc.t2code.net'
|
||||
SetConfig:
|
||||
Enable: false
|
||||
File:
|
||||
Path: ''
|
||||
Option:
|
||||
Path: ''
|
||||
Premat: String
|
||||
Value:
|
||||
LeftClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
RightClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
PluginReload:
|
||||
Enable: false
|
||||
Command: ''
|
67
Defaultconfig/Functions/UseItem.yml
Normal file
67
Defaultconfig/Functions/UseItem.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
Slots:
|
||||
Function:
|
||||
Item:
|
||||
Empty: false
|
||||
Amount: 1
|
||||
PlayerHead:
|
||||
Enable: false
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
PlayerWhoHasOpenedTheGUI: false
|
||||
PlayerName: ''
|
||||
Material: ''
|
||||
Name: '&6Toggle UseItem'
|
||||
Lore:
|
||||
- '&bYou currently have the UseItem set to: %commandgui_useitem%'
|
||||
CustomSound:
|
||||
Enable: false
|
||||
NoSound: false
|
||||
Sound: ''
|
||||
Cost:
|
||||
Enable: false
|
||||
Price: 0.0
|
||||
Command:
|
||||
Enable: false
|
||||
BungeeCommand: false
|
||||
CommandAsConsole: false
|
||||
Command: []
|
||||
ServerChange:
|
||||
Enable: false
|
||||
Server: ''
|
||||
OpenGUI:
|
||||
Enable: false
|
||||
GUI: ''
|
||||
Toggle:
|
||||
Permission:
|
||||
Enable: false
|
||||
Permission: ''
|
||||
UseItem:
|
||||
Enable: true
|
||||
Message:
|
||||
Enable: true
|
||||
Message:
|
||||
- '&bYour UseItem was set to: %commandgui_useitem%&b.'
|
||||
SetConfig:
|
||||
Enable: false
|
||||
File:
|
||||
Path: ''
|
||||
Option:
|
||||
Path: ''
|
||||
Premat: String
|
||||
Value:
|
||||
LeftClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
RightClick:
|
||||
String: ''
|
||||
Boolean: false
|
||||
Integer: 0
|
||||
Double: 0.0
|
||||
List: []
|
||||
PluginReload:
|
||||
Enable: false
|
||||
Command: ''
|
28
Defaultconfig/GUIs/default.yml
Normal file
28
Defaultconfig/GUIs/default.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
GUI:
|
||||
Enable: true
|
||||
Lines: 1
|
||||
Name: '&5default &9GUI'
|
||||
FillItem:
|
||||
Enable: true
|
||||
Item: BLACK_STAINED_GLASS_PANE
|
||||
Command:
|
||||
Alias: true
|
||||
Permission:
|
||||
Required: true
|
||||
Slots:
|
||||
SupportDiscord:
|
||||
Slot: 4
|
||||
Enable: true
|
||||
Function: SupportDiscord
|
||||
Permission:
|
||||
Required: false
|
||||
See: commandgui.gui.[guiname].slot.[slot].see
|
||||
Use: commandgui.gui.[guiname].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
|
@@ -1,3 +1,4 @@
|
||||
ConfigVersion: 5
|
||||
Plugin:
|
||||
UpdateCheckOnJoin: true
|
||||
Debug: false
|
||||
@@ -25,6 +26,7 @@ UseItem:
|
||||
OpenGUI: default
|
||||
Permission:
|
||||
NeededToUse: true
|
||||
KeepAtCommandClear: true
|
||||
InventorySlot:
|
||||
Slot: 1
|
||||
SlotEnforce: false
|
||||
@@ -46,9 +48,57 @@ UseItem:
|
||||
GiveOnlyOnFirstJoin: false
|
||||
Cursor:
|
||||
ToGUIItem:
|
||||
OnEveryLogin: true
|
||||
OnOnlyFirstLogin: true
|
||||
EXPERIMENTELL_ServerChhange: false
|
||||
OnLogin:
|
||||
Enable: true
|
||||
Spigot:
|
||||
OnOnlyFirstLogin: true
|
||||
Bungee:
|
||||
OnServerChange: false
|
||||
Advanced:
|
||||
UseItem:
|
||||
GameMode:
|
||||
Change:
|
||||
Enable: true
|
||||
DelayInTicks: 1
|
||||
Protection:
|
||||
Enable: false
|
||||
RemoveItemWhenItIsDisabled: false
|
||||
Mode: blacklist
|
||||
List:
|
||||
- CREATIVE
|
||||
- Spectator
|
||||
World:
|
||||
Change:
|
||||
Enable: true
|
||||
DelayInTicks: 1
|
||||
Protection:
|
||||
Enable: false
|
||||
RemoveItemWhenItIsDisabled: false
|
||||
Mode: blacklist
|
||||
List:
|
||||
- World1
|
||||
- World2
|
||||
Toggle:
|
||||
Items:
|
||||
OnOrYes:
|
||||
Item:
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
Material: GREEN_WOOL
|
||||
OffOrNo:
|
||||
Item:
|
||||
Base64:
|
||||
Enable: false
|
||||
Base64Value: ''
|
||||
Material: RED_WOOL
|
||||
Permission:
|
||||
Commands:
|
||||
'True': luckperms user [player] permission set [perm] true
|
||||
'False': luckperms user [player] permission set [perm] false
|
||||
Placeholder:
|
||||
'True': '&2true'
|
||||
'False': '&4false'
|
||||
Sound:
|
||||
Enable: true
|
||||
OpenInventory:
|
@@ -4,13 +4,11 @@ Plugin:
|
||||
settings.'
|
||||
OnlyForPlayer: '[prefix] &cThis command is for players only!'
|
||||
DefaultGUI:
|
||||
create: '[prefix] &2DefaultGUI was created. You can find it in the directory::
|
||||
create: '[prefix] &2DefaultGUI was created. You can find it in the directory:
|
||||
&e[directory]&2!'
|
||||
Reload:
|
||||
Start: '[prefix] &6Plugin is reloaded...'
|
||||
End: '[prefix] &2Plugin was successfully reloaded.'
|
||||
Warning: '[prefix] &6To enable / disable alias commands, reload / restart the
|
||||
server!'
|
||||
NoPermission:
|
||||
ForCommandGUI: '[prefix] &cYou do not have permission for &4Command&9GUI&c!'
|
||||
ForCommand: '[prefix] &cFor &b[cmd] &cyou lack the permission &6[perm]&c!'
|
||||
@@ -24,6 +22,8 @@ UseItem:
|
||||
SlotNotEmpty: '[prefix] &6The slot &e[slot] &6is currently occupied!'
|
||||
SlotAlreadySet: '[prefix] &6The slot §e[slot] §6is already set!'
|
||||
ItemSlot_wrongValue: '[prefix] &cThe specified slot must be between 1 and 9!'
|
||||
DisabledInGameMode: '[prefix] &cThe UseItem is disabled in this GameMode!'
|
||||
DisabledInWorld: '[prefix] &cThe UseItem is disabled in this World!'
|
||||
Cost:
|
||||
Buy_msg: '[prefix] &2You bought [itemname] &2for &6[price]&2.'
|
||||
No_money: '[prefix] &cYou don''t have enough money!'
|
||||
@@ -42,12 +42,13 @@ Player:
|
||||
Help:
|
||||
CGUI: '&8''''&b/commandgui &8| &b/cgui&8'''' &eOpen the default GUI &7(&r[gui]&7)&e.'
|
||||
Help: '&8''''&b/commandguihelp&8'''' &eOpen this help.'
|
||||
Info: '&8''''&b/commandguiadmin info&8'''' &eCall the info from &4Command&9GUI &e.'
|
||||
Info: '&8''''&b/commandgui admin info&8'''' &eCall the info from &4Command&9GUI
|
||||
&e.'
|
||||
Open: '&8''''&b/commandgui [gui]&8'''' &eOpen the GUI: &6[guiname]&e.'
|
||||
Give: '&8''''&b/commandguiadmin give &7<player>&8'''' &eGive a player the GUI item.'
|
||||
CreateDefaultGUI: '&8''''&b/commandguiadmin createdefaultgui&8'''' &eCreate a default
|
||||
Give: '&8''''&b/commandgui admin give &7<player>&8'''' &eGive a player the GUI item.'
|
||||
CreateDefaultGUI: '&8''''&b/commandgui admin createdefaultgui&8'''' &eCreate a default
|
||||
GUI &7([directory])&e.'
|
||||
Reload: '&8''''&b/commandguiadmin reload&8'''' &eReload the plugin.'
|
||||
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
|
@@ -8,8 +8,6 @@ Plugin:
|
||||
Reload:
|
||||
Start: '[prefix] &6Plugin wird neu geladen...'
|
||||
End: '[prefix] &2Plugin wurde erfolgreich neu geladen.'
|
||||
Warning: '[prefix] &6Um Alias-Befehle zu aktivieren / deaktivieren, lade / starte
|
||||
den Server neu!!'
|
||||
NoPermission:
|
||||
ForCommandGUI: '[prefix] &cDu hast keine Permission f[ue]r &4Command&9GUI&c!'
|
||||
ForCommand: '[prefix] &cF[ue]r &b[cmd] &cfehlt dir die Permission &6[perm]&c!'
|
||||
@@ -24,6 +22,8 @@ UseItem:
|
||||
SlotAlreadySet: '[prefix] &6Der Slot §e[slot] §6ist bereits eingestellt!'
|
||||
ItemSlot_wrongValue: '[prefix] &cDer angegebene Slot muss sich zwischen 1 und 9
|
||||
befinden!'
|
||||
DisabledInGameMode: '[prefix] &cDas UseItem ist in diesem GameMode deaktiviert!'
|
||||
DisabledInWorld: '[prefix] &cDas UseItem ist in dieser Welt deaktiviert!'
|
||||
Cost:
|
||||
Buy_msg: '[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft.'
|
||||
No_money: '[prefix] &cDu hast nicht gen[ue]gend Geld!'
|
||||
@@ -44,12 +44,14 @@ Player:
|
||||
Help:
|
||||
CGUI: '&8''''&b/commandgui &8| &b/cgui&8'''' &e[OE]ffne die default GUI &7(&r[gui]&7)&e.'
|
||||
Help: '&8''''&b/commandguihelp&8'''' &e[OE]ffne diese help.'
|
||||
Info: '&8''''&b/commandguiadmin info&8'''' &eRufe die Infos von &4Command&9GUI &eauf.'
|
||||
Info: '&8''''&b/commandgui admin info&8'''' &eRufe die Infos von &4Command&9GUI
|
||||
&eauf.'
|
||||
Open: '&8''''&b/commandgui [gui]&8'''' &e[OE]ffne die GUI: &6[guiname]&e.'
|
||||
Give: '&8''''&b/commandguiadmin give &7<player>&8'''' &eGebe einem Spieler das GUI-Item.'
|
||||
CreateDefaultGUI: '&8''''&b/commandguiadmin createdefaultgui&8'''' &eLasse eine
|
||||
Give: '&8''''&b/commandgui admin give &7<player>&8'''' &eGebe einem Spieler das
|
||||
GUI-Item.'
|
||||
CreateDefaultGUI: '&8''''&b/commandgui admin createdefaultgui&8'''' &eLasse eine
|
||||
default GUI erstellen &7([directory])&e.'
|
||||
Reload: '&8''''&b/commandguiadmin reload&8'''' &eLade das Plugin neu.'
|
||||
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
|
@@ -8,8 +8,6 @@ Plugin:
|
||||
Reload:
|
||||
Start: '[prefix] &6Pluginet blir relastet...'
|
||||
End: '[prefix] &2Pluginet har blitt lastet inn på nytt.'
|
||||
Warning: '[prefix] &6For å skru på / skru av alias kommandoer, relast / restart
|
||||
serveren!'
|
||||
NoPermission:
|
||||
ForCommandGUI: '[prefix] &cDu har ikke tilgang til &4Command&9GUI&c!'
|
||||
ForCommand: '[prefix] &cFor &b[cmd] &cmangler du tillatelsen &6[perm]&c!'
|
||||
@@ -23,6 +21,8 @@ UseItem:
|
||||
SlotNotEmpty: '[prefix] &6Plassen &e[slot] &6er opptatt for øyeblikket!'
|
||||
SlotAlreadySet: '[prefix] &6Plassen §e[slot] §6er allerede satt!'
|
||||
ItemSlot_wrongValue: '[prefix] &cDen spesifiserte plassen må være mellom 1 og 9!'
|
||||
DisabledInGameMode: '[prefix] &cBrukselementet er deaktivert i denne spillmodusen!!'
|
||||
DisabledInWorld: '[prefix] &cUseItem er deaktivert i denne verden!'
|
||||
Cost:
|
||||
Buy_msg: '[prefix] &2Du kjøpte [itemname] &2for &6[price]&2.'
|
||||
No_money: '[prefix] &cDu har ikke nok penger!'
|
||||
@@ -42,12 +42,12 @@ Player:
|
||||
Help:
|
||||
CGUI: '&8''''&b/commandgui &8| &b/cgui&8'''' &eÅpne default GUIen &7(&r[gui]&7)&e.'
|
||||
Help: '&8''''&b/commandguihelp&8'''' &eSender denne hjelpe meldingen.'
|
||||
Info: '&8''''&b/commandguiadmin info&8'''' &eKall informasjon fra &4Command&9GUI&e.'
|
||||
Info: '&8''''&b/commandgui admin info&8'''' &eKall informasjon fra &4Command&9GUI&e.'
|
||||
Open: '&8''''&b/commandgui [gui]&8'''' &eÅpne GUIen: &6[guiname]&e.'
|
||||
Give: '&8''''&b/commandguiadmin give &7<player>&8'''' &eGi en spiller GUI gjenstanden.'
|
||||
CreateDefaultGUI: '&8''''&b/commandguiadmin createdefaultgui&8'''' &eLag en normalverdi
|
||||
Give: '&8''''&b/commandgui admin give &7<player>&8'''' &eGi en spiller GUI gjenstanden.'
|
||||
CreateDefaultGUI: '&8''''&b/commandgui admin createdefaultgui&8'''' &eLag en normalverdi
|
||||
GUI &7([directory])&e.'
|
||||
Reload: '&8''''&b/commandguiadmin reload&8'''' &eLast inn pluginet på nytt.'
|
||||
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
|
Reference in New Issue
Block a user