diff --git a/gradle.properties b/gradle.properties index 7ca422e..ef7e472 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx8G org.gradle.daemon=false -my_version=1.3.3.5 +my_version=1.3.3.6 mc_version=1.19.2 forge_version=43.1.32 diff --git a/src/main/java/dev/zontreck/otemod/commands/homes/SetHomeCommand.java b/src/main/java/dev/zontreck/otemod/commands/homes/SetHomeCommand.java index 58d42aa..7423a9a 100644 --- a/src/main/java/dev/zontreck/otemod/commands/homes/SetHomeCommand.java +++ b/src/main/java/dev/zontreck/otemod/commands/homes/SetHomeCommand.java @@ -2,6 +2,7 @@ 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; @@ -60,16 +61,23 @@ public class SetHomeCommand { Connection con = OTEMod.DB.getConnection(); try { con.beginRequest(); - Statement stat = con.createStatement(); + //Statement stat = con.createStatement(); Vec3 position = p.position(); Vec2 rot = p.getRotationVector(); TeleportDestination dest = new TeleportDestination(new Vector3(position), new Vector2(rot), p.getLevel().dimension().location().getNamespace() + ":" + p.getLevel().dimension().location().getPath()); - stat.execute("REPLACE INTO `homes` (user, home_name, teleporter) values (\"" + p.getStringUUID() + "\", \""+ homeName + "\", \""+ dest.toString() + "\");"); + String SQL = "REPLACE INTO `homes` (user, home_name, teleporter) VALUES (?, ?, ?);"; + PreparedStatement pstat = con.prepareStatement(SQL); + + pstat.setString(1, p.getStringUUID()); + pstat.setString(2, homeName); + pstat.setString(3, dest.toString()); + + pstat.execute(); + ChatServerOverride.broadcastTo(p.getUUID(), Component.literal(ChatColor.DARK_GREEN).append(Component.translatable("dev.zontreck.otemod.msgs.homes.set.success")), ctx.getServer()); - ctx.sendSuccess(MutableComponent.create(new TranslatableContents("dev.zontreck.otemod.msgs.homes.set.success")), true); con.endRequest(); } catch (SQLException e) { // TODO Auto-generated catch block diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index f91fbc7..b089198 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.5" #mandatory +version="1.3.3.6" #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/ diff --git a/src/main/resources/assets/otemod/lang/en_us.json b/src/main/resources/assets/otemod/lang/en_us.json index fe50715..96bd2b4 100644 --- a/src/main/resources/assets/otemod/lang/en_us.json +++ b/src/main/resources/assets/otemod/lang/en_us.json @@ -21,7 +21,7 @@ "dev.zontreck.otemod.msgs.only_player": "§cOnly players are allowed to execute this command", "dev.zontreck.otemod.msgs.homes.total": "§3Total number of homes: §6", - "dev.zontreck.otemod.msgs.homes.set.success": "§2Home created or updated successfully", + "dev.zontreck.otemod.msgs.homes.set.success": "Home created or updated successfully", "dev.zontreck.otemod.msgs.homes.set.fail": "§cHome could not be created or updated due to an unknown error", "dev.zontreck.otemod.msgs.homes.goto.fail": "§cHome was not found, or a error occured", "dev.zontreck.otemod.msgs.homes.goto.success": "§2Home found, warping home now",