From ef87eae96ee511ff5057220c8372e899c976f79d Mon Sep 17 00:00:00 2001 From: Chaos Date: Fri, 25 Mar 2022 21:03:14 +0100 Subject: [PATCH 1/2] fix(schematic): Fix Schem Delete Member fix(schematic): Fix Schem Status Signed-off-by: Chaos --- .../schematicsystem/commands/SchematicCommand.java | 5 +++++ .../schematicsystem/commands/SchematicCommandUtils.java | 9 +-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index 77c02bc..ecb5dd4 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -37,6 +37,8 @@ import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import java.sql.Timestamp; +import java.time.Instant; import java.util.*; import java.util.function.Function; import java.util.function.Predicate; @@ -272,6 +274,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())); From 3a885bbe5eae5050d9e463f4d258f4a03a280e33 Mon Sep 17 00:00:00 2001 From: Chaos Date: Fri, 25 Mar 2022 21:05:54 +0100 Subject: [PATCH 2/2] fix(schematic): imports Signed-off-by: Chaos --- .../de/steamwar/schematicsystem/commands/SchematicCommand.java | 1 - 1 file changed, 1 deletion(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index ecb5dd4..c3acd21 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -37,7 +37,6 @@ import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import java.sql.Timestamp; import java.time.Instant; import java.util.*; import java.util.function.Function;