diff options
author | olim <bobq4582@gmail.com> | 2024-01-30 14:52:55 +0000 |
---|---|---|
committer | olim <bobq4582@gmail.com> | 2024-01-30 14:52:55 +0000 |
commit | 622b29b2f855f66ec47974d23f4931d81dffb5e9 (patch) | |
tree | 9e67967b6df07e9d3931225fbdb21d1e9e62899e /src/main | |
parent | 4725a42df06d8bf72bc6a901bd24dda25d761623 (diff) | |
download | Skyblocker-622b29b2f855f66ec47974d23f4931d81dffb5e9.tar.gz Skyblocker-622b29b2f855f66ec47974d23f4931d81dffb5e9.tar.bz2 Skyblocker-622b29b2f855f66ec47974d23f4931d81dffb5e9.zip |
Update CrystalsLocationsManager.java
makes sure the coordinates from a chat message are in the bound of crystal hollows map. and re add check that the user is in the crystal hollow to get coordinates
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java index e5f7d473..3484bafd 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java @@ -62,7 +62,7 @@ public class CrystalsLocationsManager { ClientCommandRegistrationCallback.EVENT.register(CrystalsLocationsManager::registerWaypointLocationCommands); } private static void extractLocationFromMessage(Text message, SignedMessage signedMessage, GameProfile sender, MessageType.Parameters params, Instant receptionTimestamp){ - if (!SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.findInChat ) { //todo || !Utils.isInCrystals() + if (!SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.findInChat || !Utils.isInCrystals()) { return; } //get the message text @@ -73,7 +73,10 @@ public class CrystalsLocationsManager { String location = matcher.group(); Integer[] cowordinates = Arrays.stream(location.split(" ",3)).map(Integer::parseInt).toArray(Integer[]::new); BlockPos blockPos = new BlockPos(cowordinates[0],cowordinates[1],cowordinates[2]); - //todo make sure this is in bounds of crystals + //if position is not in the hollows do not add it + if (!checkInCrystals(blockPos)){ + return; + } //see if there is a name of a location to add to this for (String waypointLocation : WAYPOINTLOCATIONS.keySet()){ if (value.toLowerCase().contains(waypointLocation.toLowerCase())){ //todo be more lenient @@ -91,6 +94,12 @@ public class CrystalsLocationsManager { } + private static Boolean checkInCrystals(BlockPos pos){ + //checks if a location is inside crystal hollows bounds + return pos.getX() >= 202 && pos.getX() <= 823 + && pos.getZ() >= 202 && pos.getZ() <= 823 + && pos.getY() >= 31 && pos.getY() <= 188; + } private static void registerWaypointLocationCommands(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess) { dispatcher.register(literal(SkyblockerMod.NAMESPACE) .then(literal("crystalWaypoints") |