cleanup code

Former-commit-id: b0e393acd29365fb2c5992fdd7da9e60e29db8ea
This commit is contained in:
Ghost_chu committed 2018-10-27 12:19:08 +08:00
1 parent e05b9a08e9
commit 8d29a9fff2
3 files changed
+12 -6

No files matched your search

@@ -4,8 +4,9 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.bukkit.inventory.ItemStack;
import org.maxgamer.quickshop.QuickShop;
import org.maxgamer.quickshop.Util.Util;
public class DatabaseHelper {
public static void setup(Database db) throws SQLException {
@@ -106,5 +107,11 @@ public class DatabaseHelper {
+ " AND world = \"" + worldName + "\" LIMIT 1");
}
public static void updateShop(Database db, String owner, ItemStack itemConfig, int unlimited, int shopType,
double price, int x, int y, int z, String world) {
String q = "UPDATE shops SET owner = ?, itemConfig = ?, unlimited = ?, type = ?, price = ? WHERE x = ? AND y = ? and z = ? and world = ?";
db.execute(q, owner, Util.serialize(itemConfig), unlimited, shopType, price, x, y, z, world);
}
}
@@ -199,9 +199,10 @@ public class ContainerShop implements Shop {
int z = this.getLocation().getBlockZ();
String world = this.getLocation().getWorld().getName();
int unlimited = this.isUnlimited() ? 1 : 0;
String q = "UPDATE shops SET owner = ?, itemConfig = ?, unlimited = ?, type = ?, price = ? WHERE x = ? AND y = ? and z = ? and world = ?";
//String q = "UPDATE shops SET owner = ?, itemConfig = ?, unlimited = ?, type = ?, price = ? WHERE x = ? AND y = ? and z = ? and world = ?";
try {
plugin.getDB().execute(q, this.getOwner().toString(), Util.serialize(this.getItem()), unlimited, shopType.toID(), this.getPrice(), x, y, z, world);
//plugin.getDB().execute(q, this.getOwner().toString(), Util.serialize(this.getItem()), unlimited, shopType.toID(), this.getPrice(), x, y, z, world);
DatabaseHelper.updateShop(plugin.getDB(), this.getOwner().toString(), this.getItem(), unlimited, shopType.toID(), this.getPrice(), x, y, z, world);
} catch (Exception e) {
e.printStackTrace();
plugin.getLogger().log(Level.WARNING, "Could not update shop in database! Changes will revert after a reboot!");
@@ -21,11 +21,9 @@ public class ItemNMS {
Object obj;
try {
obj = nmsClass.newInstance();
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
} catch (InstantiationException e1) { //NMS Class not found, Use old preview
return null;
} catch (IllegalAccessException e1) {
// TODO Auto-generated catch block
return null;
}
try {