1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-31 21:37:57 +01:00
This commit is contained in:
Zrips 2016-06-25 18:56:59 +03:00
parent fbb0bfee90
commit d516879a5f
67 changed files with 549 additions and 429 deletions

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false

View File

@ -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) {

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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() {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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<String, Integer> sort(Map<String, Integer> unsortMap) {
List<Map.Entry<String, Integer>> list = new LinkedList<Map.Entry<String, Integer>>(unsortMap.entrySet());
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
@Override
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
return (o1.getValue()).compareTo(o2.getValue());
}

View File

@ -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;

View File

@ -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)

View File

@ -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 + "%");
}

View File

@ -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<String> lines = new ArrayList<String>();

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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)) {

View File

@ -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)) {

View File

@ -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))

View File

@ -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)) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {

View File

@ -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) {

View File

@ -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) {

View File

@ -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");

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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()) {

View File

@ -36,6 +36,7 @@ public class ScboardManager {
if (timerMap.size() > 0)
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
RunScheduler();
return;

View File

@ -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;

View File

@ -59,7 +59,7 @@ public class ShopManager {
List<ShopItem> 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<ShopItem> ls, int page) {
private static int getGuiSize(List<ShopItem> 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;

View File

@ -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) {

View File

@ -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) {

View File

@ -77,6 +77,6 @@ public class JobsDAOData {
* @return the experience in the job
*/
public double getExperience() {
return (double) experience;
return experience;
}
}

View File

@ -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 + "`;");

View File

@ -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 + "`;");

View File

@ -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();
}
}

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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();
/**

View File

@ -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)

View File

@ -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))

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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<Log> 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<Log> logList = jPlayer.getLog();
boolean found = false;
for (Log one : logList) {

View File

@ -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<String, Integer> sortDESC(Map<String, Integer> unsortMap) {
// Convert Map to List
List<Map.Entry<String, Integer>> list = new LinkedList<Map.Entry<String, Integer>>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
return (o2.getValue()).compareTo(o1.getValue());
}
});
// Convert sorted map back to a Map
Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();
for (Iterator<Map.Entry<String, Integer>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Integer> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
}
return sortedMap;
}
public static Map<String, Double> sortDoubleDESC(Map<String, Double> unsortMap) {
// Convert Map to List
List<Map.Entry<String, Double>> list = new LinkedList<Map.Entry<String, Double>>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<String, Double>>() {
public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) {
return (o2.getValue()).compareTo(o1.getValue());
}
});
// Convert sorted map back to a Map
Map<String, Double> sortedMap = new LinkedHashMap<String, Double>();
for (Iterator<Map.Entry<String, Double>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Double> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
}
return sortedMap;
}
public static Map<LogAmounts, Double> sortDoubleDESCByLog(Map<LogAmounts, Double> unsortMap) {
// Convert Map to List
List<Map.Entry<LogAmounts, Double>> list = new LinkedList<Map.Entry<LogAmounts, Double>>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<LogAmounts, Double>>() {
public int compare(Map.Entry<LogAmounts, Double> o1, Map.Entry<LogAmounts, Double> o2) {
return (o2.getValue()).compareTo(o1.getValue());
}
});
// Convert sorted map back to a Map
Map<LogAmounts, Double> sortedMap = new LinkedHashMap<LogAmounts, Double>();
for (Iterator<Map.Entry<LogAmounts, Double>> it = list.iterator(); it.hasNext();) {
Map.Entry<LogAmounts, Double> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
}
return sortedMap;
}
public static Map<String, Integer> sortASC(Map<String, Integer> unsortMap) {
// Convert Map to List
List<Map.Entry<String, Integer>> list = new LinkedList<Map.Entry<String, Integer>>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
return (o1.getValue()).compareTo(o2.getValue());
}
});
// Convert sorted map back to a Map
Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();
for (Iterator<Map.Entry<String, Integer>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Integer> 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<String, Integer> sortDESC(Map<String, Integer> unsortMap) {
// Convert Map to List
List<Map.Entry<String, Integer>> list = new LinkedList<Map.Entry<String, Integer>>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
@Override
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
return (o2.getValue()).compareTo(o1.getValue());
}
});
// Convert sorted map back to a Map
Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();
for (Iterator<Map.Entry<String, Integer>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Integer> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
}
return sortedMap;
}
public static Map<String, Double> sortDoubleDESC(Map<String, Double> unsortMap) {
// Convert Map to List
List<Map.Entry<String, Double>> list = new LinkedList<Map.Entry<String, Double>>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<String, Double>>() {
@Override
public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) {
return (o2.getValue()).compareTo(o1.getValue());
}
});
// Convert sorted map back to a Map
Map<String, Double> sortedMap = new LinkedHashMap<String, Double>();
for (Iterator<Map.Entry<String, Double>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Double> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
}
return sortedMap;
}
public static Map<LogAmounts, Double> sortDoubleDESCByLog(Map<LogAmounts, Double> unsortMap) {
// Convert Map to List
List<Map.Entry<LogAmounts, Double>> list = new LinkedList<Map.Entry<LogAmounts, Double>>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<LogAmounts, Double>>() {
@Override
public int compare(Map.Entry<LogAmounts, Double> o1, Map.Entry<LogAmounts, Double> o2) {
return (o2.getValue()).compareTo(o1.getValue());
}
});
// Convert sorted map back to a Map
Map<LogAmounts, Double> sortedMap = new LinkedHashMap<LogAmounts, Double>();
for (Iterator<Map.Entry<LogAmounts, Double>> it = list.iterator(); it.hasNext();) {
Map.Entry<LogAmounts, Double> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
}
return sortedMap;
}
public static Map<String, Integer> sortASC(Map<String, Integer> unsortMap) {
// Convert Map to List
List<Map.Entry<String, Integer>> list = new LinkedList<Map.Entry<String, Integer>>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
@Override
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
return (o1.getValue()).compareTo(o2.getValue());
}
});
// Convert sorted map back to a Map
Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();
for (Iterator<Map.Entry<String, Integer>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Integer> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
}
return sortedMap;
}
}