Skip to content

Commit

Permalink
werks
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Mar 7, 2024
1 parent eeaaa6a commit 65a119b
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class BannedItemNames implements IllegalItemModule, Listener {
public class BannedItemNames implements IllegalItemModule {

private final Set<Component> coloredNames;
private final Set<String> plainTextNames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Set;
import java.util.stream.Collectors;

public class BannedMaterials implements IllegalItemModule, Listener {
public class BannedMaterials implements IllegalItemModule {

private final Set<Material> bannedMaterials;
private ScheduledTask periodicInvCheck;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Set;
import java.util.stream.Collectors;

public class OverstackedItems implements IllegalItemModule, Listener {
public class OverstackedItems implements IllegalItemModule {

private final Set<Material> whitelistedTypes;
private ScheduledTask periodicInvCheck;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.*;
import java.util.stream.Collectors;

public class InapplicableEnchants implements IllegalItemModule, Listener {
public class InapplicableEnchants implements IllegalItemModule {

private final Set<Material> whitelistedTypes;
private ScheduledTask periodicInvCheck;
Expand All @@ -32,6 +32,9 @@ public class InapplicableEnchants implements IllegalItemModule, Listener {
public InapplicableEnchants() {
shouldEnable();
Config config = AnarchyExploitFixes.getConfiguration();
config.addComment("illegals.revert-overstacked-items.enable",
"Checks if an item has an enchant that shouldnt be possible (ex. enchanted stone).\n" +
"Bypass permission: " + bypassPermission().get());
this.doSomething = config.getBoolean("illegals.enchantments.inapplicable-enchants.delete-or-revert-item", true);
this.checkStored = config.getBoolean("illegals.enchantments.inapplicable-enchants.check-stored-items", false);
this.useWhitelist = config.getBoolean("illegals.enchantments.inapplicable-enchants.item-whitelist-enabled", true);
Expand Down Expand Up @@ -100,6 +103,7 @@ public boolean shouldEnable() {
@Override
public void disable() {
if (periodicInvCheck != null) periodicInvCheck.cancel();
if (hopperListener != null) HandlerList.unregisterAll(hopperListener);
HandlerList.unregisterAll(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Set;
import java.util.stream.Collectors;

public class IncompatibleEnchants implements IllegalItemModule, Listener {
public class IncompatibleEnchants implements IllegalItemModule {

private final Set<Material> whitelistedTypes;
private ScheduledTask periodicInvCheck;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Set;
import java.util.stream.Collectors;

public class CustomNBTFilter implements IllegalItemModule, Listener {
public class CustomNBTFilter implements IllegalItemModule {

private final Set<String> illegalTags;
private final Set<Material> whitelistedTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import me.moomoo.anarchyexploitfixes.enums.ItemLegality;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

Expand All @@ -15,7 +14,7 @@
import java.util.Set;
import java.util.stream.Collectors;

public class BannedItemNames implements IllegalItemModule, Listener {
public class BannedItemNames implements IllegalItemModule {

private final Set<String> coloredNames, plainTextNames;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.logging.Level;
import java.util.stream.Collectors;

public class OverstackedItems implements IllegalItemModule, Listener {
public class OverstackedItems implements IllegalItemModule {

private final Set<Material> whitelistedTypes;
private final long checkPeriod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ public class InapplicableEnchants implements IllegalItemModule {
public InapplicableEnchants() {
shouldEnable();
Config config = AnarchyExploitFixes.getConfiguration();
config.addComment("illegals.revert-overstacked-items.enable",
"Checks if an item has an enchant that shouldnt be possible (ex. enchanted stone).\n" +
"Bypass permission: " + bypassPermission().get());
this.doSomething = config.getBoolean("illegals.enchantments.inapplicable-enchants.delete-or-revert-item", true);
this.checkStored = config.getBoolean("illegals.enchantments.inapplicable-enchants.check-stored-items", false);
this.useWhitelist = config.getBoolean("illegals.enchantments.inapplicable-enchants.item-whitelist-enabled", true);
this.blacklistMode = config.getBoolean("illegals.enchantments.inapplicable-enchants.use-as-blacklist-instead", false);
this.whitelistedTypes = config.getList("illegals.enchantments.inapplicable-enchants.whitelisted-items", List.of("GOLDEN_APPLE"))
this.whitelistedTypes = config.getList("illegals.enchantments.inapplicable-enchants.whitelisted-items",
Collections.singletonList("GOLDEN_APPLE"))
.stream()
.map(configuredType -> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.logging.Level;
import java.util.stream.Collectors;

public class IncompatibleEnchants implements IllegalItemModule, Listener {
public class IncompatibleEnchants implements IllegalItemModule {

private final Set<Material> whitelistedTypes;
private final long checkPeriod;
Expand Down

0 comments on commit 65a119b

Please sign in to comment.