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
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@
29
29
importjava.util.Date;
30
30
importjava.util.Objects;
31
31
importjava.util.Optional;
32
+
importjava.util.UUID;
32
33
importjava.util.logging.Level;
33
34
importjava.util.stream.IntStream;
34
35
importjava.util.zip.CRC32;
@@ -96,7 +97,7 @@ public POS(final @NotNull ResultSet rs) throws @NotNull SQLException, @NotNull I
96
97
this.x = rs.getInt("x");
97
98
this.y = rs.getInt("y");
98
99
this.z = rs.getInt("z");
99
-
final@NotNullOptional<@NotNullWorld> world = Optional.ofNullable(BankAccounts.getInstance().getServer().getWorld(rs.getString("world")));
100
+
final@NotNullOptional<@NotNullWorld> world = Optional.ofNullable(BankAccounts.getInstance().getServer().getWorld(UUID.fromString(rs.getString("world"))));
100
101
if (world.isEmpty()) thrownewIllegalStateException("World not found: " + rs.getString("world"));
101
102
this.world = world.get();
102
103
this.price = rs.getBigDecimal("price");
@@ -123,7 +124,7 @@ public POS(final @NotNull ResultSet rs) throws @NotNull SQLException, @NotNull I
123
124
* Create POS id
124
125
*/
125
126
public@NotNullStringid() {
126
-
returnworld.getName() + ":" + x + ":" + y + ":" + z;
127
+
returnworld.getUID() + ":" + x + ":" + y + ":" + z;
127
128
}
128
129
129
130
/**
@@ -135,7 +136,7 @@ public void save() {
135
136
stmt.setInt(1, x);
136
137
stmt.setInt(2, y);
137
138
stmt.setInt(3, z);
138
-
stmt.setString(4, world.getName());
139
+
stmt.setString(4, world.getUID().toString());
139
140
stmt.setBigDecimal(5, price);
140
141
if (description == null) stmt.setNull(6, Types.VARCHAR);
141
142
elsestmt.setString(6, description);
@@ -157,7 +158,7 @@ public void delete() {
157
158
stmt.setInt(1, x);
158
159
stmt.setInt(2, y);
159
160
stmt.setInt(3, z);
160
-
stmt.setString(4, world.getName());
161
+
stmt.setString(4, world.getUID().toString());
161
162
stmt.executeUpdate();
162
163
} catch (final@NotNullSQLExceptione) {
163
164
BankAccounts.getInstance().getLogger().log(Level.SEVERE, "Could not delete POS in " + world.getName() + " at X: " + x + " Y: " + y + " Z: " + z, e);
0 commit comments