Skip to content

Commit

Permalink
allow any item without tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Brokkonaut committed Feb 10, 2024
1 parent 86844e3 commit a3c1edf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
43 changes: 24 additions & 19 deletions src/main/java/org/cyberiantiger/minecraft/itemcontrol/Main.java
Expand Up @@ -458,29 +458,34 @@ private boolean checkMenuAccess(HumanEntity whoClicked, CompoundTag itemTag) {
found = true;
hasAccess = true;
} else {
for (Map.Entry<String, ItemGroup> e : itemGroups.getGroups().entrySet()) {
String name = e.getKey();
ItemGroup group = e.getValue();
ItemType type = group.getItems().get(itemId);
if (type != null) {
if (tag != null && tag.containsKey("Damage", TagType.INT)) {
tag.remove("Damage");
if (tag.getValue().isEmpty()) {
tag = null;
if (tag == null) {
found = true;
hasAccess = true;
} else {
for (Map.Entry<String, ItemGroup> e : itemGroups.getGroups().entrySet()) {
String name = e.getKey();
ItemGroup group = e.getValue();
ItemType type = group.getItems().get(itemId);
if (type != null) {
if (tag != null && tag.containsKey("Damage", TagType.INT)) {
tag.remove("Damage");
if (tag.getValue().isEmpty()) {
tag = null;
}
}
}
if (tag == null || type.getParsedTags().contains(tag)) {
found = true;
if (whoClicked.hasPermission(PERMISSION_MENU_PREFIX + name)) {
hasAccess = true;
if (tag == null || type.getParsedTags().contains(tag)) {
found = true;
if (whoClicked.hasPermission(PERMISSION_MENU_PREFIX + name)) {
hasAccess = true;
}
}
}
}
}
if (!hasAccess) {
if (config.getAllowedItems().contains(itemId) && tag == null) {
found = true;
hasAccess = true;
if (!hasAccess) {
if (config.getAllowedItems().contains(itemId) && tag == null) {
found = true;
hasAccess = true;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/resources/items.yml
Expand Up @@ -517,7 +517,7 @@ groups:
'minecraft:acacia_leaves': {}
'minecraft:dark_oak_leaves': {}
'minecraft:cobweb': {}
'minecraft:grass': {}
'minecraft:short_grass': {}
'minecraft:fern': {}
'minecraft:dead_bush': {}
'minecraft:seagrass': {}
Expand Down Expand Up @@ -1096,6 +1096,7 @@ groups:
'minecraft:snow_golem_spawn_egg': {}
'minecraft:wither_spawn_egg': {}
'minecraft:camel_spawn_egg': {}
'minecraft:breeze_spawn_egg': {}
'minecraft:experience_bottle': {}
'minecraft:fire_charge': {}
'minecraft:writable_book': {}
Expand Down

0 comments on commit a3c1edf

Please sign in to comment.