mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Implement some missing codes
Fixed issue when added the schedules to list but cleared in for-loop.
This commit is contained in:
parent
0cef1e8dfd
commit
13432fe35f
@ -239,6 +239,8 @@ public class ItemManager {
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3489,6 +3491,8 @@ public class ItemManager {
|
||||
return SlabType.BOTTOM;
|
||||
case "DOUBLE":
|
||||
return SlabType.DOUBLE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@ -3536,6 +3540,8 @@ public class ItemManager {
|
||||
default:
|
||||
return SlabType.DOUBLE;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ public class Jobs extends JavaPlugin {
|
||||
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
|
||||
getServer().getPluginManager().registerEvents(new McMMO2_X_listener(this), this);
|
||||
consoleMsg("&e[Jobs] Registered McMMO 2.x listener");
|
||||
} catch (Throwable e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
getServer().getPluginManager().registerEvents(new McMMO1_X_listener(this), this);
|
||||
consoleMsg("&e[Jobs] Registered McMMO 1.x listener");
|
||||
}
|
||||
@ -247,10 +247,10 @@ public class Jobs extends JavaPlugin {
|
||||
return false;
|
||||
if (getVersionCheckManager().convertVersion(getServer().getPluginManager()
|
||||
.getPlugin("PlaceholderAPI").getDescription().getVersion()) >= getVersionCheckManager().convertVersion("2.10.0")) {
|
||||
if ((new NewPlaceholderAPIHook(this)).register())
|
||||
if (new NewPlaceholderAPIHook(this).register())
|
||||
consoleMsg("&e[Jobs] PlaceholderAPI hooked.");
|
||||
} else {
|
||||
if ((new PlaceholderAPIHook(this)).hook())
|
||||
if (new PlaceholderAPIHook(this).hook())
|
||||
consoleMsg("&e[Jobs] PlaceholderAPI hooked. This is a deprecated version. In the PlaceholderAPI"
|
||||
+ " new version has removed the extension and we using the latest.");
|
||||
}
|
||||
@ -687,7 +687,7 @@ public class Jobs extends JavaPlugin {
|
||||
try {
|
||||
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
|
||||
getInstance().getServer().getPluginManager().registerEvents(new McMMO2_X_listener(instance), instance);
|
||||
} catch (Exception e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
getInstance().getServer().getPluginManager().registerEvents(new McMMO1_X_listener(instance), instance);
|
||||
}
|
||||
}
|
||||
|
@ -591,7 +591,7 @@ public class PlayerManager {
|
||||
if (player == null || !player.isOnline())
|
||||
return;
|
||||
|
||||
Firework f = (Firework) player.getWorld().spawn(player.getLocation(), Firework.class);
|
||||
Firework f = player.getWorld().spawn(player.getLocation(), Firework.class);
|
||||
FireworkMeta fm = f.getFireworkMeta();
|
||||
|
||||
if (Jobs.getGCManager().UseRandom) {
|
||||
|
@ -377,11 +377,14 @@ public class editjobs implements Cmd {
|
||||
case "offhand":
|
||||
item = ItemReflection.getItemInOffHand(player);
|
||||
key = item.getType().name() + "-" + item.getData().getData();
|
||||
break;
|
||||
case "looking":
|
||||
case "lookingat":
|
||||
Block block = Util.getTargetBlock(player, 30);
|
||||
key = block.getType().name() + "-" + block.getData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
String myKey = key;
|
||||
@ -464,6 +467,8 @@ public class editjobs implements Cmd {
|
||||
type = "ARMOR_STAND";
|
||||
meta = "1";
|
||||
break c;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (actionT == ActionType.BREAK || actionT == ActionType.PLACE || actionT == ActionType.STRIPLOGS) {
|
||||
@ -543,6 +548,11 @@ public class editjobs implements Cmd {
|
||||
id = 68;
|
||||
meta = "1";
|
||||
break;
|
||||
default:
|
||||
type = CMIEntityType.getByName(myKey.toUpperCase()).name();
|
||||
id = CMIEntityType.getByName(myKey.toUpperCase()).getId();
|
||||
meta = "1";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,6 +627,8 @@ public class editjobs implements Cmd {
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,8 @@ public class editpoints implements Cmd {
|
||||
"%playername%", jPlayer.getUserName(),
|
||||
"%amount%", amount));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ public class exp implements Cmd {
|
||||
case "take":
|
||||
action = Action.Take;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
double amount = 0.0;
|
||||
@ -72,6 +74,8 @@ public class exp implements Cmd {
|
||||
case Take:
|
||||
prog.takeExperience(amount);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
|
@ -40,6 +40,8 @@ public class level implements Cmd {
|
||||
case "take":
|
||||
action = Action.Take;
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -83,6 +85,8 @@ public class level implements Cmd {
|
||||
case Take:
|
||||
prog.setLevel(amount);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
|
@ -250,6 +250,8 @@ public class ConfigManager {
|
||||
id = 30;
|
||||
meta = "1";
|
||||
break c;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Break and Place actions MUST be blocks
|
||||
@ -343,6 +345,11 @@ public class ConfigManager {
|
||||
id = 68;
|
||||
meta = "1";
|
||||
break;
|
||||
default:
|
||||
type = CMIEntityType.getByName(myKey.toUpperCase()).name();
|
||||
id = CMIEntityType.getByName(myKey.toUpperCase()).getId();
|
||||
meta = "1";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1034,6 +1041,8 @@ public class ConfigManager {
|
||||
id = 30;
|
||||
meta = "1";
|
||||
break c;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Break and Place actions MUST be blocks
|
||||
@ -1122,6 +1131,11 @@ public class ConfigManager {
|
||||
id = 68;
|
||||
meta = "1";
|
||||
break;
|
||||
default:
|
||||
type = CMIEntityType.getByName(myKey.toUpperCase()).name();
|
||||
id = CMIEntityType.getByName(myKey.toUpperCase()).getId();
|
||||
meta = "1";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,7 @@ public class NameTranslatorManager {
|
||||
return one.getName();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -157,6 +157,8 @@ public class ScheduleManager {
|
||||
return "saturday";
|
||||
case 1:
|
||||
return "sunday";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "all";
|
||||
}
|
||||
|
@ -83,11 +83,11 @@ public class Schedule {
|
||||
}
|
||||
|
||||
public void setBoost(CurrencyType type, double amount) {
|
||||
this.BM.add(type, amount - 1);
|
||||
BM.add(type, amount - 1);
|
||||
}
|
||||
|
||||
public double getBoost(CurrencyType type) {
|
||||
return this.BM.get(type);
|
||||
return BM.get(type);
|
||||
}
|
||||
|
||||
public BoostMultiplier getBoost() {
|
||||
@ -138,13 +138,14 @@ public class Schedule {
|
||||
}
|
||||
|
||||
public void setJobs(List<String> JobsNameList) {
|
||||
for (int z = 0; z < JobsNameList.size(); z++) {
|
||||
|
||||
if (JobsNameList.get(z).equalsIgnoreCase("all")) {
|
||||
JobsList.clear();
|
||||
|
||||
List<Job> jobl = Jobs.getJobs();
|
||||
for (int z = 0; z < JobsNameList.size(); z++) {
|
||||
if (JobsNameList.get(z).equalsIgnoreCase("all")) {
|
||||
if (jobl != null)
|
||||
JobsList.addAll(Jobs.getJobs());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -177,7 +178,7 @@ public class Schedule {
|
||||
for (String one : msg) {
|
||||
temp.add(ChatColor.translateAlternateColorCodes('&', one.replace("[until]", Until).replace("[from]", From)));
|
||||
}
|
||||
this.MessageOnStart.addAll(temp);
|
||||
MessageOnStart.addAll(temp);
|
||||
}
|
||||
|
||||
public List<String> GetMessageOnStart() {
|
||||
@ -189,7 +190,7 @@ public class Schedule {
|
||||
for (String one : msg) {
|
||||
temp.add(ChatColor.translateAlternateColorCodes('&', one.replace("[until]", Until).replace("[from]", From)));
|
||||
}
|
||||
this.MessageOnStop.addAll(temp);
|
||||
MessageOnStop.addAll(temp);
|
||||
}
|
||||
|
||||
public List<String> GetMessageOnStop() {
|
||||
@ -201,7 +202,7 @@ public class Schedule {
|
||||
for (String one : msg) {
|
||||
temp.add(ChatColor.translateAlternateColorCodes('&', one.replace("[until]", Until).replace("[from]", From)));
|
||||
}
|
||||
this.MessageToBroadcast.addAll(temp);
|
||||
MessageToBroadcast.addAll(temp);
|
||||
}
|
||||
|
||||
public List<String> GetMessageToBroadcast() {
|
||||
|
@ -127,7 +127,6 @@ public class JobsMySQL extends JobsDAO {
|
||||
try {
|
||||
statement = conn.createStatement();
|
||||
statement.execute(query);
|
||||
statement.close();
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("&cCould not create table, SQLException: " + e.getMessage());
|
||||
return false;
|
||||
@ -174,8 +173,9 @@ public class JobsMySQL extends JobsDAO {
|
||||
return false;
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("Not a table |" + "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='" + table + "';" + "|");
|
||||
close(statement);
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,12 +190,12 @@ public class JobsMySQL extends JobsDAO {
|
||||
}
|
||||
try {
|
||||
statement.executeQuery("SELECT `" + collumn + "` FROM `" + table + "`;");
|
||||
statement.close();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("Not a culumn |" + "SELECT " + collumn + " FROM " + table + "|");
|
||||
close(statement);
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,11 +211,11 @@ public class JobsMySQL extends JobsDAO {
|
||||
try {
|
||||
Jobs.consoleMsg("Creating culumn |" + "ALTER TABLE `" + table + "` ADD COLUMN `" + collumn + "` " + type + ";" + "|");
|
||||
statement.executeUpdate("ALTER TABLE `" + table + "` ADD COLUMN `" + collumn + "` " + type + ";");
|
||||
statement.close();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
close(statement);
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,14 +231,13 @@ public class JobsMySQL extends JobsDAO {
|
||||
statement = getConnection().createStatement();
|
||||
query = "DELETE FROM " + table + ";";
|
||||
statement.executeUpdate(query);
|
||||
statement.close();
|
||||
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("&cCould not wipe table, SQLException: " + e.getMessage());
|
||||
close(statement);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,14 +253,13 @@ public class JobsMySQL extends JobsDAO {
|
||||
statement = getConnection().createStatement();
|
||||
query = "DROP TABLE IF EXISTS `" + table + "`;";
|
||||
statement.executeUpdate(query);
|
||||
statement.close();
|
||||
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("&cCould not wipe table, SQLException: " + e.getMessage());
|
||||
close(statement);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,12 +121,12 @@ public class JobsSQLite extends JobsDAO {
|
||||
|
||||
statement = getConnection().createStatement();
|
||||
statement.execute(query);
|
||||
statement.close();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("&cCould not create table, SQLException: " + e.getMessage());
|
||||
close(statement);
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,11 +177,11 @@ public class JobsSQLite extends JobsDAO {
|
||||
}
|
||||
try {
|
||||
statement.executeQuery("ALTER TABLE `" + table + "` ADD `" + collumn + "` " + type);
|
||||
statement.close();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
close(statement);
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,14 +197,14 @@ public class JobsSQLite extends JobsDAO {
|
||||
statement = getConnection().createStatement();
|
||||
query = "DELETE FROM `" + table + "`;";
|
||||
statement.executeQuery(query);
|
||||
statement.close();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
if (!(e.getMessage().toLowerCase().contains("locking") || e.getMessage().toLowerCase().contains("locked")) &&
|
||||
!e.toString().contains("not return ResultSet"))
|
||||
Jobs.consoleMsg("&cError in wipeTable() query: " + e);
|
||||
close(statement);
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,13 +220,11 @@ public class JobsSQLite extends JobsDAO {
|
||||
statement = getConnection().createStatement();
|
||||
query = "DROP TABLE IF EXISTS `" + table + "`;";
|
||||
statement.executeQuery(query);
|
||||
statement.close();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
if (!(e.getMessage().toLowerCase().contains("locking") || e.getMessage().toLowerCase().contains("locked")) &&
|
||||
!e.toString().contains("not return ResultSet"))
|
||||
Jobs.consoleMsg("&cError in dropTable() query: " + e);
|
||||
close(statement);
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
|
Loading…
Reference in New Issue
Block a user