Closed FlashLight34 closed 8 years ago
If you wan i maked the code for convert old username to uuid :P i inserted this at line 226 in quickshop.java
int type = rs.getInt("type"); UUID uuidowner = null; try { uuidowner = UUID.fromString(owner); }catch(Exception e){ //Convert owner getLogger().info("Try to find "+owner+" to convert to uuid..."); uuidowner = GetPlayerUuidByName(owner); if (uuidowner == null) { //delete de shop getLogger().warning("Owner of this shop not found deleted all shop from him... "+owner); //code for delete the shop PreparedStatement delps = getDB().getConnection().prepareStatement("DELETE FROM shops WHERE owner = ?"); delps.setString(1, owner); delps.execute(); //refresh db connection rs.close(); ps = con.prepareStatement("SELECT * FROM shops"); rs = ps.executeQuery(); count = 0; continue; }else { //SQL CODE update old shop getLogger().info("Update all owner shops from "+owner+" to "+uuidowner.toString()); PreparedStatement delps = getDB().getConnection().prepareStatement("UPDATE shops SET owner = ? WHERE owner = ?"); delps.setString(1, uuidowner.toString()); delps.setString(2, owner); delps.execute(); //reload db rs.close(); ps = con.prepareStatement("SELECT * FROM shops"); rs = ps.executeQuery(); count = 0; continue; } } if (item == null) { getLogger().warning("Item null skip this shop "+x+" "+y+" "+z+" in "+worldName); continue; } Shop shop = new ContainerShop(loc, price, item, uuidowner);
with this:
public UUID getplayeruuidbyname(String name){ Player onlpl = getServer().getPlayer(name); if (onlpl != null) return onlpl.getUniqueId(); for (OfflinePlayer pl:getServer().getOfflinePlayers()) { if (pl.getName().equalsIgnoreCase(name)) { return pl.getUniqueId(); } } return null; }
I added a conversion from older databases on this commit: https://github.com/KaiKikuchi/QuickShop/commit/b74fc7fd5f2b92313409b1028578dae4e439ae2e
If you wan i maked the code for convert old username to uuid :P i inserted this at line 226 in quickshop.java
with this: