Skip to content

Commit

Permalink
rename to long name
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jan 2, 2025
1 parent 63914f6 commit 76c2fa0
Show file tree
Hide file tree
Showing 29 changed files with 59 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public BannedItemNames() {
})
.filter(Objects::nonNull)
.collect(Collectors.toCollection(() -> EnumSet.noneOf(Material.class)));
if (handling == IllegalHandling.STRICT) {
if (illegalHandling == IllegalHandling.STRICT) {
// Add listener for preview in anvil (for example)
optionalListeners.add(new Listener() {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
Expand Down Expand Up @@ -101,7 +101,7 @@ private void onPrepareResult(PrepareResultEvent event) {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

if (legality == ItemLegality.ILLEGAL) {
if (delete) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public BannedMaterials() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (legality != ItemLegality.LEGAL) {
itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
public abstract class IllegalItemModule extends AEFModule implements Listener {

protected final AEFPermission bypassPermission;
protected final IllegalHandling handling;
protected final IllegalHandling illegalHandling;
protected final boolean guiPluginsSupported;

protected final Set<Listener> optionalListeners;
Expand All @@ -82,11 +82,11 @@ public IllegalItemModule(String configPath, boolean defEnabled, AEFPermission by
handling = IllegalHandling.PREVENT_USE_ONLY;
warn("Handling option '" + configuredHandling + "' not recognized. Defaulting to " + handling.name());
}
this.handling = handling;
this.illegalHandling = handling;

this.guiPluginsSupported = config.getBoolean(configPath + ".gui-plugins-supported", false, """
Enable this if you have problems with the plugin removing items from chest guis.""");
if (this.handling == IllegalHandling.STRICT) {
if (this.illegalHandling == IllegalHandling.STRICT) {
optionalListeners.add(new Listener() {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
private void onInventoryOpen(InventoryOpenEvent event) {
Expand Down Expand Up @@ -206,7 +206,7 @@ public ItemLegality legalityOf(@Nullable Iterable<ItemStack> itemStacks) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPlayerItemConsume(PlayerItemConsumeEvent event) {
if (event.isCancelled() && handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (event.isCancelled() && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getPlayer().getUniqueId())) {
event.setCancelled(true);
Expand All @@ -223,7 +223,7 @@ public void onPlayerItemConsume(PlayerItemConsumeEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onBlockDispense(BlockDispenseEvent event) {
if (event.isCancelled() && handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (event.isCancelled() && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getBlock().getLocation())) {
event.setCancelled(true);
Expand All @@ -238,7 +238,7 @@ public void onBlockDispense(BlockDispenseEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPlayerArmorChange(PlayerArmorChangeEvent event) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // Cant cancel this event
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // Cant cancel this event

if (!AnarchyExploitFixes.permissions().permissionValue(event.getPlayer(), bypassPermission.node()).toBoolean()) {
handleItem(event.getNewItem(), legalityOf(event.getNewItem()));
Expand All @@ -250,7 +250,7 @@ public void onPlayerArmorChange(PlayerArmorChangeEvent event) {
public void onInventoryClick(InventoryClickEvent event) {
if (guiPluginsSupported && event.getInventory().getLocation() == null) return;

if (handling == IllegalHandling.PREVENT_USE_ONLY) {
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) {
if ( event.isCancelled()
|| event.getClick() == ClickType.DROP
|| event.getClick() == ClickType.CONTROL_DROP
Expand Down Expand Up @@ -286,7 +286,7 @@ public void onInventoryClick(InventoryClickEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onInventoryDrag(InventoryDragEvent event) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;
if (guiPluginsSupported && event.getInventory().getLocation() == null) return;

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getWhoClicked().getUniqueId())) {
Expand All @@ -308,7 +308,7 @@ public void onInventoryDrag(InventoryDragEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPrePlayerAttackEntity(PrePlayerAttackEntityEvent event) {
if (event.isCancelled() && handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (event.isCancelled() && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getPlayer().getUniqueId())) {
event.setCancelled(true);
Expand Down Expand Up @@ -336,7 +336,7 @@ public void onPrePlayerAttackEntity(PrePlayerAttackEntityEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (event.isCancelled() && handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (event.isCancelled() && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (event.getDamager().getType() == EntityType.PLAYER) {
final Player player = (Player) event.getDamager();
Expand Down Expand Up @@ -369,7 +369,7 @@ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (EntityUtil.isLivingEntity(event.getDamager())) {
if (legalityOf(((LivingEntity) event.getDamager()).getActiveItem()) != ItemLegality.LEGAL) {
event.setCancelled(true);
if (handling != IllegalHandling.PREVENT_USE_ONLY)
if (illegalHandling != IllegalHandling.PREVENT_USE_ONLY)
event.getDamager().getScheduler().execute(plugin, event.getDamager()::remove, null, 1L);
return;
}
Expand All @@ -378,15 +378,15 @@ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (EntityUtil.isInventoryHolder(event.getDamager())) {
if (legalityOf(((InventoryHolder) event.getDamager()).getInventory()) != ItemLegality.LEGAL) {
event.setCancelled(true);
if (handling != IllegalHandling.PREVENT_USE_ONLY)
if (illegalHandling != IllegalHandling.PREVENT_USE_ONLY)
event.getDamager().getScheduler().execute(plugin, event.getDamager()::remove, null, 1L);
}
}
}

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPlayerAttemptPickupItem(PlayerAttemptPickupItemEvent event) {
if (event.isCancelled() && handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (event.isCancelled() && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getPlayer().getUniqueId())) {
event.setCancelled(true);
Expand All @@ -407,7 +407,7 @@ public void onPlayerAttemptPickupItem(PlayerAttemptPickupItemEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPlayerDropItem(PlayerDropItemEvent event) {
if (event.isCancelled() && handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (event.isCancelled() && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getPlayer().getUniqueId())) {
event.setCancelled(true);
Expand All @@ -427,7 +427,7 @@ public void onPlayerDropItem(PlayerDropItemEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.useItemInHand() == Event.Result.DENY && handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (event.useItemInHand() == Event.Result.DENY && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getPlayer().getUniqueId())) {
event.setCancelled(true);
Expand All @@ -447,7 +447,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
if (event.isCancelled() && handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (event.isCancelled() && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getPlayer().getUniqueId())) {
event.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public IllegalPotions() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

switch (legality) {
case CONTAINS_ILLEGAL -> itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public InvalidStackSize() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

switch (legality) {
case ILLEGAL -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ItemAttributes() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

switch (legality) {
case CONTAINS_ILLEGAL -> itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public PlayerHeads() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

if (legality != ItemLegality.LEGAL) {
itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public SpawnEggs() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

if (legality != ItemLegality.LEGAL) {
itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Unbreakables() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

switch (legality) {
case CONTAINS_ILLEGAL -> itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public HigherEnchants() {
@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (legality == ItemLegality.LEGAL) return;
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

if (legality == ItemLegality.CONTAINS_ILLEGAL) {
itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public InapplicableEnchants() {
@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (legality == ItemLegality.LEGAL) return;
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

if (legality == ItemLegality.CONTAINS_ILLEGAL) {
itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public boolean shouldEnable() {
@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (legality == ItemLegality.LEGAL) return;
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

if (legality == ItemLegality.CONTAINS_ILLEGAL) {
itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public CustomNBTFilter() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (legality != ItemLegality.LEGAL) {
itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public NBTFilledStorageItem() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (legality != ItemLegality.LEGAL) {
itemStack.setAmount(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public BannedItemNames() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return; // We are cancelling the action in the super class

if (legality == ItemLegality.ILLEGAL) {
if (delete) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public BannedMaterials() {

@Override
public void handleItem(ItemStack itemStack, ItemLegality legality) {
if (handling == IllegalHandling.PREVENT_USE_ONLY) return;
if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;

if (legality != ItemLegality.LEGAL) {
itemStack.setAmount(0);
Expand Down
Loading

0 comments on commit 76c2fa0

Please sign in to comment.