Skip to content

Commit

Permalink
/map suggests worlds now
Browse files Browse the repository at this point in the history
  • Loading branch information
not-coded committed Aug 2, 2024
1 parent 374ada4 commit 13ad388
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static void register(CommandDispatcher<CommandSourceInfo> dispatcher) {
.then(CommandUtils.argument("type", StringArgumentType.string())
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((new String[]{"delete", "create", "tp"}), builder)))
.then(CommandUtils.argument("map", StringArgumentType.greedyString())
.suggests(((context, builder) -> SharedSuggestionProvider.suggest((WorldUtil.getAllWorldsId()), builder)))
.executes(MapCommand::run)
)
)
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/nexia/core/utilities/world/WorldUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,14 @@ public static void deleteTempWorlds() {
WorldUtil.deleteWorld(deletion);
}
}

public static ArrayList<String> getAllWorldsId() {
ArrayList<String> arrayList = new ArrayList<>();

for(World world : ServerTime.nexusServer.getWorlds()) {
arrayList.add(world.getIdentifier().pure());
}

return arrayList;
}
}

0 comments on commit 13ad388

Please sign in to comment.