Skip to content

Commit

Permalink
add threshold of enchants
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Feb 3, 2022
1 parent 2e55e5f commit 21a5eef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/surf/listeners/antiillegal/ItemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bukkit.inventory.ItemStack;
//import org.bukkit.inventory.meta.BlockStateMeta;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.meta.ItemMeta;
import org.surf.Main;
import org.surf.util.Utils;
Expand Down Expand Up @@ -92,7 +93,7 @@ public boolean hasIllegalAttributes(ItemStack item) {
public boolean hasIllegalEnchants(ItemStack item) {
Map<Enchantment, Integer> enchants = item.getEnchantments();
for (int level : enchants.values()) {
return level > 5;
return level > plugin.getConfig().getInt("IllegalEnchants-Maximum");
}
return false;
}
Expand Down Expand Up @@ -241,4 +242,5 @@ public void deleteIllegals(PlayerInventory inventory) {

}
}

}
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ BlockPhysics-disable-tps: 15
Connection:
Player-Join-Message: "&7[&a+&7] &8%player%"
Player-Leave-Message: "&7[&c-&7] &8%player%"
#The maximum value of allowing enchants
IllegalEnchants-Threshold: 5

0 comments on commit 21a5eef

Please sign in to comment.