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.

Stuff is starting to work even more, fixes

+474 -245
+2 -1
.github/workflows/build.yml
··· 26 26 distribution: temurin 27 27 cache: 'gradle' 28 28 - name: build 29 - run: chmod +x ./gradlew && ./gradlew build 29 + run: chmod +x ./gradlew && ./gradlew build && ./gradlew mergeJars 30 30 - name: capture build artifacts 31 31 uses: actions/upload-artifact@v4 32 32 with: 33 33 name: Artifacts 34 34 path: | 35 35 */build/libs 36 + */Merged 36 37 !buildSrc/ 37 38 !common/ 38 39 if-no-files-found: error
+1
.gitignore
··· 16 16 # other 17 17 run 18 18 runs 19 + Merged 19 20 20 21 # java 21 22 hs_err_*.log
+8 -5
CHANGELOG.md
··· 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 7 8 8 ### [W.I.P] 9 - - Storage is loaded in memory instead of reading it again and again, Improves speed and IO usage. (W.I.P) 10 - - Adding comments to alot of code (W.I.P) 11 - - Made it so the DeathLocation is only kept in memory 9 + - Storage is loaded in memory instead of reading it again and again, Improves speed and IO usage, however there might be slightly higher memory usage. 10 + - Adding comments to a lot of code (W.I.P) 11 + - Made it so the DeathLocation (for `/back`) is only kept in memory 12 12 - Improved the Storage classes and functions (I'm doing proper java, yipie) 13 - - Better error handling for command suggestions 13 + - Better error handling for command suggestions. 14 14 - Added hover effects for warp and homes text (W.I.P) 15 - - Throw an exception when the world isn't found (when going back or home), instead of giving an incorrect notFound error. 15 + - Throw a warning and an error message when the world isn't found (when going back, going home or warping), instead of giving an incorrect notFound error. 16 16 - Added a new `home.defaultNone` translation key for when there is no default house set. (before this would give `home.homeless` for some reason) 17 + - Added a new `common.worldNotFound` translation key for when a world cannot be found 18 + - Added a new `common.defaultPrompt` translation key for a new "Set Default" button for `/homes` 19 + - Made it so that when printing the homes or warps, they get sent in one go. 17 20 18 21 ### [v1.2.2] 19 22 - Handled a case where the client (geyser) will return the language as uppercase instead of lowercase.
+1
README.md
··· 38 38 - [ ] `/wild` - Teleports you to a random location in the Overworld 39 39 - [x] `/worldspawn` - Teleports you to the worldspawn 40 40 - [ ] `/spawn <dimension>` - Teleports you to your spawnpoint in a dimension, defaults to your current dimension 41 + - [ ] `/previous` - Go to the last teleported location 41 42 42 43 #### Improvements: 43 44 - [ ] Look into changing the mod into the more safe and sane kotlin (I love java)
+23
build.gradle
··· 1 1 plugins { 2 2 // Required for NeoGradle 3 3 id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" 4 + id "io.github.pacifistmc.forgix" version "1.2.9" 5 + } 6 + 7 + forgix { 8 + group = "dev.mrsnowy.teleport_commands" 9 + mergedJarName = "${mod_id}-${minecraft_version}-${version}.jar" 10 + 11 + // NeoForge Project Configuration 12 + neoforge { 13 + projectName = "neoforge" // Name of the NeoForge subproject 14 + 15 + // // Mixin configuration files (if applicable) 16 + // mixin "${mod_id}.mixins.json" 17 + // mixin "${mod_id}-forge.mixins.json" 18 + jarLocation = "build/libs/${mod_id}-neoforge-${minecraft_version}-${version}.jar" 19 + } 20 + 21 + // Fabric Project Configuration 22 + fabric { 23 + projectName = "fabric" // Name of the Fabric subproject 24 + 25 + jarLocation = "build/libs/${mod_id}-fabric-${minecraft_version}-${version}.jar" 26 + } 4 27 }
+6 -1
buildSrc/src/main/groovy/multiloader-common.gradle
··· 83 83 expand expandProps 84 84 } 85 85 inputs.properties(expandProps) 86 - } 86 + 87 + 88 + filesMatching("version") { 89 + expand(version: project.version) 90 + } 91 + }
+11
buildSrc/src/main/groovy/multiloader-loader.gradle
··· 22 22 } 23 23 24 24 tasks.named('compileJava', JavaCompile) { 25 + doFirst { 26 + fileTree('src/main/java').matching { 27 + include 'path/to/TeleportCommands.java' 28 + }.each { File file -> 29 + def text = file.text 30 + text = text.replace('${version}', project.version.toString()) 31 + .replace('${mod_id}', mod_id.toString()) 32 + .replace('${mod_name}', mod_name.toString()) 33 + file.text = text 34 + } 35 + } 25 36 dependsOn(configurations.commonJava) 26 37 source(configurations.commonJava) 27 38 }
+15 -3
common/src/main/java/dev/mrsnowy/teleport_commands/TeleportCommands.java
··· 11 11 import org.slf4j.Logger; 12 12 import org.slf4j.LoggerFactory; 13 13 14 - import java.io.FileReader; 15 - import java.io.IOException; 14 + import java.io.*; 15 + import java.nio.charset.StandardCharsets; 16 16 import java.nio.file.Files; 17 17 import java.nio.file.Path; 18 18 import java.nio.file.Paths; 19 19 import java.nio.file.StandardOpenOption; 20 + import java.util.Objects; 20 21 21 22 import net.minecraft.core.BlockPos; 22 23 ··· 25 26 public class TeleportCommands { 26 27 public static final String MOD_ID = "teleport_commands"; 27 28 public static final String MOD_NAME = "Teleport Commands"; 29 + public static String VERSION = "unknown"; 28 30 public static final Logger LOGGER = LoggerFactory.getLogger(MOD_NAME); 29 31 public static String MOD_LOADER; 30 32 public static Path SAVE_DIR; ··· 34 36 35 37 // Gets ran when the server starts 36 38 public static void initializeMod(MinecraftServer server) { 39 + 40 + InputStream stream = TeleportCommands.class.getResourceAsStream("/version"); 41 + try { 42 + BufferedReader reader = new BufferedReader(new InputStreamReader(Objects.requireNonNull(stream, "Couldn't find the version file!"), StandardCharsets.UTF_8)); 43 + VERSION = reader.readLine(); 44 + 45 + } catch (Exception e) { 46 + LOGGER.error("Couldn't find the version file!"); 47 + } 48 + 37 49 // initialize da variables 38 - LOGGER.info("Initializing Teleport Commands! Hello {}!", MOD_LOADER); 50 + LOGGER.info("Initializing Teleport Commands (V{})! Hello {}!", VERSION, MOD_LOADER); 39 51 40 52 SAVE_DIR = Path.of(String.valueOf(server.getWorldPath(LevelResource.ROOT))); 41 53
+11 -4
common/src/main/java/dev/mrsnowy/teleport_commands/commands/back.java
··· 7 7 8 8 import dev.mrsnowy.teleport_commands.storage.DeathLocationStorage; 9 9 import dev.mrsnowy.teleport_commands.common.DeathLocation; 10 + import dev.mrsnowy.teleport_commands.utils.tools; 10 11 import net.minecraft.ChatFormatting; 11 12 import net.minecraft.commands.Commands; 12 13 import net.minecraft.core.BlockPos; ··· 73 74 74 75 DeathLocation deathLocation = optionalDeathLocation.get(); 75 76 76 - // get the world, otherwise throw an exception 77 + // Get the world, otherwise give a warning and error message 77 78 Optional<ServerLevel> optionalWorld = deathLocation.getWorld(); 79 + 78 80 if (optionalWorld.isEmpty()) { 79 - // todo! test this exception 81 + TeleportCommands.LOGGER.warn("({}) Error while going back! \nCouldn't find a world with the id: \"{}\" \nAvailable worlds: {}", 82 + player.getName().getString(), 83 + deathLocation.getWorldString(), 84 + tools.getWorldIds()); 85 + 86 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.worldNotFound", player) 87 + .withStyle(ChatFormatting.RED, ChatFormatting.BOLD), true); 80 88 81 - throw new Exception( String.format("Couldn't find a world with the id: %s \nAvailable worlds: %s", 82 - deathLocation.getWorldString(), TeleportCommands.SERVER.getAllLevels())); 89 + return; 83 90 } 84 91 85 92 ServerLevel deathLocationWorld = optionalWorld.get();
+134 -91
common/src/main/java/dev/mrsnowy/teleport_commands/commands/home.java
··· 7 7 import dev.mrsnowy.teleport_commands.common.Player; 8 8 import dev.mrsnowy.teleport_commands.suggestions.HomeSuggestionProvider; 9 9 10 + import java.awt.*; 10 11 import java.util.List; 11 12 import java.util.Optional; 12 13 14 + import dev.mrsnowy.teleport_commands.utils.tools; 13 15 import net.minecraft.ChatFormatting; 14 16 import net.minecraft.commands.Commands; 15 17 import net.minecraft.core.BlockPos; 16 18 import net.minecraft.network.chat.ClickEvent; 17 19 import net.minecraft.network.chat.Component; 20 + import net.minecraft.network.chat.HoverEvent; 21 + import net.minecraft.network.chat.MutableComponent; 18 22 import net.minecraft.server.level.ServerLevel; 19 23 import net.minecraft.server.level.ServerPlayer; 20 24 import net.minecraft.world.phys.Vec3; 25 + import org.apache.logging.log4j.core.config.builder.api.ComponentBuilder; 21 26 22 27 import static dev.mrsnowy.teleport_commands.storage.StorageManager.STORAGE; 23 28 import static dev.mrsnowy.teleport_commands.utils.tools.getTranslatedText; 24 29 import static net.minecraft.commands.Commands.argument; 25 - import static dev.mrsnowy.teleport_commands.storage.StorageManager.StorageSaver; 26 30 import static dev.mrsnowy.teleport_commands.utils.tools.Teleporter; 27 31 28 32 public class home { ··· 201 205 String defaultHome = playerStorage.getDefaultHome(); 202 206 203 207 if (defaultHome.isEmpty()) { 204 - // todo! test if this translation key works correctly! 208 + // No default home set! 205 209 player.displayClientMessage(getTranslatedText("commands.teleport_commands.home.defaultNone", player).withStyle(ChatFormatting.AQUA), true); 210 + 206 211 return; 207 212 } else { 208 213 homeName = defaultHome; ··· 218 223 219 224 NamedLocation home = optionalHome.get(); 220 225 221 - // Get the world, otherwise throw an exception 222 - ServerLevel homeWorld = home.getWorld().orElseThrow(() -> { 223 - // todo! test this exception 224 - return new Exception( String.format("Couldn't find a world with the id: %s \nAvailable worlds: %s", 225 - home.getWorldString(), TeleportCommands.SERVER.getAllLevels())); 226 - }); 226 + // Get the world, otherwise give a warning and error message 227 + Optional<ServerLevel> optionalWorld = home.getWorld(); 228 + 229 + if (optionalWorld.isEmpty()) { 230 + TeleportCommands.LOGGER.warn("({}) Error while going to the home \"{}\"! \nCouldn't find a world with the id: \"{}\" \nAvailable worlds: {}", 231 + player.getName().getString(), 232 + home.getName(), 233 + home.getWorldString(), 234 + tools.getWorldIds()); 235 + 236 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.worldNotFound", player) 237 + .withStyle(ChatFormatting.RED, ChatFormatting.BOLD), true); 238 + 239 + return; 240 + } 241 + 242 + ServerLevel homeWorld = optionalWorld.get(); 227 243 228 244 BlockPos teleportBlockPos = home.getBlockPos(); 229 245 ··· 340 356 } 341 357 342 358 private static void PrintHomes(ServerPlayer player) throws Exception { 343 - 344 - // todo! fix the values 345 - 346 - // Gets player storage 359 + // Gets player storage, if no storage then the player is homeless! 347 360 Optional<Player> optionalPlayerStorage = STORAGE.getPlayer(player.getStringUUID()); 348 361 if (optionalPlayerStorage.isEmpty()) { 349 362 player.displayClientMessage(getTranslatedText("commands.teleport_commands.home.homeless", player).withStyle(ChatFormatting.AQUA), true); ··· 360 373 return; 361 374 } 362 375 363 - // Print the stuffz 376 + MutableComponent message = Component.empty(); 364 377 365 - player.displayClientMessage(getTranslatedText("commands.teleport_commands.homes.homes", player).withStyle(ChatFormatting.YELLOW, ChatFormatting.BOLD) 366 - .append("\n"), false); 378 + // make da message 379 + message.append(getTranslatedText("commands.teleport_commands.homes.homes", player) 380 + .withStyle(ChatFormatting.YELLOW, ChatFormatting.BOLD) 381 + ); 382 + 367 383 368 - // todo! Make it send it all at once? 369 384 for (NamedLocation currentHome : homes) { 370 - 371 385 String name = String.format(" - %s", currentHome.getName()); 372 386 String coords = String.format("[X%d Y%d Z%d]", currentHome.getX(), currentHome.getY(), currentHome.getZ()); 373 387 String dimension = String.format(" [%s]", currentHome.getWorldString()); 374 388 375 - // Check if the home is the default home, then add text showcasing that it is 389 + // linebreak 390 + message.append("\n"); 391 + 392 + // Name of the home 393 + message.append(Component.literal(name) 394 + .withStyle(ChatFormatting.AQUA) 395 + ); 396 + 397 + // If it is the default home, show that it is 376 398 if (playerStorage.getDefaultHome().equals(currentHome.getName())) { 377 - player.displayClientMessage(Component.literal(name) 378 - .withStyle(ChatFormatting.AQUA) 379 - .append(" ") 380 - .append(getTranslatedText("commands.teleport_commands.common.default", player) 381 - .withStyle(ChatFormatting.AQUA, ChatFormatting.BOLD) 382 - ), 383 - false 384 - ); 385 - } else { 386 - player.displayClientMessage(Component.literal(name).withStyle(ChatFormatting.AQUA), false); 399 + 400 + message.append(" ") 401 + .append(getTranslatedText("commands.teleport_commands.common.default", player) 402 + .withStyle(ChatFormatting.AQUA, ChatFormatting.BOLD) 403 + ); 387 404 } 388 405 406 + // linebreak 407 + message.append("\n"); 408 + 389 409 // Cords and dimension 390 - player.displayClientMessage(Component.literal(" | ") 410 + message.append(Component.literal(" | ") 391 411 .withStyle(ChatFormatting.AQUA) 392 - .append(Component.literal(coords) 393 - .withStyle(ChatFormatting.LIGHT_PURPLE) 394 - .withStyle(style -> 395 - style.withClickEvent( 396 - new ClickEvent( 397 - ClickEvent.Action.COPY_TO_CLIPBOARD, 398 - String.format("X%d Y%d Z%d", currentHome.getX(), currentHome.getY(), currentHome.getZ()) 399 - ) 412 + ) 413 + .append(Component.literal(coords) 414 + .withStyle(ChatFormatting.LIGHT_PURPLE) 415 + .withStyle(style -> 416 + style.withClickEvent( 417 + new ClickEvent( 418 + ClickEvent.Action.COPY_TO_CLIPBOARD, 419 + String.format("X%d Y%d Z%d", currentHome.getX(), currentHome.getY(), currentHome.getZ()) 400 420 ) 401 421 ) 402 422 ) 403 - .append(Component.literal(dimension) 404 - .withStyle(ChatFormatting.DARK_PURPLE) 405 - .withStyle(style -> 406 - style.withClickEvent( 407 - new ClickEvent( 408 - ClickEvent.Action.COPY_TO_CLIPBOARD, 409 - currentHome.getWorldString() 410 - ) 411 - ) 412 - ) 413 - ), 414 - false 415 - ); 416 - 417 - // Teleport, rename and delete buttons 418 - player.displayClientMessage(Component.literal(" | ").withStyle(ChatFormatting.AQUA) 419 - .append(getTranslatedText("commands.teleport_commands.common.tp", player) 420 - .withStyle(ChatFormatting.GREEN) 421 - .withStyle(style -> 422 - style.withClickEvent( 423 - new ClickEvent( 424 - ClickEvent.Action.RUN_COMMAND, 425 - String.format("/home %s", currentHome.getName()) 426 - ) 423 + .withStyle(style -> 424 + style.withHoverEvent(new HoverEvent( 425 + HoverEvent.Action.SHOW_TEXT, 426 + getTranslatedText("commands.teleport_commands.common.hoverCopy", player) 427 + )) 428 + ) 429 + ) 430 + .append(Component.literal(dimension) 431 + .withStyle(ChatFormatting.DARK_PURPLE) 432 + .withStyle(style -> 433 + style.withClickEvent( 434 + new ClickEvent( 435 + ClickEvent.Action.COPY_TO_CLIPBOARD, 436 + currentHome.getWorldString() 427 437 ) 428 438 ) 429 439 ) 430 - .append(" ") 431 - .append(getTranslatedText("commands.teleport_commands.common.rename", player) 432 - .withStyle(ChatFormatting.BLUE) 433 - .withStyle(style -> 434 - style.withClickEvent( 435 - new ClickEvent( 436 - ClickEvent.Action.SUGGEST_COMMAND, 437 - String.format("/renamehome %s ", currentHome.getName()) 438 - ) 440 + .withStyle(style -> 441 + style.withHoverEvent(new HoverEvent( 442 + HoverEvent.Action.SHOW_TEXT, 443 + getTranslatedText("commands.teleport_commands.common.hoverCopy", player) 444 + )) 445 + ) 446 + ); 447 + 448 + // linebreak 449 + message.append("\n"); 450 + 451 + // Teleport, rename, set default and delete buttons 452 + message.append(Component.literal(" | ") 453 + .withStyle(ChatFormatting.AQUA) 454 + ) 455 + .append(getTranslatedText("commands.teleport_commands.common.tp", player) 456 + .withStyle(ChatFormatting.GREEN) 457 + .withStyle(style -> 458 + style.withClickEvent( 459 + new ClickEvent( 460 + ClickEvent.Action.RUN_COMMAND, 461 + String.format("/home %s", currentHome.getName()) 439 462 ) 440 463 ) 441 464 ) 442 - .append(" ") 443 - .append(getTranslatedText("commands.teleport_commands.common.default", player) 444 - .withStyle(ChatFormatting.DARK_BLUE) 445 - .withStyle(style -> 446 - style.withClickEvent( 447 - new ClickEvent( 448 - ClickEvent.Action.RUN_COMMAND, 449 - String.format("/defaulthome %s", currentHome.getName()) 450 - ) 465 + ) 466 + .append(" ") 467 + .append(getTranslatedText("commands.teleport_commands.common.rename", player) 468 + .withStyle(ChatFormatting.BLUE) 469 + .withStyle(style -> 470 + style.withClickEvent( 471 + new ClickEvent( 472 + ClickEvent.Action.SUGGEST_COMMAND, 473 + String.format("/renamehome %s ", currentHome.getName()) 451 474 ) 452 475 ) 453 476 ) 454 - .append(" ") 455 - .append(getTranslatedText("commands.teleport_commands.common.delete", player) 456 - .withStyle(ChatFormatting.RED) 457 - .withStyle(style -> 458 - style.withClickEvent( 459 - new ClickEvent( 460 - ClickEvent.Action.SUGGEST_COMMAND, 461 - String.format("/delhome %s", currentHome.getName()) 462 - ) 477 + ) 478 + .append(" "); 479 + 480 + // add set default button if it isn't the default home 481 + if (!playerStorage.getDefaultHome().equals(currentHome.getName())) { 482 + message.append(getTranslatedText("commands.teleport_commands.common.defaultPrompt", player) 483 + .withStyle(ChatFormatting.DARK_AQUA) 484 + .withStyle(style -> 485 + style.withClickEvent( 486 + new ClickEvent( 487 + ClickEvent.Action.RUN_COMMAND, 488 + String.format("/defaulthome %s", currentHome.getName()) 489 + ) 490 + ) 491 + ) 492 + ) 493 + .append(" "); 494 + } 495 + 496 + message.append(getTranslatedText("commands.teleport_commands.common.delete", player) 497 + .withStyle(ChatFormatting.RED) 498 + .withStyle(style -> 499 + style.withClickEvent( 500 + new ClickEvent( 501 + ClickEvent.Action.SUGGEST_COMMAND, 502 + String.format("/delhome %s", currentHome.getName()) 463 503 ) 464 504 ) 465 505 ) 466 - .append("\n"), 467 - false 468 - ); 506 + ); 507 + 508 + // linebreak 509 + message.append("\n"); 469 510 } 470 511 512 + // send the message 513 + player.displayClientMessage(message, false); 471 514 } 472 515 }
+76
common/src/main/java/dev/mrsnowy/teleport_commands/commands/main.java
··· 1 + package dev.mrsnowy.teleport_commands.commands; 2 + 3 + import com.mojang.brigadier.arguments.BoolArgumentType; 4 + import dev.mrsnowy.teleport_commands.TeleportCommands; 5 + import dev.mrsnowy.teleport_commands.common.DeathLocation; 6 + import dev.mrsnowy.teleport_commands.storage.DeathLocationStorage; 7 + import net.minecraft.ChatFormatting; 8 + import net.minecraft.commands.Commands; 9 + import net.minecraft.core.BlockPos; 10 + import net.minecraft.network.chat.ClickEvent; 11 + import net.minecraft.network.chat.Component; 12 + import net.minecraft.server.level.ServerLevel; 13 + import net.minecraft.server.level.ServerPlayer; 14 + import net.minecraft.world.phys.Vec3; 15 + 16 + import java.util.Optional; 17 + 18 + import static dev.mrsnowy.teleport_commands.utils.tools.*; 19 + import static net.minecraft.commands.Commands.argument; 20 + 21 + // TODO! add option to reload registered commands! 22 + 23 + public class main { 24 + 25 + public static void register(Commands commandManager) { 26 + 27 + commandManager.getDispatcher().register(Commands.literal("teleportcommands") 28 + .then(Commands.literal("help") 29 + .requires(source -> source.getPlayer() != null) 30 + .executes(context -> { 31 + final ServerPlayer player = context.getSource().getPlayerOrException(); 32 + 33 + try { 34 + printCommands(player); 35 + 36 + } catch (Exception e) { 37 + TeleportCommands.LOGGER.error("Error while going back! => ", e); 38 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.error", player).withStyle(ChatFormatting.RED, ChatFormatting.BOLD), true); 39 + return 1; 40 + } 41 + return 0; 42 + })) 43 + .then(argument("Disable Safety", BoolArgumentType.bool()) 44 + .requires(source -> source.getPlayer() != null) 45 + .executes(context -> { 46 + final boolean safety = BoolArgumentType.getBool(context, "Disable Safety"); 47 + final ServerPlayer player = context.getSource().getPlayerOrException(); 48 + 49 + try { 50 + // ToDeathLocation(player, safety); 51 + 52 + } catch (Exception e) { 53 + TeleportCommands.LOGGER.error("Error while going back! => ", e); 54 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.error", player).withStyle(ChatFormatting.RED, ChatFormatting.BOLD), true); 55 + return 1; 56 + } 57 + return 0; 58 + })) 59 + ); 60 + } 61 + 62 + 63 + // ----- 64 + 65 + 66 + // Gets the DeathLocation of the player and teleports the player to it 67 + private static void printCommands(ServerPlayer player) throws Exception { 68 + 69 + player.displayClientMessage(Component.literal("Thank you for using Teleport Commands (V)!").withStyle(ChatFormatting.AQUA), false); 70 + player.displayClientMessage(Component.literal("Teleport Commands is a server-side mod that adds various teleportation related commands").withStyle(ChatFormatting.AQUA), false); 71 + 72 + player.displayClientMessage(Component.literal("----").withStyle(ChatFormatting.AQUA), false); 73 + 74 + player.displayClientMessage(Component.literal("Usage:").withStyle(ChatFormatting.AQUA), false); 75 + } 76 + }
+1
common/src/main/java/dev/mrsnowy/teleport_commands/commands/tpa.java
··· 141 141 ToPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.received", ToPlayer, Component.literal(hereText), Component.literal(ReceivedFromPlayer).withStyle(ChatFormatting.AQUA, ChatFormatting.BOLD)).withStyle(ChatFormatting.AQUA) 142 142 .append("\n") 143 143 .append(getTranslatedText("commands.teleport_commands.tpa.accept", ToPlayer).withStyle(ChatFormatting.GREEN, ChatFormatting.BOLD).withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/tpaaccept %s", ReceivedFromPlayer))))) 144 + .append(" ") 144 145 .append(getTranslatedText("commands.teleport_commands.tpa.deny", ToPlayer).withStyle(ChatFormatting.RED, ChatFormatting.BOLD).withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/tpadeny %s", ReceivedFromPlayer))))), 145 146 false 146 147 );
+114 -95
common/src/main/java/dev/mrsnowy/teleport_commands/commands/warp.java
··· 4 4 import dev.mrsnowy.teleport_commands.TeleportCommands; 5 5 import dev.mrsnowy.teleport_commands.common.NamedLocation; 6 6 import dev.mrsnowy.teleport_commands.suggestions.WarpSuggestionProvider; 7 + import dev.mrsnowy.teleport_commands.utils.tools; 7 8 import net.minecraft.ChatFormatting; 8 9 import net.minecraft.commands.Commands; 9 10 import net.minecraft.core.BlockPos; 10 11 import net.minecraft.network.chat.ClickEvent; 11 12 import net.minecraft.network.chat.Component; 12 13 import net.minecraft.network.chat.HoverEvent; 14 + import net.minecraft.network.chat.MutableComponent; 13 15 import net.minecraft.server.level.ServerLevel; 14 16 import net.minecraft.server.level.ServerPlayer; 15 17 import net.minecraft.world.phys.Vec3; ··· 57 59 GoToWarp(player, name); 58 60 59 61 } catch (Exception e) { 60 - TeleportCommands.LOGGER.error("Error while going to the warp!", e); 62 + TeleportCommands.LOGGER.error("Error while going to the warp!",e); 61 63 player.displayClientMessage(getTranslatedText("commands.teleport_commands.warp.goError", player).withStyle(ChatFormatting.RED, ChatFormatting.BOLD), true); 62 64 return 1; 63 65 } ··· 133 135 String worldString = player.serverLevel().dimension().location().toString(); 134 136 135 137 // Check if warp already exists 136 - if ( STORAGE.getWarp(warpName).isEmpty() ) { 138 + if ( STORAGE.getWarp(warpName).isPresent() ) { 137 139 player.displayClientMessage(getTranslatedText("commands.teleport_commands.warp.exists", player).withStyle(ChatFormatting.RED), true); 138 140 return; 139 141 } ··· 157 159 158 160 NamedLocation warp = optionalWarp.get(); 159 161 160 - // Get the world, otherwise throw an exception 161 - ServerLevel warpWorld = warp.getWorld().orElseThrow(() -> { 162 - // todo! test this exception 163 - return new Exception( String.format("Couldn't find a world with the id: %s \nAvailable worlds: %s", 164 - warp.getWorldString(), TeleportCommands.SERVER.getAllLevels())); 165 - }); 162 + // Get the world, otherwise give a warning and error message 163 + Optional<ServerLevel> optionalWorld = warp.getWorld(); 164 + 165 + if (optionalWorld.isEmpty()) { 166 + TeleportCommands.LOGGER.warn("({}) Error while going to the warp \"{}\"! \nCouldn't find a world with the id: \"{}\" \nAvailable worlds: {}", 167 + player.getName().getString(), 168 + warp.getName(), 169 + warp.getWorldString(), 170 + tools.getWorldIds()); 171 + 172 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.worldNotFound", player) 173 + .withStyle(ChatFormatting.RED, ChatFormatting.BOLD), true); 174 + 175 + return; 176 + } 177 + 178 + ServerLevel warpWorld = optionalWorld.get(); 166 179 167 180 BlockPos teleportBlockPos = warp.getBlockPos(); 168 181 ··· 182 195 private static void DeleteWarp(ServerPlayer player, String warpName) throws Exception { 183 196 warpName = warpName.toLowerCase(); 184 197 185 - // todo! maybe replace with ifPresentOrElse 186 198 // get the existing warp 187 199 Optional<NamedLocation> optionalWarp = STORAGE.getWarp(warpName); 188 200 ··· 233 245 return; 234 246 } 235 247 236 - // Print the stuffz 248 + MutableComponent message = Component.empty(); 237 249 238 - player.displayClientMessage(getTranslatedText("commands.teleport_commands.warps.warps", player).withStyle(ChatFormatting.YELLOW, ChatFormatting.BOLD) 239 - .append("\n"), false); 250 + // make da message 251 + message.append(getTranslatedText("commands.teleport_commands.warps.warps", player) 252 + .withStyle(ChatFormatting.YELLOW, ChatFormatting.BOLD) 253 + ); 240 254 241 255 for (NamedLocation currentWarp : warps) { 242 256 ··· 244 258 String coords = String.format("[X%d Y%d Z%d]", currentWarp.getX(), currentWarp.getY(), currentWarp.getZ()); 245 259 String dimension = String.format(" [%s]", currentWarp.getWorldString()); 246 260 247 - player.displayClientMessage(Component.literal(name).withStyle(ChatFormatting.AQUA), false); 261 + boolean canModify = player.hasPermissions(4); 262 + 263 + // linebreak 264 + message.append("\n"); 265 + 266 + // Name of the warp 267 + message.append(Component.literal(name) 268 + .withStyle(ChatFormatting.AQUA) 269 + ); 270 + 271 + // linebreak 272 + message.append("\n"); 248 273 249 - player.displayClientMessage(Component.literal(" | ").withStyle(ChatFormatting.AQUA) 250 - .append(Component.literal(coords) 251 - .withStyle(ChatFormatting.LIGHT_PURPLE) 252 - .withStyle(style -> 253 - style.withClickEvent( 254 - new ClickEvent( 255 - ClickEvent.Action.COPY_TO_CLIPBOARD, 256 - String.format("X%d Y%d Z%d", currentWarp.getX(), currentWarp.getY(), currentWarp.getZ()) 257 - ) 274 + // Cords and dimension 275 + message.append(Component.literal(" | ") 276 + .withStyle(ChatFormatting.AQUA) 277 + ) 278 + .append(Component.literal(coords) 279 + .withStyle(ChatFormatting.LIGHT_PURPLE) 280 + .withStyle(style -> 281 + style.withClickEvent( 282 + new ClickEvent( 283 + ClickEvent.Action.COPY_TO_CLIPBOARD, 284 + String.format("X%d Y%d Z%d", currentWarp.getX(), currentWarp.getY(), currentWarp.getZ()) 258 285 ) 259 286 ) 260 - //todo! test the hover 261 - .withStyle(style -> 262 - style.withHoverEvent(new HoverEvent( 263 - HoverEvent.Action.SHOW_TEXT, getTranslatedText("commands.teleport_commands.common.hoverCopy", player) 264 - )) 265 - ) 266 287 ) 267 - .append(Component.literal(dimension) 268 - .withStyle(ChatFormatting.DARK_PURPLE) 269 - .withStyle(style -> 270 - style.withClickEvent( 271 - new ClickEvent( 272 - ClickEvent.Action.COPY_TO_CLIPBOARD, 273 - currentWarp.getWorldString() 274 - ) 288 + .withStyle(style -> 289 + style.withHoverEvent(new HoverEvent( 290 + HoverEvent.Action.SHOW_TEXT, 291 + getTranslatedText("commands.teleport_commands.common.hoverCopy", player) 292 + )) 293 + ) 294 + ) 295 + .append(Component.literal(dimension) 296 + .withStyle(ChatFormatting.DARK_PURPLE) 297 + .withStyle(style -> 298 + style.withClickEvent( 299 + new ClickEvent( 300 + ClickEvent.Action.COPY_TO_CLIPBOARD, 301 + currentWarp.getWorldString() 275 302 ) 276 303 ) 277 - .withStyle(style -> style 278 - .withHoverEvent( 279 - new HoverEvent( 280 - HoverEvent.Action.SHOW_TEXT, 281 - getTranslatedText("commands.teleport_commands.common.hoverCopy", player) 282 - ) 304 + ) 305 + .withStyle(style -> style 306 + .withHoverEvent( 307 + new HoverEvent( 308 + HoverEvent.Action.SHOW_TEXT, 309 + getTranslatedText("commands.teleport_commands.common.hoverCopy", player) 283 310 ) 284 311 ) 285 - ), 286 - false 287 - ); 312 + ) 313 + ); 288 314 289 - // todo! maybe make this a boolean at the begging of the function. 290 - if (player.hasPermissions(4)) { 291 - player.displayClientMessage(Component.literal(" | ").withStyle(ChatFormatting.AQUA) 292 - .append(getTranslatedText("commands.teleport_commands.common.tp", player) 293 - .withStyle(ChatFormatting.GREEN) 294 - .withStyle(style -> 295 - style.withClickEvent(new ClickEvent( 296 - ClickEvent.Action.RUN_COMMAND, 297 - String.format("/warp %s", currentWarp.getName()) 298 - )) 299 - ) 300 - ) 301 - .append(" ") 302 - .append(getTranslatedText("commands.teleport_commands.common.rename", player) 303 - .withStyle(ChatFormatting.BLUE) 304 - .withStyle(style -> style 305 - .withClickEvent(new ClickEvent( 306 - ClickEvent.Action.SUGGEST_COMMAND, 307 - String.format("/renamewarp %s ", currentWarp.getName())) 308 - ) 309 - ) 310 - ) 311 - .append(" ") 312 - .append(getTranslatedText("commands.teleport_commands.common.delete", player) 313 - .withStyle(ChatFormatting.RED) 314 - .withStyle(style -> style 315 - .withClickEvent(new ClickEvent( 316 - ClickEvent.Action.SUGGEST_COMMAND, 317 - String.format("/delwarp %s", currentWarp.getName())) 318 - ) 319 - ) 320 - ) 321 - .append("\n"), 322 - false 323 - ); 324 - } else { 325 - player.displayClientMessage(Component.literal(" | ") 326 - .withStyle(ChatFormatting.AQUA) 327 - .append(getTranslatedText("commands.teleport_commands.common.tp", player) 328 - .withStyle(ChatFormatting.GREEN) 329 - .withStyle(style -> style 330 - .withClickEvent(new ClickEvent( 331 - ClickEvent.Action.RUN_COMMAND, 332 - String.format("/warp %s", currentWarp.getName())) 333 - ) 334 - ) 335 - ) 336 - .append("\n"), 337 - false 338 - ); 315 + // linebreak 316 + message.append("\n"); 317 + 318 + // Teleport button 319 + message.append(Component.literal(" | ").withStyle(ChatFormatting.AQUA)) 320 + .append(getTranslatedText("commands.teleport_commands.common.tp", player) 321 + .withStyle(ChatFormatting.GREEN) 322 + .withStyle(style -> 323 + style.withClickEvent(new ClickEvent( 324 + ClickEvent.Action.RUN_COMMAND, 325 + String.format("/warp %s", currentWarp.getName()) 326 + )) 327 + ) 328 + ) 329 + .append(" "); 330 + 331 + // Rename and delete buttons if admin 332 + if (canModify) { 333 + message.append(getTranslatedText("commands.teleport_commands.common.rename", player) 334 + .withStyle(ChatFormatting.BLUE) 335 + .withStyle(style -> style 336 + .withClickEvent(new ClickEvent( 337 + ClickEvent.Action.SUGGEST_COMMAND, 338 + String.format("/renamewarp %s ", currentWarp.getName())) 339 + ) 340 + ) 341 + ) 342 + .append(" ") 343 + .append(getTranslatedText("commands.teleport_commands.common.delete", player) 344 + .withStyle(ChatFormatting.RED) 345 + .withStyle(style -> style 346 + .withClickEvent(new ClickEvent( 347 + ClickEvent.Action.SUGGEST_COMMAND, 348 + String.format("/delwarp %s", currentWarp.getName())) 349 + ) 350 + ) 351 + ); 339 352 } 353 + 354 + // linebreak 355 + message.append("\n"); 340 356 } 357 + 358 + // send the message 359 + player.displayClientMessage(message, false); 341 360 } 342 361 }
+7
common/src/main/java/dev/mrsnowy/teleport_commands/storage/configManager.java
··· 3 3 public class configManager { 4 4 // Currently nothing to see here... yet 5 5 6 + // --- Ideas! --- 7 + // Make config options for disabling certain commands 8 + // Make config options for renaming certain commands 9 + // Make config option for changing required permission level for certain commands 10 + // Make config for setting max homes 11 + // Make config that adds a delay between teleports and when fighting. (in teleport function?) 12 + // Make config that automatically deletes namedLocations (warps/homes) with invalid world id's 6 13 }
+11
common/src/main/java/dev/mrsnowy/teleport_commands/utils/tools.java
··· 8 8 import java.util.*; 9 9 import java.util.regex.Matcher; 10 10 import java.util.regex.Pattern; 11 + import java.util.stream.StreamSupport; 11 12 12 13 import net.minecraft.core.BlockPos; 13 14 import net.minecraft.core.particles.ParticleTypes; ··· 107 108 108 109 // Gets the translated text for each player based on their language, this is fully server side and actually works (UNLIKE MOJANG'S TRANSLATED KEY'S WHICH ARE CLIENT SIDE) (I'm not mad, I swear!) 109 110 public static MutableComponent getTranslatedText(String key, ServerPlayer player, MutableComponent... args) { 111 + //todo! maybe make this also loaded in memory? 110 112 String language = player.clientInformation().language().toLowerCase(); 111 113 String regex = "%(\\d+)%"; 112 114 Pattern pattern = Pattern.compile(regex); ··· 175 177 return Component.literal(key); 176 178 } 177 179 } 180 + 181 + 182 + // Gets the ids of all the worlds 183 + public static List<String> getWorldIds() { 184 + return StreamSupport.stream(TeleportCommands.SERVER.getAllLevels().spliterator(), false) 185 + .map(level -> level.dimension().location().toString()) 186 + .toList(); 187 + } 188 + 178 189 179 190 // todo! test 180 191 // checks if a BlockPos is safe, used by the teleportSafetyChecker.
+21 -20
common/src/main/resources/assets/teleport_commands/lang/en_us.json
··· 3 3 "commands.teleport_commands.back.same": "Already Back", 4 4 5 5 "commands.teleport_commands.worldspawn.go": "Going To The Worldspawn", 6 - "commands.teleport_commands.worldspawn.same": "Already At Worldspawn", 6 + "commands.teleport_commands.worldspawn.same": "Already At The Worldspawn", 7 7 8 8 "commands.teleport_commands.home.set": "Home Set", 9 9 "commands.teleport_commands.home.setError": "Error Setting Home!", ··· 13 13 "commands.teleport_commands.home.delete": "Home Deleted", 14 14 "commands.teleport_commands.home.deleteError": "Error Deleting Home!", 15 15 "commands.teleport_commands.home.rename": "Home Renamed", 16 - "commands.teleport_commands.home.renameError": "Error Renaming Home!", 17 - "commands.teleport_commands.home.default": "Default Home Set", 16 + "commands.teleport_commands.home.renameError": "Error renaming home!", 17 + "commands.teleport_commands.home.default": "Default home set", 18 18 "commands.teleport_commands.home.defaultNone": "No default home set!", 19 - "commands.teleport_commands.home.defaultError": "Error Changing Default Home!", 19 + "commands.teleport_commands.home.defaultError": "Error changing the default home!", 20 20 "commands.teleport_commands.home.defaultSame": "Home is already set as default!", 21 21 "commands.teleport_commands.home.notFound": "Home Not Found!", 22 - "commands.teleport_commands.home.exists": "Home Already Exists!", 23 - "commands.teleport_commands.home.homeless": "You Have No Homes!", 22 + "commands.teleport_commands.home.exists": "Home already exists!", 23 + "commands.teleport_commands.home.homeless": "You have no Homes!", 24 24 25 - "commands.teleport_commands.homes.error": "Error Getting Homes!", 25 + "commands.teleport_commands.homes.error": "Error getting homes!", 26 26 "commands.teleport_commands.homes.homes": "Homes:", 27 27 28 28 "commands.teleport_commands.warp.set": "Warp set", ··· 43 43 44 44 "commands.teleport_commands.tpa.self": "Well, that was easy", 45 45 "commands.teleport_commands.tpa.alreadySent": "A request has already been sent to %0%", 46 - "commands.teleport_commands.tpa.received": "Tpa%0% Request Received From %1%", 47 - "commands.teleport_commands.tpa.sent": "Tpa%0% Request Sent to %1%", 46 + "commands.teleport_commands.tpa.received": "Tpa%0% request received from %1%", 47 + "commands.teleport_commands.tpa.sent": "Tpa%0% request sent to %1%", 48 48 "commands.teleport_commands.tpa.accept": "[Accept]", 49 - "commands.teleport_commands.tpa.deny": " [Deny]", 50 - "commands.teleport_commands.tpa.expired": "Tpa%0% Request Expired", 51 - "commands.teleport_commands.tpa.notFound": "No Requests found!", 52 - "commands.teleport_commands.tpa.accepted": "Request Accepted", 53 - "commands.teleport_commands.tpa.denied": "Request Denied", 49 + "commands.teleport_commands.tpa.deny": "[Deny]", 50 + "commands.teleport_commands.tpa.expired": "Tpa%0% request expired", 51 + "commands.teleport_commands.tpa.notFound": "No requests found!", 52 + "commands.teleport_commands.tpa.accepted": "Request accepted", 53 + "commands.teleport_commands.tpa.denied": "Request denied", 54 54 55 55 "commands.teleport_commands.common.teleport": "Teleporting", 56 - "commands.teleport_commands.common.error": "Error Teleporting!", 57 - "commands.teleport_commands.common.noSafeLocation": "No Safe Location Found!", 56 + "commands.teleport_commands.common.error": "Error teleporting!", 57 + "commands.teleport_commands.common.noSafeLocation": "No safe location found!", 58 58 "commands.teleport_commands.common.safetyIsForLosers": "Teleport anyways? (Warning, you might die!)", 59 - "commands.teleport_commands.common.forceTeleport": "[Force Teleport]", 59 + "commands.teleport_commands.common.forceTeleport": "[Force teleport]", 60 60 "commands.teleport_commands.common.tp": "[Tp]", 61 61 "commands.teleport_commands.common.rename": "[Rename]", 62 62 "commands.teleport_commands.common.delete": "[Delete]", 63 63 "commands.teleport_commands.common.default": "(Default)", 64 - "commands.teleport_commands.common.renameExists": "That Name Already Exists!", 65 - "commands.teleport_commands.common.noLocation": "No Location Found!", 66 - "commands.teleport_commands.common.hoverCopy": "Click to copy!" 64 + "commands.teleport_commands.common.defaultPrompt": "[Set Default]", 65 + "commands.teleport_commands.common.noLocation": "No location found!", 66 + "commands.teleport_commands.common.hoverCopy": "Click to copy!", 67 + "commands.teleport_commands.common.worldNotFound": "World not found!" 67 68 }
+4 -3
common/src/main/resources/assets/teleport_commands/lang/hu_hu.json
··· 46 46 "commands.teleport_commands.tpa.received": "Tpa%0% kérés megkapva %1%-től", 47 47 "commands.teleport_commands.tpa.sent": "tpa%0% kérés elküldve %1%-nek", 48 48 "commands.teleport_commands.tpa.accept": "[Elfogadás]", 49 - "commands.teleport_commands.tpa.deny": " [Elutasítás]", 49 + "commands.teleport_commands.tpa.deny": "[Elutasítás]", 50 50 "commands.teleport_commands.tpa.expired": "Tpa%0% kérés lejárt", 51 51 "commands.teleport_commands.tpa.notFound": "Semmi kérésed sincsen!", 52 52 "commands.teleport_commands.tpa.accepted": "Elfogadva", ··· 61 61 "commands.teleport_commands.common.rename": "[Átnevezés]", 62 62 "commands.teleport_commands.common.delete": "[Törlés]", 63 63 "commands.teleport_commands.common.default": "(Alap)", 64 - "commands.teleport_commands.common.renameExists": "A név már létezik!", 64 + "commands.teleport_commands.common.defaultPrompt": "[Set Default]", 65 65 "commands.teleport_commands.common.noLocation": "Nem található a koordináta", 66 - "commands.teleport_commands.common.hoverCopy": "Click to copy!" 66 + "commands.teleport_commands.common.hoverCopy": "Click to copy!", 67 + "commands.teleport_commands.common.worldNotFound": "World not found!" 67 68 }
+3 -2
common/src/main/resources/assets/teleport_commands/lang/it_it.json
··· 61 61 "commands.teleport_commands.common.rename": "[Rinomina]", 62 62 "commands.teleport_commands.common.delete": "[Elimina]", 63 63 "commands.teleport_commands.common.default": "(Predefinita)", 64 - "commands.teleport_commands.common.renameExists": "Quel Nome Esiste Già!", 64 + "commands.teleport_commands.common.defaultPrompt": "[Set Default]", 65 65 "commands.teleport_commands.common.noLocation": "Nessuna Posizione Trovata!", 66 - "commands.teleport_commands.common.hoverCopy": "Click to copy!" 66 + "commands.teleport_commands.common.hoverCopy": "Click to copy!", 67 + "commands.teleport_commands.common.worldNotFound": "World not found!" 67 68 }
+5 -4
common/src/main/resources/assets/teleport_commands/lang/nl_nl.json
··· 19 19 "commands.teleport_commands.home.defaultError": "Probleem Tijdens Het Wijzigen Van Het Standaard Huis!", 20 20 "commands.teleport_commands.home.defaultSame": "Huis is al als standaard ingesteld!", 21 21 "commands.teleport_commands.home.notFound": "Huis Niet Gevonden!", 22 - "commands.teleport_commands.home.exists": "Dat huis bestaad Al!", 22 + "commands.teleport_commands.home.exists": "Dat huis bestaad al!", 23 23 "commands.teleport_commands.home.homeless": "Je Hebt Geen Huizen!", 24 24 25 25 "commands.teleport_commands.homes.error": "Probleem Bij Het Ophalen Van De Huizen!", ··· 46 46 "commands.teleport_commands.tpa.received": "Tpa%0% Verzoek Ontvangen Van %1%", 47 47 "commands.teleport_commands.tpa.sent": "Tpa%0% Verzoek Verzonden Naar %1%", 48 48 "commands.teleport_commands.tpa.accept": "[Accepteren]", 49 - "commands.teleport_commands.tpa.deny": " [Weigeren]", 49 + "commands.teleport_commands.tpa.deny": "[Weigeren]", 50 50 "commands.teleport_commands.tpa.expired": "Tpa%0% Verzoek Verlopen", 51 51 "commands.teleport_commands.tpa.notFound": "Geen Verzoeken Gevonden!", 52 52 "commands.teleport_commands.tpa.accepted": "Verzoek Geaccepteerd", ··· 61 61 "commands.teleport_commands.common.rename ": "[Naam Wijzigen]", 62 62 "commands.teleport_commands.common.delete": "[Verwijderen]", 63 63 "commands.teleport_commands.common.default": "(Standaard)", 64 - "commands.teleport_commands.common.renameExists": "Die Naam Bestaat Al!", 64 + "commands.teleport_commands.common.defaultPrompt": "[Standaard instellen]", 65 65 "commands.teleport_commands.common.noLocation": "Geen Locatie Gevonden!", 66 - "commands.teleport_commands.common.hoverCopy": "Klik om te kopiëren!" 66 + "commands.teleport_commands.common.hoverCopy": "Klik om te kopiëren!", 67 + "commands.teleport_commands.common.worldNotFound": "Wereld niet gevonden!" 67 68 }
+3 -2
common/src/main/resources/assets/teleport_commands/lang/ru_ru.json
··· 61 61 "commands.teleport_commands.common.rename": "[Переименовать]", 62 62 "commands.teleport_commands.common.delete": "[Удалить]", 63 63 "commands.teleport_commands.common.default": "(По умолчанию)", 64 - "commands.teleport_commands.common.renameExists": "Это имя уже занято!", 64 + "commands.teleport_commands.common.defaultPrompt": "[Set Default]", 65 65 "commands.teleport_commands.common.noLocation": "Местоположение не найдено!", 66 - "commands.teleport_commands.common.hoverCopy": "Нажмите, чтобы скопировать!" 66 + "commands.teleport_commands.common.hoverCopy": "Нажмите, чтобы скопировать!", 67 + "commands.teleport_commands.common.worldNotFound": "World not found!" 67 68 }
+8 -8
common/src/main/resources/assets/teleport_commands/lang/translations.md
··· 4 4 I also want to thank everyone who made a translation for this mod! This makes the mod more accessible for everyone. 5 5 6 6 Things to know: 7 - - The "%number%" are placeholders, The number indicates what it needs to be replaced with. 7 + - The "%number%" are placeholders, The number indicates what it needs to be replaced with. (For example `Tpa%0%` will become `TpaHere` or `Tpa`, this allows the translations to be more flexible) 8 8 - funny things are allowed, as long as they don't make the mod less accessible or cluttered! 9 9 10 10 #### Want to make a translation? 11 - 1. Make a fork of the mod 12 - 2. Go [here](https://minecraft.wiki/w/Language) and pick the in-game locale code for the language you want to translate 13 - 3. Copy `en_us.json` and paste it in a new file called `[in-game locale code here].json` 14 - 4. Translate the values in the file 15 - 5. Submit a pull request with your translation :D! 11 + 1. Make a fork of the mod ([Guide here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo#forking-a-repository)) 12 + 2. Go [here](https://minecraft.wiki/w/Language) and pick the in-game locale code for the language you want to translate. (for example: `en_us`) 13 + 3. Copy `en_us.json` and paste it in a new file called `[in-game locale code here].json` (in the same directory!) 14 + 4. Translate the values in the file (`"commands.teleport_commands.XX.XX": "Translate this!",`) 15 + 5. Submit a pull request with your translation :D! ([Guide here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request#creating-the-pull-request)) 16 16 17 17 #### Want to improve an existing translation? 18 - 1. Make a fork of the mod 18 + 1. Make a fork of the mod ([Guide here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo#forking-a-repository)) 19 19 2. Modify the existing translation in the mod 20 - 3. Submit a pull request with your changes :D! 20 + 3. Submit a pull request with your changes :D! ([Guide here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request#creating-the-pull-request)) 21 21 22 22 23 23 #### Credits
+4 -3
common/src/main/resources/assets/teleport_commands/lang/zh_cn.json
··· 46 46 "commands.teleport_commands.tpa.received": "Tpa%0% 请求来自 %1%", 47 47 "commands.teleport_commands.tpa.sent": "Tpa%0% 请求已发送到 %1%", 48 48 "commands.teleport_commands.tpa.accept": "[接受]", 49 - "commands.teleport_commands.tpa.deny": " [拒绝]", 49 + "commands.teleport_commands.tpa.deny": "[拒绝]", 50 50 "commands.teleport_commands.tpa.expired": "Tpa%0% 请求已过期", 51 51 "commands.teleport_commands.tpa.notFound": "没找到请求!", 52 52 "commands.teleport_commands.tpa.accepted": "请求已同意", ··· 61 61 "commands.teleport_commands.common.rename": "[重命名]", 62 62 "commands.teleport_commands.common.delete": "[删除]", 63 63 "commands.teleport_commands.common.default": "(默认)", 64 - "commands.teleport_commands.common.renameExists": "这个名称已经存在了!", 64 + "commands.teleport_commands.common.defaultPrompt": "[Set Default]", 65 65 "commands.teleport_commands.common.noLocation": "找不到位置!", 66 - "commands.teleport_commands.common.hoverCopy": "点击以复制!" 66 + "commands.teleport_commands.common.hoverCopy": "点击以复制!", 67 + "commands.teleport_commands.common.worldNotFound": "World not found!" 67 68 }
+4 -3
common/src/main/resources/assets/teleport_commands/lang/zh_tw.json
··· 46 46 "commands.teleport_commands.tpa.received": "Tpa%0% 請求來自 %1%", 47 47 "commands.teleport_commands.tpa.sent": "Tpa%0% 請求已發送到 %1%", 48 48 "commands.teleport_commands.tpa.accept": "[接受]", 49 - "commands.teleport_commands.tpa.deny": " [拒絕]", 49 + "commands.teleport_commands.tpa.deny": "[拒絕]", 50 50 "commands.teleport_commands.tpa.expired": "Tpa%0% 請求已過期", 51 51 "commands.teleport_commands.tpa.notFound": "沒找到請求!", 52 52 "commands.teleport_commands.tpa.accepted": "請求已同意", ··· 61 61 "commands.teleport_commands.common.rename": "[重命名]", 62 62 "commands.teleport_commands.common.delete": "[刪除]", 63 63 "commands.teleport_commands.common.default": "(默認)", 64 - "commands.teleport_commands.common.renameExists": "這個名稱已經存在了!", 64 + "commands.teleport_commands.common.defaultPrompt": "[Set Default]", 65 65 "commands.teleport_commands.common.noLocation": "找不到位置!", 66 - "commands.teleport_commands.common.hoverCopy": "點擊以複製!" 66 + "commands.teleport_commands.common.hoverCopy": "點擊以複製!", 67 + "commands.teleport_commands.common.worldNotFound": "World not found!" 67 68 }
+1
common/src/main/resources/version
··· 1 + ${version}