diff --git a/gradle.properties b/gradle.properties index ae2f2fd..7ca422e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx8G org.gradle.daemon=false -my_version=1.3.3.4 +my_version=1.3.3.5 mc_version=1.19.2 forge_version=43.1.32 diff --git a/src/main/java/dev/zontreck/otemod/commands/homes/HomeCommand.java b/src/main/java/dev/zontreck/otemod/commands/homes/HomeCommand.java index 7c9df77..4be6b21 100644 --- a/src/main/java/dev/zontreck/otemod/commands/homes/HomeCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/homes/HomeCommand.java @@ -1,48 +1,31 @@ package dev.zontreck.otemod.commands.homes; -import java.sql.Array; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; -import com.ibm.icu.impl.InvalidFormatException; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.math.Vector3d; import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.chat.ChatColor; import dev.zontreck.otemod.chat.ChatServerOverride; import dev.zontreck.otemod.commands.teleport.TeleportActioner; import dev.zontreck.otemod.commands.teleport.TeleportContainer; -import dev.zontreck.otemod.configs.PlayerFlyCache; import dev.zontreck.otemod.database.TeleportDestination; +import dev.zontreck.otemod.exceptions.InvalidDeserialization; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.nbt.NbtUtils; import net.minecraft.network.chat.contents.TranslatableContents; -import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.TickTask; -import net.minecraft.server.commands.BossBarCommands; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.BossEvent.BossBarColor; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffectUtil; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.server.command.TextComponentHelper; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -148,7 +131,7 @@ public class HomeCommand { ctx.sendFailure(Component.translatable("dev.zontreck.otemod.msgs.homes.goto.fail")); else ctx.sendFailure(Component.literal("FAILED SQL: "+ ChatColor.GOLD+ SQL)); - } catch (InvalidFormatException e) { + } catch (InvalidDeserialization e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (CommandSyntaxException e) { diff --git a/src/main/java/dev/zontreck/otemod/containers/Vector2.java b/src/main/java/dev/zontreck/otemod/containers/Vector2.java index d9878c5..b493249 100644 --- a/src/main/java/dev/zontreck/otemod/containers/Vector2.java +++ b/src/main/java/dev/zontreck/otemod/containers/Vector2.java @@ -1,7 +1,6 @@ package dev.zontreck.otemod.containers; -import com.ibm.icu.impl.InvalidFormatException; - +import dev.zontreck.otemod.exceptions.InvalidDeserialization; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; @@ -31,7 +30,7 @@ public class Vector2 y=pos.y; } - public Vector2(String pos) throws InvalidFormatException + public Vector2(String pos) throws InvalidDeserialization { // This will be serialized most likely from the ToString method // Parse @@ -46,7 +45,7 @@ public class Vector2 if(positions.length!=2) { - throw new InvalidFormatException("Positions must be in the same format provided by ToString() (ex. <1,1> or <1, 1>"); + throw new InvalidDeserialization("Positions must be in the same format provided by ToString() (ex. <1,1> or <1, 1>"); } this.x = Float.parseFloat(positions[0]); diff --git a/src/main/java/dev/zontreck/otemod/containers/Vector3.java b/src/main/java/dev/zontreck/otemod/containers/Vector3.java index f4baf37..565ff46 100644 --- a/src/main/java/dev/zontreck/otemod/containers/Vector3.java +++ b/src/main/java/dev/zontreck/otemod/containers/Vector3.java @@ -1,7 +1,6 @@ package dev.zontreck.otemod.containers; -import com.ibm.icu.impl.InvalidFormatException; - +import dev.zontreck.otemod.exceptions.InvalidDeserialization; import net.minecraft.world.phys.Vec3; public class Vector3 @@ -33,7 +32,7 @@ public class Vector3 z=pos.z; } - public Vector3(String pos) throws InvalidFormatException + public Vector3(String pos) throws InvalidDeserialization { // This will be serialized most likely from the ToString method // Parse @@ -48,7 +47,7 @@ public class Vector3 if(positions.length!=3) { - throw new InvalidFormatException("Positions must be in the same format provided by ToString() (ex. <1,1,1> or <1, 1, 1>"); + throw new InvalidDeserialization("Positions must be in the same format provided by ToString() (ex. <1,1,1> or <1, 1, 1>"); } this.x = Double.parseDouble(positions[0]); diff --git a/src/main/java/dev/zontreck/otemod/database/TeleportDestination.java b/src/main/java/dev/zontreck/otemod/database/TeleportDestination.java index 8673e60..a52375a 100644 --- a/src/main/java/dev/zontreck/otemod/database/TeleportDestination.java +++ b/src/main/java/dev/zontreck/otemod/database/TeleportDestination.java @@ -1,9 +1,8 @@ package dev.zontreck.otemod.database; -import com.ibm.icu.impl.InvalidFormatException; - import dev.zontreck.otemod.containers.Vector2; import dev.zontreck.otemod.containers.Vector3; +import dev.zontreck.otemod.exceptions.InvalidDeserialization; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; @@ -15,7 +14,7 @@ public class TeleportDestination { public Vector2 Rotation; public String Dimension; - public TeleportDestination(CompoundTag tag) throws InvalidFormatException + public TeleportDestination(CompoundTag tag) throws InvalidDeserialization { Position = new Vector3(tag.getString("Position")); Rotation = new Vector2(tag.getString("Rotation")); diff --git a/src/main/java/dev/zontreck/otemod/exceptions/InvalidDeserialization.java b/src/main/java/dev/zontreck/otemod/exceptions/InvalidDeserialization.java new file mode 100644 index 0000000..f645d92 --- /dev/null +++ b/src/main/java/dev/zontreck/otemod/exceptions/InvalidDeserialization.java @@ -0,0 +1,11 @@ +package dev.zontreck.otemod.exceptions; + +public class InvalidDeserialization extends Exception +{ + public InvalidDeserialization(String error){ + super(error); + } + public InvalidDeserialization(){ + super("Incorrect information was provided to the deserializer"); + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index a1acd85..f91fbc7 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -19,7 +19,7 @@ modId="otemod" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build -version="1.3.3.4" #mandatory +version="1.3.3.5" #mandatory # A display name for the mod displayName="OTEMod Resources" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/