diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index 77c02bc..c3acd21 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -37,6 +37,7 @@ import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import java.time.Instant; import java.util.*; import java.util.function.Function; import java.util.function.Predicate; @@ -272,6 +273,9 @@ public class SchematicCommand extends SWCommand { if (!nodes.isEmpty()) { for (SchematicNode schematicNode : nodes) { SchematicNode newNode = mkdirs(schematicNode.generateBreadcrumbs(user).split("/"), target, 1); + if(SchematicNode.getSchematicNode(schematicNode.getName(), newNode == null ? 0 : newNode.getId()) != null) { + schematicNode.setName(schematicNode.getName() + "-" + Instant.now().getEpochSecond() % 1000); + } schematicNode.setParent(newNode == null ? 0 : newNode.getId()); } } diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java index 675b21f..ea92be3 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java @@ -202,14 +202,7 @@ public class SchematicCommandUtils { } player.sendMessage("§7Format: §e" + (node.getSchemFormat() ? ".schem" : ".schematic")); - List checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId()); - for (CheckedSchematic checkedSchematic : checkedSchematics) { - if (checkedSchematic.getSchemName().equals(node.getName()) && - checkedSchematic.getSchemOwner() == node.getOwner()) { - player.sendMessage("§cStatus: §c" + checkedSchematic.getStartTime() + " : " + checkedSchematic.getDeclineReason()); - break; - } - } + CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> player.sendMessage("§cStatus: §c" + checkedSchematic.getStartTime() + " : " + checkedSchematic.getDeclineReason())); } List schematicMembers = new ArrayList<>(); NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> schematicMembers.add(SteamwarUser.get(nodeMember.getMember()).getUserName()));