From c9d6e306f1f90866f2bae2fc8fbe8e34fe12ffd4 Mon Sep 17 00:00:00 2001 From: Zrips Date: Wed, 15 Jun 2016 20:30:21 +0300 Subject: [PATCH] New mob names --- .../jobs/config/NameTranslatorManager.java | 6 ++++ com/gamingmesh/jobs/container/JobsPlayer.java | 1 - com/gamingmesh/jobs/dao/JobsDAOMySQL.java | 17 +++++++---- com/gamingmesh/jobs/dao/JobsDAOSQLite.java | 29 ++++++++++++++----- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/com/gamingmesh/jobs/config/NameTranslatorManager.java b/com/gamingmesh/jobs/config/NameTranslatorManager.java index e44e7121..12107991 100644 --- a/com/gamingmesh/jobs/config/NameTranslatorManager.java +++ b/com/gamingmesh/jobs/config/NameTranslatorManager.java @@ -1463,6 +1463,8 @@ public class NameTranslatorManager { c.get("EntityList.51.Name", "Skeleton"); c.get("EntityList.51:1.MCName", "Skeleton"); c.get("EntityList.51:1.Name", "WitherSkeleton"); + c.get("EntityList.51:2.MCName", "Skeleton"); + c.get("EntityList.51:2.Name", "Skeleton Stray"); c.get("EntityList.52.MCName", "Spider"); c.get("EntityList.52.Name", "Spider"); c.get("EntityList.53.MCName", "Giant"); @@ -1471,6 +1473,8 @@ public class NameTranslatorManager { c.get("EntityList.54.Name", "Zombie"); c.get("EntityList.54:1.MCName", "Zombie"); c.get("EntityList.54:1.Name", "Zombie Villager"); + c.get("EntityList.54:2.MCName", "Zombie"); + c.get("EntityList.54:2.Name", "Zombie Husk"); c.get("EntityList.55.MCName", "Slime"); c.get("EntityList.55.Name", "Slime"); c.get("EntityList.56.MCName", "Ghast"); @@ -1527,6 +1531,8 @@ public class NameTranslatorManager { c.get("EntityList.100.Name", "Horse"); c.get("EntityList.101.MCName", "Rabbit"); c.get("EntityList.101.Name", "Rabbit"); + c.get("EntityList.102.MCName", "PolarBear"); + c.get("EntityList.102.Name", "Polar Bear"); c.get("EntityList.120.MCName", "Villager"); c.get("EntityList.120.Name", "Villager"); c.get("EntityList.200.MCName", "EnderCrystal"); diff --git a/com/gamingmesh/jobs/container/JobsPlayer.java b/com/gamingmesh/jobs/container/JobsPlayer.java index 01e80547..624c6b7f 100644 --- a/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/com/gamingmesh/jobs/container/JobsPlayer.java @@ -33,7 +33,6 @@ import com.gamingmesh.jobs.dao.JobsDAO; import com.gamingmesh.jobs.dao.JobsDAOData; import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.stuff.ChatColor; -import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.Perm; public class JobsPlayer { diff --git a/com/gamingmesh/jobs/dao/JobsDAOMySQL.java b/com/gamingmesh/jobs/dao/JobsDAOMySQL.java index 20731bb1..a3524608 100644 --- a/com/gamingmesh/jobs/dao/JobsDAOMySQL.java +++ b/com/gamingmesh/jobs/dao/JobsDAOMySQL.java @@ -531,10 +531,11 @@ public class JobsDAOMySQL extends JobsDAO { // dropping 2 columns PreparedStatement prestLogTemp = null; ResultSet rsLogTemp = null; + boolean next = false; try { prestLogTemp = conn.prepareStatement("SELECT * FROM `" + getPrefix() + "log`;"); rsLogTemp = prestLogTemp.executeQuery(); - while (rsLogTemp.next()) { + while (next = rsLogTemp.next()) { rsLogTemp.getInt("userid"); rsLogTemp.getLong("time"); rsLogTemp.getString("action"); @@ -552,11 +553,6 @@ public class JobsDAOMySQL extends JobsDAO { prestLogTemp.close(); } catch (Exception e) { } - try { - executeSQL("CREATE TABLE `" + getPrefix() - + "log` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `userid` int, `username` varchar(20), `time` bigint, `action` varchar(20), `itemname` varchar(60), `count` int, `money` double, `exp` double);"); - } catch (Exception e) { - } } finally { try { if (rsLogTemp != null) @@ -567,6 +563,15 @@ public class JobsDAOMySQL extends JobsDAO { } } + if (!next) { + dropDataBase("log"); + try { + executeSQL("CREATE TABLE `" + getPrefix() + + "log` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `userid` int, `username` varchar(20), `time` bigint, `action` varchar(20), `itemname` varchar(60), `count` int, `money` double, `exp` double);"); + } catch (Exception e) { + } + } + if (rows == 0) { HashMap tempMap = new HashMap(); PreparedStatement prestJobs = null; diff --git a/com/gamingmesh/jobs/dao/JobsDAOSQLite.java b/com/gamingmesh/jobs/dao/JobsDAOSQLite.java index 9ba06552..32c183c7 100644 --- a/com/gamingmesh/jobs/dao/JobsDAOSQLite.java +++ b/com/gamingmesh/jobs/dao/JobsDAOSQLite.java @@ -29,6 +29,7 @@ import org.bukkit.Bukkit; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.container.PlayerInfo; +import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.UUIDUtil; public class JobsDAOSQLite extends JobsDAO { @@ -537,10 +538,13 @@ public class JobsDAOSQLite extends JobsDAO { // checking log table, recreating if old version present PreparedStatement prestLogTemp = null; ResultSet rsLogTemp = null; + boolean next = false; try { + Debug.D("trying table"); prestLogTemp = conn.prepareStatement("SELECT * FROM `" + getPrefix() + "log`;"); rsLogTemp = prestLogTemp.executeQuery(); - while (rsLogTemp.next()) { + while (next = rsLogTemp.next()) { + Debug.D("din table"); rsLogTemp.getInt("userid"); rsLogTemp.getLong("time"); rsLogTemp.getString("action"); @@ -548,9 +552,14 @@ public class JobsDAOSQLite extends JobsDAO { rsLogTemp.getInt("count"); rsLogTemp.getDouble("money"); rsLogTemp.getDouble("exp"); + + Debug.D("din table"); break; } } catch (Exception ex) { + + Debug.D("recreating table"); + try { if (rsLogTemp != null) rsLogTemp.close(); @@ -558,13 +567,7 @@ public class JobsDAOSQLite extends JobsDAO { prestLogTemp.close(); } catch (Exception e) { } - executeSQL("DROP TABLE IF EXISTS `" + getPrefix() + "log`;"); - try { - executeSQL("CREATE TABLE `" + getPrefix() - + "log_temp` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `userid` int, `time` bigint, `action` varchar(20), `itemname` varchar(60), `count` int, `money` double, `exp` double);"); - } catch (Exception e) { - e.printStackTrace(); - } + } finally { try { if (rsLogTemp != null) @@ -574,6 +577,16 @@ public class JobsDAOSQLite extends JobsDAO { } catch (Exception e) { } } + + if (!next){ + executeSQL("DROP TABLE IF EXISTS `" + getPrefix() + "log`;"); + try { + executeSQL("CREATE TABLE `" + getPrefix() + + "log` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `userid` int, `time` bigint, `action` varchar(20), `itemname` varchar(60), `count` int, `money` double, `exp` double);"); + } catch (Exception e) { + e.printStackTrace(); + } + } if (rows != 0) return;