Skip to content

Commit

Permalink
simplify Changer.java
Browse files Browse the repository at this point in the history
Signed-off-by: Mineshafter61 <[email protected]>
  • Loading branch information
Mineshafter61 committed Jun 28, 2024
1 parent 5c7e910 commit 03d4dcf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions src/main/java/mikeshafter/mikestcaddons/attachments/Changer.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ public Changer(MinecartMember<?> member, String name, Material type, int data) {
@Override
protected ConfigurationNode call(ConfigurationNode node) {
List<String> names = node.getList("names", String.class);
if (names.contains(this.name)) {
ItemStack item = node.get("item", ItemStack.class);
var meta = item.getItemMeta();
item.setType(this.type);
meta.setCustomModelData(this.data);
item.setItemMeta(meta);
node.set("item", item);
}
if (!names.contains(this.name)) return node;

ItemStack item = node.get("item", ItemStack.class);
var meta = item.getItemMeta();
item.setType(this.type);
meta.setCustomModelData(this.data);
item.setItemMeta(meta);
node.set("item", item);

return node;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void execute(SignActionEvent info) {

for (MinecartMember<?> member : info.getMembers()) {
Changer a = new Changer(member, name, material, customModelData);
new Thread(a).start();
a.run();
}
}
}
Expand Down

0 comments on commit 03d4dcf

Please sign in to comment.