7 Commits

17 changed files with 180 additions and 106 deletions

View File

@@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId> <artifactId>CommandGUI_V2</artifactId>
<version>2.5.18</version> <version>2.5.20</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>CommandGUI</name> <name>CommandGUI</name>

View File

@@ -1,56 +1,39 @@
package de.jatitv.commandguiv2.Bungee; package de.jatitv.commandguiv2.Bungee;
import de.jatitv.commandguiv2.Util;
import net.md_5.bungee.config.Configuration; import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider; import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration; import net.md_5.bungee.config.YamlConfiguration;
import net.t2code.lib.Bungee.Lib.messages.Bsend;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
public class BConfig { public class BConfig {
public static void create() { public static void create() throws IOException {
File config = new File(BMain.plugin.getDataFolder(), "config.yml");
if (!BMain.plugin.getDataFolder().exists()) if (!BMain.plugin.getDataFolder().exists()) BMain.plugin.getDataFolder().mkdir();
BMain.plugin.getDataFolder().mkdir(); if (!config.exists()) {
config.createNewFile();
File file = new File(BMain.plugin.getDataFolder(), "config.yml");
if (!file.exists()) {
try (InputStream in = BMain.plugin.getResourceAsStream("config.yml")) {
Files.copy(in, file.toPath());
} catch (IOException e) {
e.printStackTrace();
}
} }
Configuration configuration = 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);
Configuration configuration;
try {
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(BMain.plugin.getDataFolder(), "config.yml"));
BMySQL.Enable = configuration.getBoolean("MySQL.Enable"); BMySQL.Enable = configuration.getBoolean("MySQL.Enable");
} catch (IOException e) {
Bsend.console(Util.getSpigot() + " Please replace the config: MySQL.Enable: [false,true]");
e.printStackTrace();
}
try {
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(BMain.plugin.getDataFolder(), "config.yml"));
BMySQL.ip = configuration.getString("MySQL.IP"); BMySQL.ip = configuration.getString("MySQL.IP");
BMySQL.port = configuration.getInt("MySQL.Port"); BMySQL.port = configuration.getInt("MySQL.Port");
BMySQL.database = configuration.getString("MySQL.Database"); BMySQL.database = configuration.getString("MySQL.Database");
BMySQL.user = configuration.getString("MySQL.User"); BMySQL.user = configuration.getString("MySQL.User");
BMySQL.password = configuration.getString("MySQL.Password"); BMySQL.password = configuration.getString("MySQL.Password");
BMySQL.SSL = configuration.getBoolean("MySQL.SSL"); BMySQL.SSL = configuration.getBoolean("MySQL.SSL");
} catch (IOException e) {
e.printStackTrace();
}
} }

View File

@@ -34,20 +34,24 @@ public class BListener implements Listener {
public void onJoin(PostLoginEvent e) { public void onJoin(PostLoginEvent e) {
ProxiedPlayer player = e.getPlayer(); ProxiedPlayer player = e.getPlayer();
sendToSpigotPlayer(player.getName(), true); sendToSpigotPlayer(player.getName(), true);
/*
if (BMySQL.Enable) { if (BMySQL.Enable) {
BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName() BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
+ "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = 'true';"); + "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = 'true';");
} }
*/
} }
@EventHandler @EventHandler
public void onDisconnect(PlayerDisconnectEvent e) { public void onDisconnect(PlayerDisconnectEvent e) {
ProxiedPlayer player = e.getPlayer(); ProxiedPlayer player = e.getPlayer();
sendToSpigotPlayer(e.getPlayer().getName(), false); sendToSpigotPlayer(e.getPlayer().getName(), false);
/*
if (BMySQL.Enable) { if (BMySQL.Enable) {
BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName() BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
+ "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = 'false';"); + "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = 'false';");
} }
*/
} }
@@ -65,7 +69,8 @@ public class BListener implements Listener {
Logger.getLogger(e.getMessage()); Logger.getLogger(e.getMessage());
} }
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> { BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
server.sendData("cgui:onlineplayers", stream.toByteArray());
server.sendData("cgui:onlinepl", stream.toByteArray());
}); });
} }
@@ -79,7 +84,7 @@ public class BListener implements Listener {
Logger.getLogger(e.getMessage()); Logger.getLogger(e.getMessage());
} }
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> { BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
server.sendData("cgui:onlineplayers", stream.toByteArray()); server.sendData("cgui:onlinepl", stream.toByteArray());
}); });
} }
} }

View File

@@ -5,6 +5,7 @@ import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.lib.Bungee.Lib.messages.Bsend; import net.t2code.lib.Bungee.Lib.messages.Bsend;
import java.io.IOException;
import java.util.logging.Level; import java.util.logging.Level;
public final class BMain extends Plugin { public final class BMain extends Plugin {
@@ -41,13 +42,18 @@ public final class BMain extends Plugin {
Bsend.console(prefix + " §2Version: §6" + version); Bsend.console(prefix + " §2Version: §6" + version);
Bsend.console(prefix + " §2Spigot: §6" + spigot); Bsend.console(prefix + " §2Spigot: §6" + spigot);
Bsend.console(prefix + " §2Discord: §6" + discord); Bsend.console(prefix + " §2Discord: §6" + discord);
/* try {
BConfig.create(); BConfig.create();
} catch (IOException e) {
e.printStackTrace();
}
*/
plugin.getProxy().registerChannel("cgui:bungee"); plugin.getProxy().registerChannel("cgui:bungee");
plugin.getProxy().getPluginManager().registerListener(plugin, new BListener()); plugin.getProxy().getPluginManager().registerListener(plugin, new BListener());
BListener.sendToSpigotDeleteAll(); BListener.sendToSpigotDeleteAll();
BMetrics metrics = new BMetrics(this, bstatsID); BMetrics metrics = new BMetrics(this, bstatsID);
/*
if (BMySQL.Enable){ if (BMySQL.Enable){
BMySQL.main(); BMySQL.main();
BMySQL.query("CREATE TABLE IF NOT EXISTS `gui-bungeeplayer` (" + BMySQL.query("CREATE TABLE IF NOT EXISTS `gui-bungeeplayer` (" +
@@ -59,8 +65,8 @@ public final class BMain extends Plugin {
"COLLATE='utf8mb4_general_ci'" + "COLLATE='utf8mb4_general_ci'" +
"ENGINE=InnoDB" + "ENGINE=InnoDB" +
";"); ";");
} }
*/
Bsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); Bsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
Bsend.console(prefix + "§4=============================================================================="); Bsend.console(prefix + "§4==============================================================================");

View File

@@ -27,13 +27,12 @@ public class BUpdateChecker {
public static void sendUpdateMsg(String Prefix, String foundVersion, String update_version) { public static void sendUpdateMsg(String Prefix, String foundVersion, String update_version) {
Bsend.console("§4=========== " + Prefix + " §4==========="); Bsend.console("§4=========== " + Prefix + " §4===========");
Bsend.console("§6A new version was found!"); Bsend.console("§6A new version was found!");
Bsend.console("§6Your version: §c" + foundVersion + " §7- §6Current version: §a" + update_version+"_Bungee"); Bsend.console("§6Your version: §c" + foundVersion + " §7- §6Current version: §a" + update_version);
Bsend.console("§6You can download it here: §e" + BMain.spigot); Bsend.console("§6You can download it here: §e" + BMain.spigot);
Bsend.console("§6You can find more information on Discord: §e" + BMain.discord); Bsend.console("§6You can find more information on Discord: §e" + BMain.discord);
Bsend.console("§4=========== " + Prefix + " §4==========="); Bsend.console("§4=========== " + Prefix + " §4===========");
} }
public static void onUpdateCheckTimer() { public static void onUpdateCheckTimer() {
ProxyServer.getInstance().getScheduler().schedule(BMain.plugin, new Runnable() { ProxyServer.getInstance().getScheduler().schedule(BMain.plugin, new Runnable() {
public void run() { public void run() {

View File

@@ -5,6 +5,7 @@ import de.jatitv.commandguiv2.Spigot.system.Give_UseItem;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig; import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database; import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
import net.t2code.lib.Spigot.Lib.items.ItemVersion; import net.t2code.lib.Spigot.Lib.items.ItemVersion;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@@ -28,11 +29,21 @@ public class ItemChange {
} }
if (SelectConfig.UseItemGameModeProtection) { if (SelectConfig.UseItemGameModeProtection) {
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) { if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
removeItem(player); if (SelectConfig.UseItemGameModeRemoveItemWhenItIsDisabled) removeItem(player);
return; return;
} }
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) { if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
removeItem(player); if (SelectConfig.UseItemGameModeRemoveItemWhenItIsDisabled) removeItem(player);
return;
}
}
if (SelectConfig.UseItemWorldProtection) {
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
if (SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled)removeItem(player);
return;
}
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
if (SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled)removeItem(player);
return; return;
} }
} }
@@ -43,6 +54,9 @@ public class ItemChange {
@Override @Override
public void run() { public void run() {
Give_UseItem.onGive(player); Give_UseItem.onGive(player);
if (setCursor) {
setCursor(player, slot);
}
} }
}.runTaskLater(Main.plugin, 1L * 1); }.runTaskLater(Main.plugin, 1L * 1);
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin || SelectConfig.Cursor_ToGUIItem_OnLogin) { if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin || SelectConfig.Cursor_ToGUIItem_OnLogin) {
@@ -84,25 +98,37 @@ public class ItemChange {
} }
private static void setCursor(Player player, int slot) { private static void setCursor(Player player, int slot) {
send.debug(Main.plugin,"setCursor 1 Player: "+player.getName());
if (!SelectConfig.Cursor_ToGUIItem_OnLogin) { if (!SelectConfig.Cursor_ToGUIItem_OnLogin) {
return; return;
} }
send.debug(Main.plugin,"setCursor 2 Player: "+player.getName());
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) { if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {
if (!player.hasPlayedBefore()) { if (!player.hasPlayedBefore()) {
player.getInventory().setHeldItemSlot(slot - 1); player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 3 Player: "+player.getName());
} }
return; return;
} }
send.debug(Main.plugin,"setCursor 4 Player: "+player.getName());
if (!SelectConfig.Bungee) { if (!SelectConfig.Bungee) {
player.getInventory().setHeldItemSlot(slot - 1); player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 5 Player: "+player.getName());
return; return;
} }
send.debug(Main.plugin,"setCursor 6 Player: "+player.getName());
if (SelectConfig.UseItem_ServerChange) { if (SelectConfig.UseItem_ServerChange) {
player.getInventory().setHeldItemSlot(slot - 1); player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 7 Player: "+player.getName());
return; 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());
if (Main.bungeejoinplayers.contains(player.getName())) { if (Main.bungeejoinplayers.contains(player.getName())) {
player.getInventory().setHeldItemSlot(slot - 1); player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 9 Player: "+player.getName());
Main.bungeejoinplayers.remove(player.getName()); Main.bungeejoinplayers.remove(player.getName());
} }
} }

View File

@@ -7,7 +7,9 @@ import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages; import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI; import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.api.CGuiAPI; import de.jatitv.commandguiv2.api.CGuiAPI;
import net.t2code.lib.Bungee.Lib.messages.Bsend;
import net.t2code.lib.Spigot.Lib.items.ItemVersion; import net.t2code.lib.Spigot.Lib.items.ItemVersion;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion; import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -110,6 +112,20 @@ public class Events implements Listener {
}.runTaskLater(Main.plugin, SelectConfig.UseItemGameModeChangeDelayInTicks * 1L); }.runTaskLater(Main.plugin, SelectConfig.UseItemGameModeChangeDelayInTicks * 1L);
} }
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent e) {
Player player = e.getPlayer();
if (!SelectConfig.UseItemWorldChangeEnable) {
return;
}
new BukkitRunnable() {
@Override
public void run() {
ItemChange.itemChange(player, false);
}
}.runTaskLater(Main.plugin, SelectConfig.UseItemWorldChangeDelayInTicks * 1L);
}
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onInteract(PlayerInteractEvent e) { public void onInteract(PlayerInteractEvent e) {
@@ -118,29 +134,22 @@ public class Events implements Listener {
if (SelectConfig.UseItem_PlayerHead_Enable) { if (SelectConfig.UseItem_PlayerHead_Enable) {
if (e.getItem() != null && p.getItemInHand().getType() == ItemVersion.getHead()) { if (e.getItem() != null && p.getItemInHand().getType() == ItemVersion.getHead()) {
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) { if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
e.setCancelled(true); openGUI(e, p);
if (p.isSneaking()) {
Commands.info(p);
return;
}
if (!legacy()) {
if (!topInventoryIsEmpty(p)) return;
}
if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) {
OpenGUI.openGUI(p, Main.guiHashMap.get(SelectConfig.UseItem_OpenGUI), SelectConfig.UseItem_OpenGUI);
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
p.playSound(p.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
}
} else {
p.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
.replace("[gui]", SelectConfig.UseItem_OpenGUI));
}
} }
} }
} else { } else {
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(SelectConfig.UseItem_Material)) { if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(SelectConfig.UseItem_Material)) {
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) { if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
openGUI(e, p);
}
}
}
}
}
private static void openGUI(PlayerInteractEvent e, Player p) {
e.setCancelled(true); e.setCancelled(true);
if (p.isSneaking()) { if (p.isSneaking()) {
Commands.info(p); Commands.info(p);
return; return;
@@ -148,6 +157,30 @@ public class Events implements Listener {
if (!legacy()) { if (!legacy()) {
if (!topInventoryIsEmpty(p)) return; if (!topInventoryIsEmpty(p)) return;
} }
if (SelectConfig.UseItemGameModeProtection) {
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(p.getGameMode().toString())) {
e.setCancelled(true);
send.player(p, SelectMessages.UseItemDisabledInGameMode);
return;
}
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(p.getGameMode().toString())) {
e.setCancelled(true);
send.player(p, SelectMessages.UseItemDisabledInGameMode);
return;
}
}
if (SelectConfig.UseItemWorldProtection) {
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(p.getWorld().getName())) {
e.setCancelled(true);
send.player(p, SelectMessages.UseItemDisabledInWorld);
return;
}
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemWorldList.contains(p.getWorld().getName())) {
e.setCancelled(true);
send.player(p, SelectMessages.UseItemDisabledInWorld);
return;
}
}
if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) { if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) {
OpenGUI.openGUI(p, Main.guiHashMap.get(SelectConfig.UseItem_OpenGUI), SelectConfig.UseItem_OpenGUI); OpenGUI.openGUI(p, Main.guiHashMap.get(SelectConfig.UseItem_OpenGUI), SelectConfig.UseItem_OpenGUI);
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) { if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
@@ -158,10 +191,6 @@ public class Events implements Listener {
.replace("[gui]", SelectConfig.UseItem_OpenGUI)); .replace("[gui]", SelectConfig.UseItem_OpenGUI));
} }
} }
}
}
}
}
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onItemMoveEvent(InventoryMoveItemEvent e) { public void onItemMoveEvent(InventoryMoveItemEvent e) {

View File

@@ -18,7 +18,6 @@ import java.util.logging.Logger;
public final class Main extends JavaPlugin { public final class Main extends JavaPlugin {
public static ArrayList<String> bungeeplayers = new ArrayList<>();
public static ArrayList<String> bungeejoinplayers = new ArrayList<>(); public static ArrayList<String> bungeejoinplayers = new ArrayList<>();
public static File getPath() { public static File getPath() {

View File

@@ -14,7 +14,7 @@ import java.util.Arrays;
public class ConfigCreate { public class ConfigCreate {
public static Integer ConfigVersion = 3; public static Integer ConfigVersion = 4;
public static void configCreate() { public static void configCreate() {
Long long_ = Long.valueOf(System.currentTimeMillis()); Long long_ = Long.valueOf(System.currentTimeMillis());
@@ -25,7 +25,7 @@ public class ConfigCreate {
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (yamlConfiguration.getInt("ConfigVersion") < ConfigVersion) { if (yamlConfiguration.getInt("ConfigVersion") < ConfigVersion && new File(Main.getPath(), "config.yml").exists()) {
send.console(Util.getPrefix() +" §4----------------------"); send.console(Util.getPrefix() +" §4----------------------");
send.console(Util.getPrefix() +" "); send.console(Util.getPrefix() +" ");
send.console(Util.getPrefix() +" §6New features have been added to CommandGUI. The Config is adapted!"); send.console(Util.getPrefix() +" §6New features have been added to CommandGUI. The Config is adapted!");
@@ -99,9 +99,17 @@ public class ConfigCreate {
Config.set("Advanced.UseItem.GameMode.Change.Enable", true, yamlConfiguration); Config.set("Advanced.UseItem.GameMode.Change.Enable", true, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Change.DelayInTicks", 1, yamlConfiguration); Config.set("Advanced.UseItem.GameMode.Change.DelayInTicks", 1, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.Enable", false, yamlConfiguration); Config.set("Advanced.UseItem.GameMode.Protection.Enable", false, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.Mode", "blacklist", yamlConfiguration); Config.set("Advanced.UseItem.GameMode.Protection.Mode", "blacklist", yamlConfiguration);
Config.set("Advanced.UseItem.GameMode.Protection.List", Arrays.asList("CREATIVE", "Spectator"), yamlConfiguration); Config.set("Advanced.UseItem.GameMode.Protection.List", Arrays.asList("CREATIVE", "Spectator"), yamlConfiguration);
Config.set("Advanced.UseItem.World.Change.Enable", true, yamlConfiguration);
Config.set("Advanced.UseItem.World.Change.DelayInTicks", 1, yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.Enable", false, yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.Mode", "blacklist", yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), yamlConfiguration);
Config.set("Sound.Enable", true, yamlConfiguration); Config.set("Sound.Enable", true, yamlConfiguration);
Config.set("Sound.OpenInventory.Enable", true, yamlConfiguration); Config.set("Sound.OpenInventory.Enable", true, yamlConfiguration);

View File

@@ -43,14 +43,19 @@ public class SelectConfig {
public static Boolean UseItem_Permission; public static Boolean UseItem_Permission;
public static Boolean UseItem_KeepAtCommandClear; public static Boolean UseItem_KeepAtCommandClear;
public static Boolean UseItemGameModeChangeEnable; public static Boolean UseItemGameModeChangeEnable;
public static int UseItemGameModeChangeDelayInTicks; public static int UseItemGameModeChangeDelayInTicks;
public static Boolean UseItemGameModeProtection; public static Boolean UseItemGameModeProtection;
public static Boolean UseItemGameModeRemoveItemWhenItIsDisabled;
public static String UseItemGameModeMode; public static String UseItemGameModeMode;
public static List<String> UseItemGameModeList; public static List<String> UseItemGameModeList;
public static Boolean UseItemWorldChangeEnable;
public static int UseItemWorldChangeDelayInTicks;
public static Boolean UseItemWorldProtection;
public static Boolean UseItemWorldRemoveItemWhenItIsDisabled;
public static String UseItemWorldMode;
public static List<String> UseItemWorldList;
public static Boolean UseItem_InventorySlot_FreeSlot; public static Boolean UseItem_InventorySlot_FreeSlot;
public static Integer UseItem_InventorySlot; public static Integer UseItem_InventorySlot;
@@ -64,8 +69,6 @@ public class SelectConfig {
public static String UseItem_Name; public static String UseItem_Name;
public static List<String> UseItem_Lore; public static List<String> UseItem_Lore;
public static Boolean Sound_Enable = true; public static Boolean Sound_Enable = true;
public static Boolean Sound_OpenInventory_Enable = true; public static Boolean Sound_OpenInventory_Enable = true;
@@ -80,7 +83,6 @@ public class SelectConfig {
public static Sound Sound_NoMoney; public static Sound Sound_NoMoney;
public static String Sound_NoMoney_input; public static String Sound_NoMoney_input;
public static Boolean Sound_NoInventorySpace_Enable = true; public static Boolean Sound_NoInventorySpace_Enable = true;
public static Sound Sound_NoInventorySpace; public static Sound Sound_NoInventorySpace;
public static String Sound_NoInventorySpace_input; public static String Sound_NoInventorySpace_input;
@@ -149,6 +151,7 @@ public class SelectConfig {
UseItemGameModeChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Change.Enable"); UseItemGameModeChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Change.Enable");
UseItemGameModeChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.GameMode.Change.DelayInTicks"); UseItemGameModeChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.GameMode.Change.DelayInTicks");
UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable"); UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable");
UseItemGameModeRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
UseItemGameModeMode = yamlConfiguration.getString("Advanced.UseItem.GameMode.Protection.Mode"); UseItemGameModeMode = yamlConfiguration.getString("Advanced.UseItem.GameMode.Protection.Mode");
List<String> gml = new ArrayList<>(); List<String> gml = new ArrayList<>();
for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")){ for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")){
@@ -156,7 +159,12 @@ public class SelectConfig {
} }
UseItemGameModeList = gml; UseItemGameModeList = gml;
UseItemWorldChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.World.Change.Enable");
UseItemWorldChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.World.Change.DelayInTicks");
UseItemWorldProtection = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.Enable");
UseItemWorldRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
UseItemWorldList =yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
Sound_Enable = yamlConfiguration.getBoolean("Sound.Enable"); Sound_Enable = yamlConfiguration.getBoolean("Sound.Enable");
Sound_OpenInventory_Enable = yamlConfiguration.getBoolean("Sound.OpenInventory.Enable"); Sound_OpenInventory_Enable = yamlConfiguration.getBoolean("Sound.OpenInventory.Enable");
@@ -172,7 +180,6 @@ public class SelectConfig {
Sound_Give_input = (yamlConfiguration.getString("Sound.Give.Sound").toUpperCase().replace(".", "_")); Sound_Give_input = (yamlConfiguration.getString("Sound.Give.Sound").toUpperCase().replace(".", "_"));
Sound_PlayerNotFound_Enable = yamlConfiguration.getBoolean("Sound.PlayerNotFound.Enable"); Sound_PlayerNotFound_Enable = yamlConfiguration.getBoolean("Sound.PlayerNotFound.Enable");
Sound_PlayerNotFound_input = (yamlConfiguration.getString("Sound.PlayerNotFound.Sound").toUpperCase().replace(".", "_")); Sound_PlayerNotFound_input = (yamlConfiguration.getString("Sound.PlayerNotFound.Sound").toUpperCase().replace(".", "_"));
} }

View File

@@ -42,6 +42,8 @@ public class LanguagesCreate {
set("UseItem.SlotNotEmpty", MSG.EN_ItemSlotNotEmpty, yamlConfigurationEN); set("UseItem.SlotNotEmpty", MSG.EN_ItemSlotNotEmpty, yamlConfigurationEN);
set("UseItem.SlotAlreadySet", MSG.EN_ItemSlotAlreadySet, yamlConfigurationEN); set("UseItem.SlotAlreadySet", MSG.EN_ItemSlotAlreadySet, yamlConfigurationEN);
set("UseItem.ItemSlot_wrongValue", MSG.EN_ItemSlot_wrongValue, yamlConfigurationEN); set("UseItem.ItemSlot_wrongValue", MSG.EN_ItemSlot_wrongValue, yamlConfigurationEN);
set("UseItem.DisabledInGameMode", MSG.EN_UseItemDisabledInGameMode, yamlConfigurationEN);
set("UseItem.DisabledInWorld", MSG.EN_UseItemDisabledInWorld, yamlConfigurationEN);
set("Cost.Buy_msg", MSG.EN_Buy_msg, yamlConfigurationEN); set("Cost.Buy_msg", MSG.EN_Buy_msg, yamlConfigurationEN);
set("Cost.No_money", MSG.EN_No_money, yamlConfigurationEN); set("Cost.No_money", MSG.EN_No_money, yamlConfigurationEN);
@@ -104,6 +106,8 @@ public class LanguagesCreate {
set("UseItem.SlotNotEmpty", MSG.DE_ItemSlotNotEmpty, yamlConfigurationDE); set("UseItem.SlotNotEmpty", MSG.DE_ItemSlotNotEmpty, yamlConfigurationDE);
set("UseItem.SlotAlreadySet", MSG.DE_ItemSlotAlreadySet, yamlConfigurationDE); set("UseItem.SlotAlreadySet", MSG.DE_ItemSlotAlreadySet, yamlConfigurationDE);
set("UseItem.ItemSlot_wrongValue", MSG.DE_ItemSlot_wrongValue, yamlConfigurationDE); set("UseItem.ItemSlot_wrongValue", MSG.DE_ItemSlot_wrongValue, yamlConfigurationDE);
set("UseItem.DisabledInGameMode", MSG.DE_UseItemDisabledInGameMode, yamlConfigurationDE);
set("UseItem.DisabledInWorld", MSG.DE_UseItemDisabledInWorld, yamlConfigurationDE);
set("Cost.Buy_msg", MSG.DE_Buy_msg, yamlConfigurationDE); set("Cost.Buy_msg", MSG.DE_Buy_msg, yamlConfigurationDE);
set("Cost.No_money", MSG.DE_No_money, yamlConfigurationDE); set("Cost.No_money", MSG.DE_No_money, yamlConfigurationDE);
@@ -167,6 +171,8 @@ public class LanguagesCreate {
set("UseItem.SlotNotEmpty", MSG.NO_ItemSlotNotEmpty, yamlConfigurationNO); set("UseItem.SlotNotEmpty", MSG.NO_ItemSlotNotEmpty, yamlConfigurationNO);
set("UseItem.SlotAlreadySet", MSG.NO_ItemSlotAlreadySet, yamlConfigurationNO); set("UseItem.SlotAlreadySet", MSG.NO_ItemSlotAlreadySet, yamlConfigurationNO);
set("UseItem.ItemSlot_wrongValue", MSG.NO_ItemSlot_wrongValue, yamlConfigurationNO); set("UseItem.ItemSlot_wrongValue", MSG.NO_ItemSlot_wrongValue, yamlConfigurationNO);
set("UseItem.DisabledInGameMode", MSG.NO_UseItemDisabledInGameMode, yamlConfigurationNO);
set("UseItem.DisabledInWorld", MSG.NO_UseItemDisabledInWorld, yamlConfigurationNO);
set("Cost.Buy_msg", MSG.NO_Buy_msg, yamlConfigurationNO); set("Cost.Buy_msg", MSG.NO_Buy_msg, yamlConfigurationNO);
set("Cost.No_money", MSG.NO_No_money, yamlConfigurationNO); set("Cost.No_money", MSG.NO_No_money, yamlConfigurationNO);

View File

@@ -38,6 +38,8 @@ public class MSG {
public static String EN_ItemSlotNotEmpty = "[prefix] &6The slot &e[slot] &6is currently occupied!"; public static String EN_ItemSlotNotEmpty = "[prefix] &6The slot &e[slot] &6is currently occupied!";
public static String EN_ItemSlotAlreadySet = "[prefix] &6The slot §e[slot] §6is already set!"; public static String EN_ItemSlotAlreadySet = "[prefix] &6The slot §e[slot] §6is already set!";
public static String EN_ItemSlot_wrongValue = "[prefix] &cThe specified slot must be between 1 and 9!"; public static String EN_ItemSlot_wrongValue = "[prefix] &cThe specified slot must be between 1 and 9!";
public static String EN_UseItemDisabledInGameMode = "[prefix] &cThe UseItem is disabled in this GameMode!";
public static String EN_UseItemDisabledInWorld = "[prefix] &cThe UseItem is disabled in this World!";
public static String EN_GUInotFound = "[prefix] &cThe GUI chosen by the does not exist."; public static String EN_GUInotFound = "[prefix] &cThe GUI chosen by the does not exist.";
public static String EN_GUIisDisabled = "[prefix] &cThe GUI [gui] &cis currently Disabled!"; public static String EN_GUIisDisabled = "[prefix] &cThe GUI [gui] &cis currently Disabled!";
@@ -79,6 +81,8 @@ public class MSG {
public static String DE_ItemSlotNotEmpty = "[prefix] &6Der Slot §e[slot] §6ist derzeit belegt!."; public static String DE_ItemSlotNotEmpty = "[prefix] &6Der Slot §e[slot] §6ist derzeit belegt!.";
public static String DE_ItemSlotAlreadySet = "[prefix] &6Der Slot §e[slot] §6ist bereits eingestellt!"; public static String DE_ItemSlotAlreadySet = "[prefix] &6Der Slot §e[slot] §6ist bereits eingestellt!";
public static String DE_ItemSlot_wrongValue = "[prefix] &cDer angegebene Slot muss sich zwischen 1 und 9 befinden!"; public static String DE_ItemSlot_wrongValue = "[prefix] &cDer angegebene Slot muss sich zwischen 1 und 9 befinden!";
public static String DE_UseItemDisabledInGameMode = "[prefix] &cDas UseItem ist in diesem GameMode deaktiviert!";
public static String DE_UseItemDisabledInWorld = "[prefix] &cDas UseItem ist in dieser Welt deaktiviert!";
public static String DE_Buy_msg = "[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft."; public static String DE_Buy_msg = "[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft.";
public static String DE_No_money = "[prefix] &cDu hast nicht gen[ue]gend Geld!"; public static String DE_No_money = "[prefix] &cDu hast nicht gen[ue]gend Geld!";
@@ -130,6 +134,8 @@ public class MSG {
public static String NO_ItemSlotNotEmpty = "[prefix] &6Plassen &e[slot] &6er opptatt for øyeblikket!"; public static String NO_ItemSlotNotEmpty = "[prefix] &6Plassen &e[slot] &6er opptatt for øyeblikket!";
public static String NO_ItemSlotAlreadySet = "[prefix] &6Plassen §e[slot] §6er allerede satt!"; public static String NO_ItemSlotAlreadySet = "[prefix] &6Plassen §e[slot] §6er allerede satt!";
public static String NO_ItemSlot_wrongValue = "[prefix] &cDen spesifiserte plassen må være mellom 1 og 9!"; public static String NO_ItemSlot_wrongValue = "[prefix] &cDen spesifiserte plassen må være mellom 1 og 9!";
public static String NO_UseItemDisabledInGameMode = "[prefix] &cBrukselementet er deaktivert i denne spillmodusen!!";
public static String NO_UseItemDisabledInWorld = "[prefix] &cUseItem er deaktivert i denne verden!";
public static String NO_Buy_msg = "[prefix] &2Du kjøpte [itemname] &2for &6[price]&2."; public static String NO_Buy_msg = "[prefix] &2Du kjøpte [itemname] &2for &6[price]&2.";
public static String NO_No_money = "[prefix] &cDu har ikke nok penger!"; public static String NO_No_money = "[prefix] &cDu har ikke nok penger!";

View File

@@ -32,6 +32,8 @@ public class SelectMessages {
public static String ItemSlotNotEmpty; public static String ItemSlotNotEmpty;
public static String ItemSlotAlreadySet; public static String ItemSlotAlreadySet;
public static String ItemSlot_wrongValue; public static String ItemSlot_wrongValue;
public static String UseItemDisabledInGameMode;
public static String UseItemDisabledInWorld;
public static String Buy_msg; public static String Buy_msg;
public static String No_money; public static String No_money;
@@ -97,6 +99,8 @@ public class SelectMessages {
ItemSlotNotEmpty = select("UseItem.SlotNotEmpty", yamlConfiguration_msg); ItemSlotNotEmpty = select("UseItem.SlotNotEmpty", yamlConfiguration_msg);
ItemSlotAlreadySet = select("UseItem.SlotAlreadySet", yamlConfiguration_msg); ItemSlotAlreadySet = select("UseItem.SlotAlreadySet", yamlConfiguration_msg);
ItemSlot_wrongValue = select("UseItem.ItemSlot_wrongValue", yamlConfiguration_msg); ItemSlot_wrongValue = select("UseItem.ItemSlot_wrongValue", yamlConfiguration_msg);
UseItemDisabledInGameMode =select("UseItem.DisabledInGameMode",yamlConfiguration_msg);
UseItemDisabledInWorld =select("UseItem.DisabledInWorld",yamlConfiguration_msg);
Buy_msg = select("Cost.Buy_msg", yamlConfiguration_msg); Buy_msg = select("Cost.Buy_msg", yamlConfiguration_msg);
No_money = select("Cost.No_money", yamlConfiguration_msg); No_money = select("Cost.No_money", yamlConfiguration_msg);

View File

@@ -24,20 +24,20 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
@Override @Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) { public void onPluginMessageReceived(String channel, Player player, byte[] message) {
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message)); DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
send.debug(Main.plugin,"stream: "+stream.toString());
try { try {
String subChannel = stream.readUTF(); String subChannel = stream.readUTF();
String input = stream.readUTF(); String input = stream.readUTF();
send.debug(Main.plugin,"subChannel: " +subChannel);
send.debug(Main.plugin,"input: " +input);
switch (subChannel) { switch (subChannel) {
case "join": case "join":
Main.bungeeplayers.add(input);
Main.bungeejoinplayers.add(input); Main.bungeejoinplayers.add(input);
break; break;
case "left": case "left":
Main.bungeeplayers.remove(input);
Main.bungeejoinplayers.remove(input); Main.bungeejoinplayers.remove(input);
break; break;
case "clear": case "clear":
Main.bungeeplayers.clear();
Main.bungeejoinplayers.clear(); Main.bungeejoinplayers.clear();
break; break;
} }

View File

@@ -61,9 +61,13 @@ public class Load {
if (SelectConfig.Bungee) { if (SelectConfig.Bungee) {
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin,"cgui:bungee")){ if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin,"cgui:bungee")){
send.debug(plugin, "registerIncomingPluginChannel §ecgui:bungee"); send.debug(plugin, "registerOutgoingPluginChannel §ecgui:bungee");
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin,"cgui:bungee"); Bukkit.getMessenger().registerOutgoingPluginChannel(plugin,"cgui:bungee");
} }
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin,"cgui:onlinepl")){
send.debug(plugin, "registerIncomingPluginChannel §ecgui:onlinepl");
Bukkit.getMessenger().registerIncomingPluginChannel(plugin,"cgui:onlinepl", new Bungee_Sender_Reciver());
}
} }
try { try {

View File

@@ -1,7 +1,7 @@
package de.jatitv.commandguiv2; package de.jatitv.commandguiv2;
public class Util { public class Util {
private static double requiredT2CodeLibVersion = 8; private static double requiredT2CodeLibVersion = 10.1;
private static String Prefix = "§8[§4C§9GUI§8]"; private static String Prefix = "§8[§4C§9GUI§8]";
private static Integer SpigotID = 90671; private static Integer SpigotID = 90671;
private static Integer BstatsID = 10840; private static Integer BstatsID = 10840;

View File

@@ -1,8 +0,0 @@
MySQL:
Enable: false
IP: localhost
Port: 3306
Database: database
User: user
Password: ''
SSL: false