Compare commits

...

1 Commits

Author SHA1 Message Date
JaTiTV b6347c8fad 2.7.0 2 months ago
  1. 6
      CommandGUI V2/pom.xml
  2. 22
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java
  3. 3
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/ConfigCreate.java
  4. 12
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/SelectConfig.java
  5. 1
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Metrics.java

6
CommandGUI V2/pom.xml

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId>
<version>2.7.0_Snapshot-6</version>
<version>2.7.0</version>
<packaging>jar</packaging>
<name>CommandGUI</name>
@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
</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>
@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>11.4</version>
<version>11.6</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>

22
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java

@ -36,23 +36,24 @@ public class Events implements Listener { @@ -36,23 +36,24 @@ public class Events implements Listener {
public static HashMap<Player, Boolean> useItemHashMap = new HashMap<>();
public static HashMap<Player, Integer> useItemSlotHashMap = new HashMap<>();
@EventHandler
public void onJoin(PlayerJoinEvent e) {
if (SelectDatabase.selectItemStatus(e.getPlayer())){
if (SelectDatabase.selectItemStatus(e.getPlayer())) {
useItemHashMap.put(e.getPlayer(), true);
} else useItemHashMap.put(e.getPlayer(), false);
useItemSlotHashMap.put(e.getPlayer(), SelectDatabase.selectSlot(e.getPlayer()));
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);
@ -159,14 +160,17 @@ public class Events implements Listener { @@ -159,14 +160,17 @@ public class Events implements Listener {
private static void openGUI(PlayerInteractEvent e, Player player) {
e.setCancelled(true);
if (player.isSneaking()) {
if (SelectConfig.disableInfoBySneak && player.isSneaking()) {
Commands.info(player);
return;
}
if (!legacy()) {
if (!topInventoryIsEmpty(player)) return;
}
if (UseItem.protection(player, true)) return;
if (SelectConfig.UseItemGameModeProtection) {
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
e.setCancelled(true);
@ -179,6 +183,7 @@ public class Events implements Listener { @@ -179,6 +183,7 @@ public class Events implements Listener {
return;
}
}
if (SelectConfig.UseItemWorldProtection) {
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
e.setCancelled(true);
@ -191,6 +196,7 @@ public class Events implements Listener { @@ -191,6 +196,7 @@ public class Events implements Listener {
return;
}
}
if (!SelectConfig.UseItem_Permission || player.hasPermission("commandgui.useitem")) {
OpenGUI.openGUI(player, SelectConfig.UseItem_OpenGUI, true);
} else {
@ -213,6 +219,7 @@ public class Events implements Listener { @@ -213,6 +219,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()
@ -234,7 +241,6 @@ public class Events implements Listener { @@ -234,7 +241,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)) {
@ -244,13 +250,13 @@ public class Events implements Listener { @@ -244,13 +250,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()
@ -263,6 +269,7 @@ public class Events implements Listener { @@ -263,6 +269,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);
@ -272,6 +279,7 @@ public class Events implements Listener { @@ -272,6 +279,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()
@ -282,7 +290,7 @@ public class Events implements Listener { @@ -282,7 +290,7 @@ 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) {
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;
}

3
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/ConfigCreate.java

@ -26,8 +26,6 @@ public class ConfigCreate { @@ -26,8 +26,6 @@ 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);
@ -102,7 +100,6 @@ public class ConfigCreate { @@ -102,7 +100,6 @@ public class ConfigCreate {
Config.set("Advanced.UseItem.World.Protection.Mode", "blacklist", yamlConfiguration);
Config.set("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), 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);

12
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/SelectConfig.java

@ -22,9 +22,6 @@ public class SelectConfig { @@ -22,9 +22,6 @@ 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;
@ -64,6 +61,8 @@ public class SelectConfig { @@ -64,6 +61,8 @@ public class SelectConfig {
public static String UseItemWorldMode;
public static List<String> UseItemWorldList;
public static Boolean disableInfoBySneak;
public static Boolean UseItem_InventorySlot_FreeSlot;
public static Integer UseItem_InventorySlot;
public static Boolean UseItem_InventorySlotEnforce;
@ -129,10 +128,6 @@ public class SelectConfig { @@ -129,10 +128,6 @@ 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");
@ -194,6 +189,9 @@ public class SelectConfig { @@ -194,6 +189,9 @@ public class SelectConfig {
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
UseItemWorldList = yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
if (yamlConfiguration.get("Advanced.UseItem.DisableInfoBySneak") != null){
disableInfoBySneak = yamlConfiguration.getBoolean("Advanced.UseItem.DisableInfoBySneak");
}
toggleItemOnOrYesBase64 = yamlConfiguration.getBoolean("Toggle.Items.OnOrYes.Item.Base64.Enable");
toggleItemOnOrYesBase64Value = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Base64.Base64Value");

1
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Metrics.java

@ -36,7 +36,6 @@ public class Metrics { @@ -36,7 +36,6 @@ 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 DrilldownPie("storage_type_mysql", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
String storage = SelectDatabase.getStorage().toString();

Loading…
Cancel
Save