2.7.2
ADD: Added a UseItem Item/Block Blacklist so that when you look at one of these blocks, the GUI does not open but the block (for example: CHEST, CRAFTING_TABLE, or buttons).
This commit is contained in:
parent
326dfae0e9
commit
32c1219bb2
@ -133,10 +133,17 @@ public class Events implements Listener {
|
|||||||
}.runTaskLater(Main.plugin, SelectConfig.UseItemWorldChangeDelayInTicks * 1L);
|
}.runTaskLater(Main.plugin, SelectConfig.UseItemWorldChangeDelayInTicks * 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onInteract(PlayerInteractEvent e) {
|
public void onInteract(PlayerInteractEvent e) {
|
||||||
Player p = e.getPlayer();
|
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_Enable) {
|
||||||
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()) {
|
||||||
|
@ -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.messages.send;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ConfigCreate {
|
public class ConfigCreate {
|
||||||
|
|
||||||
|
|
||||||
public static void configCreate() {
|
public static void configCreate() {
|
||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||||
@ -99,6 +103,33 @@ public class ConfigCreate {
|
|||||||
Config.set("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", 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.Mode", "blacklist", yamlConfiguration);
|
||||||
Config.set("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), 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.Enable", false, yamlConfiguration);
|
||||||
Config.set("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", yamlConfiguration);
|
Config.set("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", yamlConfiguration);
|
||||||
|
@ -4,8 +4,6 @@ import de.jatitv.commandguiv2.Spigot.Main;
|
|||||||
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
|
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
|
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
|
||||||
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
|
|
||||||
import de.jatitv.commandguiv2.Spigot.system.database.StorageType;
|
|
||||||
import de.jatitv.commandguiv2.Util;
|
import de.jatitv.commandguiv2.Util;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||||
@ -57,6 +55,7 @@ public class SelectConfig {
|
|||||||
public static Boolean UseItemWorldRemoveItemWhenItIsDisabled;
|
public static Boolean UseItemWorldRemoveItemWhenItIsDisabled;
|
||||||
public static String UseItemWorldMode;
|
public static String UseItemWorldMode;
|
||||||
public static List<String> UseItemWorldList;
|
public static List<String> UseItemWorldList;
|
||||||
|
public static List<String> UseItemItemBlockBlacklist;
|
||||||
|
|
||||||
public static Boolean disableInfoBySneak = false;
|
public static Boolean disableInfoBySneak = false;
|
||||||
|
|
||||||
@ -189,10 +188,13 @@ public class SelectConfig {
|
|||||||
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
|
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
|
||||||
UseItemWorldList = yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
|
UseItemWorldList = yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
|
||||||
|
|
||||||
|
|
||||||
if (yamlConfiguration.get("Advanced.UseItem.DisableInfoBySneak") != null) {
|
if (yamlConfiguration.get("Advanced.UseItem.DisableInfoBySneak") != null) {
|
||||||
disableInfoBySneak = yamlConfiguration.getBoolean("Advanced.UseItem.DisableInfoBySneak");
|
disableInfoBySneak = yamlConfiguration.getBoolean("Advanced.UseItem.DisableInfoBySneak");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UseItemItemBlockBlacklist = yamlConfiguration.getStringList("Advanced.UseItem.ItemBlockBlacklist");
|
||||||
|
|
||||||
toggleItemOnOrYesBase64 = yamlConfiguration.getBoolean("Toggle.Items.OnOrYes.Item.Base64.Enable");
|
toggleItemOnOrYesBase64 = yamlConfiguration.getBoolean("Toggle.Items.OnOrYes.Item.Base64.Enable");
|
||||||
toggleItemOnOrYesBase64Value = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Base64.Base64Value");
|
toggleItemOnOrYesBase64Value = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Base64.Base64Value");
|
||||||
toggleItemOnOrYesMaterial = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Material");
|
toggleItemOnOrYesMaterial = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Material");
|
||||||
|
Loading…
Reference in New Issue
Block a user