Fix a error with sethome
This commit is contained in:
parent
9153f2a853
commit
e3cfc79055
4 changed files with 14 additions and 6 deletions
|
@ -3,7 +3,7 @@
|
||||||
org.gradle.jvmargs=-Xmx8G
|
org.gradle.jvmargs=-Xmx8G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
|
|
||||||
my_version=1.3.3.5
|
my_version=1.3.3.6
|
||||||
|
|
||||||
mc_version=1.19.2
|
mc_version=1.19.2
|
||||||
forge_version=43.1.32
|
forge_version=43.1.32
|
||||||
|
|
|
@ -2,6 +2,7 @@ package dev.zontreck.otemod.commands.homes;
|
||||||
|
|
||||||
import java.sql.Array;
|
import java.sql.Array;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
@ -60,16 +61,23 @@ public class SetHomeCommand {
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
try {
|
try {
|
||||||
con.beginRequest();
|
con.beginRequest();
|
||||||
Statement stat = con.createStatement();
|
//Statement stat = con.createStatement();
|
||||||
Vec3 position = p.position();
|
Vec3 position = p.position();
|
||||||
Vec2 rot = p.getRotationVector();
|
Vec2 rot = p.getRotationVector();
|
||||||
|
|
||||||
TeleportDestination dest = new TeleportDestination(new Vector3(position), new Vector2(rot), p.getLevel().dimension().location().getNamespace() + ":" + p.getLevel().dimension().location().getPath());
|
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();
|
con.endRequest();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
|
|
|
@ -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
|
# 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
|
# ${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
|
# 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
|
# A display name for the mod
|
||||||
displayName="OTEMod Resources" #mandatory
|
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/
|
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
"dev.zontreck.otemod.msgs.only_player": "§cOnly players are allowed to execute this command",
|
"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.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.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.fail": "§cHome was not found, or a error occured",
|
||||||
"dev.zontreck.otemod.msgs.homes.goto.success": "§2Home found, warping home now",
|
"dev.zontreck.otemod.msgs.homes.goto.success": "§2Home found, warping home now",
|
||||||
|
|
Reference in a new issue