mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-03 23:08:07 +01:00
Cleanup and some fixes
This commit is contained in:
parent
324b4dc0b4
commit
fbb0bfee90
@ -257,7 +257,7 @@ public class Jobs {
|
||||
return GUIManager;
|
||||
}
|
||||
|
||||
public static void setGUIManager(JobsPlugin plugin) {
|
||||
public static void setGUIManager() {
|
||||
GUIManager = new GuiManager();
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ public class Jobs {
|
||||
}
|
||||
|
||||
Jobs.getGCManager().reload();
|
||||
Jobs.getLanguage().reload(Jobs.getGCManager().getLocale());
|
||||
Jobs.getLanguage().reload();
|
||||
Jobs.getConfigManager().reload();
|
||||
usedSlots.clear();
|
||||
for (Job job : jobs) {
|
||||
@ -533,7 +533,6 @@ public class Jobs {
|
||||
public static int getUsedSlots(Job job) {
|
||||
if (usedSlots.containsKey(job))
|
||||
return usedSlots.get(job);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -631,7 +630,8 @@ public class Jobs {
|
||||
if (data.isReseted())
|
||||
data.setReseted(false);
|
||||
return false;
|
||||
} else
|
||||
}
|
||||
|
||||
data.AddAmount(amount);
|
||||
paymentLimit.put(playername, data);
|
||||
}
|
||||
@ -669,7 +669,7 @@ public class Jobs {
|
||||
if (data.isReseted())
|
||||
data.setReseted(false);
|
||||
return false;
|
||||
} else
|
||||
}
|
||||
data.AddExpAmount(amount);
|
||||
ExpLimit.put(playername, data);
|
||||
}
|
||||
@ -710,7 +710,7 @@ public class Jobs {
|
||||
if (data.isReseted())
|
||||
data.setReseted(false);
|
||||
return false;
|
||||
} else
|
||||
}
|
||||
data.AddPoints(amount);
|
||||
PointLimit.put(playername, data);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class JobsPlugin extends JavaPlugin {
|
||||
|
||||
Jobs.setScboard(this);
|
||||
Jobs.setLanguage(this);
|
||||
Jobs.setGUIManager(this);
|
||||
Jobs.setGUIManager();
|
||||
Jobs.setExplore();
|
||||
|
||||
Jobs.setBBManager(this);
|
||||
@ -103,6 +103,7 @@ public class JobsPlugin extends JavaPlugin {
|
||||
getServer().getPluginManager().registerEvents(new JobsListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new JobsPaymentListener(this), this);
|
||||
|
||||
Jobs.setMcMMOlistener(this);
|
||||
if (Jobs.getMcMMOlistener().CheckmcMMO()){
|
||||
getServer().getPluginManager().registerEvents(new McMMOlistener(this), this);
|
||||
}
|
||||
@ -127,7 +128,7 @@ public class JobsPlugin extends JavaPlugin {
|
||||
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Plugin has been enabled succesfully.");
|
||||
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
||||
console.sendMessage(message);
|
||||
Jobs.getLanguage().reload(Jobs.getGCManager().getLocale());
|
||||
Jobs.getLanguage().reload();
|
||||
|
||||
Jobs.getJobsDAO().loadExplore();
|
||||
|
||||
|
@ -243,9 +243,8 @@ public class PermissionHandler {
|
||||
public boolean hasWorldPermission(Player player, String world) {
|
||||
if (!player.hasPermission("jobs.use")) {
|
||||
return false;
|
||||
} else {
|
||||
return player.hasPermission("jobs.world." + world.toLowerCase());
|
||||
}
|
||||
return player.hasPermission("jobs.world." + world.toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -437,8 +437,7 @@ public class PlayerManager {
|
||||
return;
|
||||
|
||||
// LevelUp event
|
||||
JobsLevelUpEvent levelUpEvent = new JobsLevelUpEvent(jPlayer, job.getName(), prog.getLevel(), Jobs.gettitleManager().getTitleForLevel(oldLevel, job
|
||||
.getName()), Jobs.gettitleManager().getTitleForLevel(prog.getLevel(), job.getName()), Jobs.getGCManager().SoundLevelupSound
|
||||
JobsLevelUpEvent levelUpEvent = new JobsLevelUpEvent(jPlayer, job.getName(), prog.getLevel(), Jobs.gettitleManager().getTitleForLevel(oldLevel), Jobs.gettitleManager().getTitleForLevel(prog.getLevel()), Jobs.getGCManager().SoundLevelupSound
|
||||
.toUpperCase(), Jobs.getGCManager().SoundLevelupVolume, Jobs.getGCManager().SoundLevelupPitch, Jobs.getGCManager().SoundTitleChangeSound.toUpperCase(),
|
||||
Jobs.getGCManager().SoundTitleChangeVolume, Jobs.getGCManager().SoundTitleChangePitch);
|
||||
Bukkit.getServer().getPluginManager().callEvent(levelUpEvent);
|
||||
|
@ -131,7 +131,7 @@ public class SignUtil {
|
||||
if (i >= PlayerList.size()) {
|
||||
break;
|
||||
}
|
||||
String PlayerName = ((TopList) PlayerList.get(i)).getPlayerName();
|
||||
String PlayerName = PlayerList.get(i).getPlayerName();
|
||||
|
||||
if (PlayerName != null && PlayerName.length() > 8) {
|
||||
String PlayerNameStrip = PlayerName.split("(?<=\\G.{7})")[0];
|
||||
@ -144,14 +144,14 @@ public class SignUtil {
|
||||
String line = Jobs.getLanguage().getMessage("signs.List");
|
||||
line = line.replace("[number]", String.valueOf(i + number + 1));
|
||||
line = line.replace("[player]", PlayerName);
|
||||
line = line.replace("[level]", String.valueOf(((TopList) PlayerList.get(i)).getLevel()));
|
||||
line = line.replace("[level]", String.valueOf(PlayerList.get(i).getLevel()));
|
||||
|
||||
sign.setLine(i, line);
|
||||
}
|
||||
sign.update();
|
||||
UpdateHead(sign, ((TopList) PlayerList.get(0)).getPlayerName(), timelapse);
|
||||
UpdateHead(sign, PlayerList.get(0).getPlayerName(), timelapse);
|
||||
} else {
|
||||
String PlayerName = ((TopList) PlayerList.get(0)).getPlayerName();
|
||||
String PlayerName = PlayerList.get(0).getPlayerName();
|
||||
if (PlayerName.length() > 8) {
|
||||
String PlayerNameStrip = PlayerName.split("(?<=\\G.{7})")[0];
|
||||
PlayerName = PlayerNameStrip + "~";
|
||||
@ -159,32 +159,32 @@ public class SignUtil {
|
||||
String line1 = Jobs.getLanguage().getMessage("signs.SpecialList." + one.GetNumber() + ".1");
|
||||
line1 = line1.replace("[number]", String.valueOf(one.GetNumber() + number + 1));
|
||||
line1 = line1.replace("[player]", PlayerName);
|
||||
line1 = line1.replace("[level]", String.valueOf(((TopList) PlayerList.get(0)).getLevel()));
|
||||
line1 = line1.replace("[level]", String.valueOf(PlayerList.get(0).getLevel()));
|
||||
|
||||
sign.setLine(0, line1);
|
||||
|
||||
line1 = Jobs.getLanguage().getMessage("signs.SpecialList." + one.GetNumber() + ".2");
|
||||
line1 = line1.replace("[number]", String.valueOf(one.GetNumber() + number + 1));
|
||||
line1 = line1.replace("[player]", PlayerName);
|
||||
line1 = line1.replace("[level]", String.valueOf(((TopList) PlayerList.get(0)).getLevel()));
|
||||
line1 = line1.replace("[level]", String.valueOf(PlayerList.get(0).getLevel()));
|
||||
|
||||
sign.setLine(1, line1);
|
||||
|
||||
line1 = Jobs.getLanguage().getMessage("signs.SpecialList." + one.GetNumber() + ".3");
|
||||
line1 = line1.replace("[number]", String.valueOf(one.GetNumber() + number + 1));
|
||||
line1 = line1.replace("[player]", PlayerName);
|
||||
line1 = line1.replace("[level]", String.valueOf(((TopList) PlayerList.get(0)).getLevel()));
|
||||
line1 = line1.replace("[level]", String.valueOf(PlayerList.get(0).getLevel()));
|
||||
|
||||
sign.setLine(2, line1);
|
||||
|
||||
line1 = Jobs.getLanguage().getMessage("signs.SpecialList." + one.GetNumber() + ".4");
|
||||
line1 = line1.replace("[number]", String.valueOf(one.GetNumber() + number + 1));
|
||||
line1 = line1.replace("[player]", PlayerName);
|
||||
line1 = line1.replace("[level]", String.valueOf(((TopList) PlayerList.get(0)).getLevel()));
|
||||
line1 = line1.replace("[level]", String.valueOf(PlayerList.get(0).getLevel()));
|
||||
|
||||
sign.setLine(3, line1);
|
||||
sign.update();
|
||||
UpdateHead(sign, ((TopList) PlayerList.get(0)).getPlayerName(), timelapse);
|
||||
UpdateHead(sign, PlayerList.get(0).getPlayerName(), timelapse);
|
||||
}
|
||||
|
||||
timelapse++;
|
||||
|
@ -161,7 +161,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
int amountToShow = 7;
|
||||
int start = page * amountToShow - amountToShow;
|
||||
int end = page * amountToShow;
|
||||
int TotalPages = (int) commands.size() / amountToShow;
|
||||
int TotalPages = commands.size() / amountToShow;
|
||||
if (((commands.size() * 1.0) / (amountToShow * 1.0)) - TotalPages > 0)
|
||||
TotalPages++;
|
||||
if (start >= commands.size()) {
|
||||
@ -235,10 +235,9 @@ public class JobsCommands implements CommandExecutor {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
if (jarFile != null)
|
||||
try {
|
||||
if (jarFile != null) {
|
||||
jarFile.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
@ -338,9 +337,8 @@ public class JobsCommands implements CommandExecutor {
|
||||
public boolean hasJobPermission(CommandSender sender, Job job) {
|
||||
if (!sender.hasPermission("jobs.use")) {
|
||||
return false;
|
||||
} else {
|
||||
return sender.hasPermission("jobs.join." + job.getName().toLowerCase());
|
||||
}
|
||||
return sender.hasPermission("jobs.join." + job.getName().toLowerCase());
|
||||
}
|
||||
|
||||
public void sendValidActions(CommandSender sender) {
|
||||
@ -505,7 +503,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
String message = Jobs.getLanguage().getMessage("command.stats.output",
|
||||
"%joblevel%", Integer.valueOf(jobProg.getLevel()).toString(),
|
||||
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName() + ChatColor.WHITE,
|
||||
"%jobxp%", Double.toString(Math.round((Double) jobProg.getExperience() * 100.0) / 100.0),
|
||||
"%jobxp%", Double.toString(Math.round(jobProg.getExperience() * 100.0) / 100.0),
|
||||
"%jobmaxxp%", Integer.toString(jobProg.getMaxExperience()));
|
||||
return " " + jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) + " " + message;
|
||||
}
|
||||
@ -545,7 +543,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
"%joblevel%", Integer.valueOf(splited[1]).toString(),
|
||||
"%getbackjoblevel%", Integer.valueOf(splited[2]).toString(),
|
||||
"%jobname%", Jobs.getJob(splited[0]).getChatColor() + splited[0] + ChatColor.WHITE,
|
||||
"%jobxp%", Double.toString(Math.round((Double) Double.valueOf(splited[3]) * 100.0) / 100.0));
|
||||
"%jobxp%", Double.toString(Math.round(Double.valueOf(splited[3]) * 100.0) / 100.0));
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
@ -29,14 +29,12 @@ public class convert implements Cmd {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player pSender = (Player) sender;
|
||||
|
||||
List<Convert> list = null;
|
||||
List<Convert> archivelist = null;
|
||||
|
||||
try {
|
||||
list = Jobs.getJobsDAO().convertDatabase(pSender, "jobs");
|
||||
archivelist = Jobs.getJobsDAO().convertDatabase(pSender, "archive");
|
||||
list = Jobs.getJobsDAO().convertDatabase("jobs");
|
||||
archivelist = Jobs.getJobsDAO().convertDatabase("archive");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
sender.sendMessage(ChatColor.RED + "Can't read data from data base, please send error log to dev's.");
|
||||
|
@ -66,7 +66,7 @@ public class expboost implements Cmd {
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
if (job == null) {
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
@ -76,4 +76,3 @@ public class expboost implements Cmd {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class moneyboost implements Cmd {
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
if (job == null) {
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
@ -77,4 +77,3 @@ public class moneyboost implements Cmd {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class pointboost implements Cmd {
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
if (job == null) {
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
@ -77,4 +77,3 @@ public class pointboost implements Cmd {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ public class BossBarManager {
|
||||
String message = Jobs.getLanguage().getMessage("command.stats.output",
|
||||
"%joblevel%", Integer.valueOf(jobProg.getLevel()).toString(),
|
||||
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName() + ChatColor.WHITE,
|
||||
"%jobxp%", formatter.format(Math.round((Double) jobProg.getExperience() * 100.0) / 100.0),
|
||||
"%jobmaxxp%", (int) jobProg.getMaxExperience());
|
||||
"%jobxp%", formatter.format(Math.round(jobProg.getExperience() * 100.0) / 100.0),
|
||||
"%jobmaxxp%", jobProg.getMaxExperience());
|
||||
|
||||
if (bar == null) {
|
||||
BarColor color = BarColor.BLUE;
|
||||
|
@ -61,7 +61,7 @@ public class ExploreManager {
|
||||
eRegion.addChunk(eChunk);
|
||||
worlds.put(worldName, eRegion);
|
||||
return new ExploreRespond(eChunk.getCount(), true);
|
||||
} else {
|
||||
}
|
||||
ExploreRegion eRegion = worlds.get(worldName);
|
||||
ExploreChunk eChunk = null;
|
||||
for (ExploreChunk one : eRegion.getChunks()) {
|
||||
@ -77,10 +77,7 @@ public class ExploreManager {
|
||||
eChunk = new ExploreChunk(player, ChunkX, ChunkZ);
|
||||
eRegion.addChunk(eChunk);
|
||||
return new ExploreRespond(eChunk.getCount(), true);
|
||||
} else {
|
||||
}
|
||||
return eChunk.addPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,8 +7,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.JobsPlugin;
|
||||
import com.gamingmesh.jobs.container.LocaleReader;
|
||||
@ -39,7 +37,7 @@ public class LanguageManager {
|
||||
languages.add("tr");
|
||||
|
||||
for (String lang : languages) {
|
||||
YmlMaker langFile = new YmlMaker((JavaPlugin) plugin, "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
YmlMaker langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
if (langFile != null)
|
||||
langFile.saveDefaultConfig();
|
||||
}
|
||||
|
@ -9,8 +9,6 @@ import java.util.Set;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.JobsPlugin;
|
||||
import com.gamingmesh.jobs.container.JobInfo;
|
||||
@ -114,7 +112,7 @@ public class NameTranslatorManager {
|
||||
}
|
||||
|
||||
public void readFile() {
|
||||
YmlMaker ItemFile = new YmlMaker((JavaPlugin) plugin, "TranslatableWords" + File.separator + "Words_" + Jobs.getGCManager().localeString + ".yml");
|
||||
YmlMaker ItemFile = new YmlMaker(plugin, "TranslatableWords" + File.separator + "Words_" + Jobs.getGCManager().localeString + ".yml");
|
||||
ItemFile.saveDefaultConfig();
|
||||
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("ItemList");
|
||||
Set<String> keys = section.getKeys(false);
|
||||
@ -178,7 +176,7 @@ public class NameTranslatorManager {
|
||||
languages.add("fr");
|
||||
|
||||
for (String lang : languages) {
|
||||
YmlMaker langFile = new YmlMaker((JavaPlugin) plugin, "TranslatableWords" + File.separator + "Words_" + lang + ".yml");
|
||||
YmlMaker langFile = new YmlMaker(plugin, "TranslatableWords" + File.separator + "Words_" + lang + ".yml");
|
||||
if (langFile != null)
|
||||
langFile.saveDefaultConfig();
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class TitleManager {
|
||||
* @return the correct title
|
||||
* @return null if no title matches
|
||||
*/
|
||||
public Title getTitleForLevel(int level, String jobName) {
|
||||
public Title getTitleForLevel(int level) {
|
||||
Title title = null;
|
||||
for (Title t : titles) {
|
||||
if (title == null) {
|
||||
|
@ -47,12 +47,6 @@ public class YmlMaker {
|
||||
e1.printStackTrace();
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
f.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
this.Configuration = YamlConfiguration.loadConfiguration(f);
|
||||
@ -63,11 +57,18 @@ public class YmlMaker {
|
||||
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
|
||||
this.Configuration.setDefaults(defConfig);
|
||||
}
|
||||
if (defConfigStream != null)
|
||||
try {
|
||||
defConfigStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (f != null)
|
||||
try {
|
||||
f.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public FileConfiguration getConfig() {
|
||||
|
@ -9,11 +9,6 @@ public class ExploreRegion {
|
||||
int z;
|
||||
List<ExploreChunk> chunks = new ArrayList<ExploreChunk>();
|
||||
|
||||
public ExploreRegion(int x, int z, List<ExploreChunk> chunks) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public ExploreRegion(int x, int z) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
|
@ -233,9 +233,8 @@ public class JobsPlayer {
|
||||
counter.setBoost(Boost);
|
||||
counter.setTime(time);
|
||||
return Boost;
|
||||
} else {
|
||||
return counter.getBoost();
|
||||
}
|
||||
return counter.getBoost();
|
||||
}
|
||||
Boost = getPlayerBoost(JobName, type);
|
||||
counterList.add(new BoostCounter(type, Boost, time));
|
||||
@ -574,7 +573,7 @@ public class JobsPlayer {
|
||||
builder.append(Jobs.getGCManager().getModifyChatSeparator());
|
||||
gotTitle = false;
|
||||
}
|
||||
Title title = Jobs.gettitleManager().getTitleForLevel(prog.getLevel(), prog.getJob().getName());
|
||||
Title title = Jobs.gettitleManager().getTitleForLevel(prog.getLevel());
|
||||
|
||||
if (numJobs == 1) {
|
||||
if (method.equals(DisplayMethod.FULL) || method.equals(DisplayMethod.TITLE)) {
|
||||
|
@ -59,7 +59,6 @@ public class LocaleReader {
|
||||
copySetting(path);
|
||||
if (colorize)
|
||||
return ChatColor.translateAlternateColorCodes('&', config.getString(path));
|
||||
else
|
||||
return config.getString(path);
|
||||
}
|
||||
|
||||
|
@ -67,21 +67,18 @@ public final class Log {
|
||||
public int getCount(String item) {
|
||||
if (this.amountMap.containsKey(item))
|
||||
return this.amountMap.get(item).getCount();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getMoney(String item) {
|
||||
if (this.amountMap.containsKey(item))
|
||||
return this.amountMap.get(item).getMoney();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getExp(String item) {
|
||||
if (this.amountMap.containsKey(item))
|
||||
return this.amountMap.get(item).getExp();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -19,8 +19,6 @@ public final class TopList {
|
||||
if (info != null) {
|
||||
if (info.getValue().getName() != null)
|
||||
return info.getValue().getName();
|
||||
else
|
||||
return "Unknown";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public abstract class JobsDAO {
|
||||
if (userData == null) {
|
||||
recordNewPlayer(playerName, uuid);
|
||||
return jobs;
|
||||
} else
|
||||
}
|
||||
id = userData.getID();
|
||||
|
||||
JobsConnection conn = getConnection();
|
||||
@ -337,7 +337,7 @@ public abstract class JobsDAO {
|
||||
* @param job - job that the player wishes to join
|
||||
* @throws SQLException
|
||||
*/
|
||||
public List<Convert> convertDatabase(Player Player, String table) throws SQLException {
|
||||
public List<Convert> convertDatabase(String table) throws SQLException {
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return null;
|
||||
|
@ -540,7 +540,8 @@ public class JobsDAOMySQL extends JobsDAO {
|
||||
try {
|
||||
prestLogTemp = conn.prepareStatement("SELECT * FROM `" + getPrefix() + "log`;");
|
||||
rsLogTemp = prestLogTemp.executeQuery();
|
||||
while (next = rsLogTemp.next()) {
|
||||
while (rsLogTemp.next()) {
|
||||
next = true;
|
||||
rsLogTemp.getInt("userid");
|
||||
rsLogTemp.getLong("time");
|
||||
rsLogTemp.getString("action");
|
||||
|
@ -545,7 +545,8 @@ public class JobsDAOSQLite extends JobsDAO {
|
||||
try {
|
||||
prestLogTemp = conn.prepareStatement("SELECT * FROM `" + getPrefix() + "log`;");
|
||||
rsLogTemp = prestLogTemp.executeQuery();
|
||||
while (next = rsLogTemp.next()) {
|
||||
while (rsLogTemp.next()) {
|
||||
next = true;
|
||||
rsLogTemp.getInt("userid");
|
||||
rsLogTemp.getLong("time");
|
||||
rsLogTemp.getString("action");
|
||||
|
@ -180,12 +180,11 @@ public class BufferedEconomy {
|
||||
if (!hasMoney) {
|
||||
Jobs.getActionBar().send(payment.getOfflinePlayer().getPlayer(), ChatColor.RED + Jobs.getLanguage().getMessage("economy.error.nomoney"));
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
if (Jobs.getGCManager().isEconomyAsync())
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i);
|
||||
else
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i);
|
||||
}
|
||||
} else {
|
||||
if (Jobs.getGCManager().isEconomyAsync())
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i);
|
||||
|
@ -64,8 +64,8 @@ public class PaymentData {
|
||||
return this.lastAnnouced;
|
||||
}
|
||||
|
||||
public boolean IsAnnounceTime(int time) {
|
||||
if (this.lastAnnouced + (time * 1000) > System.currentTimeMillis())
|
||||
public boolean IsAnnounceTime(int t) {
|
||||
if (this.lastAnnouced + (t * 1000) > System.currentTimeMillis())
|
||||
return false;
|
||||
SetAnnouncmentTime();
|
||||
return true;
|
||||
@ -169,6 +169,7 @@ public class PaymentData {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
public int GetLeftsec(int time) {
|
||||
int lefttime1 = GetLeftTime(time);
|
||||
int sec = 0;
|
||||
@ -185,6 +186,7 @@ public class PaymentData {
|
||||
return sec;
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
public int GetLeftMin(int time) {
|
||||
int lefttime1 = GetLeftTime(time);
|
||||
int min = 0;
|
||||
|
@ -18,11 +18,8 @@
|
||||
|
||||
package com.gamingmesh.jobs.i18n;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.JobsPlugin;
|
||||
import com.gamingmesh.jobs.config.YmlMaker;
|
||||
@ -39,9 +36,9 @@ public class Language {
|
||||
/**
|
||||
* Reloads the config
|
||||
*/
|
||||
public void reload(Locale locale) {
|
||||
customlocale = new YmlMaker((JavaPlugin) plugin, "locale/messages_" + Jobs.getGCManager().localeString + ".yml").getConfig();
|
||||
enlocale = new YmlMaker((JavaPlugin) plugin, "locale/messages_en.yml").getConfig();
|
||||
public void reload() {
|
||||
customlocale = new YmlMaker(plugin, "locale/messages_" + Jobs.getGCManager().localeString + ".yml").getConfig();
|
||||
enlocale = new YmlMaker(plugin, "locale/messages_en.yml").getConfig();
|
||||
if (customlocale == null)
|
||||
customlocale = enlocale;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public class JobsListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
Player player = (Player) event.getPlayer();
|
||||
Player player = event.getPlayer();
|
||||
Bukkit.dispatchCommand(player, "jobs " + command + " " + ChatColor.stripColor(sign.getLine(2)) + " " + ChatColor.stripColor(sign.getLine(3)));
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ public class JobsListener implements Listener {
|
||||
if (!(block.getState() instanceof Sign))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getPlayer();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Sign sign = (Sign) block.getState();
|
||||
String FirstLine = sign.getLine(0);
|
||||
@ -316,7 +316,7 @@ public class JobsListener implements Listener {
|
||||
if (!signtype.equalsIgnoreCase("toplist") && !signtype.equalsIgnoreCase("gtoplist"))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getPlayer();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!event.getPlayer().hasPermission("jobs.command.signs")) {
|
||||
event.setCancelled(true);
|
||||
@ -531,7 +531,7 @@ public class JobsListener implements Listener {
|
||||
//disabling plugin in world
|
||||
if (event.getClickedBlock() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getClickedBlock().getWorld()))
|
||||
return;
|
||||
Player player = (Player) event.getPlayer();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
ItemStack iih = player.getItemInHand();
|
||||
|
||||
@ -607,11 +607,7 @@ public class JobsListener implements Listener {
|
||||
if (oneItem.getenchants().get(oneE.getKey()) <= oneE.getValue()) {
|
||||
foundEnc = true;
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,6 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
import org.bukkit.inventory.AnvilInventory;
|
||||
import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.EnchantingInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -112,12 +111,12 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
if (!(event.getRightClicked() instanceof LivingEntity))
|
||||
return;
|
||||
Entity cow = (LivingEntity) event.getRightClicked();
|
||||
Entity cow = event.getRightClicked();
|
||||
|
||||
if (cow.getType() != EntityType.COW && cow.getType() != EntityType.MUSHROOM_COW)
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getPlayer();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
@ -183,7 +182,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (!this.plugin.isEnabled())
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getPlayer();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
@ -228,7 +227,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (jPlayer == null || !jPlayer.getPlayer().isOnline())
|
||||
return;
|
||||
|
||||
Player player = (Player) jPlayer.getPlayer();
|
||||
Player player = jPlayer.getPlayer();
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
return;
|
||||
@ -259,7 +258,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
if (Jobs.getGCManager().useBlockTimer)
|
||||
if (Jobs.getPistonProtectionListener().checkVegybreak(block, (Player) event.getPlayer()))
|
||||
if (Jobs.getPistonProtectionListener().checkVegybreak(block, event.getPlayer()))
|
||||
return;
|
||||
|
||||
// make sure plugin is enabled
|
||||
@ -407,9 +406,8 @@ public class JobsPaymentListener implements Listener {
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
return;
|
||||
// Entity that died must be living
|
||||
if (!(event.getEntity() instanceof LivingEntity))
|
||||
return;
|
||||
LivingEntity animal = (LivingEntity) event.getEntity();
|
||||
|
||||
LivingEntity animal = event.getEntity();
|
||||
|
||||
// mob spawner, no payment or experience
|
||||
if (animal.hasMetadata(this.mobSpawnerMetadata)) {
|
||||
@ -461,7 +459,7 @@ public class JobsPaymentListener implements Listener {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(event.getInventory() instanceof CraftingInventory) || !event.getSlotType().equals(SlotType.RESULT))
|
||||
if (!event.getSlotType().equals(SlotType.RESULT))
|
||||
return;
|
||||
|
||||
ItemStack resultStack = event.getRecipe().getResult();
|
||||
@ -622,7 +620,6 @@ public class JobsPaymentListener implements Listener {
|
||||
// See if we can create a new item stack with the combined elements of a and b
|
||||
if (a == null || b == null)
|
||||
return true;// Treat null as an empty stack
|
||||
else
|
||||
return a.getAmount() + b.getAmount() <= a.getType().getMaxStackSize();
|
||||
}
|
||||
|
||||
@ -797,12 +794,9 @@ public class JobsPaymentListener implements Listener {
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
return;
|
||||
// Entity that died must be living
|
||||
if (!(event.getEntity() instanceof LivingEntity))
|
||||
return;
|
||||
LivingEntity lVictim = (LivingEntity) event.getEntity();
|
||||
LivingEntity lVictim = event.getEntity();
|
||||
|
||||
//extra check for Citizens 2 sentry kills
|
||||
if (lVictim.getKiller() instanceof Player)
|
||||
if (lVictim.getKiller().hasMetadata("NPC"))
|
||||
return;
|
||||
|
||||
@ -888,7 +882,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
return;
|
||||
if (event.getSpawnReason() == SpawnReason.SPAWNER) {
|
||||
LivingEntity creature = (LivingEntity) event.getEntity();
|
||||
LivingEntity creature = event.getEntity();
|
||||
creature.setMetadata(this.mobSpawnerMetadata, new FixedMetadataValue(this.plugin, true));
|
||||
}
|
||||
}
|
||||
@ -926,11 +920,8 @@ public class JobsPaymentListener implements Listener {
|
||||
if (!reason.toString().equalsIgnoreCase("BREEDING"))
|
||||
return;
|
||||
|
||||
// Entity that spawn must be living
|
||||
if (!(event.getEntity() instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
LivingEntity animal = (LivingEntity) event.getEntity();
|
||||
LivingEntity animal = event.getEntity();
|
||||
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
@ -1105,7 +1096,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (!Jobs.getExplore().isExploreEnabled())
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getPlayer();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Jobs.getGCManager().payExploringWhenFlying())
|
||||
return;
|
||||
|
@ -35,10 +35,7 @@ public class McMMOlistener implements Listener {
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
|
||||
if (!(event.getPlayer() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getPlayer();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
ItemStack resultStack = event.getRepairedObject();
|
||||
|
||||
|
@ -92,7 +92,6 @@ public class ConstantNode implements ExpressionNode {
|
||||
// Checks if this is integer or double
|
||||
if (Math.floor(constant) == constant)
|
||||
return Long.toString(Math.round(constant));
|
||||
else
|
||||
return Double.toString(constant);
|
||||
}
|
||||
|
||||
@ -137,7 +136,6 @@ public class ConstantNode implements ExpressionNode {
|
||||
public String toString() {
|
||||
if (name == null)
|
||||
return getSubtype();
|
||||
else
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@ -103,30 +103,54 @@ public class FunctionNode implements ExpressionNode {
|
||||
*/
|
||||
public double getValue() {
|
||||
switch (function) {
|
||||
case 0: return - child.getValue();
|
||||
case 1: return Math.sin(child.getValue());
|
||||
case 2: return Math.cos(child.getValue());
|
||||
case 3: return Math.tan(child.getValue());
|
||||
case 4: return Math.asin(child.getValue());
|
||||
case 5: return Math.acos(child.getValue());
|
||||
case 6: return Math.atan(child.getValue());
|
||||
case 7: return Sfun.sinh(child.getValue());
|
||||
case 8: return Sfun.cosh(child.getValue());
|
||||
case 9: return Sfun.tanh(child.getValue());
|
||||
case 10: return Sfun.asinh(child.getValue());
|
||||
case 11: return Sfun.acosh(child.getValue());
|
||||
case 12: return Sfun.atanh(child.getValue());
|
||||
case 13: return Math.log(child.getValue());
|
||||
case 14: return Math.log(child.getValue()) * 0.43429448190325182765;
|
||||
case 15: return Math.abs(child.getValue());
|
||||
case 16: return Math.random() * child.getValue();
|
||||
case 17: return Math.sqrt(child.getValue());
|
||||
case 18: return Sfun.erf(child.getValue());
|
||||
case 19: return Sfun.erfc(child.getValue());
|
||||
case 20: return Sfun.gamma(child.getValue());
|
||||
case 21: return Math.exp(child.getValue());
|
||||
case 22: return Sfun.cot(child.getValue());
|
||||
case 23: return Math.log(child.getValue()) * 1.442695040888963407360;
|
||||
case 0:
|
||||
return -child.getValue();
|
||||
case 1:
|
||||
return Math.sin(child.getValue());
|
||||
case 2:
|
||||
return Math.cos(child.getValue());
|
||||
case 3:
|
||||
return Math.tan(child.getValue());
|
||||
case 4:
|
||||
return Math.asin(child.getValue());
|
||||
case 5:
|
||||
return Math.acos(child.getValue());
|
||||
case 6:
|
||||
return Math.atan(child.getValue());
|
||||
case 7:
|
||||
return Sfun.sinh(child.getValue());
|
||||
case 8:
|
||||
return Sfun.cosh(child.getValue());
|
||||
case 9:
|
||||
return Sfun.tanh(child.getValue());
|
||||
case 10:
|
||||
return Sfun.asinh(child.getValue());
|
||||
case 11:
|
||||
return Sfun.acosh(child.getValue());
|
||||
case 12:
|
||||
return Sfun.atanh(child.getValue());
|
||||
case 13:
|
||||
return Math.log(child.getValue());
|
||||
case 14:
|
||||
return Math.log(child.getValue()) * 0.43429448190325182765;
|
||||
case 15:
|
||||
return Math.abs(child.getValue());
|
||||
case 16:
|
||||
return Math.random() * child.getValue();
|
||||
case 17:
|
||||
return Math.sqrt(child.getValue());
|
||||
case 18:
|
||||
return Sfun.erf(child.getValue());
|
||||
case 19:
|
||||
return Sfun.erfc(child.getValue());
|
||||
case 20:
|
||||
return Sfun.gamma(child.getValue());
|
||||
case 21:
|
||||
return Math.exp(child.getValue());
|
||||
case 22:
|
||||
return Sfun.cot(child.getValue());
|
||||
case 23:
|
||||
return Math.log(child.getValue()) * 1.442695040888963407360;
|
||||
}
|
||||
// This is never reached
|
||||
return 0;
|
||||
@ -161,14 +185,10 @@ public class FunctionNode implements ExpressionNode {
|
||||
// Special case for negation function
|
||||
if (function != 0)
|
||||
return this.getSubtype() + "(" + child.toString() + ")";
|
||||
else {
|
||||
if (child.getType() == CONSTANT_NODE || child.getType() == VARIABLE_NODE ||
|
||||
(child.getType() == FUNCTION_NODE && !child.getSubtype().equals(FUNCTIONS[0])))
|
||||
return FUNCTIONS[0] + child.toString();
|
||||
else
|
||||
return FUNCTIONS[0] + "(" + child.toString() + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ package com.gamingmesh.jobs.resources.jfep;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
|
||||
/**
|
||||
* <p><b>Name:</b> Parser</p>
|
||||
* <p><b>Description:</b>
|
||||
@ -110,9 +109,7 @@ public class Parser {
|
||||
root = S();
|
||||
if (!isEndOfExpression(cc.getToken()))
|
||||
throw new ParseError("Expecting operator or end of input", inp_cur);
|
||||
return root;
|
||||
}
|
||||
else
|
||||
return root; // Parsing was already performed before
|
||||
}
|
||||
|
||||
@ -197,8 +194,7 @@ public class Parser {
|
||||
double d;
|
||||
try {
|
||||
d = Double.valueOf(s).doubleValue();
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new ParseError("Invalid number: " + s, inp_cur);
|
||||
}
|
||||
return new Element(NUM, d);
|
||||
@ -351,7 +347,6 @@ public class Parser {
|
||||
cc = parse();
|
||||
if (constPosition >= 0)
|
||||
return new ConstantNode(constPosition);
|
||||
else
|
||||
return new ConstantNode(n);
|
||||
case VAR:
|
||||
String name = cc.name;
|
||||
|
@ -82,7 +82,6 @@ public class VariableNode implements ExpressionNode {
|
||||
public double getValue() {
|
||||
if (!error)
|
||||
return value;
|
||||
else
|
||||
throw new EvaluationException("Variable '" + name + "' was not initialized.");
|
||||
}
|
||||
|
||||
|
@ -162,12 +162,10 @@ public class ActionBar {
|
||||
}
|
||||
|
||||
private String getChatSerializerClasspath() {
|
||||
if (cleanVersion < 1820) {
|
||||
if (cleanVersion < 1820)
|
||||
return "net.minecraft.server." + version + ".ChatSerializer";
|
||||
} else {
|
||||
return "net.minecraft.server." + version + ".IChatBaseComponent$ChatSerializer";// 1_8_R2 moved to IChatBaseComponent
|
||||
}
|
||||
}
|
||||
|
||||
private String getPacketPlayOutChat() {
|
||||
return "net.minecraft.server." + version + ".PacketPlayOutChat";
|
||||
|
Loading…
Reference in New Issue
Block a user