A Minecraft server-side mod that adds various teleportation related commands
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[1.21.2-1.21.3] v1.2.0

Check the CHANGELOG.md for all the new changes!

+61 -34
+8 -7
CHANGELOG.md
··· 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 7 8 - ### [v1.2.0] WIP! 8 + ### [v1.2.0] 9 9 - Added the following warp related commands: `/warp` `/setwarp` `/delwarp` `/renamewarp` and `/warps` 10 + - Added `/worldspawn` 10 11 - Improved error handling and error messages a lot, this will make bug reporting (and fixing) a lot easier since it says on what command it fails, and it also gives a stack trace. 11 12 - Fixed some small things which may cause errors. 12 - - Improved code of some commands to make them more sane and readable 13 - - Modified storage code to make it more sane 13 + - Improved code of some commands to make them more sane and readable. 14 + - Modified storage code to make it more sane. 14 15 - Fixed bug with /home when in a diff dimension. (apparently I did this for /back already but forgot to add it to /home) 15 - - Added Russian Translations (Thanks to [rfin0](https://github.com/rfin0)) 16 + - Added Russian Translations (Thanks to [rfin0](https://github.com/rfin0)!) 16 17 17 18 ### [v1.1.3] 18 19 - Added support for 1.21.2 - 1.21.3 19 20 20 21 ### [v1.1.2] 21 - - Added Italian Translations (Thanks to [Vlad Andrei Morariu](https://github.com/VladAndreiMorariu) 22 + - Added Italian Translations (Thanks to [Vlad Andrei Morariu](https://github.com/VladAndreiMorariu)!) 22 23 23 24 ### [v1.1.1] 24 25 - Added support for 1.21 ··· 34 35 - Added a CHANGELOG.md 35 36 - Added Tpa Accept/Deny Suggestions 36 37 - Added Dutch translations 37 - - Added Hungarian translations (Thanks to [Martin Morningstar](https://github.com/RMI637)) 38 + - Added Hungarian translations (Thanks to [Martin Morningstar](https://github.com/RMI637)!) 38 39 39 40 #### Changed 40 41 - Limited the requests a player can do to the same player to 1 ··· 65 66 #### Changed 66 67 - Changed mappings to Mojang. 67 68 - Cleaned up commands code 68 - - Changed build files to support multiple mod loader 69 + - Changed build files to support multiple mod loaders 69 70 70 71 71 72 ### [v1.0.2]
+5 -1
README.md
··· 6 6 7 7 #### Currently available commands: 8 8 9 + - `/worldspawn [<Disable Safety>]` - Teleports you to the world spawn (in the overworld), if given true it will not do safety checks 9 10 - `/back [<Disable Safety>]` - Teleports you to the location where you last died, if given true it will not do safety checks 10 11 <br><br> 11 12 **Homes are player specific locations that only that player can teleport to** ··· 35 36 36 37 #### Planned commands: 37 38 - [ ] `/wild` - Teleports you to a random location in the Overworld 38 - - [ ] `/worldspawn` - Teleports you to the worldspawn 39 + - [x] `/worldspawn` - Teleports you to the worldspawn 39 40 - [ ] `/spawn <dimension>` - Teleports you to your spawnpoint in a dimension, defaults to your current dimension 40 41 41 42 #### Improvements: 43 + - [ ] Look into changing the mod into the more safe and sane kotlin (I love java) 44 + - [ ] Find a way to combine the mod loader specific jars into one 45 + - [ ] Find the easiest way to backport the mod to older version (help) 42 46 - [ ] Create a config to add any delays and disable commands, with commands for operators in game 43 47 - [ ] Add a perm system 44 48 - [x] Json Storage automatic updater & cleaner
+1 -1
common/src/main/java/dev/mrsnowy/teleport_commands/commands/back.java
··· 119 119 } 120 120 121 121 if (!found) { 122 - player.displayClientMessage(getTranslatedText("commands.teleport_commands.back.noLocation", player).withStyle(ChatFormatting.RED), true); 122 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.noLocation", player).withStyle(ChatFormatting.RED), true); 123 123 } 124 124 } 125 125 }
+3 -3
common/src/main/java/dev/mrsnowy/teleport_commands/commands/tpa.java
··· 114 114 FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.self", FromPlayer).withStyle(ChatFormatting.AQUA), true); 115 115 116 116 } else if (playerTpaList >= 1) { 117 - FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.alreadySent", FromPlayer, Component.literal(Objects.requireNonNull(ToPlayer.getName().getString())).withStyle(ChatFormatting.BOLD)).withStyle(ChatFormatting.AQUA) 117 + FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.alreadySent", FromPlayer, Component.literal(Objects.requireNonNull(ToPlayer.getName().getString(), "ToPlayer name cannot be null")).withStyle(ChatFormatting.BOLD)).withStyle(ChatFormatting.AQUA) 118 118 , true 119 119 ); 120 120 ··· 128 128 tpaRequest.here = here; 129 129 tpaList.add(tpaRequest); 130 130 131 - String ReceivedFromPlayer = Objects.requireNonNull(FromPlayer.getName().getString()); 132 - String SentToPlayer = Objects.requireNonNull(ToPlayer.getName().getString()); 131 + String ReceivedFromPlayer = Objects.requireNonNull(FromPlayer.getName().getString(), "FromPlayer name cannot be null"); 132 + String SentToPlayer = Objects.requireNonNull(ToPlayer.getName().getString(), "ToPlayer name cannot be null"); 133 133 134 134 FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.sent", FromPlayer, Component.literal(hereText), Component.literal(SentToPlayer).withStyle(ChatFormatting.BOLD)) 135 135 // .append(Text.literal("\n[Cancel]").formatted(Formatting.BLUE, Formatting.BOLD))
+15 -8
common/src/main/java/dev/mrsnowy/teleport_commands/commands/worldspawn.java
··· 58 58 59 59 } 60 60 61 - private static void toWorldSpawn(ServerPlayer player, boolean safetyDisabled) { 61 + private static void toWorldSpawn(ServerPlayer player, boolean safetyDisabled) throws NullPointerException { 62 62 ServerLevel world = TeleportCommands.SERVER.getLevel(OVERWORLD); 63 - BlockPos worldSpawn = Objects.requireNonNull(world).getSharedSpawnPos(); 64 - 63 + BlockPos worldSpawn = Objects.requireNonNull(world,"Overworld cannot be null").getSharedSpawnPos(); 65 64 66 65 if (!safetyDisabled) { 67 66 Pair<Integer, Optional<Vec3>> teleportData = teleportSafetyChecker(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), world, player); ··· 69 68 switch (teleportData.getFirst()) { 70 69 case 0: // safe location found! 71 70 if (teleportData.getSecond().isPresent()) { 72 - player.displayClientMessage(getTranslatedText("commands.teleport_commands.back.go", player), true); 71 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.worldspawn.go", player), true); 73 72 Teleporter(player, world, teleportData.getSecond().get()); 74 73 } else { 75 74 player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.error", player).withStyle(ChatFormatting.RED, ChatFormatting.BOLD), true); ··· 77 76 78 77 break; 79 78 case 1: // the location is already safe! 80 - player.displayClientMessage(getTranslatedText("commands.teleport_commands.back.same", player).withStyle(ChatFormatting.AQUA), true); 79 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.worldspawn.same", player).withStyle(ChatFormatting.AQUA), true); 81 80 break; 82 81 case 2: // no safe location found! 83 82 ··· 87 86 .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/worldspawn true"))),false); 88 87 break; 89 88 } 89 + } else { 90 + BlockPos playerBlockPos = new BlockPos(player.getBlockX(), player.getBlockY(), player.getBlockZ()); 91 + 92 + if (!playerBlockPos.equals(worldSpawn) || player.level() != world) { 93 + 94 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.worldspawn.go", player), true); 95 + Teleporter(player, world, new Vec3(worldSpawn.getX() + 0.5, worldSpawn.getY(), worldSpawn.getZ() + 0.5)); 96 + 97 + } else { 98 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.worldspawn.same", player).withStyle(ChatFormatting.AQUA), true); 99 + } 90 100 } 91 - 92 - TeleportCommands.LOGGER.error("{}", world.getSharedSpawnPos()); 93 101 } 94 - 95 102 }
+3 -3
common/src/main/java/dev/mrsnowy/teleport_commands/utils/tools.java
··· 174 174 String filePath = String.format("/assets/%s/lang/en_us.json", MOD_ID); 175 175 InputStream stream = TeleportCommands.class.getResourceAsStream(filePath); 176 176 177 - Reader reader = new InputStreamReader(Objects.requireNonNull(stream), StandardCharsets.UTF_8); 177 + Reader reader = new InputStreamReader(Objects.requireNonNull(stream, "translation file stream cannot be null"), StandardCharsets.UTF_8); 178 178 JsonElement json = JsonParser.parseReader(reader); 179 179 String translation = json.getAsJsonObject().get(key).getAsString(); 180 180 181 - 182 - Matcher matcher = pattern.matcher(Objects.requireNonNull(translation)); 181 + // Adds the optional MutableComponents in the correct places 182 + Matcher matcher = pattern.matcher(Objects.requireNonNull(translation, "translation cannot be null")); 183 183 184 184 MutableComponent component = Component.literal(""); 185 185 int lastIndex = 0;
+5 -2
common/src/main/resources/assets/teleport_commands/lang/en_us.json
··· 1 1 { 2 2 "commands.teleport_commands.back.go": "Going Back", 3 3 "commands.teleport_commands.back.same": "Already Back", 4 - "commands.teleport_commands.back.noLocation": "No Location Found!", 4 + 5 + "commands.teleport_commands.worldspawn.go": "Going To The Worldspawn", 6 + "commands.teleport_commands.worldspawn.same": "Already At Worldspawn", 5 7 6 8 "commands.teleport_commands.home.set": "Home Set", 7 9 "commands.teleport_commands.home.setError": "Error Setting Home!", ··· 58 60 "commands.teleport_commands.common.rename": "[Rename]", 59 61 "commands.teleport_commands.common.delete": "[Delete]", 60 62 "commands.teleport_commands.common.default": "(Default)", 61 - "commands.teleport_commands.common.renameExists": "That Name Already Exists!" 63 + "commands.teleport_commands.common.renameExists": "That Name Already Exists!", 64 + "commands.teleport_commands.common.noLocation": "No Location Found!" 62 65 }
+5 -2
common/src/main/resources/assets/teleport_commands/lang/hu_hu.json
··· 1 1 { 2 2 "commands.teleport_commands.back.go": "Indulás vissza", 3 3 "commands.teleport_commands.back.same": "Vissza", 4 - "commands.teleport_commands.back.noLocation": "Nem található a koordináta", 4 + 5 + "commands.teleport_commands.worldspawn.go": "Going To The Worldspawn", 6 + "commands.teleport_commands.worldspawn.same": "Already At Worldspawn", 5 7 6 8 "commands.teleport_commands.home.set": "Otthon beállítása", 7 9 "commands.teleport_commands.home.setError": "Hiba történt az otthon beállításával!", ··· 58 60 "commands.teleport_commands.common.rename": "[Átnevezés]", 59 61 "commands.teleport_commands.common.delete": "[Törlés]", 60 62 "commands.teleport_commands.common.default": "(Alap)", 61 - "commands.teleport_commands.common.renameExists": "A név már létezik!" 63 + "commands.teleport_commands.common.renameExists": "A név már létezik!", 64 + "commands.teleport_commands.common.noLocation": "Nem található a koordináta" 62 65 }
+5 -2
common/src/main/resources/assets/teleport_commands/lang/it_it.json
··· 1 1 { 2 2 "commands.teleport_commands.back.go": "Tornando Indietro", 3 3 "commands.teleport_commands.back.same": "Già Tornato Indietro", 4 - "commands.teleport_commands.back.noLocation": "Nessuna Posizione Trovata!", 4 + 5 + "commands.teleport_commands.worldspawn.go": "Going To The Worldspawn", 6 + "commands.teleport_commands.worldspawn.same": "Already At Worldspawn", 5 7 6 8 "commands.teleport_commands.home.set": "Casa Impostata", 7 9 "commands.teleport_commands.home.setError": "Errore Nell'Impostazione Della Casa!", ··· 58 60 "commands.teleport_commands.common.rename": "[Rinomina]", 59 61 "commands.teleport_commands.common.delete": "[Elimina]", 60 62 "commands.teleport_commands.common.default": "(Predefinita)", 61 - "commands.teleport_commands.common.renameExists": "Quel Nome Esiste Già!" 63 + "commands.teleport_commands.common.renameExists": "Quel Nome Esiste Già!", 64 + "commands.teleport_commands.common.noLocation": "Nessuna Posizione Trovata!" 62 65 }
+5 -2
common/src/main/resources/assets/teleport_commands/lang/nl_nl.json
··· 1 1 { 2 2 "commands.teleport_commands.back.go": "Terug gaan", 3 3 "commands.teleport_commands.back.same": "Al Terug", 4 - "commands.teleport_commands.back.noLocation": "Geen Locatie Gevonden!", 4 + 5 + "commands.teleport_commands.worldspawn.go": "Naar de Worldspawn", 6 + "commands.teleport_commands.worldspawn.same": "Al bij de Worldspawn", 5 7 6 8 "commands.teleport_commands.home.set": "Huis Ingesteld", 7 9 "commands.teleport_commands.home.setError": "Probleem tijdens het instellen van het Huis!", ··· 58 60 "commands.teleport_commands.common.rename ": "[Naam Wijzigen]", 59 61 "commands.teleport_commands.common.delete": "[Verwijderen]", 60 62 "commands.teleport_commands.common.default": "(Standaard)", 61 - "commands.teleport_commands.common.renameExists": "Die Naam Bestaat Al!" 63 + "commands.teleport_commands.common.renameExists": "Die Naam Bestaat Al!", 64 + "commands.teleport_commands.common.noLocation": "Geen Locatie Gevonden!" 62 65 }
+5 -2
common/src/main/resources/assets/teleport_commands/lang/ru_ru.json
··· 1 1 { 2 2 "commands.teleport_commands.back.go": "Возвращение назад", 3 3 "commands.teleport_commands.back.same": "Уже на месте", 4 - "commands.teleport_commands.back.noLocation": "Местоположение не найдено!", 4 + 5 + "commands.teleport_commands.worldspawn.go": "Going To The Worldspawn", 6 + "commands.teleport_commands.worldspawn.same": "Already At Worldspawn", 5 7 6 8 "commands.teleport_commands.home.set": "Дом установлен", 7 9 "commands.teleport_commands.home.setError": "Ошибка установки дома!", ··· 58 60 "commands.teleport_commands.common.rename": "[Переименовать]", 59 61 "commands.teleport_commands.common.delete": "[Удалить]", 60 62 "commands.teleport_commands.common.default": "(По умолчанию)", 61 - "commands.teleport_commands.common.renameExists": "Это имя уже занято!" 63 + "commands.teleport_commands.common.renameExists": "Это имя уже занято!", 64 + "commands.teleport_commands.common.noLocation": "Местоположение не найдено!" 62 65 }
+1 -1
gradle.properties
··· 2 2 # Every field you add must be added to the root build.gradle expandProps map. 3 3 4 4 # Project 5 - version=1.1.3 5 + version=1.2.0 6 6 group=dev.mrsnowy.teleport_commands 7 7 java_version=21 8 8