forked from SteamWar/SteamWar
Refactor SchematicNode
This commit is contained in:
@@ -122,7 +122,7 @@ public class SchematicSelector {
|
||||
list.add(renderItem(node));
|
||||
}
|
||||
|
||||
SWListInv<SchematicNode> inv = new SWListInv<>(player, MessageFormat.format(injectable.createTitle(player), target.target.getName(player), (filter == null || filter.getName() == null)?(parent == null?"/":parent.generateBreadcrumbs()):filter.getName()), false, list, (clickType, node) -> handleClick(node, parent));
|
||||
SWListInv<SchematicNode> inv = new SWListInv<>(player, MessageFormat.format(injectable.createTitle(player), target.target.getName(player), (filter == null || filter.getName() == null)?(parent == null?"/":parent.generateBreadcrumbs(user)):filter.getName()), false, list, (clickType, node) -> handleClick(node, parent));
|
||||
if(publicMode == PublicMode.ALL) {
|
||||
if(user.getId() == 0) {
|
||||
inv.setItem(48, new SWItem(Material.BUCKET, Core.MESSAGE.parse("SCHEM_SELECTOR_OWN", player), clickType -> {
|
||||
@@ -178,7 +178,7 @@ public class SchematicSelector {
|
||||
Optional<SchematicNode> currentParent = Optional.of(parent);
|
||||
do {
|
||||
sdoTrigger = false;
|
||||
currentParent = currentParent.flatMap(SchematicSelector::getParent);
|
||||
currentParent = currentParent.flatMap(this::getParent);
|
||||
if(!currentParent.isPresent()) {
|
||||
break;
|
||||
}
|
||||
@@ -484,8 +484,8 @@ public class SchematicSelector {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
private static Optional<SchematicNode> getParent(SchematicNode node) {
|
||||
return node.getOptionalParent().map(integer -> SchematicNode.byIdAndUser(SteamwarUser.byId(node.getEffectiveOwner()), integer));
|
||||
private Optional<SchematicNode> getParent(SchematicNode node) {
|
||||
return node.getOptionalParent().map(integer -> SchematicNode.byIdAndUser(user, integer));
|
||||
}
|
||||
|
||||
public static SelectorTarget selectSchematic() {
|
||||
|
||||
Reference in New Issue
Block a user