Skip to content

Commit

Permalink
change config path
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Mar 6, 2024
1 parent 3aa6dc5 commit ca59adc
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
public class BannedItemNames implements IllegalItemModule {

private final AnarchyExploitFixes plugin;
private final Set<Component> colorSensitiveNames;
private final Set<String> colorInsensitiveNames;
private final Set<Component> coloredNames;
private final Set<String> plainTextNames;

public BannedItemNames() {
shouldEnable();
this.plugin = AnarchyExploitFixes.getInstance();
Config config = AnarchyExploitFixes.getConfiguration();
config.addComment("illegals.remove-specific-item-names.enable", "Resets an item's name if configured in the config.");
this.colorInsensitiveNames = new HashSet<>(config.getList("illegals.remove-specific-item-names.color-insensitive-item-names",
config.addComment("illegals.banned-item-names.enable", "Resets an item's name if configured in the config.");
this.plainTextNames = new HashSet<>(config.getList("illegals.banned-item-names.plain-names",
List.of("Super Insane Mega Sussy Item")));
this.colorSensitiveNames = config.getList("illegals.remove-specific-item-names.color-sensitive-item-names",
this.coloredNames = config.getList("illegals.banned-item-names.color-sensitive-names",
List.of("<bold><aqua>PvP KIT V2"))
.stream()
.map(serialized -> MiniMessage.miniMessage().deserialize(serialized))
Expand All @@ -45,7 +45,7 @@ public BannedItemNames() {

@Override
public String name() {
return "remove-items-with-specific-names";
return "banned-item-names";
}

@Override
Expand All @@ -60,7 +60,7 @@ public void enable() {

@Override
public boolean shouldEnable() {
return AnarchyExploitFixes.getConfiguration().getBoolean("illegals.remove-specific-item-names.enable", false);
return AnarchyExploitFixes.getConfiguration().getBoolean("illegals.banned-item-names.enable", false);
}

@Override
Expand All @@ -75,8 +75,7 @@ public ItemCheckResult checkItem(ItemStack itemStack) {
}

final Component displayName = itemStack.displayName();
if (colorSensitiveNames.contains(displayName)
|| colorInsensitiveNames.contains(PlainTextComponentSerializer.plainText().serialize(displayName))) {
if (coloredNames.contains(displayName) || plainTextNames.contains(PlainTextComponentSerializer.plainText().serialize(displayName))) {
return ItemCheckResult.IS_ILLEGAL;
}

Expand Down

0 comments on commit ca59adc

Please sign in to comment.