diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 50aa92d8..fcbb6665 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -78,7 +78,18 @@ public class TraceCommand extends SWCommand { BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player); } + @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") + public void delete(Player player){ + manager.clear(); + //BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_ALL", player); + } + //TODO Manage non exsistent trace + @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") + public void delete(Player player, int id){ + manager.remove(id); + //BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); + } @ClassMapper(value = BundleFilter.class, local = true) public TypeMapper bundleFilterClassMapper() { @@ -100,8 +111,6 @@ public class TraceCommand extends SWCommand { return Arrays.stream(BundleFilter.values()) .map(Enum::toString) .collect(Collectors.toList()); - - } }; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 8308b7b5..786fe8e5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -70,10 +70,12 @@ public class TraceManager implements Listener { * * @param id id of the trace to be removed */ - public void remove(int id){ + public boolean remove(int id){ + if(id >= nextOpenId) return false; for(Player player: viewFlagMap.keySet()) traces.get(id).hide(player); traces.remove(id); + return true; } /** Clears all traces