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.20.4-1.20.6] v1.1.0 - Stable

Fixed hopefully all the bugs from the previous beta version. Check out the changelog.md for all the changes in this version!

+293 -393
+2 -4
.github/workflows/build.yml
··· 24 24 with: 25 25 java-version: ${{ matrix.java }} 26 26 distribution: temurin 27 - - name: make gradle wrapper executable 28 - run: chmod +x ./gradlew 27 + cache: 'gradle' 29 28 - name: build 30 - run: ./gradlew shadowJar 29 + run: chmod +x ./gradlew && ./gradlew build 31 30 - name: capture build artifacts 32 - # if: ${{ matrix.java == '17' }} # Only upload artifacts built from latest java 33 31 uses: actions/upload-artifact@v4 34 32 with: 35 33 name: Artifacts
+8 -13
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 - ### [Unreleased] 9 8 10 - 11 - ### [Planned for 1.2.0] 12 - 13 - - Add a Config System 14 - - Add `/spawn` 15 - - Add `/wild` 16 - - Add `/worldspawn` 17 - 18 - 19 - ### [v1.1.0-beta] 9 + ### [v1.1.0] 20 10 21 11 #### Added 22 12 - Added a completely server-side translation system (UNLIKE MOJANG'S SYSTEM WHICH IS CLIENT SIDE) 23 13 - Added a Json Storage cleaner, which automatically cleans and updates any values 24 - - Added a safety check with /back that automatically chooses a nearby safe location 14 + - Added a safety check with `/back` and `/tpa[here]` that automatically chooses a nearby safe location 25 15 - Added quilt support 26 16 - Added a CHANGELOG.md 27 17 - Added Tpa Accept/Deny Suggestions 28 18 - Added Dutch translations 29 19 - Added Hungarian translations (Thanks to [Martin Morningstar](https://github.com/RMI637)) 30 20 31 - 32 21 #### Changed 33 22 - Limited the requests a player can do to the same player to 1 34 23 - Improved command messages and colors ··· 38 27 - Improved performance by changing the death event to be player specific (not all entities) 39 28 - Replaced all loader specific api events with Mixins 40 29 - Edited /back to have a DisableSafety option: `/back [<Disable Safety>]` 30 + - Improved /back and /home `Already there` detection 41 31 42 32 #### Removed 43 33 - Removed Sources and Javadoc files to improve build speed 44 34 - Removed Fabric API dependency 45 35 - Removed pretty json printing (to save storage) 46 36 37 + #### Breaking changes (non-backwards compatible) 38 + - Replaced `Player_UUID` in the storage json to `UUID` 39 + - Changed Death location coords in the storage json from `double` to `int` 40 + - Changed Home coords in the storage json from `double` to `int` 41 + - 47 42 48 43 ### [v1.0.5] 49 44
-2
build.gradle
··· 1 1 plugins { 2 2 // Required for NeoGradle 3 3 id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" 4 - // Required to bundle the toml library 5 - id 'com.github.johnrengelman.shadow' version '8.1.1' 6 4 }
+5 -14
buildSrc/src/main/groovy/multiloader-common.gradle
··· 1 1 plugins { 2 2 id 'java-library' 3 - id 'com.github.johnrengelman.shadow' 4 3 } 5 4 6 5 base { ··· 23 22 24 23 dependencies { 25 24 implementation 'org.jetbrains:annotations:24.1.0' 26 - implementation 'org.tomlj:tomlj:1.1.1' 27 25 } 28 26 29 27 // Declare capabilities on the outgoing configurations. ··· 38 36 // } 39 37 } 40 38 41 - shadowJar { 39 + 40 + jar { 42 41 from(rootProject.file("LICENSE")) { 43 42 rename { "${it}_${mod_name}" } 44 43 } ··· 54 53 'Built-On-Minecraft' : minecraft_version 55 54 ]) 56 55 } 57 - 58 - dependencies { 59 - include(dependency('org.tomlj:tomlj:1.1.1')) 60 - relocate 'org.tomlj', "dev.mrsnowy.tomlj_${mod_id}" 61 - } 62 - 63 - exclude('mappings/**') 64 56 } 65 57 66 58 processResources { ··· 69 61 "group": project.group, //Else we target the task's group. 70 62 "minecraft_version": minecraft_version, 71 63 "minecraft_version_range": minecraft_version_range, 72 - "parchment_mappings": parchment_mappings, 73 64 // "fabric_api": fabric_api, 74 65 "fabric_loader_version": fabric_loader_version, 75 66 "fabric_loom": fabric_loom, 76 67 "neoforge_version": neoforge_version, 77 68 "neoforge_loader_version_range": neoforge_loader_version_range, 78 - "quilt_loader_version": quilt_loader_version, 79 - "quilt_fabric_api": quilt_fabric_api, 80 - "quilt_loom": quilt_loom, 69 + // "quilt_loader_version": quilt_loader_version, 70 + // "quilt_fabric_api": quilt_fabric_api, 71 + // "quilt_loom": quilt_loom, 81 72 "mod_name": mod_name, 82 73 "mod_author": mod_author, 83 74 "mod_id": mod_id,
+18 -16
common/src/main/java/dev/mrsnowy/teleport_commands/TeleportCommands.java
··· 4 4 import dev.mrsnowy.teleport_commands.storage.StorageManager; 5 5 import dev.mrsnowy.teleport_commands.commands.*; 6 6 import net.minecraft.commands.Commands; 7 + import net.minecraft.core.BlockPos; 7 8 import net.minecraft.server.MinecraftServer; 8 9 import net.minecraft.server.level.ServerPlayer; 9 10 import net.minecraft.world.level.storage.LevelResource; ··· 26 27 public static String MOD_LOADER; 27 28 public static Path SAVE_DIR; 28 29 public static Path CONFIG_DIR; 29 - // public static MinecraftServer Server; 30 30 31 31 32 32 // Gets ran when the server starts ··· 39 39 // Construct the game directory path 40 40 CONFIG_DIR = Paths.get(System.getProperty("user.dir")).resolve("config"); 41 41 42 - // Server = server; 43 - 44 42 cleanStorage(); 45 43 46 44 // initialize commands, also allows me to easily disable any when there is a config ··· 53 51 public static void onPlayerDeath(ServerPlayer player) { 54 52 try { 55 53 // update /back command position 56 - DeathLocationUpdater(player.position(), player.serverLevel(), player.getStringUUID()); 54 + DeathLocationUpdater(new BlockPos(player.getBlockX(), player.getBlockY(), player.getBlockZ()), player.serverLevel(), player.getStringUUID()); 57 55 58 56 } catch (Exception e) { 59 57 LOGGER.error(e.toString()); ··· 65 63 LOGGER.info("Cleaning and updating Storage!"); 66 64 try { 67 65 StorageManager.StorageInit(); 66 + long startFileSize = Files.size(StorageManager.STORAGE_FILE); 67 + 68 68 FileReader reader = new FileReader(StorageManager.STORAGE_FILE.toString()); 69 69 JsonElement jsonElement = JsonParser.parseReader(reader); 70 70 71 - boolean done = false; 72 71 73 72 if (jsonElement.isJsonObject()) { 74 73 JsonObject mainJsonObject = jsonElement.getAsJsonObject(); ··· 80 79 81 80 // players 82 81 for (JsonElement playerElement : mainJsonObject.get("Players").getAsJsonArray()) { 83 - System.out.println("Element: " + playerElement); 84 82 85 83 // player 86 84 if (playerElement.isJsonObject()) { ··· 109 107 110 108 if (player.has("Homes") && player.get("Homes").isJsonArray() ) { 111 109 JsonArray tempHomes = player.get("Homes").getAsJsonArray(); 112 - boolean defaultFound = false; 110 + boolean defaultHomeFound = false; 113 111 114 112 115 113 for (JsonElement homeElement : tempHomes) { ··· 119 117 String homeName = home.has("name") 120 118 ? home.get("name").getAsString() : ""; 121 119 122 - Double homeX = home.has("x") 123 - ? home.get("x").getAsDouble() : null; 120 + // upgrade doubles to int 121 + Integer homeX = home.has("x") && home.get("x").isJsonPrimitive() && home.get("x").getAsJsonPrimitive().isNumber() 122 + ? (int) Math.floor(home.get("x").getAsDouble()) : null; 124 123 125 - Double homeY = home.has("y") 126 - ? home.get("y").getAsDouble() : null; 124 + Integer homeY = home.has("y") && home.get("y").isJsonPrimitive() && home.get("y").getAsJsonPrimitive().isNumber() 125 + ? (int) Math.floor(home.get("y").getAsDouble()) : null; 127 126 128 - Double homeZ = home.has("z") 129 - ? home.get("z").getAsDouble() : null; 127 + Integer homeZ = home.has("z") && home.get("z").isJsonPrimitive() && home.get("z").getAsJsonPrimitive().isNumber() 128 + ? (int) Math.floor(home.get("z").getAsDouble()) : null; 130 129 131 130 String homeWorld = home.has("world") 132 131 ? home.get("world").getAsString() : ""; 133 - 134 132 135 133 // check if it is valid 136 134 if (!homeName.isBlank() && !homeWorld.isBlank() && homeX != null && homeY != null && homeZ != null) { 137 135 138 136 // check if it is the default home 139 137 if (!DefaultHome.isBlank() && homeName.equals(DefaultHome)) { 140 - defaultFound = true; 138 + defaultHomeFound = true; 141 139 } 142 140 143 141 JsonObject newHome = new JsonObject(); ··· 155 153 } 156 154 157 155 // clean DefaultHome if there is no home with the name 158 - if (!defaultFound) { 156 + if (!defaultHomeFound) { 159 157 DefaultHome = ""; 160 158 } 161 159 } ··· 182 180 Gson gson = new GsonBuilder().create(); 183 181 byte[] json = gson.toJson(mainJsonObject).getBytes(); 184 182 Files.write(StorageManager.STORAGE_FILE, json, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING); 183 + 184 + long endFileSize = Files.size(StorageManager.STORAGE_FILE); 185 + 186 + LOGGER.info("Success! Cleaned: " + Math.round((startFileSize - endFileSize)) + "B"); 185 187 } 186 188 } 187 189
+15 -113
common/src/main/java/dev/mrsnowy/teleport_commands/commands/back.java
··· 7 7 8 8 import java.util.*; 9 9 10 - import dev.mrsnowy.teleport_commands.suggestions.HomeSuggestionProvider; 11 10 import net.minecraft.ChatFormatting; 12 11 import net.minecraft.commands.Commands; 13 12 import net.minecraft.core.BlockPos; 14 13 import net.minecraft.network.chat.ClickEvent; 15 - import net.minecraft.network.chat.Component; 16 14 import net.minecraft.server.level.ServerLevel; 17 15 import net.minecraft.server.level.ServerPlayer; 18 16 import net.minecraft.world.phys.Vec3; 19 - import org.tomlj.Toml; 20 - 21 - import javax.swing.text.html.Option; 22 17 23 18 import static dev.mrsnowy.teleport_commands.storage.StorageManager.GetPlayerStorage; 24 19 import static dev.mrsnowy.teleport_commands.utils.tools.*; ··· 29 24 public static void register(Commands commandManager) { 30 25 31 26 commandManager.getDispatcher().register(Commands.literal("back").executes(context -> { 32 - ServerPlayer player = context.getSource().getPlayerOrException(); 27 + final ServerPlayer player = context.getSource().getPlayerOrException(); 33 28 34 29 try { 35 30 ToDeathLocation(player, false); ··· 43 38 }) 44 39 .then(argument("Disable Safety", BoolArgumentType.bool()).executes(context -> { 45 40 final boolean safety = BoolArgumentType.getBool(context, "Disable Safety"); 46 - ServerPlayer player = context.getSource().getPlayerOrException(); 41 + final ServerPlayer player = context.getSource().getPlayerOrException(); 47 42 48 43 try { 49 44 ToDeathLocation(player, safety); ··· 56 51 return 0; 57 52 })) 58 53 ); 59 - 60 - commandManager.getDispatcher().register(Commands.literal("test").executes(context -> { 61 - ServerPlayer player = context.getSource().getPlayerOrException(); 62 - 63 - 64 - player.displayClientMessage(Component.literal("Yellow").withStyle(ChatFormatting.YELLOW, ChatFormatting.BOLD), true); 65 - TeleportCommands.LOGGER.info("Yellow info"); 66 - TeleportCommands.LOGGER.warn("Yellow warn"); 67 - TeleportCommands.LOGGER.error("Yellow error"); 68 - TeleportCommands.LOGGER.error(String.valueOf(Toml.parse("commands.teleport_commands.back.go = \"Going Back\""))); 69 - Toml.parse("commands.teleport_commands.back.go = \"Going Back\""); 70 - return 0; 71 - })); 72 54 } 73 - 74 55 75 56 76 57 private static void ToDeathLocation(ServerPlayer player, boolean safetyDisabled) throws Exception { ··· 81 62 if (playerStorage.deathLocation == null) { 82 63 player.displayClientMessage(getTranslatedText("commands.teleport_commands.back.noLocation", player).withStyle(ChatFormatting.RED), true); 83 64 } else { 84 - final Vec3 pos = new Vec3(playerStorage.deathLocation.x, playerStorage.deathLocation.y, playerStorage.deathLocation.z); 65 + final BlockPos pos = new BlockPos(playerStorage.deathLocation.x, playerStorage.deathLocation.y, playerStorage.deathLocation.z); 85 66 86 67 boolean found = false; 87 68 for (ServerLevel currentWorld : Objects.requireNonNull(player.getServer()).getAllLevels()) { 88 69 89 70 if (Objects.equals(currentWorld.dimension().location().toString(), playerStorage.deathLocation.world)) { 90 71 91 - int playerX = (int) pos.x; 92 - int playerY = (int) pos.y; 93 - int playerZ = (int) pos.z; 94 - 95 72 // check if the death location isn't safe and that safety isn't enabled 96 73 if (!safetyDisabled) { 97 - Pair<Integer, Optional<Vec3>> silly = teleportSafetyChecker(playerX, playerY, playerZ, currentWorld, player); 98 74 75 + Pair<Integer, Optional<Vec3>> teleportData = teleportSafetyChecker(pos.getX(), pos.getY(), pos.getZ(), currentWorld, player); 99 76 100 - switch (silly.getFirst()) { 77 + switch (teleportData.getFirst()) { 101 78 case 0: // safe! 102 - if (silly.getSecond().isPresent()) { 79 + if (teleportData.getSecond().isPresent()) { 103 80 player.displayClientMessage(getTranslatedText("commands.teleport_commands.back.go", player), true); 104 - Teleporter(player, currentWorld, silly.getSecond().get()); 81 + Teleporter(player, currentWorld, teleportData.getSecond().get()); 105 82 } else { 106 83 player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.error", player).withStyle(ChatFormatting.RED, ChatFormatting.BOLD), true); 107 84 } ··· 111 88 player.displayClientMessage(getTranslatedText("commands.teleport_commands.back.same", player).withStyle(ChatFormatting.AQUA), true); 112 89 break; 113 90 case 2: // no safe location 114 - player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.forceTeleport", player) 115 - .withStyle(ChatFormatting.AQUA, ChatFormatting.BOLD) 116 - .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/back true"))) 117 - ,false); 91 + 92 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.noSafeLocation", player).withStyle(ChatFormatting.RED, ChatFormatting.BOLD), false); 93 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.safetyIsForLosers", player).withStyle(ChatFormatting.AQUA), false); 94 + player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.forceTeleport", player).withStyle(ChatFormatting.AQUA, ChatFormatting.BOLD) 95 + .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/back true"))),false); 118 96 break; 119 97 } 120 98 121 - // if (!safetyDisabled && isBlockPosUnsafe(new BlockPos(playerX, playerY, playerZ), currentWorld)) { 122 - // int row = 1; 123 - // int rows = 3; 124 - // boolean safeLocationFound = false; 125 - // 126 - // // find a safe location in an x row radius 127 - // whileLoop: 128 - // while (row <= rows) { 129 - //// TeleportCommands.LOGGER.info("currently doing row " + row + " of " + rows); //debug 130 - // 131 - // for (int z = -row; z <= row; z++) { 132 - // for (int x = -row; x <= row; x++) { 133 - // for (int y = -row; y <= row; y++ ) { 134 - // 135 - // if ((x == -row || x == row) || (z == -row || z == row) || (y == -row || y == row)) { 136 - // if (!isBlockPosUnsafe(new BlockPos(playerX + x, playerY + y, playerZ + z), currentWorld)) { 137 - // 138 - // Vec3 PlayerToTeleport = new Vec3(playerX + x + 0.5, playerY + y, playerZ + z + 0.5); 139 - // 140 - // if (!player.getPosition(0).equals(PlayerToTeleport) || player.level() != currentWorld) { 141 - // 142 - // Teleporter(player, currentWorld, PlayerToTeleport); 143 - // } else { 144 - // 145 - // } 146 - // 147 - // safeLocationFound = true; 148 - // break whileLoop; 149 - // } 150 - // } 151 - // } 152 - // } 153 - // } 154 - // 155 - // row++; 156 - // } 157 - // 158 - // if (!safeLocationFound) { 159 - // player.displayClientMessage( 160 - // getTranslatedText("commands.teleport_commands.back.noSafeLocation", player) 161 - // .withStyle(ChatFormatting.RED, ChatFormatting.BOLD) 162 - // , false); 163 - // 164 - // player.displayClientMessage( 165 - // getTranslatedText("commands.teleport_commands.back.safetyIsForLosers", player).withStyle(ChatFormatting.AQUA) 166 - // .append("\n") 167 - // .append( 168 - // getTranslatedText("commands.teleport_commands.back.forceTeleport", player) 169 - // .withStyle(ChatFormatting.AQUA, ChatFormatting.BOLD) 170 - // .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/back true"))) 171 - // ) 172 - // ,false); 173 - // } 174 - 175 99 } else { 176 - if (!player.getPosition(0).equals(pos) || player.level() != currentWorld) { 100 + BlockPos playerBlockPos = new BlockPos(player.getBlockX(), player.getBlockY(), player.getBlockZ()); 101 + if (!playerBlockPos.equals(pos) || player.level() != currentWorld) { 177 102 178 103 player.displayClientMessage(getTranslatedText("commands.teleport_commands.back.go", player), true); 179 - Teleporter(player, currentWorld, new Vec3(playerX + 0.5, playerY, playerZ + 0.5)); 104 + Teleporter(player, currentWorld, new Vec3(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5)); 180 105 181 106 } else { 182 107 player.displayClientMessage(getTranslatedText("commands.teleport_commands.back.same", player).withStyle(ChatFormatting.AQUA), true); ··· 194 119 } 195 120 } 196 121 } 197 - 198 - // private static boolean isBlockPosUnsafe(BlockPos bottomPlayer, ServerLevel world) { 199 - // // bottomPlayer is presumed to be the bottom of the player character 200 - // 201 - // BlockPos belowPlayer = new BlockPos(bottomPlayer.getX(), bottomPlayer.getY() -1, bottomPlayer.getZ()); // below the player 202 - // String belowPlayerId = world.getBlockState(belowPlayer).getBlock().getDescriptionId(); // below the player 203 - // 204 - // String BottomPlayerId = world.getBlockState(bottomPlayer).getBlock().getDescriptionId(); // bottom of player 205 - // 206 - // BlockPos TopPlayer = new BlockPos(bottomPlayer.getX(), bottomPlayer.getY() + 1, bottomPlayer.getZ()); // top of player 207 - // String TopPlayerId = world.getBlockState(TopPlayer).getBlock().getDescriptionId(); // top of player 208 - // 209 - // 210 - // // check if the death location isn't safe 211 - // if ( 212 - // (belowPlayerId.equals("block.minecraft.water") || !world.getBlockState(belowPlayer).getCollisionShape(world, belowPlayer).isEmpty()) // check if the player is gonna fall on teleport 213 - // && (world.getBlockState(bottomPlayer).getCollisionShape(world, bottomPlayer).isEmpty() && !unsafeCollisionFreeBlocks.contains(BottomPlayerId)) // check if it is a collision free block, that isnt dangerous 214 - // && (!unsafeCollisionFreeBlocks.contains(TopPlayerId)) // check if it is a dangerous collision free block, if it is solid then the player crawls 215 - // ){ 216 - // return false; // it's safe 217 - // } 218 - // return true; // it's not safe! 219 - // } 220 122 }
+20 -19
common/src/main/java/dev/mrsnowy/teleport_commands/commands/home.java
··· 7 7 import java.util.Objects; 8 8 import net.minecraft.ChatFormatting; 9 9 import net.minecraft.commands.Commands; 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.server.level.ServerLevel; ··· 26 27 .then(argument("name", StringArgumentType.string()) 27 28 .executes(context -> { 28 29 final String name = StringArgumentType.getString(context, "name"); 29 - ServerPlayer player = context.getSource().getPlayerOrException(); 30 + final ServerPlayer player = context.getSource().getPlayerOrException(); 30 31 31 32 try { 32 33 SetHome(player, name); ··· 42 43 43 44 commandManager.getDispatcher().register(Commands.literal("home") 44 45 .executes(context -> { 45 - ServerPlayer player = context.getSource().getPlayerOrException(); 46 + final ServerPlayer player = context.getSource().getPlayerOrException(); 46 47 47 48 try { 48 49 GoHome(player, ""); ··· 57 58 .then(argument("name", StringArgumentType.string()).suggests(new HomeSuggestionProvider()) 58 59 .executes(context -> { 59 60 final String name = StringArgumentType.getString(context, "name"); 60 - ServerPlayer player = context.getSource().getPlayerOrException(); 61 + final ServerPlayer player = context.getSource().getPlayerOrException(); 61 62 62 63 try { 63 64 GoHome(player, name); ··· 74 75 .then(argument("name", StringArgumentType.string()).suggests(new HomeSuggestionProvider()) 75 76 .executes(context -> { 76 77 final String name = StringArgumentType.getString(context, "name"); 77 - ServerPlayer player = context.getSource().getPlayerOrException(); 78 + final ServerPlayer player = context.getSource().getPlayerOrException(); 78 79 79 80 try { 80 81 DeleteHome(player, name); ··· 93 94 .executes(context -> { 94 95 final String name = StringArgumentType.getString(context, "name"); 95 96 final String newName = StringArgumentType.getString(context, "newName"); 96 - ServerPlayer player = context.getSource().getPlayerOrException(); 97 + final ServerPlayer player = context.getSource().getPlayerOrException(); 97 98 98 99 try { 99 100 RenameHome(player, name, newName); ··· 111 112 .then(argument("name", StringArgumentType.string()).suggests(new HomeSuggestionProvider()) 112 113 .executes(context -> { 113 114 final String name = StringArgumentType.getString(context, "name"); 114 - ServerPlayer player = context.getSource().getPlayerOrException(); 115 + final ServerPlayer player = context.getSource().getPlayerOrException(); 115 116 116 117 try { 117 118 SetDefaultHome(player, name); ··· 126 127 127 128 commandManager.getDispatcher().register(Commands.literal("homes") 128 129 .executes(context -> { 129 - ServerPlayer player = context.getSource().getPlayerOrException(); 130 + final ServerPlayer player = context.getSource().getPlayerOrException(); 130 131 131 132 try { 132 133 PrintHomes(player); ··· 144 145 145 146 private static void SetHome(ServerPlayer player, String homeName) throws Exception { 146 147 homeName = homeName.toLowerCase(); 147 - Vec3 pos = player.position(); 148 + BlockPos blockPos = new BlockPos(player.getBlockX(), player.getBlockY(), player.getBlockZ()); 148 149 ServerLevel world = player.serverLevel(); 149 150 150 151 StorageManager.PlayerStorageClass storages = GetPlayerStorage(player.getStringUUID()); ··· 166 167 StorageManager.StorageClass.Player.Home homeLocation = new StorageManager.StorageClass.Player.Home(); 167 168 168 169 homeLocation.name = homeName; 169 - homeLocation.x = Double.parseDouble(String.format("%.1f", pos.x())); 170 - homeLocation.y = Double.parseDouble(String.format("%.1f", pos.y())); 171 - homeLocation.z = Double.parseDouble(String.format("%.1f", pos.z())); 170 + homeLocation.x = blockPos.getX(); 171 + homeLocation.y = blockPos.getY(); 172 + homeLocation.z = blockPos.getZ(); 172 173 homeLocation.world = world.dimension().location().toString(); 173 174 174 175 playerStorage.Homes.add(homeLocation); ··· 198 199 } 199 200 } 200 201 201 - boolean foundHome = false; 202 202 boolean foundWorld = false; 203 203 204 204 // find correct home 205 205 for (StorageManager.StorageClass.Player.Home currentHome : playerStorage.Homes) { 206 206 if (Objects.equals(currentHome.name, homeName)){ 207 - foundHome = true; 208 207 209 208 // find correct world 210 209 for (ServerLevel currentWorld : Objects.requireNonNull(player.getServer()).getAllLevels()) { 211 210 if (Objects.equals(currentWorld.dimension().location().toString(), currentHome.world)) { 212 - Vec3 coords = new Vec3(currentHome.x, currentHome.y, currentHome.z); 213 211 foundWorld = true; 214 212 215 - if (!player.getPosition(0).equals(coords)) { 213 + BlockPos coords = new BlockPos(currentHome.x, currentHome.y, currentHome.z); 214 + BlockPos playerBlockPos = new BlockPos(player.getBlockX(), player.getBlockY(), player.getBlockZ()); 215 + 216 + if (!playerBlockPos.equals(coords)) { 216 217 player.displayClientMessage(getTranslatedText("commands.teleport_commands.home.go", player), true); 217 - Teleporter(player, currentWorld, new Vec3(currentHome.x, currentHome.y, currentHome.z)); 218 + Teleporter(player, currentWorld, new Vec3(currentHome.x + 0.5, currentHome.y, currentHome.z + 0.5)); 218 219 } else { 219 220 player.displayClientMessage(getTranslatedText("commands.teleport_commands.home.goSame", player).withStyle(ChatFormatting.AQUA), true); 220 221 } ··· 224 225 } 225 226 } 226 227 227 - if (!foundHome || !foundWorld) { 228 + if (!foundWorld) { 228 229 player.displayClientMessage(getTranslatedText("commands.teleport_commands.home.notFound", player).withStyle(ChatFormatting.RED), true); 229 230 } 230 231 } ··· 346 347 String name = String.format(" - %s", currenthome.name); 347 348 348 349 349 - String coords = String.format("[X%.1f Y%.1f Z%.1f]", currenthome.x, currenthome.y, currenthome.z); 350 + String coords = String.format("[X%d Y%d Z%d]", currenthome.x, currenthome.y, currenthome.z); 350 351 String dimension = String.format(" [%s]", currenthome.world); 351 352 352 353 if (Objects.equals(currenthome.name, playerStorage.DefaultHome)) { ··· 361 362 362 363 363 364 player.displayClientMessage(Component.literal(" | ").withStyle(ChatFormatting.AQUA) 364 - .append(Component.literal(coords).withStyle(ChatFormatting.LIGHT_PURPLE).withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, String.format("X%.2f Y%.2f Z%.2f", currenthome.x, currenthome.y, currenthome.z))))) 365 + .append(Component.literal(coords).withStyle(ChatFormatting.LIGHT_PURPLE).withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, String.format("X%d Y%d Z%d", currenthome.x, currenthome.y, currenthome.z))))) 365 366 .append(Component.literal(dimension).withStyle(ChatFormatting.DARK_PURPLE).withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, currenthome.world)))), 366 367 false 367 368 );
+33 -15
common/src/main/java/dev/mrsnowy/teleport_commands/commands/tpa.java
··· 2 2 3 3 import java.util.*; 4 4 5 + import com.mojang.datafixers.util.Pair; 5 6 import dev.mrsnowy.teleport_commands.suggestions.tpaSuggestionProvider; 6 7 7 8 import net.minecraft.ChatFormatting; ··· 10 11 import net.minecraft.network.chat.ClickEvent; 11 12 import net.minecraft.network.chat.Component; 12 13 import net.minecraft.server.level.ServerPlayer; 14 + import net.minecraft.world.phys.Vec3; 13 15 14 - import static dev.mrsnowy.teleport_commands.utils.tools.Teleporter; 15 - import static dev.mrsnowy.teleport_commands.utils.tools.getTranslatedText; 16 + import static dev.mrsnowy.teleport_commands.utils.tools.*; 16 17 17 18 public class tpa { 18 19 ··· 30 31 .then(Commands.argument("player", EntityArgument.player()) 31 32 .executes(context -> { 32 33 final ServerPlayer TargetPlayer = EntityArgument.getPlayer(context, "player"); 33 - ServerPlayer player = context.getSource().getPlayerOrException(); 34 + final ServerPlayer player = context.getSource().getPlayerOrException(); 34 35 35 36 tpaCommandHandler(player, TargetPlayer, false); 36 37 return 0; ··· 40 41 .then(Commands.argument("player", EntityArgument.player()) 41 42 .executes(context -> { 42 43 final ServerPlayer TargetPlayer = EntityArgument.getPlayer(context, "player"); 43 - ServerPlayer player = context.getSource().getPlayerOrException(); 44 + final ServerPlayer player = context.getSource().getPlayerOrException(); 44 45 45 46 46 47 tpaCommandHandler(player, TargetPlayer, true); ··· 51 52 .then(Commands.argument("player", EntityArgument.player()).suggests(new tpaSuggestionProvider()) 52 53 .executes(context -> { 53 54 final ServerPlayer TargetPlayer = EntityArgument.getPlayer(context, "player"); 54 - ServerPlayer player = context.getSource().getPlayerOrException(); 55 + final ServerPlayer player = context.getSource().getPlayerOrException(); 55 56 56 57 tpaAccept(player, TargetPlayer); 57 58 return 0; ··· 61 62 .then(Commands.argument("player", EntityArgument.player()).suggests(new tpaSuggestionProvider()) 62 63 .executes(context -> { 63 64 final ServerPlayer TargetPlayer = EntityArgument.getPlayer(context, "player"); 64 - ServerPlayer player = context.getSource().getPlayerOrException(); 65 + final ServerPlayer player = context.getSource().getPlayerOrException(); 65 66 66 67 tpaDeny(player, TargetPlayer); 67 68 return 0; ··· 81 82 FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.self", FromPlayer).withStyle(ChatFormatting.AQUA),true); 82 83 83 84 } else if (playerTpaList >= 1) { 84 - FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.alreadySent", FromPlayer, Component.literal(Objects.requireNonNull(ToPlayer.getName().tryCollapseToString())).withStyle(ChatFormatting.BOLD)).withStyle(ChatFormatting.AQUA) 85 + FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.alreadySent", FromPlayer, Component.literal(Objects.requireNonNull(ToPlayer.getName().getString())).withStyle(ChatFormatting.BOLD)).withStyle(ChatFormatting.AQUA) 85 86 ,true 86 87 ); 87 88 ··· 95 96 tpaRequest.here = here; 96 97 tpaList.add(tpaRequest); 97 98 98 - String ReceivedFromPlayer = Objects.requireNonNull(FromPlayer.getName().tryCollapseToString()); 99 - String SentToPlayer = Objects.requireNonNull(ToPlayer.getName().tryCollapseToString()); 99 + String ReceivedFromPlayer = Objects.requireNonNull(FromPlayer.getName().getString()); 100 + String SentToPlayer = Objects.requireNonNull(ToPlayer.getName().getString()); 100 101 101 102 FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.sent", FromPlayer, Component.literal(hereText), Component.literal(SentToPlayer).withStyle(ChatFormatting.BOLD)) 102 103 // .append(Text.literal("\n[Cancel]").formatted(Formatting.BLUE, Formatting.BOLD)) ··· 123 124 // else { 124 125 // TeleportCommands.LOGGER.error("Error removing tpaRequest from tpaList!"); 125 126 // } 126 - // else not needed since it may be cancelled 127 + // else not needed since it may be denied/cancelled 127 128 } 128 129 }, 30 * 1000 // 30 seconds 129 130 ); ··· 140 141 .filter(tpa -> Objects.equals(FromPlayer.getStringUUID(), tpa.RecPlayer)) 141 142 .findFirst(); 142 143 144 + // Check if there is a request 143 145 if (tpaStorage.isPresent()) { 144 146 145 - if (tpaStorage.get().here) { 146 - Teleporter(FromPlayer, ToPlayer.serverLevel(), ToPlayer.position()); 147 + ServerPlayer destinationPlayer = tpaStorage.get().here ? ToPlayer : FromPlayer; 148 + ServerPlayer toSentPlayer = tpaStorage.get().here ? FromPlayer : ToPlayer; 147 149 148 - } else { 149 - Teleporter(ToPlayer, FromPlayer.serverLevel(), FromPlayer.position()); 150 + Pair<Integer, Optional<Vec3>> teleportData = teleportSafetyChecker(destinationPlayer.getBlockX(), destinationPlayer.getBlockY(), destinationPlayer.getBlockZ(), destinationPlayer.serverLevel(), toSentPlayer); 151 + 152 + switch (teleportData.getFirst()) { 153 + case 1: // same (let it fall through) 154 + case 0: // safe! 155 + if (teleportData.getSecond().isPresent() ) { 156 + 157 + Teleporter(toSentPlayer, destinationPlayer.serverLevel(), teleportData.getSecond().get()); 158 + break; 159 + } else { 160 + toSentPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.common.error", toSentPlayer).withStyle(ChatFormatting.RED, ChatFormatting.BOLD), true); 161 + return; // exit 162 + } 163 + case 2: // if no safe location then just teleport to the player 164 + Teleporter(toSentPlayer, destinationPlayer.serverLevel(), destinationPlayer.position()); 165 + break; 150 166 } 151 167 168 + // if the player teleported then these messages get sent && the request gets removed 152 169 FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.accepted", FromPlayer).withStyle(ChatFormatting.WHITE),true); 153 170 ToPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.accepted", ToPlayer).withStyle(ChatFormatting.GREEN),true); 171 + tpaList.remove(tpaStorage.get()); 154 172 155 - tpaList.remove(tpaStorage.get()); 173 + // No request found 156 174 } else { 157 175 FromPlayer.displayClientMessage(getTranslatedText("commands.teleport_commands.tpa.notFound", FromPlayer).withStyle(ChatFormatting.RED),true); 158 176 }
+1 -1
common/src/main/java/dev/mrsnowy/teleport_commands/mixin/PlayerDeathMixin.java
··· 15 15 16 16 TeleportCommands.onPlayerDeath((ServerPlayer) (Object) this); 17 17 } 18 - } 18 + }
+1 -2
common/src/main/java/dev/mrsnowy/teleport_commands/mixin/ServerStartMixin.java
··· 15 15 16 16 TeleportCommands.initializeMod((MinecraftServer) (Object) this); 17 17 } 18 - } 19 - 18 + }
+3 -3
common/src/main/java/dev/mrsnowy/teleport_commands/storage/StorageManager.java
··· 142 142 143 143 public static class Home { 144 144 public String name; 145 - public double x; 146 - public double y; 147 - public double z; 145 + public int x; 146 + public int y; 147 + public int z; 148 148 public String world; 149 149 } 150 150 }
-1
common/src/main/java/dev/mrsnowy/teleport_commands/suggestions/HomeSuggestionProvider.java
··· 6 6 import com.mojang.brigadier.suggestion.SuggestionsBuilder; 7 7 import dev.mrsnowy.teleport_commands.TeleportCommands; 8 8 import dev.mrsnowy.teleport_commands.storage.StorageManager; 9 - import java.util.Objects; 10 9 import java.util.concurrent.CompletableFuture; 11 10 import net.minecraft.commands.CommandSourceStack; 12 11 import net.minecraft.server.level.ServerPlayer;
+1 -1
common/src/main/java/dev/mrsnowy/teleport_commands/suggestions/tpaSuggestionProvider.java
··· 26 26 27 27 for (tpa.tpaArrayClass tpaEntry : playerTpaList) { 28 28 29 - Optional<String> recPlayerName = Optional.ofNullable(context.getSource().getServer().getPlayerList().getPlayer(UUID.fromString(tpaEntry.InitPlayer)).getName().tryCollapseToString()); 29 + Optional<String> recPlayerName = Optional.ofNullable(context.getSource().getServer().getPlayerList().getPlayer(UUID.fromString(tpaEntry.InitPlayer)).getName().getString()); 30 30 31 31 if (recPlayerName.isPresent()) { 32 32 builder.suggest(recPlayerName.get());
+38 -27
common/src/main/java/dev/mrsnowy/teleport_commands/utils/tools.java
··· 1 1 package dev.mrsnowy.teleport_commands.utils; 2 2 3 + import com.google.gson.*; 3 4 import com.mojang.datafixers.util.Pair; 4 5 import dev.mrsnowy.teleport_commands.TeleportCommands; 5 6 import dev.mrsnowy.teleport_commands.storage.StorageManager; 6 7 7 8 import java.io.*; 9 + import java.nio.charset.StandardCharsets; 8 10 import java.util.*; 9 11 import java.util.regex.Matcher; 10 12 import java.util.regex.Pattern; 11 13 12 - import net.minecraft.ChatFormatting; 13 14 import net.minecraft.core.BlockPos; 14 15 import net.minecraft.core.particles.ParticleTypes; 15 16 import net.minecraft.network.chat.Component; ··· 19 20 import net.minecraft.sounds.SoundEvent; 20 21 import net.minecraft.sounds.SoundSource; 21 22 import net.minecraft.world.phys.Vec3; 22 - import org.tomlj.Toml; 23 - import org.tomlj.TomlParseResult; 24 23 25 24 import static dev.mrsnowy.teleport_commands.TeleportCommands.MOD_ID; 26 25 import static dev.mrsnowy.teleport_commands.storage.StorageManager.GetPlayerStorage; ··· 32 31 private static final Set<String> unsafeCollisionFreeBlocks = Set.of("block.minecraft.lava", "block.minecraft.flowing_lava", "block.minecraft.end_portal", "block.minecraft.end_gateway","block.minecraft.fire", "block.minecraft.soul_fire", "block.minecraft.powder_snow", "block.minecraft.nether_portal"); 33 32 34 33 public static void Teleporter(ServerPlayer player, ServerLevel world, Vec3 coords) { 34 + // before teleportation effects 35 35 world.sendParticles(ParticleTypes.SNOWFLAKE, player.getX(), player.getY() + 1, player.getZ(), 20, 0.0D, 0.0D, 0.0D, 0.01); 36 36 world.sendParticles(ParticleTypes.WHITE_SMOKE, player.getX(), player.getY(), player.getZ(), 15, 0.0D, 1.0D, 0.0D, 0.03); 37 37 world.playSound(null, player.blockPosition(), SoundEvent.createVariableRangeEvent(ENDERMAN_TELEPORT.getLocation()), SoundSource.PLAYERS, 0.4f, 1.0f); 38 38 39 39 var flying = player.getAbilities().flying; 40 40 41 + // teleport! 41 42 player.teleportTo(world, coords.x, coords.y, coords.z, player.getYRot(), player.getXRot()); 42 43 43 44 // Restore flying when teleporting dimensions ··· 50 51 world.playSound(null, player.blockPosition(), SoundEvent.createVariableRangeEvent(ENDERMAN_TELEPORT.getLocation()), SoundSource.PLAYERS, 0.4f, 1.0f); 51 52 Timer timer = new Timer(); 52 53 54 + // delay visual effects so the player can see it when switching dimensions 53 55 timer.schedule( 54 56 new TimerTask() { 55 57 @Override ··· 62 64 } 63 65 64 66 65 - public static void DeathLocationUpdater(Vec3 pos, ServerLevel world, String UUID) throws Exception { 67 + public static void DeathLocationUpdater(BlockPos pos, ServerLevel world, String UUID) throws Exception { 66 68 StorageManager.PlayerStorageClass storages = GetPlayerStorage(UUID); 67 69 68 70 StorageManager.StorageClass storage = storages.storage; 69 71 StorageManager.StorageClass.Player playerStorage = storages.playerStorage; 70 72 71 - // to ensure compatibility with older versions we cast it to double 72 - playerStorage.deathLocation.x = (int) Math.round(pos.x()); 73 - playerStorage.deathLocation.y = (int) Math.round(pos.y()); 74 - playerStorage.deathLocation.z = (int) Math.round(pos.z()); 75 - 73 + playerStorage.deathLocation.x = pos.getX(); 74 + playerStorage.deathLocation.y = pos.getY(); 75 + playerStorage.deathLocation.z = pos.getZ(); 76 76 playerStorage.deathLocation.world = world.dimension().location().toString(); 77 77 78 78 StorageSaver(storage); ··· 82 82 public static Pair<Integer, Optional<Vec3>> teleportSafetyChecker(int playerX, int playerY, int playerZ, ServerLevel world, ServerPlayer player) { 83 83 int row = 1; 84 84 int rows = 3; 85 + 86 + BlockPos playerBlockPos = new BlockPos(player.getBlockX(), player.getBlockY(), player.getBlockZ()); 87 + BlockPos blockPos = new BlockPos(playerX, playerY, playerZ); 85 88 86 89 // find a safe location in an x row radius 87 - if (isBlockPosUnsafe(new BlockPos(playerX, playerY, playerZ), world)) { 90 + if (isBlockPosUnsafe(blockPos, world)) { 88 91 89 92 while (row <= rows) { 90 93 // TeleportCommands.LOGGER.info("currently doing row " + row + " of " + rows); //debug ··· 93 96 for (int x = -row; x <= row; x++) { 94 97 for (int y = -row; y <= row; y++) { 95 98 99 + // checks if we are on the outer layer of the row, not on the inside 96 100 if ((x == -row || x == row) || (z == -row || z == row) || (y == -row || y == row)) { 97 - if (!isBlockPosUnsafe(new BlockPos(playerX + x, playerY + y, playerZ + z), world)) { 98 101 99 - Vec3 toTeleportTo = new Vec3(playerX + x + 0.5, playerY + y, playerZ + z + 0.5); 102 + BlockPos newSafePos = new BlockPos(playerX + x, playerY + y, playerZ + z); 100 103 101 - if (!player.getPosition(0).equals(toTeleportTo) || player.level() != world) { 102 - return new Pair<>(0, Optional.of(toTeleportTo)); // safe! 104 + if (!isBlockPosUnsafe(newSafePos, world)) { 105 + 106 + if (!playerBlockPos.equals(newSafePos) || player.level() != world) { 107 + return new Pair<>(0, Optional.of(new Vec3(newSafePos.getX() + 0.5, newSafePos.getY(), newSafePos.getZ() + 0.5))); // safe! 103 108 104 109 } else { 105 - return new Pair<>(1, Optional.empty()); // same 110 + return new Pair<>(1, Optional.of(new Vec3(newSafePos.getX() + 0.5, newSafePos.getY(), newSafePos.getZ() + 0.5))); // same 106 111 } 107 112 } 108 113 } ··· 112 117 113 118 row++; 114 119 } 115 - 116 120 // no safe location 117 - player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.noSafeLocation", player).withStyle(ChatFormatting.RED, ChatFormatting.BOLD), false); 118 - player.displayClientMessage(getTranslatedText("commands.teleport_commands.common.safetyIsForLosers", player).withStyle(ChatFormatting.AQUA), false); 121 + return new Pair<>(2, Optional.empty()); // no safe location 119 122 120 - return new Pair<>(2, Optional.empty()); // no safe location 123 + // check if the location is the same 124 + } else if (!playerBlockPos.equals(blockPos) || player.level() != world) { 125 + return new Pair<>(0, Optional.of(new Vec3(playerX + 0.5, playerY, playerZ + 0.5))); // good and safe! 126 + 121 127 } else { 122 - return new Pair<>(0, Optional.of(new Vec3(playerX + 0.5, playerY, playerZ + 0.5))); // safe! 128 + return new Pair<>(1, Optional.of(new Vec3(playerX + 0.5, playerY, playerZ + 0.5))); // same 123 129 } 124 130 } 125 131 126 132 127 133 128 - // 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) 134 + // 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) 129 135 public static MutableComponent getTranslatedText(String key, ServerPlayer player, MutableComponent... args) { 130 136 String language = player.clientInformation().language(); 131 137 String regex = "%(\\d+)%"; ··· 133 139 134 140 // the try catch stuff is so wacky, but it works fine and I don't need to check everything 135 141 try { 136 - String filePath = String.format("/assets/%s/lang/%s.toml", MOD_ID, language); 142 + String filePath = String.format("/assets/%s/lang/%s.json", MOD_ID, language); 137 143 InputStream stream = TeleportCommands.class.getResourceAsStream(filePath); 138 144 139 - TomlParseResult toml = Toml.parse(Objects.requireNonNull(stream)); 140 - String translation = toml.getString(key); 145 + Reader reader = new InputStreamReader(Objects.requireNonNull(stream), StandardCharsets.UTF_8); 146 + JsonElement json = JsonParser.parseReader(reader); 147 + String translation = json.getAsJsonObject().get(key).getAsString(); 141 148 149 + 150 + // Adds the optional MutableComponents in the correct places 142 151 Matcher matcher = pattern.matcher(Objects.requireNonNull(translation)); 143 152 144 153 MutableComponent component = Component.literal(""); ··· 162 171 if (!Objects.equals(language, "en_us")) { 163 172 // TeleportCommands.LOGGER.warn("Key \"{}\" not found in the language: {}, falling back to default (en_us)", key, language); 164 173 165 - String filePath = String.format("/assets/%s/lang/en_us.toml", MOD_ID); 174 + String filePath = String.format("/assets/%s/lang/en_us.json", MOD_ID); 166 175 InputStream stream = TeleportCommands.class.getResourceAsStream(filePath); 167 176 168 - TomlParseResult toml = Toml.parse(Objects.requireNonNull(stream)); 169 - String translation = toml.getString(key); 177 + Reader reader = new InputStreamReader(Objects.requireNonNull(stream), StandardCharsets.UTF_8); 178 + JsonElement json = JsonParser.parseReader(reader); 179 + String translation = json.getAsJsonObject().get(key).getAsString(); 180 + 170 181 171 182 Matcher matcher = pattern.matcher(Objects.requireNonNull(translation)); 172 183
+46
common/src/main/resources/assets/teleport_commands/lang/en_us.json
··· 1 + { 2 + "commands.teleport_commands.back.go": "Going Back", 3 + "commands.teleport_commands.back.same": "Already Back", 4 + "commands.teleport_commands.back.noLocation": "No Location Found!", 5 + 6 + "commands.teleport_commands.home.set": "Home Set", 7 + "commands.teleport_commands.home.setError": "Error Setting Home!", 8 + "commands.teleport_commands.home.go": "Going Home", 9 + "commands.teleport_commands.home.goError": "Error Going Home!", 10 + "commands.teleport_commands.home.goSame": "Already Home", 11 + "commands.teleport_commands.home.delete": "Home Deleted", 12 + "commands.teleport_commands.home.deleteError": "Error Deleting Home!", 13 + "commands.teleport_commands.home.rename": "Home Renamed", 14 + "commands.teleport_commands.home.renameError": "Error Renaming Home!", 15 + "commands.teleport_commands.home.renameExists": "That Name Already Exists!", 16 + "commands.teleport_commands.home.default": "Default Home Set", 17 + "commands.teleport_commands.home.defaultError": "Error Changing Default Home!", 18 + "commands.teleport_commands.home.defaultSame": "Home is already set as default!", 19 + "commands.teleport_commands.home.notFound": "Home Not Found!", 20 + "commands.teleport_commands.home.exists": "Home Already Exists!", 21 + "commands.teleport_commands.home.homeless": "You Have No Homes!", 22 + 23 + "commands.teleport_commands.homes.error": "Error Getting Homes!", 24 + "commands.teleport_commands.homes.homes": "Homes:", 25 + "commands.teleport_commands.homes.default": "(Default)", 26 + "commands.teleport_commands.homes.tp": "[Tp]", 27 + "commands.teleport_commands.homes.rename": "[Rename]", 28 + "commands.teleport_commands.homes.delete": "[Delete]", 29 + 30 + "commands.teleport_commands.tpa.self": "Well, that was easy", 31 + "commands.teleport_commands.tpa.alreadySent": "A request has already been sent to %0%", 32 + "commands.teleport_commands.tpa.received": "Tpa%0% Request Received From %1%", 33 + "commands.teleport_commands.tpa.sent": "Tpa%0% Request Sent to %1%", 34 + "commands.teleport_commands.tpa.accept": "[Accept]", 35 + "commands.teleport_commands.tpa.deny": " [Deny]", 36 + "commands.teleport_commands.tpa.expired": "Tpa%0% Request Expired", 37 + "commands.teleport_commands.tpa.notFound": "No Requests found!", 38 + "commands.teleport_commands.tpa.accepted": "Request Accepted", 39 + "commands.teleport_commands.tpa.denied": "Request Denied", 40 + 41 + "commands.teleport_commands.common.teleport": "Teleporting", 42 + "commands.teleport_commands.common.error": "Error Teleporting!", 43 + "commands.teleport_commands.common.noSafeLocation": "No Safe Location Found!", 44 + "commands.teleport_commands.common.safetyIsForLosers": "Teleport anyways? (Warning, you might die!)", 45 + "commands.teleport_commands.common.forceTeleport": "[Force Teleport]" 46 + }
-49
common/src/main/resources/assets/teleport_commands/lang/en_us.toml
··· 1 - # back 2 - commands.teleport_commands.back.go = "Going Back" 3 - commands.teleport_commands.back.same = "Already Back" 4 - commands.teleport_commands.back.noLocation = "No Location Found!" 5 - 6 - # home 7 - commands.teleport_commands.home.set = "Home Set" 8 - commands.teleport_commands.home.setError = "Error Setting Home!" 9 - commands.teleport_commands.home.go = "Going Home" 10 - commands.teleport_commands.home.goError = "Error Going Home!" 11 - commands.teleport_commands.home.goSame = "Already Home" 12 - commands.teleport_commands.home.delete = "Home Deleted" 13 - commands.teleport_commands.home.deleteError = "Error Deleting Home!" 14 - commands.teleport_commands.home.rename = "Home Renamed" 15 - commands.teleport_commands.home.renameError = "Error Renaming Home!" 16 - commands.teleport_commands.home.renameExists = "That Name Already Exists!" 17 - commands.teleport_commands.home.default = "Default Home Set" 18 - commands.teleport_commands.home.defaultError = "Error Changing Default Home!" 19 - commands.teleport_commands.home.defaultSame = "Home is already set as default!" 20 - commands.teleport_commands.home.notFound = "Home Not Found!" 21 - commands.teleport_commands.home.exists = "Home Already Exists!" 22 - commands.teleport_commands.home.homeless = "You Have No Homes!" 23 - 24 - # homes 25 - commands.teleport_commands.homes.error = "Error Getting Homes!" 26 - commands.teleport_commands.homes.homes = "Homes:" 27 - commands.teleport_commands.homes.default = "(Default)" 28 - commands.teleport_commands.homes.tp = "[Tp]" 29 - commands.teleport_commands.homes.rename = "[Rename]" 30 - commands.teleport_commands.homes.delete = "[Delete]" 31 - 32 - # tpa 33 - commands.teleport_commands.tpa.self = "Well, that was easy" 34 - commands.teleport_commands.tpa.alreadySent = "A request has already been sent to %0%" 35 - commands.teleport_commands.tpa.received = "Tpa%0% Request Received From %1%" 36 - commands.teleport_commands.tpa.sent = "Tpa%0% Request Sent to %1%" 37 - commands.teleport_commands.tpa.accept = "[Accept]" 38 - commands.teleport_commands.tpa.deny = " [Deny]" 39 - commands.teleport_commands.tpa.expired = "Tpa%0% Request Expired" 40 - commands.teleport_commands.tpa.notFound = "No Requests found!" 41 - commands.teleport_commands.tpa.accepted = "Request Accepted" 42 - commands.teleport_commands.tpa.denied = "Request Denied" 43 - 44 - # common 45 - commands.teleport_commands.common.teleport = "Teleporting" 46 - commands.teleport_commands.common.error = "Error Teleporting!" 47 - commands.teleport_commands.common.noSafeLocation = "No Safe Location Found!" 48 - commands.teleport_commands.common.safetyIsForLosers = "Teleport anyways? (Warning, you might die!)" 49 - commands.teleport_commands.common.forceTeleport = "[Force Teleport]"
+46
common/src/main/resources/assets/teleport_commands/lang/hu_hu.json
··· 1 + { 2 + "commands.teleport_commands.back.go": "Indulás vissza", 3 + "commands.teleport_commands.back.same": "Vissza", 4 + "commands.teleport_commands.back.noLocation": "Nem található a koordináta", 5 + 6 + "commands.teleport_commands.home.set": "Otthon beállítása", 7 + "commands.teleport_commands.home.setError": "Hiba történt az otthon beállításával!", 8 + "commands.teleport_commands.home.go": "Indulás haza!", 9 + "commands.teleport_commands.home.goError": "Hiba történt az otthonnal!", 10 + "commands.teleport_commands.home.goSame": "Otthon, édes otthon", 11 + "commands.teleport_commands.home.delete": "Otthon törölve", 12 + "commands.teleport_commands.home.deleteError": "Hiba történt az otthon rökésével!", 13 + "commands.teleport_commands.home.rename": "Otthon átnevezve", 14 + "commands.teleport_commands.home.renameError": "Hiba történt az otthon átnevezésével!", 15 + "commands.teleport_commands.home.renameExists": "A név már létezik!", 16 + "commands.teleport_commands.home.default": "Alap otthon beállítva", 17 + "commands.teleport_commands.home.defaultError": "Hiba történt az alap otthon beállításával!", 18 + "commands.teleport_commands.home.defaultSame": "Már alap ez az otthon!", 19 + "commands.teleport_commands.home.notFound": "Otthon nem találva!", 20 + "commands.teleport_commands.home.exists": "Az otthon már létezik!", 21 + "commands.teleport_commands.home.homeless": "Nincs otthonod!", 22 + 23 + "commands.teleport_commands.homes.error": "Hiba történt az otthonok megtalálásával!", 24 + "commands.teleport_commands.homes.homes": "Otthonol:", 25 + "commands.teleport_commands.homes.default": "(Alap)", 26 + "commands.teleport_commands.homes.tp": "[Tp]", 27 + "commands.teleport_commands.homes.rename": "[Átnevezés]", 28 + "commands.teleport_commands.homes.delete": "[Törlés]", 29 + 30 + "commands.teleport_commands.tpa.self": "Hát ez gyors volt", 31 + "commands.teleport_commands.tpa.alreadySent": "Egy kérés már el lett küldve %0%-nek", 32 + "commands.teleport_commands.tpa.received": "Tpa%0% kérés megkapva %1%-től", 33 + "commands.teleport_commands.tpa.sent": "tpa%0% kérés elküldve %1%-nek", 34 + "commands.teleport_commands.tpa.accept": "[Elfogadás]", 35 + "commands.teleport_commands.tpa.deny": " [Elutasítás]", 36 + "commands.teleport_commands.tpa.expired": "Tpa%0% kérés lejárt", 37 + "commands.teleport_commands.tpa.notFound": "Semmi kérésed sincsen!", 38 + "commands.teleport_commands.tpa.accepted": "Elfogadva", 39 + "commands.teleport_commands.tpa.denied": "Elutasítva", 40 + 41 + "commands.teleport_commands.common.teleport": "Utazás", 42 + "commands.teleport_commands.common.error": "Hiba történt a teleportálással!", 43 + "commands.teleport_commands.common.noSafeLocation": "Nem találtunk biztonságos helyet!", 44 + "commands.teleport_commands.common.safetyIsForLosers": "Biztos teleportálsz?", 45 + "commands.teleport_commands.common.forceTeleport": "[Teleportálás mindenképp]" 46 + }
-50
common/src/main/resources/assets/teleport_commands/lang/hu_hu.toml
··· 1 - # back 2 - commands.teleport_commands.back.go = "Indulás vissza" 3 - commands.teleport_commands.back.same = "Vissza" 4 - commands.teleport_commands.back.noLocation = "Nem található a koordináta" 5 - 6 - # home 7 - commands.teleport_commands.home.set = "Otthon beállítása" 8 - commands.teleport_commands.home.setError = "Hiba történt az otthon beállításával!" 9 - commands.teleport_commands.home.go = "Indulás haza!" 10 - commands.teleport_commands.home.goError = "Hiba történt az otthonnal!" 11 - commands.teleport_commands.home.goSame = "Otthon, édes otthon" 12 - commands.teleport_commands.home.delete = "Otthon törölve" 13 - commands.teleport_commands.home.deleteError = "Hiba történt az otthon rökésével!" 14 - commands.teleport_commands.home.rename = "Otthon átnevezve" 15 - commands.teleport_commands.home.renameError = "Hiba történt az otthon átnevezésével!" 16 - commands.teleport_commands.home.renameExists = "A név már létezik!" 17 - commands.teleport_commands.home.default = "Alap otthon beállítva" 18 - commands.teleport_commands.home.defaultError = "Hiba történt az alap otthon beállításával!" 19 - commands.teleport_commands.home.defaultSame = "Már alap ez az otthon!" 20 - commands.teleport_commands.home.notFound = "Otthon nem találva!" 21 - commands.teleport_commands.home.exists = "Az otthon már létezik!" 22 - commands.teleport_commands.home.homeless = "Nincs otthonod!" 23 - 24 - # homes 25 - commands.teleport_commands.homes.error = "Hiba történt az otthonok megtalálásával!" 26 - commands.teleport_commands.homes.homes = "Otthonol:" 27 - commands.teleport_commands.homes.default = "(Alap)" 28 - commands.teleport_commands.homes.tp = "[Tp]" 29 - commands.teleport_commands.homes.rename = "[Átnevezés]" 30 - commands.teleport_commands.homes.delete = "[Törlés]" 31 - 32 - # tpa 33 - commands.teleport_commands.tpa.self = "Hát ez gyors volt" 34 - commands.teleport_commands.tpa.alreadySent = "Egy kérés már el lett küldve %0%-nek" 35 - commands.teleport_commands.tpa.received = "Tpa%0% kérés megkapva %1%-től" 36 - commands.teleport_commands.tpa.sent = "tpa%0% kérés elküldve %1%-nek" 37 - commands.teleport_commands.tpa.accept = "[Elfogadás]" 38 - commands.teleport_commands.tpa.deny = " [Elutasítás]" 39 - commands.teleport_commands.tpa.expired = "Tpa%0% kérés lejárt" 40 - commands.teleport_commands.tpa.notFound = "Semmi kérésed sincsen!" 41 - commands.teleport_commands.tpa.accepted = "Elfogadva" 42 - commands.teleport_commands.tpa.denied = "Elutasítva" 43 - 44 - # common 45 - commands.teleport_commands.common.teleport = "Utazás" 46 - commands.teleport_commands.common.error = "Hiba történt a teleportálással!" 47 - 48 - commands.teleport_commands.common.noSafeLocation = "No Safe Location Found!" 49 - commands.teleport_commands.common.safetyIsForLosers = "Teleport anyways? (Warning, you might die!)" 50 - commands.teleport_commands.common.forceTeleport = "[Force Teleport]"
+46
common/src/main/resources/assets/teleport_commands/lang/nl_nl.json
··· 1 + { 2 + "commands.teleport_commands.back.go": "Terug gaan", 3 + "commands.teleport_commands.back.same": "Al Terug", 4 + "commands.teleport_commands.back.noLocation": "Geen Locatie Gevonden!", 5 + 6 + "commands.teleport_commands.home.set": "Huis Ingesteld", 7 + "commands.teleport_commands.home.setError": "Probleem Met Het Huis Instellen!", 8 + "commands.teleport_commands.home.go": "Naar Huis", 9 + "commands.teleport_commands.home.goError": "Probleem Met Naar Huis Gaan!", 10 + "commands.teleport_commands.home.goSame": "Al Thuis", 11 + "commands.teleport_commands.home.delete": "Huis Verwijderd", 12 + "commands.teleport_commands.home.deleteError": "Probleem Met Het Verwijderen Van Het Huis!", 13 + "commands.teleport_commands.home.rename": "Huis Hernoemd", 14 + "commands.teleport_commands.home.renameError": "Probleem Met Het Huis Hernamen!", 15 + "commands.teleport_commands.home.renameExists": "Die Naam Bestaat Al!", 16 + "commands.teleport_commands.home.default": "Standaard Huis Ingesteld", 17 + "commands.teleport_commands.home.defaultError": "Probleem Tijdens Het Wijzigen Van Het Standaard Huis!", 18 + "commands.teleport_commands.home.defaultSame": "Huis is al als standaard ingesteld!", 19 + "commands.teleport_commands.home.notFound": "Huis Niet Gevonden!", 20 + "commands.teleport_commands.home.exists": "Dat huis bestaad Al!", 21 + "commands.teleport_commands.home.homeless": "Je Hebt Geen Huizen!", 22 + 23 + "commands.teleport_commands.homes.error": "Probleem Bij Het Ophalen Van De Huizen!", 24 + "commands.teleport_commands.homes.homes": "Huizen:", 25 + "commands.teleport_commands.homes.default": "(Standaard)", 26 + "commands.teleport_commands.homes.tp": "[Tp]", 27 + "commands.teleport_commands.homes.rename ": "[Naam Wijzigen]", 28 + "commands.teleport_commands.homes.delete": "[Verwijderen]", 29 + 30 + "commands.teleport_commands.tpa.self": "Welp, Dat Was Makkelijk", 31 + "commands.teleport_commands.tpa.alreadySent": "Er is al een verzoek verzonden naar %0%", 32 + "commands.teleport_commands.tpa.received": "Tpa%0% Verzoek Ontvangen Van %1%", 33 + "commands.teleport_commands.tpa.sent": "Tpa%0% Verzoek Verzonden Naar %1%", 34 + "commands.teleport_commands.tpa.accept": "[Accepteren]", 35 + "commands.teleport_commands.tpa.deny": " [Weigeren]", 36 + "commands.teleport_commands.tpa.expired": "Tpa%0% Verzoek Verlopen", 37 + "commands.teleport_commands.tpa.notFound": "Geen Verzoeken Gevonden!", 38 + "commands.teleport_commands.tpa.accepted": "Verzoek Geaccepteerd", 39 + "commands.teleport_commands.tpa.denied": "Verzoek Geweigerd", 40 + 41 + "commands.teleport_commands.common.teleport": "Teleporteren", 42 + "commands.teleport_commands.common.error": "Probleem tijdens het Teleporteren!", 43 + "commands.teleport_commands.common.noSafeLocation": "Geen veilige locatie gevonden!", 44 + "commands.teleport_commands.common.safetyIsForLosers": "Toch teleporteren? (Waarschuwing, je kan dood gaan!)", 45 + "commands.teleport_commands.common.forceTeleport": "[Geforceerd Teleporteren]" 46 + }
-49
common/src/main/resources/assets/teleport_commands/lang/nl_nl.toml
··· 1 - # back 2 - commands.teleport_commands.back.go = "Terug gaan" 3 - commands.teleport_commands.back.same = "Al Terug" 4 - commands.teleport_commands.back.noLocation = "Geen Locatie Gevonden!" 5 - 6 - # home 7 - commands.teleport_commands.home.set = "Huis Ingesteld" 8 - commands.teleport_commands.home.setError = "Probleem Met Het Huis Instellen!" 9 - commands.teleport_commands.home.go = "Naar Huis" 10 - commands.teleport_commands.home.goError = "Probleem Met Naar Huis Gaan!" 11 - commands.teleport_commands.home.goSame = "Al Thuis" 12 - commands.teleport_commands.home.delete = "Huis Verwijderd" 13 - commands.teleport_commands.home.deleteError = "Probleem Met Het Verwijderen Van Het Huis!" 14 - commands.teleport_commands.home.rename = "Huis Hernoemd" 15 - commands.teleport_commands.home.renameError = "Probleem Met Het Huis Hernamen!" 16 - commands.teleport_commands.home.renameExists = "Die Naam Bestaat Al!" 17 - commands.teleport_commands.home.default = "Standaard Huis Ingesteld" 18 - commands.teleport_commands.home.defaultError = "Probleem Tijdens Het Wijzigen Van Het Standaard Huis!" 19 - commands.teleport_commands.home.defaultSame = "Huis is al als standaard ingesteld!" 20 - commands.teleport_commands.home.notFound = "Huis Niet Gevonden!" 21 - commands.teleport_commands.home.exists = "Dat huis bestaad Al!" 22 - commands.teleport_commands.home.homeless = "Je Hebt Geen Huizen!" 23 - 24 - # homes 25 - commands.teleport_commands.homes.error = "Probleem Bij Het Ophalen Van De Huizen!" 26 - commands.teleport_commands.homes.homes = "Huizen:" 27 - commands.teleport_commands.homes.default = "(Standaard)" 28 - commands.teleport_commands.homes.tp = "[Tp]" 29 - commands.teleport_commands.homes.rename = "[Naam Wijzigen]" 30 - commands.teleport_commands.homes.delete = "[Verwijderen]" 31 - 32 - # tpa 33 - commands.teleport_commands.tpa.self = "Welp, Dat Was Makkelijk" 34 - commands.teleport_commands.tpa.alreadySent = "Er is al een verzoek verzonden naar %0%" 35 - commands.teleport_commands.tpa.received = "Tpa%0% Verzoek Ontvangen Van %1%" 36 - commands.teleport_commands.tpa.sent = "Tpa%0% Verzoek Verzonden Naar %1%" 37 - commands.teleport_commands.tpa.accept = "[Accepteren]" 38 - commands.teleport_commands.tpa.deny = " [Weigeren]" 39 - commands.teleport_commands.tpa.expired = "Tpa%0% Verzoek Verlopen" 40 - commands.teleport_commands.tpa.notFound = "Geen Verzoeken Gevonden!" 41 - commands.teleport_commands.tpa.accepted = "Verzoek Geaccepteerd" 42 - commands.teleport_commands.tpa.denied = "Verzoek Geweigerd" 43 - 44 - # common 45 - commands.teleport_commands.common.teleport = "Teleporteren" 46 - commands.teleport_commands.common.error = "Probleem tijdens het Teleporteren!" 47 - commands.teleport_commands.common.noSafeLocation = "Geen veilige locatie gevonden!" 48 - commands.teleport_commands.common.safetyIsForLosers = "Toch teleporteren? (Waarschuwing, je kan dood gaan!)" 49 - commands.teleport_commands.common.forceTeleport = "[Geforceerd Teleporteren]"
+2 -2
common/src/main/resources/assets/teleport_commands/lang/translations.md
··· 10 10 #### Want to make a translation? 11 11 1. Make a fork of the mod 12 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.toml` and paste it in a new file called `[in-game locale code here].toml` 14 - 4. Translate the values (everything between " ") in the file 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 15 5. Submit a pull request with your translation :D! 16 16 17 17 #### Want to improve an existing translation?
-1
fabric/build.gradle
··· 7 7 minecraft "com.mojang:minecraft:${minecraft_version}" 8 8 mappings loom.layered() { 9 9 officialMojangMappings() 10 - // parchment("org.parchmentmc.data:parchment-${parchment_mappings}@zip") 11 10 } 12 11 modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" 13 12 // modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api}"
+6 -7
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.0-beta 5 + version=1.1.0 6 6 group=dev.mrsnowy.teleport_commands 7 7 java_version=17 8 8 9 9 # Common 10 10 minecraft_version=1.20.4 11 - parchment_mappings=1.20.4:2024.04.14 12 11 mod_name=Teleport Commands 13 12 mod_author=Mr. Snowy 14 13 mod_id=teleport_commands 15 14 license=MIT 16 15 credits=Mr. Snowy 17 16 description=A server-side mod that adds various teleportation related commands. 18 - minecraft_version_range=[1.20.4, 1.21) 17 + minecraft_version_range=[1.20.4, 1.21] 19 18 20 19 # Fabric 21 20 fabric_loader_version=0.15.7 22 21 #fabric_api=0.97.0+1.20.4 23 22 fabric_loom=1.6-SNAPSHOT 24 23 25 - # Quilt 26 - quilt_loader_version=0.25.0 27 - quilt_fabric_api=9.0.0-alpha.8+0.97.0-1.20.4 28 - quilt_loom=1.6.7 24 + # Quilt (Currently disabled since fabric port works better) 25 + #quilt_loader_version=0.25.0 26 + #quilt_fabric_api=9.0.0-alpha.8+0.97.0-1.20.4 27 + #quilt_loom=1.6.7 29 28 30 29 31 30 # NeoForge
-1
quilt/build.gradle
··· 7 7 minecraft "com.mojang:minecraft:${minecraft_version}" 8 8 mappings loom.layered() { 9 9 officialMojangMappings() 10 - // parchment("org.parchmentmc.data:parchment-${parchment_mappings}@zip") 11 10 } 12 11 modImplementation "org.quiltmc:quilt-loader:${quilt_loader_version}" 13 12 modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${quilt_fabric_api}"
+2 -3
settings.gradle
··· 7 7 } 8 8 maven { 9 9 name = 'Quilt' 10 - url = 'https://maven.quiltmc.org/repository/release' 10 + url = uri("https://maven.quiltmc.org/repository/release") 11 11 } 12 12 maven { 13 13 name = 'NeoForge' ··· 29 29 include("common") 30 30 include("fabric") 31 31 include("neoforge") 32 - include("quilt") 33 - 32 + //include("quilt") // disabled since the fabric port works better then the native quilt port