You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/pro/cloudnode/smp/bankaccounts/POS.java
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
packagepro.cloudnode.smp.bankaccounts;
2
2
3
-
importorg.bukkit.Bukkit;
4
3
importorg.bukkit.Location;
5
4
importorg.bukkit.World;
6
5
importorg.bukkit.block.Block;
@@ -29,6 +28,7 @@
29
28
importjava.util.Date;
30
29
importjava.util.Objects;
31
30
importjava.util.Optional;
31
+
importjava.util.UUID;
32
32
importjava.util.logging.Level;
33
33
importjava.util.stream.IntStream;
34
34
importjava.util.zip.CRC32;
@@ -96,7 +96,7 @@ public POS(final @NotNull ResultSet rs) throws @NotNull SQLException, @NotNull I
96
96
this.x = rs.getInt("x");
97
97
this.y = rs.getInt("y");
98
98
this.z = rs.getInt("z");
99
-
final@NotNullOptional<@NotNullWorld> world = Optional.ofNullable(BankAccounts.getInstance().getServer().getWorld(rs.getString("world")));
99
+
final@NotNullOptional<@NotNullWorld> world = Optional.ofNullable(BankAccounts.getInstance().getServer().getWorld(UUID.fromString(rs.getString("world"))));
100
100
if (world.isEmpty()) thrownewIllegalStateException("World not found: " + rs.getString("world"));
101
101
this.world = world.get();
102
102
this.price = rs.getBigDecimal("price");
@@ -123,7 +123,7 @@ public POS(final @NotNull ResultSet rs) throws @NotNull SQLException, @NotNull I
123
123
* Create POS id
124
124
*/
125
125
public@NotNullStringid() {
126
-
returnworld.getName() + ":" + x + ":" + y + ":" + z;
126
+
returnworld.getUID() + ":" + x + ":" + y + ":" + z;
127
127
}
128
128
129
129
/**
@@ -135,7 +135,7 @@ public void save() {
135
135
stmt.setInt(1, x);
136
136
stmt.setInt(2, y);
137
137
stmt.setInt(3, z);
138
-
stmt.setString(4, world.getName());
138
+
stmt.setString(4, world.getUID().toString());
139
139
stmt.setBigDecimal(5, price);
140
140
if (description == null) stmt.setNull(6, Types.VARCHAR);
141
141
elsestmt.setString(6, description);
@@ -157,7 +157,7 @@ public void delete() {
157
157
stmt.setInt(1, x);
158
158
stmt.setInt(2, y);
159
159
stmt.setInt(3, z);
160
-
stmt.setString(4, world.getName());
160
+
stmt.setString(4, world.getUID().toString());
161
161
stmt.executeUpdate();
162
162
} catch (final@NotNullSQLExceptione) {
163
163
BankAccounts.getInstance().getLogger().log(Level.SEVERE, "Could not delete POS in " + world.getName() + " at X: " + x + " Y: " + y + " Z: " + z, e);
0 commit comments