From d516879a5f5bc16e11ef5d8c55da92682223fd9a Mon Sep 17 00:00:00 2001 From: Zrips Date: Sat, 25 Jun 2016 18:56:59 +0300 Subject: [PATCH] Cleanup --- .../org.eclipse.ltk.core.refactoring.prefs | 2 + com/gamingmesh/jobs/HookEconomyTask.java | 1 + com/gamingmesh/jobs/Jobs.java | 13 +- com/gamingmesh/jobs/JobsPlugin.java | 3 +- com/gamingmesh/jobs/PlayerManager.java | 8 +- com/gamingmesh/jobs/Signs/SignUtil.java | 1 + .../jobs/api/JobsChunkChangeEvent.java | 3 + com/gamingmesh/jobs/api/JobsExpGainEvent.java | 3 + com/gamingmesh/jobs/api/JobsJoinEvent.java | 89 +++--- com/gamingmesh/jobs/api/JobsLeaveEvent.java | 89 +++--- com/gamingmesh/jobs/api/JobsLevelUpEvent.java | 293 +++++++++--------- com/gamingmesh/jobs/api/JobsPaymentEvent.java | 3 + .../jobs/commands/JobsCommands.java | 6 +- .../jobs/commands/list/archive.java | 1 + .../jobs/commands/list/blockinfo.java | 3 +- com/gamingmesh/jobs/commands/list/bonus.java | 3 +- com/gamingmesh/jobs/commands/list/browse.java | 1 + .../jobs/commands/list/convert.java | 1 + com/gamingmesh/jobs/commands/list/demote.java | 1 + .../jobs/commands/list/editpoints.java | 1 + com/gamingmesh/jobs/commands/list/employ.java | 1 + .../jobs/commands/list/expboost.java | 1 + com/gamingmesh/jobs/commands/list/fire.java | 1 + .../jobs/commands/list/fireall.java | 1 + com/gamingmesh/jobs/commands/list/give.java | 1 + com/gamingmesh/jobs/commands/list/glog.java | 1 + .../jobs/commands/list/grantxp.java | 1 + com/gamingmesh/jobs/commands/list/gtop.java | 1 + com/gamingmesh/jobs/commands/list/info.java | 1 + com/gamingmesh/jobs/commands/list/join.java | 1 + com/gamingmesh/jobs/commands/list/leave.java | 1 + .../jobs/commands/list/leaveall.java | 1 + com/gamingmesh/jobs/commands/list/limit.java | 1 + com/gamingmesh/jobs/commands/list/log.java | 1 + .../jobs/commands/list/moneyboost.java | 1 + .../jobs/commands/list/playerinfo.java | 1 + .../jobs/commands/list/pointboost.java | 1 + com/gamingmesh/jobs/commands/list/points.java | 1 + .../jobs/commands/list/promote.java | 1 + com/gamingmesh/jobs/commands/list/reload.java | 1 + .../jobs/commands/list/removexp.java | 1 + com/gamingmesh/jobs/commands/list/shop.java | 1 + .../jobs/commands/list/signupdate.java | 3 +- com/gamingmesh/jobs/commands/list/stats.java | 1 + com/gamingmesh/jobs/commands/list/toggle.java | 1 + com/gamingmesh/jobs/commands/list/top.java | 1 + .../jobs/commands/list/transfer.java | 1 + .../jobs/config/BossBarManager.java | 1 + .../jobs/config/ScboardManager.java | 1 + .../jobs/config/ScheduleManager.java | 2 + com/gamingmesh/jobs/config/ShopManager.java | 6 +- .../jobs/container/RestrictedArea.java | 2 +- com/gamingmesh/jobs/dao/JobsDAO.java | 3 +- com/gamingmesh/jobs/dao/JobsDAOData.java | 2 +- com/gamingmesh/jobs/dao/JobsDAOMySQL.java | 2 + com/gamingmesh/jobs/dao/JobsDAOSQLite.java | 2 + com/gamingmesh/jobs/dao/JobsDriver.java | 114 ++++--- .../jobs/listeners/JobsListener.java | 6 +- .../jobs/listeners/JobsPaymentListener.java | 32 +- .../jobs/resources/jfep/ConstantNode.java | 9 + .../jobs/resources/jfep/ExpressionNode.java | 1 + .../jobs/resources/jfep/FunctionNode.java | 9 + .../jobs/resources/jfep/OperatorNode.java | 9 + .../jobs/resources/jfep/Parser.java | 10 +- .../jobs/resources/jfep/VariableNode.java | 9 + com/gamingmesh/jobs/stuff/Loging.java | 6 +- com/gamingmesh/jobs/stuff/Sorting.java | 198 ++++++------ 67 files changed, 549 insertions(+), 429 deletions(-) create mode 100644 .settings/org.eclipse.ltk.core.refactoring.prefs diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100644 index 00000000..b196c64a --- /dev/null +++ b/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/com/gamingmesh/jobs/HookEconomyTask.java b/com/gamingmesh/jobs/HookEconomyTask.java index 6479ede3..027b3c9f 100644 --- a/com/gamingmesh/jobs/HookEconomyTask.java +++ b/com/gamingmesh/jobs/HookEconomyTask.java @@ -36,6 +36,7 @@ public class HookEconomyTask implements Runnable { this.plugin = plugin; } + @Override public void run() { Plugin eco = Bukkit.getServer().getPluginManager().getPlugin("Vault"); if (eco != null) { diff --git a/com/gamingmesh/jobs/Jobs.java b/com/gamingmesh/jobs/Jobs.java index 4a3390ea..2b5d29dd 100644 --- a/com/gamingmesh/jobs/Jobs.java +++ b/com/gamingmesh/jobs/Jobs.java @@ -84,6 +84,7 @@ public class Jobs { private static RestrictedAreaManager RAManager = null; private static BossBarManager BBManager; private static ShopManager shopManager; + private static Loging loging; private static PistonProtectionListener PistonProtectionListener = null; private static McMMOlistener McMMOlistener = null; @@ -141,6 +142,14 @@ public class Jobs { return MythicManager; } + public static void setLoging() { + loging = new Loging(); + } + + public static Loging getLoging() { + return loging; + } + public static void setShopManager(JobsPlugin plugin) { shopManager = new ShopManager(plugin); } @@ -799,7 +808,7 @@ public class Jobs { Jobs.getEconomy().pay(jPlayer, amount, pointAmount, 0.0); if (Jobs.getGCManager().LoggingUse) - Loging.recordToLog(jPlayer, info, amount, 0); + Jobs.getLoging().recordToLog(jPlayer, info, amount, 0); } } } else { @@ -932,7 +941,7 @@ public class Jobs { int oldLevel = prog.getLevel(); if (Jobs.getGCManager().LoggingUse) - Loging.recordToLog(jPlayer, info, amount, expAmount); + Jobs.getLoging().recordToLog(jPlayer, info, amount, expAmount); if (prog.addExperience(expAmount)) Jobs.getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel); diff --git a/com/gamingmesh/jobs/JobsPlugin.java b/com/gamingmesh/jobs/JobsPlugin.java index f9c65c6f..8e7d859e 100644 --- a/com/gamingmesh/jobs/JobsPlugin.java +++ b/com/gamingmesh/jobs/JobsPlugin.java @@ -88,6 +88,7 @@ public class JobsPlugin extends JavaPlugin { Jobs.setDataFolder(getDataFolder()); + Jobs.setLoging(); Jobs.setGCManager(this); Jobs.setConfigManager(this); @@ -104,7 +105,7 @@ public class JobsPlugin extends JavaPlugin { getServer().getPluginManager().registerEvents(new JobsPaymentListener(this), this); Jobs.setMcMMOlistener(this); - if (Jobs.getMcMMOlistener().CheckmcMMO()){ + if (Jobs.getMcMMOlistener().CheckmcMMO()) { getServer().getPluginManager().registerEvents(new McMMOlistener(this), this); } diff --git a/com/gamingmesh/jobs/PlayerManager.java b/com/gamingmesh/jobs/PlayerManager.java index 25c3da3e..cc5a7483 100644 --- a/com/gamingmesh/jobs/PlayerManager.java +++ b/com/gamingmesh/jobs/PlayerManager.java @@ -415,7 +415,7 @@ public class PlayerManager { // } } - private Sound getSound(String soundName) { + private static Sound getSound(String soundName) { for (Sound one : Sound.values()) { if (one.name().equalsIgnoreCase(soundName)) return one; @@ -437,7 +437,8 @@ public class PlayerManager { return; // LevelUp event - JobsLevelUpEvent levelUpEvent = new JobsLevelUpEvent(jPlayer, job.getName(), prog.getLevel(), Jobs.gettitleManager().getTitleForLevel(oldLevel), Jobs.gettitleManager().getTitleForLevel(prog.getLevel()), 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); @@ -487,7 +488,7 @@ public class PlayerManager { if (Jobs.getGCManager().SoundTitleChangeUse) { Sound sound = getSound(levelUpEvent.getTitleChangeSoundName()); - if (sound != null) + if (sound != null && player != null) player.getWorld().playSound(player.getLocation(), sound, levelUpEvent.getTitleChangeVolume(), levelUpEvent.getTitleChangePitch()); else @@ -718,6 +719,7 @@ public class PlayerManager { if (!Jobs.getGCManager().AutoJobJoinUse) return; Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { + @Override public void run() { if (!player.isOnline()) return; diff --git a/com/gamingmesh/jobs/Signs/SignUtil.java b/com/gamingmesh/jobs/Signs/SignUtil.java index 3fac2280..41104e4d 100644 --- a/com/gamingmesh/jobs/Signs/SignUtil.java +++ b/com/gamingmesh/jobs/Signs/SignUtil.java @@ -198,6 +198,7 @@ public class SignUtil { public void UpdateHead(final org.bukkit.block.Sign sign, final String Playername, final int timelapse) { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override @SuppressWarnings("deprecation") public void run() { diff --git a/com/gamingmesh/jobs/api/JobsChunkChangeEvent.java b/com/gamingmesh/jobs/api/JobsChunkChangeEvent.java index 55cd113a..1e8e14ce 100644 --- a/com/gamingmesh/jobs/api/JobsChunkChangeEvent.java +++ b/com/gamingmesh/jobs/api/JobsChunkChangeEvent.java @@ -31,14 +31,17 @@ public final class JobsChunkChangeEvent extends Event implements Cancellable { return this.newChunk; } + @Override public boolean isCancelled() { return cancelled; } + @Override public void setCancelled(boolean cancel) { cancelled = cancel; } + @Override public HandlerList getHandlers() { return handlers; } diff --git a/com/gamingmesh/jobs/api/JobsExpGainEvent.java b/com/gamingmesh/jobs/api/JobsExpGainEvent.java index 79bc3bcf..5cfe63f3 100644 --- a/com/gamingmesh/jobs/api/JobsExpGainEvent.java +++ b/com/gamingmesh/jobs/api/JobsExpGainEvent.java @@ -36,14 +36,17 @@ public final class JobsExpGainEvent extends Event implements Cancellable { this.exp = exp; } + @Override public boolean isCancelled() { return cancelled; } + @Override public void setCancelled(boolean cancel) { cancelled = cancel; } + @Override public HandlerList getHandlers() { return handlers; } diff --git a/com/gamingmesh/jobs/api/JobsJoinEvent.java b/com/gamingmesh/jobs/api/JobsJoinEvent.java index 5acc1968..d5c48aca 100644 --- a/com/gamingmesh/jobs/api/JobsJoinEvent.java +++ b/com/gamingmesh/jobs/api/JobsJoinEvent.java @@ -1,44 +1,47 @@ -package com.gamingmesh.jobs.api; - -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.container.JobsPlayer; - -public final class JobsJoinEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private JobsPlayer player; - private Job job; - private boolean cancelled; - - public JobsJoinEvent(JobsPlayer jPlayer, Job job) { - this.player = jPlayer; - this.job = job; - } - - public JobsPlayer getPlayer() { - return this.player; - } - - public Job getJob() { - return this.job; - } - - public boolean isCancelled() { - return cancelled; - } - - public void setCancelled(boolean cancel) { - cancelled = cancel; - } - - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } +package com.gamingmesh.jobs.api; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.container.JobsPlayer; + +public final class JobsJoinEvent extends Event implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private JobsPlayer player; + private Job job; + private boolean cancelled; + + public JobsJoinEvent(JobsPlayer jPlayer, Job job) { + this.player = jPlayer; + this.job = job; + } + + public JobsPlayer getPlayer() { + return this.player; + } + + public Job getJob() { + return this.job; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean cancel) { + cancelled = cancel; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } } \ No newline at end of file diff --git a/com/gamingmesh/jobs/api/JobsLeaveEvent.java b/com/gamingmesh/jobs/api/JobsLeaveEvent.java index 7ed09fbc..a7fbc4d5 100644 --- a/com/gamingmesh/jobs/api/JobsLeaveEvent.java +++ b/com/gamingmesh/jobs/api/JobsLeaveEvent.java @@ -1,44 +1,47 @@ -package com.gamingmesh.jobs.api; - -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.container.JobsPlayer; - -public final class JobsLeaveEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private JobsPlayer player; - private Job job; - private boolean cancelled; - - public JobsLeaveEvent(JobsPlayer jPlayer, Job job) { - this.player = jPlayer; - this.job = job; - } - - public JobsPlayer getPlayer() { - return this.player; - } - - public Job getJob() { - return this.job; - } - - public boolean isCancelled() { - return cancelled; - } - - public void setCancelled(boolean cancel) { - cancelled = cancel; - } - - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } +package com.gamingmesh.jobs.api; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.container.JobsPlayer; + +public final class JobsLeaveEvent extends Event implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private JobsPlayer player; + private Job job; + private boolean cancelled; + + public JobsLeaveEvent(JobsPlayer jPlayer, Job job) { + this.player = jPlayer; + this.job = job; + } + + public JobsPlayer getPlayer() { + return this.player; + } + + public Job getJob() { + return this.job; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean cancel) { + cancelled = cancel; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } } \ No newline at end of file diff --git a/com/gamingmesh/jobs/api/JobsLevelUpEvent.java b/com/gamingmesh/jobs/api/JobsLevelUpEvent.java index acb0bd31..6ef18b72 100644 --- a/com/gamingmesh/jobs/api/JobsLevelUpEvent.java +++ b/com/gamingmesh/jobs/api/JobsLevelUpEvent.java @@ -1,146 +1,149 @@ -package com.gamingmesh.jobs.api; - -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.container.Title; - -public final class JobsLevelUpEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private JobsPlayer player; - private String JobName; - private Title OldTitle; - private Title NewTitle; - private int level; - private String soundLevelupSound; - private int soundLevelupVolume; - private int soundLevelupPitch; - private String soundTitleChangeSound; - private int soundTitleChangeVolume; - private int soundTitleChangePitch; - private boolean cancelled; - - public JobsLevelUpEvent(JobsPlayer jPlayer, String JobName, int level, Title OldTitle, Title NewTitle, String soundLevelupSound, Integer soundLevelupVolume, Integer soundLevelupPitch, String soundTitleChangeSound, Integer soundTitleChangeVolume, Integer soundTitleChangePitch) { - this.player = jPlayer; - this.JobName = JobName; - this.OldTitle = OldTitle; - this.NewTitle = NewTitle; - this.level = level; - this.soundLevelupSound = soundLevelupSound; - this.soundLevelupVolume = soundLevelupVolume; - this.soundLevelupPitch = soundLevelupPitch; - this.soundTitleChangeSound = soundTitleChangeSound; - this.soundTitleChangeVolume = soundTitleChangeVolume; - this.soundTitleChangePitch = soundTitleChangePitch; - } - - public JobsPlayer getPlayer() { - return this.player; - } - - public String getJobName() { - return this.JobName; - } - - public Title getOldTitle() { - return this.OldTitle; - } - - public String getOldTitleName() { - return this.OldTitle.getName(); - } - - public String getOldTitleShort() { - return this.OldTitle.getShortName(); - } - - public String getOldTitleColor() { - return this.OldTitle.getChatColor().toString(); - } - - public Title getNewTitle() { - return this.NewTitle; - } - - public String getNewTitleName() { - return this.NewTitle.getName(); - } - - public String getNewTitleShort() { - return this.NewTitle.getShortName(); - } - - public String getNewTitleColor() { - return this.NewTitle.getChatColor().toString(); - } - - public String getSoundName() { - return this.soundLevelupSound; - } - - public void setSoundName(String sound) { - this.soundLevelupSound = sound; - } - - public int getSoundVolume() { - return this.soundLevelupVolume; - } - - public void setSoundVolume(int volume) { - this.soundLevelupVolume = volume; - } - - public int getSoundPitch() { - return this.soundLevelupPitch; - } - - public void setSoundPitch(int pitch) { - this.soundLevelupPitch = pitch; - } - - public String getTitleChangeSoundName() { - return this.soundTitleChangeSound; - } - - public void setTitleChangeSoundName(String sound) { - this.soundTitleChangeSound = sound; - } - - public int getTitleChangeVolume() { - return this.soundTitleChangeVolume; - } - - public void setTitleChangeVolume(int volume) { - this.soundTitleChangeVolume = volume; - } - - public int getTitleChangePitch() { - return this.soundTitleChangePitch; - } - - public void setTitleChangePitch(int pitch) { - this.soundTitleChangePitch = pitch; - } - - public int getLevel() { - return this.level; - } - - public boolean isCancelled() { - return cancelled; - } - - public void setCancelled(boolean cancel) { - cancelled = cancel; - } - - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } +package com.gamingmesh.jobs.api; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.gamingmesh.jobs.container.JobsPlayer; +import com.gamingmesh.jobs.container.Title; + +public final class JobsLevelUpEvent extends Event implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private JobsPlayer player; + private String JobName; + private Title OldTitle; + private Title NewTitle; + private int level; + private String soundLevelupSound; + private int soundLevelupVolume; + private int soundLevelupPitch; + private String soundTitleChangeSound; + private int soundTitleChangeVolume; + private int soundTitleChangePitch; + private boolean cancelled; + + public JobsLevelUpEvent(JobsPlayer jPlayer, String JobName, int level, Title OldTitle, Title NewTitle, String soundLevelupSound, Integer soundLevelupVolume, Integer soundLevelupPitch, String soundTitleChangeSound, Integer soundTitleChangeVolume, Integer soundTitleChangePitch) { + this.player = jPlayer; + this.JobName = JobName; + this.OldTitle = OldTitle; + this.NewTitle = NewTitle; + this.level = level; + this.soundLevelupSound = soundLevelupSound; + this.soundLevelupVolume = soundLevelupVolume; + this.soundLevelupPitch = soundLevelupPitch; + this.soundTitleChangeSound = soundTitleChangeSound; + this.soundTitleChangeVolume = soundTitleChangeVolume; + this.soundTitleChangePitch = soundTitleChangePitch; + } + + public JobsPlayer getPlayer() { + return this.player; + } + + public String getJobName() { + return this.JobName; + } + + public Title getOldTitle() { + return this.OldTitle; + } + + public String getOldTitleName() { + return this.OldTitle.getName(); + } + + public String getOldTitleShort() { + return this.OldTitle.getShortName(); + } + + public String getOldTitleColor() { + return this.OldTitle.getChatColor().toString(); + } + + public Title getNewTitle() { + return this.NewTitle; + } + + public String getNewTitleName() { + return this.NewTitle.getName(); + } + + public String getNewTitleShort() { + return this.NewTitle.getShortName(); + } + + public String getNewTitleColor() { + return this.NewTitle.getChatColor().toString(); + } + + public String getSoundName() { + return this.soundLevelupSound; + } + + public void setSoundName(String sound) { + this.soundLevelupSound = sound; + } + + public int getSoundVolume() { + return this.soundLevelupVolume; + } + + public void setSoundVolume(int volume) { + this.soundLevelupVolume = volume; + } + + public int getSoundPitch() { + return this.soundLevelupPitch; + } + + public void setSoundPitch(int pitch) { + this.soundLevelupPitch = pitch; + } + + public String getTitleChangeSoundName() { + return this.soundTitleChangeSound; + } + + public void setTitleChangeSoundName(String sound) { + this.soundTitleChangeSound = sound; + } + + public int getTitleChangeVolume() { + return this.soundTitleChangeVolume; + } + + public void setTitleChangeVolume(int volume) { + this.soundTitleChangeVolume = volume; + } + + public int getTitleChangePitch() { + return this.soundTitleChangePitch; + } + + public void setTitleChangePitch(int pitch) { + this.soundTitleChangePitch = pitch; + } + + public int getLevel() { + return this.level; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean cancel) { + cancelled = cancel; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } } \ No newline at end of file diff --git a/com/gamingmesh/jobs/api/JobsPaymentEvent.java b/com/gamingmesh/jobs/api/JobsPaymentEvent.java index 0d2acaac..07c6ee68 100644 --- a/com/gamingmesh/jobs/api/JobsPaymentEvent.java +++ b/com/gamingmesh/jobs/api/JobsPaymentEvent.java @@ -34,10 +34,12 @@ public final class JobsPaymentEvent extends Event implements Cancellable { this.points = amount; } + @Override public boolean isCancelled() { return cancelled; } + @Override public void setCancelled(boolean cancel) { cancelled = cancel; } @@ -46,6 +48,7 @@ public final class JobsPaymentEvent extends Event implements Cancellable { this.money = money; } + @Override public HandlerList getHandlers() { return handlers; } diff --git a/com/gamingmesh/jobs/commands/JobsCommands.java b/com/gamingmesh/jobs/commands/JobsCommands.java index 927a0d00..c9569ccf 100644 --- a/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/com/gamingmesh/jobs/commands/JobsCommands.java @@ -52,6 +52,7 @@ public class JobsCommands implements CommandExecutor { return CommandList; } + @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (sender instanceof Player) { @@ -282,7 +283,7 @@ public class JobsCommands implements CommandExecutor { } } - private Class getClass(String cmd) { + private static Class getClass(String cmd) { Class nmsClass = null; try { nmsClass = Class.forName(packagePath + "." + cmd.toLowerCase()); @@ -293,7 +294,7 @@ public class JobsCommands implements CommandExecutor { return nmsClass; } - private Cmd getCmdClass(String cmd) { + private static Cmd getCmdClass(String cmd) { Cmd cmdClass = null; try { Class nmsClass; @@ -315,6 +316,7 @@ public class JobsCommands implements CommandExecutor { private static Map sort(Map unsortMap) { List> list = new LinkedList>(unsortMap.entrySet()); Collections.sort(list, new Comparator>() { + @Override public int compare(Map.Entry o1, Map.Entry o2) { return (o1.getValue()).compareTo(o2.getValue()); } diff --git a/com/gamingmesh/jobs/commands/list/archive.java b/com/gamingmesh/jobs/commands/list/archive.java index e61d2858..defb459b 100644 --- a/com/gamingmesh/jobs/commands/list/archive.java +++ b/com/gamingmesh/jobs/commands/list/archive.java @@ -16,6 +16,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class archive implements Cmd { + @Override @JobCommand(1400) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { JobsPlayer jPlayer = null; diff --git a/com/gamingmesh/jobs/commands/list/blockinfo.java b/com/gamingmesh/jobs/commands/list/blockinfo.java index 66e6d243..24a1d907 100644 --- a/com/gamingmesh/jobs/commands/list/blockinfo.java +++ b/com/gamingmesh/jobs/commands/list/blockinfo.java @@ -11,6 +11,7 @@ import com.gamingmesh.jobs.commands.JobCommand; public class blockinfo implements Cmd { + @Override @SuppressWarnings("deprecation") @JobCommand(1450) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { @@ -44,7 +45,7 @@ public class blockinfo implements Cmd { return true; } - private byte getData(Block block) { + private static byte getData(Block block) { @SuppressWarnings("deprecation") byte data = block.getData(); if (block.getType() == Material.COCOA) diff --git a/com/gamingmesh/jobs/commands/list/bonus.java b/com/gamingmesh/jobs/commands/list/bonus.java index 02e888b1..6e0bd4ff 100644 --- a/com/gamingmesh/jobs/commands/list/bonus.java +++ b/com/gamingmesh/jobs/commands/list/bonus.java @@ -14,6 +14,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class bonus implements Cmd { + @Override @JobCommand(300) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { @@ -109,7 +110,7 @@ public class bonus implements Cmd { return true; } - private String formatText(double amount) { + private static String formatText(double amount) { return ((amount > 0 ? "+" : "") + amount + "%"); } diff --git a/com/gamingmesh/jobs/commands/list/browse.java b/com/gamingmesh/jobs/commands/list/browse.java index 706de354..eaa81b5c 100644 --- a/com/gamingmesh/jobs/commands/list/browse.java +++ b/com/gamingmesh/jobs/commands/list/browse.java @@ -16,6 +16,7 @@ import com.gamingmesh.jobs.stuff.Perm; public class browse implements Cmd { + @Override @JobCommand(200) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { ArrayList lines = new ArrayList(); diff --git a/com/gamingmesh/jobs/commands/list/convert.java b/com/gamingmesh/jobs/commands/list/convert.java index 04b9360d..4be891bc 100644 --- a/com/gamingmesh/jobs/commands/list/convert.java +++ b/com/gamingmesh/jobs/commands/list/convert.java @@ -16,6 +16,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class convert implements Cmd { + @Override @JobCommand(2600) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/demote.java b/com/gamingmesh/jobs/commands/list/demote.java index e60d9de7..6258d1c4 100644 --- a/com/gamingmesh/jobs/commands/list/demote.java +++ b/com/gamingmesh/jobs/commands/list/demote.java @@ -15,6 +15,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class demote implements Cmd { + @Override @JobCommand(1700) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length < 3) { diff --git a/com/gamingmesh/jobs/commands/list/editpoints.java b/com/gamingmesh/jobs/commands/list/editpoints.java index 93d27470..a012a3fb 100644 --- a/com/gamingmesh/jobs/commands/list/editpoints.java +++ b/com/gamingmesh/jobs/commands/list/editpoints.java @@ -10,6 +10,7 @@ import com.gamingmesh.jobs.container.PlayerPoints; public class editpoints implements Cmd { + @Override @JobCommand(475) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/employ.java b/com/gamingmesh/jobs/commands/list/employ.java index e34a1359..44cc82ec 100644 --- a/com/gamingmesh/jobs/commands/list/employ.java +++ b/com/gamingmesh/jobs/commands/list/employ.java @@ -15,6 +15,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class employ implements Cmd { + @Override @JobCommand(1800) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length < 2) { diff --git a/com/gamingmesh/jobs/commands/list/expboost.java b/com/gamingmesh/jobs/commands/list/expboost.java index eca74ef4..ef63acce 100644 --- a/com/gamingmesh/jobs/commands/list/expboost.java +++ b/com/gamingmesh/jobs/commands/list/expboost.java @@ -11,6 +11,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class expboost implements Cmd { + @Override @JobCommand(2300) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length > 2 || args.length <= 1) { diff --git a/com/gamingmesh/jobs/commands/list/fire.java b/com/gamingmesh/jobs/commands/list/fire.java index 81030cb5..3f14c2dd 100644 --- a/com/gamingmesh/jobs/commands/list/fire.java +++ b/com/gamingmesh/jobs/commands/list/fire.java @@ -15,6 +15,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class fire implements Cmd { + @Override @JobCommand(1900) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length < 2) { diff --git a/com/gamingmesh/jobs/commands/list/fireall.java b/com/gamingmesh/jobs/commands/list/fireall.java index 4b19619c..48048371 100644 --- a/com/gamingmesh/jobs/commands/list/fireall.java +++ b/com/gamingmesh/jobs/commands/list/fireall.java @@ -17,6 +17,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class fireall implements Cmd { + @Override @JobCommand(2000) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length < 1) { diff --git a/com/gamingmesh/jobs/commands/list/give.java b/com/gamingmesh/jobs/commands/list/give.java index ddeac236..2a4b75ac 100644 --- a/com/gamingmesh/jobs/commands/list/give.java +++ b/com/gamingmesh/jobs/commands/list/give.java @@ -14,6 +14,7 @@ import com.gamingmesh.jobs.stuff.GiveItem; public class give implements Cmd { + @Override @JobCommand(2500) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/glog.java b/com/gamingmesh/jobs/commands/list/glog.java index 0856bf2b..47331be9 100644 --- a/com/gamingmesh/jobs/commands/list/glog.java +++ b/com/gamingmesh/jobs/commands/list/glog.java @@ -21,6 +21,7 @@ import com.gamingmesh.jobs.stuff.TimeManage; public class glog implements Cmd { + @Override @JobCommand(1200) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length != 0) { diff --git a/com/gamingmesh/jobs/commands/list/grantxp.java b/com/gamingmesh/jobs/commands/list/grantxp.java index 0619e5c8..16ca8c35 100644 --- a/com/gamingmesh/jobs/commands/list/grantxp.java +++ b/com/gamingmesh/jobs/commands/list/grantxp.java @@ -16,6 +16,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class grantxp implements Cmd { + @Override @JobCommand(2100) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length < 3) { diff --git a/com/gamingmesh/jobs/commands/list/gtop.java b/com/gamingmesh/jobs/commands/list/gtop.java index 394f8c9e..cd1f96a6 100644 --- a/com/gamingmesh/jobs/commands/list/gtop.java +++ b/com/gamingmesh/jobs/commands/list/gtop.java @@ -20,6 +20,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class gtop implements Cmd { + @Override @JobCommand(600) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/info.java b/com/gamingmesh/jobs/commands/list/info.java index 62b89ec0..7981ee65 100644 --- a/com/gamingmesh/jobs/commands/list/info.java +++ b/com/gamingmesh/jobs/commands/list/info.java @@ -13,6 +13,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class info implements Cmd { + @Override @JobCommand(300) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { diff --git a/com/gamingmesh/jobs/commands/list/join.java b/com/gamingmesh/jobs/commands/list/join.java index 99a1deae..2cbf3c31 100644 --- a/com/gamingmesh/jobs/commands/list/join.java +++ b/com/gamingmesh/jobs/commands/list/join.java @@ -14,6 +14,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class join implements Cmd { + @Override @JobCommand(100) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { diff --git a/com/gamingmesh/jobs/commands/list/leave.java b/com/gamingmesh/jobs/commands/list/leave.java index 623ef829..9efbcc85 100644 --- a/com/gamingmesh/jobs/commands/list/leave.java +++ b/com/gamingmesh/jobs/commands/list/leave.java @@ -14,6 +14,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class leave implements Cmd { + @Override @JobCommand(800) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) diff --git a/com/gamingmesh/jobs/commands/list/leaveall.java b/com/gamingmesh/jobs/commands/list/leaveall.java index 1c6b8e10..6f4d02d2 100644 --- a/com/gamingmesh/jobs/commands/list/leaveall.java +++ b/com/gamingmesh/jobs/commands/list/leaveall.java @@ -14,6 +14,7 @@ import com.gamingmesh.jobs.container.JobsPlayer; public class leaveall implements Cmd { + @Override @JobCommand(900) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { diff --git a/com/gamingmesh/jobs/commands/list/limit.java b/com/gamingmesh/jobs/commands/list/limit.java index 4e0b0fc8..d172a6c9 100644 --- a/com/gamingmesh/jobs/commands/list/limit.java +++ b/com/gamingmesh/jobs/commands/list/limit.java @@ -12,6 +12,7 @@ import com.gamingmesh.jobs.economy.PaymentData; public class limit implements Cmd { + @Override @JobCommand(700) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length > 0) { diff --git a/com/gamingmesh/jobs/commands/list/log.java b/com/gamingmesh/jobs/commands/list/log.java index 8f02f665..4495d550 100644 --- a/com/gamingmesh/jobs/commands/list/log.java +++ b/com/gamingmesh/jobs/commands/list/log.java @@ -19,6 +19,7 @@ import com.gamingmesh.jobs.stuff.Sorting; public class log implements Cmd { + @Override @JobCommand(1100) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/moneyboost.java b/com/gamingmesh/jobs/commands/list/moneyboost.java index 2a85a799..c1d1a6f4 100644 --- a/com/gamingmesh/jobs/commands/list/moneyboost.java +++ b/com/gamingmesh/jobs/commands/list/moneyboost.java @@ -11,6 +11,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class moneyboost implements Cmd { + @Override @JobCommand(2400) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/playerinfo.java b/com/gamingmesh/jobs/commands/list/playerinfo.java index fd71d20c..4ebb1b25 100644 --- a/com/gamingmesh/jobs/commands/list/playerinfo.java +++ b/com/gamingmesh/jobs/commands/list/playerinfo.java @@ -14,6 +14,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class playerinfo implements Cmd { + @Override @JobCommand(1300) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length < 2) { diff --git a/com/gamingmesh/jobs/commands/list/pointboost.java b/com/gamingmesh/jobs/commands/list/pointboost.java index 31f4abff..fe47c8d2 100644 --- a/com/gamingmesh/jobs/commands/list/pointboost.java +++ b/com/gamingmesh/jobs/commands/list/pointboost.java @@ -11,6 +11,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class pointboost implements Cmd { + @Override @JobCommand(2400) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/points.java b/com/gamingmesh/jobs/commands/list/points.java index a128ccdf..14c86aa9 100644 --- a/com/gamingmesh/jobs/commands/list/points.java +++ b/com/gamingmesh/jobs/commands/list/points.java @@ -13,6 +13,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class points implements Cmd { + @Override @JobCommand(450) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/promote.java b/com/gamingmesh/jobs/commands/list/promote.java index 9ece93e6..00028ee5 100644 --- a/com/gamingmesh/jobs/commands/list/promote.java +++ b/com/gamingmesh/jobs/commands/list/promote.java @@ -15,6 +15,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class promote implements Cmd { + @Override @JobCommand(1600) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length < 3) { diff --git a/com/gamingmesh/jobs/commands/list/reload.java b/com/gamingmesh/jobs/commands/list/reload.java index 2bf6b607..bc3ae4a9 100644 --- a/com/gamingmesh/jobs/commands/list/reload.java +++ b/com/gamingmesh/jobs/commands/list/reload.java @@ -11,6 +11,7 @@ import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.stuff.ChatColor; public class reload implements Cmd { + @Override @JobCommand(2900) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { try { diff --git a/com/gamingmesh/jobs/commands/list/removexp.java b/com/gamingmesh/jobs/commands/list/removexp.java index 35169ded..bd2ccbab 100644 --- a/com/gamingmesh/jobs/commands/list/removexp.java +++ b/com/gamingmesh/jobs/commands/list/removexp.java @@ -16,6 +16,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class removexp implements Cmd { + @Override @JobCommand(2200) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length < 3) { diff --git a/com/gamingmesh/jobs/commands/list/shop.java b/com/gamingmesh/jobs/commands/list/shop.java index a2156c0e..363b6c58 100644 --- a/com/gamingmesh/jobs/commands/list/shop.java +++ b/com/gamingmesh/jobs/commands/list/shop.java @@ -9,6 +9,7 @@ import com.gamingmesh.jobs.commands.JobCommand; public class shop implements Cmd { + @Override @JobCommand(750) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/signupdate.java b/com/gamingmesh/jobs/commands/list/signupdate.java index 581cb059..caf4dabd 100644 --- a/com/gamingmesh/jobs/commands/list/signupdate.java +++ b/com/gamingmesh/jobs/commands/list/signupdate.java @@ -11,6 +11,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class signupdate implements Cmd { + @Override @JobCommand(2700) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length != 1) { @@ -24,7 +25,7 @@ public class signupdate implements Cmd { sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job")); return true; } - if (!args[0].equalsIgnoreCase("gtoplist")) + if (!args[0].equalsIgnoreCase("gtoplist") && oldjob != null) Jobs.getSignUtil().SignUpdate(oldjob.getName()); else Jobs.getSignUtil().SignUpdate("gtoplist"); diff --git a/com/gamingmesh/jobs/commands/list/stats.java b/com/gamingmesh/jobs/commands/list/stats.java index ae70f82f..8f848eb0 100644 --- a/com/gamingmesh/jobs/commands/list/stats.java +++ b/com/gamingmesh/jobs/commands/list/stats.java @@ -13,6 +13,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class stats implements Cmd { + @Override @JobCommand(400) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { JobsPlayer jPlayer = null; diff --git a/com/gamingmesh/jobs/commands/list/toggle.java b/com/gamingmesh/jobs/commands/list/toggle.java index 2f3364bb..d511b20b 100644 --- a/com/gamingmesh/jobs/commands/list/toggle.java +++ b/com/gamingmesh/jobs/commands/list/toggle.java @@ -13,6 +13,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class toggle implements Cmd { + @Override @JobCommand(1000) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/top.java b/com/gamingmesh/jobs/commands/list/top.java index c0be182f..7b4507b4 100644 --- a/com/gamingmesh/jobs/commands/list/top.java +++ b/com/gamingmesh/jobs/commands/list/top.java @@ -21,6 +21,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class top implements Cmd { + @Override @JobCommand(500) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { diff --git a/com/gamingmesh/jobs/commands/list/transfer.java b/com/gamingmesh/jobs/commands/list/transfer.java index aa1a304f..f0d77225 100644 --- a/com/gamingmesh/jobs/commands/list/transfer.java +++ b/com/gamingmesh/jobs/commands/list/transfer.java @@ -16,6 +16,7 @@ import com.gamingmesh.jobs.stuff.ChatColor; public class transfer implements Cmd { + @Override @JobCommand(1500) public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) { if (args.length < 3) { diff --git a/com/gamingmesh/jobs/config/BossBarManager.java b/com/gamingmesh/jobs/config/BossBarManager.java index f2370402..8c707801 100644 --- a/com/gamingmesh/jobs/config/BossBarManager.java +++ b/com/gamingmesh/jobs/config/BossBarManager.java @@ -120,6 +120,7 @@ public class BossBarManager { bar.setVisible(true); OldOne.setId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override public void run() { for (BossBarInfo one : player.getBossBarInfo()) { diff --git a/com/gamingmesh/jobs/config/ScboardManager.java b/com/gamingmesh/jobs/config/ScboardManager.java index e450a845..a34e8a5d 100644 --- a/com/gamingmesh/jobs/config/ScboardManager.java +++ b/com/gamingmesh/jobs/config/ScboardManager.java @@ -36,6 +36,7 @@ public class ScboardManager { if (timerMap.size() > 0) Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override public void run() { RunScheduler(); return; diff --git a/com/gamingmesh/jobs/config/ScheduleManager.java b/com/gamingmesh/jobs/config/ScheduleManager.java index 8ed74f46..b9eb3b61 100644 --- a/com/gamingmesh/jobs/config/ScheduleManager.java +++ b/com/gamingmesh/jobs/config/ScheduleManager.java @@ -41,6 +41,7 @@ public class ScheduleManager { if (dateByInt == 0) dateByInt = TimeManage.timeInInt(); Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override public void run() { dateByInt = TimeManage.timeInInt(); @@ -119,6 +120,7 @@ public class ScheduleManager { } Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override public void run() { scheduler(); return; diff --git a/com/gamingmesh/jobs/config/ShopManager.java b/com/gamingmesh/jobs/config/ShopManager.java index 3c6509ae..b97c6bee 100644 --- a/com/gamingmesh/jobs/config/ShopManager.java +++ b/com/gamingmesh/jobs/config/ShopManager.java @@ -59,7 +59,7 @@ public class ShopManager { List ls = getItemsByPage(page); - int GuiSize = this.getGuiSize(ls, page); + int GuiSize = getGuiSize(ls, page); if (slot == getPrevButtonSlot(GuiSize, page)) { openInventory(player, page - 1); return; @@ -167,7 +167,7 @@ public class ShopManager { return ls; } - private int getGuiSize(List ls, int page) { + private static int getGuiSize(List ls, int page) { int GuiSize = 9; if (ls.size() > 9) GuiSize = 18; @@ -190,7 +190,7 @@ public class ShopManager { return GuiSize; } - private int getPrevButtonSlot(int GuiSize, int page) { + private static int getPrevButtonSlot(int GuiSize, int page) { int prev = -1; if (page > 1) prev = GuiSize - 9; diff --git a/com/gamingmesh/jobs/container/RestrictedArea.java b/com/gamingmesh/jobs/container/RestrictedArea.java index f4973e98..9b1b3e32 100644 --- a/com/gamingmesh/jobs/container/RestrictedArea.java +++ b/com/gamingmesh/jobs/container/RestrictedArea.java @@ -74,7 +74,7 @@ public class RestrictedArea { * @return true - number is between bounds * @return false - number is out of bounds */ - private boolean isBetween(double number, double bound1, double bound2) { + private static boolean isBetween(double number, double bound1, double bound2) { if(bound1 < bound2 && number > bound1 && number < bound2) { return true; } else if (bound1 > bound2 && number < bound1 && number > bound2) { diff --git a/com/gamingmesh/jobs/dao/JobsDAO.java b/com/gamingmesh/jobs/dao/JobsDAO.java index 98641a94..96d9d079 100644 --- a/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/com/gamingmesh/jobs/dao/JobsDAO.java @@ -43,7 +43,6 @@ import com.gamingmesh.jobs.container.LogAmounts; import com.gamingmesh.jobs.container.PlayerInfo; import com.gamingmesh.jobs.container.PlayerPoints; import com.gamingmesh.jobs.container.TopList; -import com.gamingmesh.jobs.stuff.Loging; import com.gamingmesh.jobs.stuff.TimeManage; /** @@ -813,7 +812,7 @@ public abstract class JobsDAO { prest.setInt(2, time); ResultSet res = prest.executeQuery(); while (res.next()) { - Loging.loadToLog(player, res.getString("action"), res.getString("itemname"), res.getInt("count"), res.getDouble("money"), res.getDouble("exp")); + Jobs.getLoging().loadToLog(player, res.getString("action"), res.getString("itemname"), res.getInt("count"), res.getDouble("money"), res.getDouble("exp")); } res.close(); } catch (Exception e) { diff --git a/com/gamingmesh/jobs/dao/JobsDAOData.java b/com/gamingmesh/jobs/dao/JobsDAOData.java index 888e43e1..d8ff9074 100644 --- a/com/gamingmesh/jobs/dao/JobsDAOData.java +++ b/com/gamingmesh/jobs/dao/JobsDAOData.java @@ -77,6 +77,6 @@ public class JobsDAOData { * @return the experience in the job */ public double getExperience() { - return (double) experience; + return experience; } } diff --git a/com/gamingmesh/jobs/dao/JobsDAOMySQL.java b/com/gamingmesh/jobs/dao/JobsDAOMySQL.java index 65c1cfe2..506af45f 100644 --- a/com/gamingmesh/jobs/dao/JobsDAOMySQL.java +++ b/com/gamingmesh/jobs/dao/JobsDAOMySQL.java @@ -731,6 +731,7 @@ public class JobsDAOMySQL extends JobsDAO { return true; } + @Override protected boolean createDefaultLogBase() { try { executeSQL("CREATE TABLE `" + getPrefix() @@ -771,6 +772,7 @@ public class JobsDAOMySQL extends JobsDAO { return true; } + @Override protected boolean dropDataBase(String name) { try { executeSQL("DROP TABLE IF EXISTS `" + getPrefix() + name + "`;"); diff --git a/com/gamingmesh/jobs/dao/JobsDAOSQLite.java b/com/gamingmesh/jobs/dao/JobsDAOSQLite.java index 6f937590..6c038dd4 100644 --- a/com/gamingmesh/jobs/dao/JobsDAOSQLite.java +++ b/com/gamingmesh/jobs/dao/JobsDAOSQLite.java @@ -807,6 +807,7 @@ public class JobsDAOSQLite extends JobsDAO { return true; } + @Override protected boolean createDefaultLogBase() { try { executeSQL("CREATE TABLE `" + getPrefix() @@ -837,6 +838,7 @@ public class JobsDAOSQLite extends JobsDAO { return true; } + @Override protected boolean dropDataBase(String name) { try { executeSQL("DROP TABLE IF EXISTS `" + getPrefix() + name + "`;"); diff --git a/com/gamingmesh/jobs/dao/JobsDriver.java b/com/gamingmesh/jobs/dao/JobsDriver.java index 8139c08b..2678b4fb 100644 --- a/com/gamingmesh/jobs/dao/JobsDriver.java +++ b/com/gamingmesh/jobs/dao/JobsDriver.java @@ -1,58 +1,56 @@ -package com.gamingmesh.jobs.dao; - -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.Properties; -import java.util.logging.Logger; - -public class JobsDriver - implements Driver -{ - private Driver driver; - - public JobsDriver(Driver driver) - { - this.driver = driver; - } - - public Connection connect(String url, Properties info) - throws SQLException - { - return this.driver.connect(url, info); - } - - public boolean acceptsURL(String url) - throws SQLException - { - return this.driver.acceptsURL(url); - } - - public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) - throws SQLException - { - return this.driver.getPropertyInfo(url, info); - } - - public int getMajorVersion() - { - return this.driver.getMajorVersion(); - } - - public int getMinorVersion() - { - return this.driver.getMinorVersion(); - } - - public boolean jdbcCompliant() - { - return this.driver.jdbcCompliant(); - } - -@Override -public Logger getParentLogger() throws SQLFeatureNotSupportedException { - return this.driver.getParentLogger(); -} -} +package com.gamingmesh.jobs.dao; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverPropertyInfo; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.Properties; +import java.util.logging.Logger; + +public class JobsDriver + implements Driver { + private Driver driver; + + public JobsDriver(Driver driver) { + this.driver = driver; + } + + @Override + public Connection connect(String url, Properties info) + throws SQLException { + return this.driver.connect(url, info); + } + + @Override + public boolean acceptsURL(String url) + throws SQLException { + return this.driver.acceptsURL(url); + } + + @Override + public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) + throws SQLException { + return this.driver.getPropertyInfo(url, info); + } + + @Override + public int getMajorVersion() { + return this.driver.getMajorVersion(); + } + + @Override + public int getMinorVersion() { + return this.driver.getMinorVersion(); + } + + @Override + public boolean jdbcCompliant() { + return this.driver.jdbcCompliant(); + } + + @Override + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + return this.driver.getParentLogger(); + } +} diff --git a/com/gamingmesh/jobs/listeners/JobsListener.java b/com/gamingmesh/jobs/listeners/JobsListener.java index db68d988..d9fb4f4f 100644 --- a/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/com/gamingmesh/jobs/listeners/JobsListener.java @@ -361,7 +361,7 @@ public class JobsListener implements Listener { signInfo.setY(loc.getY()); signInfo.setZ(loc.getZ()); signInfo.setCategory(category); - if (!signtype.equalsIgnoreCase("gtoplist")) + if (!signtype.equalsIgnoreCase("gtoplist") && job != null) signInfo.setJobName(job.getName()); else signInfo.setJobName("gtoplist"); @@ -372,8 +372,9 @@ public class JobsListener implements Listener { event.setCancelled(true); Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override public void run() { - if (!signtype.equalsIgnoreCase("gtoplist")) + if (!signtype.equalsIgnoreCase("gtoplist") && job != null) Jobs.getSignUtil().SignUpdate(job.getName()); else Jobs.getSignUtil().SignUpdate("gtoplist"); @@ -517,6 +518,7 @@ public class JobsListener implements Listener { return; if (event.getBlock().getState().hasMetadata(JobsPaymentListener.PlacedBlockMetadata)) { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override public void run() { event.getBlock().getState().removeMetadata(JobsPaymentListener.PlacedBlockMetadata, plugin); return; diff --git a/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index f4006473..6a48aab8 100644 --- a/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -796,10 +796,15 @@ public class JobsPaymentListener implements Listener { // Entity that died must be living LivingEntity lVictim = event.getEntity(); - //extra check for Citizens 2 sentry kills - if (lVictim.getKiller().hasMetadata("NPC")) + if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent)) return; + EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event.getEntity().getLastDamageCause(); + //extra check for Citizens 2 sentry kills + if (e.getDamager() instanceof Player) + if (lVictim.getKiller().hasMetadata("NPC")) + return; + if (Jobs.getGCManager().MythicMobsEnabled && Jobs.getMythicManager().MMAPI != null) { if (Jobs.getMythicManager().MMAPI.getMobAPI().isMythicMob(lVictim)) return; @@ -819,19 +824,17 @@ public class JobsPaymentListener implements Listener { Double PetPayMultiplier = 0.0; // Checking if killer is player - if (event.getEntity().getKiller() instanceof Player) - pDamager = (Player) event.getEntity().getKiller(); + if (e.getDamager() instanceof Player) + pDamager = (Player) e.getDamager(); // Checking if killer is tamed animal - else if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) { - if (((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager() instanceof Tameable) { - Tameable t = (Tameable) ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager(); - if (t.isTamed() && t.getOwner() instanceof Player) { - pDamager = (Player) t.getOwner(); - if (Perm.hasPermission(pDamager, "jobs.petpay") || Perm.hasPermission(pDamager, "jobs.vippetpay")) - PetPayMultiplier = Jobs.getGCManager().VipPetPay * 100 - 100; - else - PetPayMultiplier = Jobs.getGCManager().PetPay * 100 - 100; - } + else if (e.getDamager() instanceof Tameable) { + Tameable t = (Tameable) (e).getDamager(); + if (t.isTamed() && t.getOwner() instanceof Player) { + pDamager = (Player) t.getOwner(); + if (Perm.hasPermission(pDamager, "jobs.petpay") || Perm.hasPermission(pDamager, "jobs.vippetpay")) + PetPayMultiplier = Jobs.getGCManager().VipPetPay * 100 - 100; + else + PetPayMultiplier = Jobs.getGCManager().PetPay * 100 - 100; } } else return; @@ -920,7 +923,6 @@ public class JobsPaymentListener implements Listener { if (!reason.toString().equalsIgnoreCase("BREEDING")) return; - LivingEntity animal = event.getEntity(); // make sure plugin is enabled diff --git a/com/gamingmesh/jobs/resources/jfep/ConstantNode.java b/com/gamingmesh/jobs/resources/jfep/ConstantNode.java index c4ba85d4..c0456d77 100644 --- a/com/gamingmesh/jobs/resources/jfep/ConstantNode.java +++ b/com/gamingmesh/jobs/resources/jfep/ConstantNode.java @@ -74,6 +74,7 @@ public class ConstantNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#count() */ + @Override public int count() { return 1; } @@ -81,6 +82,7 @@ public class ConstantNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getDepth() */ + @Override public int getDepth() { return 1; // This is a leaf node } @@ -88,6 +90,7 @@ public class ConstantNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getSubtype() */ + @Override public String getSubtype() { // Checks if this is integer or double if (Math.floor(constant) == constant) @@ -98,6 +101,7 @@ public class ConstantNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getType() */ + @Override public int getType() { return ExpressionNode.CONSTANT_NODE; } @@ -105,6 +109,7 @@ public class ConstantNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getValue() */ + @Override public double getValue() { return constant; } @@ -112,6 +117,7 @@ public class ConstantNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#setVariable(java.lang.String, double) */ + @Override public void setVariable(String name, double value) { // Nothing to be done here... } @@ -119,6 +125,7 @@ public class ConstantNode implements ExpressionNode { /* (non-Javadoc) * @see org.mbertoli.jfep.ExpressionNode#getChildrenNodes() */ + @Override public ExpressionNode[] getChildrenNodes() { return children; } @@ -126,6 +133,7 @@ public class ConstantNode implements ExpressionNode { /* (non-Javadoc) * @see java.lang.Object#clone() */ + @Override public Object clone() { return new ConstantNode(constant); } @@ -133,6 +141,7 @@ public class ConstantNode implements ExpressionNode { /* (non-Javadoc) * @see java.lang.Object#toString() */ + @Override public String toString() { if (name == null) return getSubtype(); diff --git a/com/gamingmesh/jobs/resources/jfep/ExpressionNode.java b/com/gamingmesh/jobs/resources/jfep/ExpressionNode.java index 0872be8e..65943679 100644 --- a/com/gamingmesh/jobs/resources/jfep/ExpressionNode.java +++ b/com/gamingmesh/jobs/resources/jfep/ExpressionNode.java @@ -79,6 +79,7 @@ public interface ExpressionNode extends Cloneable { * Returns a string describing the entire tree * @return string describing the entire tree */ + @Override public String toString(); /** diff --git a/com/gamingmesh/jobs/resources/jfep/FunctionNode.java b/com/gamingmesh/jobs/resources/jfep/FunctionNode.java index 16919ebb..a39456c3 100644 --- a/com/gamingmesh/jobs/resources/jfep/FunctionNode.java +++ b/com/gamingmesh/jobs/resources/jfep/FunctionNode.java @@ -73,6 +73,7 @@ public class FunctionNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#count() */ + @Override public int count() { return 1 + child.count(); } @@ -80,6 +81,7 @@ public class FunctionNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getDepth() */ + @Override public int getDepth() { return 1 + child.getDepth(); } @@ -87,6 +89,7 @@ public class FunctionNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getSubtype() */ + @Override public String getSubtype() { return FUNCTIONS[function]; } @@ -94,6 +97,7 @@ public class FunctionNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getType() */ + @Override public int getType() { return ExpressionNode.FUNCTION_NODE; } @@ -101,6 +105,7 @@ public class FunctionNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getValue() */ + @Override public double getValue() { switch (function) { case 0: @@ -159,6 +164,7 @@ public class FunctionNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#setVariable(java.lang.String, double) */ + @Override public void setVariable(String name, double value) { child.setVariable(name, value); } @@ -166,6 +172,7 @@ public class FunctionNode implements ExpressionNode { /* (non-Javadoc) * @see org.mbertoli.jfep.ExpressionNode#getChildrenNodes() */ + @Override public ExpressionNode[] getChildrenNodes() { return children; } @@ -173,6 +180,7 @@ public class FunctionNode implements ExpressionNode { /* (non-Javadoc) * @see java.lang.Object#clone() */ + @Override public Object clone() { ExpressionNode n_child = (ExpressionNode) child.clone(); return new FunctionNode(n_child, function); @@ -181,6 +189,7 @@ public class FunctionNode implements ExpressionNode { /* (non-Javadoc) * @see java.lang.Object#toString() */ + @Override public String toString() { // Special case for negation function if (function != 0) diff --git a/com/gamingmesh/jobs/resources/jfep/OperatorNode.java b/com/gamingmesh/jobs/resources/jfep/OperatorNode.java index 6d5cab3e..01d6cfc4 100644 --- a/com/gamingmesh/jobs/resources/jfep/OperatorNode.java +++ b/com/gamingmesh/jobs/resources/jfep/OperatorNode.java @@ -53,6 +53,7 @@ public class OperatorNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#count() */ + @Override public int count() { return 1 + left.count() + right.count(); } @@ -60,6 +61,7 @@ public class OperatorNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getDepth() */ + @Override public int getDepth() { return 1 + Math.max(left.getDepth(), right.getDepth()); } @@ -67,6 +69,7 @@ public class OperatorNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getSubtype() */ + @Override public String getSubtype() { return Character.toString(operation); } @@ -74,6 +77,7 @@ public class OperatorNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getType() */ + @Override public int getType() { return ExpressionNode.OPERATOR_NODE; } @@ -81,6 +85,7 @@ public class OperatorNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getValue() */ + @Override public double getValue() { switch (operation) { case '+': return left.getValue() + right.getValue(); @@ -97,6 +102,7 @@ public class OperatorNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#setVariable(java.lang.String, double) */ + @Override public void setVariable(String name, double value) { left.setVariable(name, value); right.setVariable(name, value); @@ -105,6 +111,7 @@ public class OperatorNode implements ExpressionNode { /* (non-Javadoc) * @see org.mbertoli.jfep.ExpressionNode#getChildrenNodes() */ + @Override public ExpressionNode[] getChildrenNodes() { return children; } @@ -112,6 +119,7 @@ public class OperatorNode implements ExpressionNode { /* (non-Javadoc) * @see java.lang.Object#clone() */ + @Override public Object clone() { ExpressionNode n_left = (ExpressionNode)left.clone(); ExpressionNode n_right = (ExpressionNode)right.clone(); @@ -121,6 +129,7 @@ public class OperatorNode implements ExpressionNode { /* (non-Javadoc) * @see java.lang.Object#toString() */ + @Override public String toString() { StringBuffer str = new StringBuffer(); if (needBrackets(left, true)) diff --git a/com/gamingmesh/jobs/resources/jfep/Parser.java b/com/gamingmesh/jobs/resources/jfep/Parser.java index 56de7abc..deabc3f6 100644 --- a/com/gamingmesh/jobs/resources/jfep/Parser.java +++ b/com/gamingmesh/jobs/resources/jfep/Parser.java @@ -118,7 +118,7 @@ public class Parser { * @param c input character * @return truth value */ - private boolean isNumber(char c) { + private static boolean isNumber(char c) { if ((c >= '0' && c <= '9') || c == '.') return true; return false; @@ -129,7 +129,7 @@ public class Parser { * @param c input character * @return truth value */ - private boolean isOperator(char c) { + private static boolean isOperator(char c) { for (int i = 0; i < OperatorNode.OPERATIONS.length; i++) if (c == OperatorNode.OPERATIONS[i]) return true; @@ -141,7 +141,7 @@ public class Parser { * @param c input character * @return truth value */ - private boolean isText(char c) { + private static boolean isText(char c) { return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_'); @@ -152,7 +152,7 @@ public class Parser { * @param c character * @return truth value */ - private boolean isBracket(char c) { + private static boolean isBracket(char c) { return (c == OP_BRACKET) || (c == CL_BRACKET); } @@ -161,7 +161,7 @@ public class Parser { * @param c input character * @return truth value */ - private boolean isEndOfExpression(char c) { + private static boolean isEndOfExpression(char c) { return c == TERM; } diff --git a/com/gamingmesh/jobs/resources/jfep/VariableNode.java b/com/gamingmesh/jobs/resources/jfep/VariableNode.java index 0db7629c..d76d54f1 100644 --- a/com/gamingmesh/jobs/resources/jfep/VariableNode.java +++ b/com/gamingmesh/jobs/resources/jfep/VariableNode.java @@ -51,6 +51,7 @@ public class VariableNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#count() */ + @Override public int count() { return 1; } @@ -58,6 +59,7 @@ public class VariableNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getDepth() */ + @Override public int getDepth() { return 1; // This is a leaf node } @@ -65,6 +67,7 @@ public class VariableNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getSubtype() */ + @Override public String getSubtype() { return name; } @@ -72,6 +75,7 @@ public class VariableNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getType() */ + @Override public int getType() { return ExpressionNode.VARIABLE_NODE; } @@ -79,6 +83,7 @@ public class VariableNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#getValue() */ + @Override public double getValue() { if (!error) return value; @@ -88,6 +93,7 @@ public class VariableNode implements ExpressionNode { /* (non-Javadoc) * @see jmt.engine.math.parser.ExpressionNode#setVariable(java.lang.String, double) */ + @Override public void setVariable(String name, double value) { if (this.name.equals(name)) { this.value = value; @@ -98,6 +104,7 @@ public class VariableNode implements ExpressionNode { /* (non-Javadoc) * @see org.mbertoli.jfep.ExpressionNode#getChildrenNodes() */ + @Override public ExpressionNode[] getChildrenNodes() { return children; } @@ -105,6 +112,7 @@ public class VariableNode implements ExpressionNode { /* (non-Javadoc) * @see java.lang.Object#clone() */ + @Override public Object clone() { VariableNode node = new VariableNode(name, error); node.value = value; @@ -114,6 +122,7 @@ public class VariableNode implements ExpressionNode { /* (non-Javadoc) * @see java.lang.Object#toString() */ + @Override public String toString() { return getSubtype(); } diff --git a/com/gamingmesh/jobs/stuff/Loging.java b/com/gamingmesh/jobs/stuff/Loging.java index e0eca796..665c2c2a 100644 --- a/com/gamingmesh/jobs/stuff/Loging.java +++ b/com/gamingmesh/jobs/stuff/Loging.java @@ -9,11 +9,11 @@ import com.gamingmesh.jobs.container.Log; public class Loging { - public static void recordToLog(JobsPlayer jPlayer, ActionInfo info, double amount, double expAmount) { + public void recordToLog(JobsPlayer jPlayer, ActionInfo info, double amount, double expAmount) { recordToLog(jPlayer, info.getType().getName(), info.getNameWithSub(), amount, expAmount); } - public static void recordToLog(JobsPlayer jPlayer, String ActionName, String item, double amount, double expAmount) { + public void recordToLog(JobsPlayer jPlayer, String ActionName, String item, double amount, double expAmount) { List logList = jPlayer.getLog(); boolean found = false; @@ -38,7 +38,7 @@ public class Loging { } } - public static void loadToLog(JobsPlayer jPlayer, String ActionName, String item, int count, double money, double expAmount) { + public void loadToLog(JobsPlayer jPlayer, String ActionName, String item, int count, double money, double expAmount) { List logList = jPlayer.getLog(); boolean found = false; for (Log one : logList) { diff --git a/com/gamingmesh/jobs/stuff/Sorting.java b/com/gamingmesh/jobs/stuff/Sorting.java index 75ffc9c9..3718aea7 100644 --- a/com/gamingmesh/jobs/stuff/Sorting.java +++ b/com/gamingmesh/jobs/stuff/Sorting.java @@ -1,97 +1,101 @@ -package com.gamingmesh.jobs.stuff; - -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import com.gamingmesh.jobs.container.LogAmounts; - -public class Sorting { - public static Map sortDESC(Map unsortMap) { - - // Convert Map to List - List> list = new LinkedList>(unsortMap.entrySet()); - - // Sort list with comparator, to compare the Map values - Collections.sort(list, new Comparator>() { - public int compare(Map.Entry o1, Map.Entry o2) { - return (o2.getValue()).compareTo(o1.getValue()); - } - }); - - // Convert sorted map back to a Map - Map sortedMap = new LinkedHashMap(); - for (Iterator> it = list.iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - sortedMap.put(entry.getKey(), entry.getValue()); - } - return sortedMap; - } - - public static Map sortDoubleDESC(Map unsortMap) { - - // Convert Map to List - List> list = new LinkedList>(unsortMap.entrySet()); - - // Sort list with comparator, to compare the Map values - Collections.sort(list, new Comparator>() { - public int compare(Map.Entry o1, Map.Entry o2) { - return (o2.getValue()).compareTo(o1.getValue()); - } - }); - - // Convert sorted map back to a Map - Map sortedMap = new LinkedHashMap(); - for (Iterator> it = list.iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - sortedMap.put(entry.getKey(), entry.getValue()); - } - return sortedMap; - } - - public static Map sortDoubleDESCByLog(Map unsortMap) { - - // Convert Map to List - List> list = new LinkedList>(unsortMap.entrySet()); - - // Sort list with comparator, to compare the Map values - Collections.sort(list, new Comparator>() { - public int compare(Map.Entry o1, Map.Entry o2) { - return (o2.getValue()).compareTo(o1.getValue()); - } - }); - - // Convert sorted map back to a Map - Map sortedMap = new LinkedHashMap(); - for (Iterator> it = list.iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - sortedMap.put(entry.getKey(), entry.getValue()); - } - return sortedMap; - } - - public static Map sortASC(Map unsortMap) { - - // Convert Map to List - List> list = new LinkedList>(unsortMap.entrySet()); - - // Sort list with comparator, to compare the Map values - Collections.sort(list, new Comparator>() { - public int compare(Map.Entry o1, Map.Entry o2) { - return (o1.getValue()).compareTo(o2.getValue()); - } - }); - - // Convert sorted map back to a Map - Map sortedMap = new LinkedHashMap(); - for (Iterator> it = list.iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - sortedMap.put(entry.getKey(), entry.getValue()); - } - return sortedMap; - } -} +package com.gamingmesh.jobs.stuff; + +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import com.gamingmesh.jobs.container.LogAmounts; + +public class Sorting { + public static Map sortDESC(Map unsortMap) { + + // Convert Map to List + List> list = new LinkedList>(unsortMap.entrySet()); + + // Sort list with comparator, to compare the Map values + Collections.sort(list, new Comparator>() { + @Override + public int compare(Map.Entry o1, Map.Entry o2) { + return (o2.getValue()).compareTo(o1.getValue()); + } + }); + + // Convert sorted map back to a Map + Map sortedMap = new LinkedHashMap(); + for (Iterator> it = list.iterator(); it.hasNext();) { + Map.Entry entry = it.next(); + sortedMap.put(entry.getKey(), entry.getValue()); + } + return sortedMap; + } + + public static Map sortDoubleDESC(Map unsortMap) { + + // Convert Map to List + List> list = new LinkedList>(unsortMap.entrySet()); + + // Sort list with comparator, to compare the Map values + Collections.sort(list, new Comparator>() { + @Override + public int compare(Map.Entry o1, Map.Entry o2) { + return (o2.getValue()).compareTo(o1.getValue()); + } + }); + + // Convert sorted map back to a Map + Map sortedMap = new LinkedHashMap(); + for (Iterator> it = list.iterator(); it.hasNext();) { + Map.Entry entry = it.next(); + sortedMap.put(entry.getKey(), entry.getValue()); + } + return sortedMap; + } + + public static Map sortDoubleDESCByLog(Map unsortMap) { + + // Convert Map to List + List> list = new LinkedList>(unsortMap.entrySet()); + + // Sort list with comparator, to compare the Map values + Collections.sort(list, new Comparator>() { + @Override + public int compare(Map.Entry o1, Map.Entry o2) { + return (o2.getValue()).compareTo(o1.getValue()); + } + }); + + // Convert sorted map back to a Map + Map sortedMap = new LinkedHashMap(); + for (Iterator> it = list.iterator(); it.hasNext();) { + Map.Entry entry = it.next(); + sortedMap.put(entry.getKey(), entry.getValue()); + } + return sortedMap; + } + + public static Map sortASC(Map unsortMap) { + + // Convert Map to List + List> list = new LinkedList>(unsortMap.entrySet()); + + // Sort list with comparator, to compare the Map values + Collections.sort(list, new Comparator>() { + @Override + public int compare(Map.Entry o1, Map.Entry o2) { + return (o1.getValue()).compareTo(o2.getValue()); + } + }); + + // Convert sorted map back to a Map + Map sortedMap = new LinkedHashMap(); + for (Iterator> it = list.iterator(); it.hasNext();) { + Map.Entry entry = it.next(); + sortedMap.put(entry.getKey(), entry.getValue()); + } + return sortedMap; + } +}