Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
- Internal Blacklisted items are now removed if present when Global Illegal List is set to Whitelist
- Added PreComment NewLine fix to SettingSectionKeys
  • Loading branch information
KillerOfPie committed Jan 1, 2022
1 parent c8d5e58 commit d29f82c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public enum SettingSectionKeys {
this.key = key;
this.sectionHeader = sectionHeader;
this.postComment = postComment;
this.preComment = preComment;
this.preComment = fixPreCommentNewLines(preComment);
if (!key.isEmpty())
this.value_lead = " ";
}
Expand All @@ -78,7 +78,7 @@ public enum SettingSectionKeys {
this.sectionHeader = sectionHeader;
this.parent = parent;
this.postComment = postComment;
this.preComment = preComment;
this.preComment = fixPreCommentNewLines(preComment);
if (!key.isEmpty())
this.value_lead = parent.value_lead + " ";
}
Expand Down Expand Up @@ -148,4 +148,8 @@ public SettingSectionKeys getParent() {
public boolean hasParent() {
return parent != null;
}

private String fixPreCommentNewLines(String str) {
return str.replace("\n ", "\n" + getValueLead() + "# ");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public boolean add(Material mat) {
return list.add(mat);
}

public boolean remove(Material mat) {
return list.remove(mat);
}

public void addColourSet(String mat) {
List<String> colourSet = Arrays.asList("BLACK", "RED", "GREEN", "BROWN", "BLUE", "PURPLE", "LIGHT_BLUE", "LIGHT_GRAY", "GRAY", "PINK", "LIME", "YELLOW", "CYAN", "MAGENTA", "ORANGE", "WHITE");

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/shanerx/tradeshop/objects/ListManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ private void updateIllegalLists() {
globalList.add(Material.AIR);
globalList.add(Material.CAVE_AIR);
globalList.add(Material.VOID_AIR);
} else if (globalList.getType().equals(ListType.WHITELIST)) {
globalList.remove(Material.AIR);
globalList.remove(Material.CAVE_AIR);
globalList.remove(Material.VOID_AIR);
}

for (String str : Setting.GLOBAL_ILLEGAL_ITEMS_LIST.getStringList()) {
Expand Down

0 comments on commit d29f82c

Please sign in to comment.