mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +00:00
Fix offline/last/respawn position setting
This commit is contained in:
1 parent
aa0dbeff4b
commit
f6cb19cf40
3 files changed
+12
-6
No files matched your search
@@ -171,7 +171,6 @@ public class HuskHomesBukkit extends JavaPlugin implements HuskHomes {
|
|||||||
for (CommandBase commandBase : commands) {
|
for (CommandBase commandBase : commands) {
|
||||||
final PluginCommand pluginCommand = getCommand(commandBase.command);
|
final PluginCommand pluginCommand = getCommand(commandBase.command);
|
||||||
if (pluginCommand != null) {
|
if (pluginCommand != null) {
|
||||||
getLogger().log(Level.INFO, "Registered /" + commandBase.command);
|
|
||||||
new BukkitCommand(commandBase, this).register(pluginCommand);
|
new BukkitCommand(commandBase, this).register(pluginCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -699,7 +699,9 @@ public class MySqlDatabase extends Database {
|
|||||||
return CompletableFuture.runAsync(() -> {
|
return CompletableFuture.runAsync(() -> {
|
||||||
try (Connection connection = getConnection()) {
|
try (Connection connection = getConnection()) {
|
||||||
try (PreparedStatement queryStatement = connection.prepareStatement(formatStatementTables("""
|
try (PreparedStatement queryStatement = connection.prepareStatement(formatStatementTables("""
|
||||||
SELECT `last_position` FROM `%players_table%`
|
SELECT `last_position`
|
||||||
|
FROM `%players_table%`
|
||||||
|
INNER JOIN `%positions_table%` ON `%players_table%`.last_position = "%positions_table%".id
|
||||||
WHERE `uuid`=?;"""))) {
|
WHERE `uuid`=?;"""))) {
|
||||||
queryStatement.setString(1, user.uuid.toString());
|
queryStatement.setString(1, user.uuid.toString());
|
||||||
|
|
||||||
@@ -760,6 +762,7 @@ public class MySqlDatabase extends Database {
|
|||||||
try (Connection connection = getConnection()) {
|
try (Connection connection = getConnection()) {
|
||||||
try (PreparedStatement queryStatement = connection.prepareStatement(formatStatementTables("""
|
try (PreparedStatement queryStatement = connection.prepareStatement(formatStatementTables("""
|
||||||
SELECT `offline_position` FROM `%players_table%`
|
SELECT `offline_position` FROM `%players_table%`
|
||||||
|
INNER JOIN `%positions_table%` ON `%players_table%`.offline_position = "%positions_table%".id
|
||||||
WHERE `uuid`=?;"""))) {
|
WHERE `uuid`=?;"""))) {
|
||||||
queryStatement.setString(1, user.uuid.toString());
|
queryStatement.setString(1, user.uuid.toString());
|
||||||
|
|
||||||
@@ -820,6 +823,7 @@ public class MySqlDatabase extends Database {
|
|||||||
try (Connection connection = getConnection()) {
|
try (Connection connection = getConnection()) {
|
||||||
try (PreparedStatement queryStatement = connection.prepareStatement(formatStatementTables("""
|
try (PreparedStatement queryStatement = connection.prepareStatement(formatStatementTables("""
|
||||||
SELECT `respawn_position` FROM `%players_table%`
|
SELECT `respawn_position` FROM `%players_table%`
|
||||||
|
INNER JOIN `%positions_table%` ON `%players_table%`.respawn_position = "%positions_table%".id
|
||||||
WHERE `uuid`=?;"""))) {
|
WHERE `uuid`=?;"""))) {
|
||||||
queryStatement.setString(1, user.uuid.toString());
|
queryStatement.setString(1, user.uuid.toString());
|
||||||
|
|
||||||
|
|||||||
@@ -185,10 +185,10 @@ public class SqLiteDatabase extends Database {
|
|||||||
updatePosition(positionId, position, connection);
|
updatePosition(positionId, position, connection);
|
||||||
|
|
||||||
try (PreparedStatement updateStatement = connection.prepareStatement(formatStatementTables("""
|
try (PreparedStatement updateStatement = connection.prepareStatement(formatStatementTables("""
|
||||||
UPDATE `%saved_positions_table%`
|
UPDATE `%saved_positions_table%`
|
||||||
SET `name`=?,
|
SET `name`=?,
|
||||||
`description`=?
|
`description`=?
|
||||||
WHERE `id`=?;"""))) {
|
WHERE `id`=?;"""))) {
|
||||||
updateStatement.setString(1, position.meta.name);
|
updateStatement.setString(1, position.meta.name);
|
||||||
updateStatement.setString(2, position.meta.description);
|
updateStatement.setString(2, position.meta.description);
|
||||||
updateStatement.setInt(3, savedPositionId);
|
updateStatement.setInt(3, savedPositionId);
|
||||||
@@ -683,6 +683,7 @@ public class SqLiteDatabase extends Database {
|
|||||||
try {
|
try {
|
||||||
try (PreparedStatement queryStatement = getConnection().prepareStatement(formatStatementTables("""
|
try (PreparedStatement queryStatement = getConnection().prepareStatement(formatStatementTables("""
|
||||||
SELECT `last_position` FROM `%players_table%`
|
SELECT `last_position` FROM `%players_table%`
|
||||||
|
INNER JOIN `%positions_table%` ON `%players_table%`.last_position = "%positions_table%".id
|
||||||
WHERE `uuid`=?;"""))) {
|
WHERE `uuid`=?;"""))) {
|
||||||
queryStatement.setString(1, user.uuid.toString());
|
queryStatement.setString(1, user.uuid.toString());
|
||||||
|
|
||||||
@@ -743,6 +744,7 @@ public class SqLiteDatabase extends Database {
|
|||||||
try {
|
try {
|
||||||
try (PreparedStatement queryStatement = getConnection().prepareStatement(formatStatementTables("""
|
try (PreparedStatement queryStatement = getConnection().prepareStatement(formatStatementTables("""
|
||||||
SELECT `offline_position` FROM `%players_table%`
|
SELECT `offline_position` FROM `%players_table%`
|
||||||
|
INNER JOIN `%positions_table%` ON `%players_table%`.offline_position = "%positions_table%".id
|
||||||
WHERE `uuid`=?;"""))) {
|
WHERE `uuid`=?;"""))) {
|
||||||
queryStatement.setString(1, user.uuid.toString());
|
queryStatement.setString(1, user.uuid.toString());
|
||||||
|
|
||||||
@@ -803,6 +805,7 @@ public class SqLiteDatabase extends Database {
|
|||||||
try {
|
try {
|
||||||
try (PreparedStatement queryStatement = getConnection().prepareStatement(formatStatementTables("""
|
try (PreparedStatement queryStatement = getConnection().prepareStatement(formatStatementTables("""
|
||||||
SELECT `respawn_position` FROM `%players_table%`
|
SELECT `respawn_position` FROM `%players_table%`
|
||||||
|
INNER JOIN `%positions_table%` ON `%players_table%`.respawn_position = "%positions_table%".id
|
||||||
WHERE `uuid`=?;"""))) {
|
WHERE `uuid`=?;"""))) {
|
||||||
queryStatement.setString(1, user.uuid.toString());
|
queryStatement.setString(1, user.uuid.toString());
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user