diff --git a/com/gamingmesh/jobs/Jobs.java b/com/gamingmesh/jobs/Jobs.java index 97206666..4909747c 100644 --- a/com/gamingmesh/jobs/Jobs.java +++ b/com/gamingmesh/jobs/Jobs.java @@ -45,7 +45,6 @@ import com.gamingmesh.jobs.economy.Economy; import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.i18n.Language; import com.gamingmesh.jobs.stuff.ActionBar; -import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.JobsClassLoader; import com.gamingmesh.jobs.stuff.Loging; import com.gamingmesh.jobs.tasks.BufferedPaymentThread; diff --git a/com/gamingmesh/jobs/PlayerManager.java b/com/gamingmesh/jobs/PlayerManager.java index d30faf65..e81719e6 100644 --- a/com/gamingmesh/jobs/PlayerManager.java +++ b/com/gamingmesh/jobs/PlayerManager.java @@ -28,9 +28,6 @@ import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.Sound; import org.bukkit.entity.Player; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionDefault; - import com.gamingmesh.jobs.api.JobsJoinEvent; import com.gamingmesh.jobs.api.JobsLeaveEvent; import com.gamingmesh.jobs.api.JobsLevelUpEvent; @@ -46,8 +43,6 @@ import com.gamingmesh.jobs.stuff.ActionBar; import com.gamingmesh.jobs.stuff.ChatColor; import com.gamingmesh.jobs.stuff.PerformCommands; -import net.milkbowl.vault.Vault; - public class PlayerManager { private Map players = Collections.synchronizedMap(new HashMap()); //private Map players = new HashMap(); diff --git a/com/gamingmesh/jobs/commands/JobsCommands.java b/com/gamingmesh/jobs/commands/JobsCommands.java index cfc8af09..61144162 100644 --- a/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/com/gamingmesh/jobs/commands/JobsCommands.java @@ -24,7 +24,6 @@ import java.lang.reflect.Method; import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -59,7 +58,6 @@ import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.i18n.Language; import com.gamingmesh.jobs.stuff.ChatColor; -import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.GiveItem; import com.gamingmesh.jobs.stuff.OfflinePlayerList; import com.gamingmesh.jobs.stuff.Perm; diff --git a/com/gamingmesh/jobs/container/Log.java b/com/gamingmesh/jobs/container/Log.java index 707b0cfe..20851ee5 100644 --- a/com/gamingmesh/jobs/container/Log.java +++ b/com/gamingmesh/jobs/container/Log.java @@ -1,7 +1,5 @@ package com.gamingmesh.jobs.container; -import java.text.SimpleDateFormat; -import java.util.Calendar; import java.util.HashMap; import com.gamingmesh.jobs.stuff.TimeManage; diff --git a/com/gamingmesh/jobs/dao/JobsDAO.java b/com/gamingmesh/jobs/dao/JobsDAO.java index f25a4766..e477104b 100644 --- a/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/com/gamingmesh/jobs/dao/JobsDAO.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; +import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; @@ -639,7 +640,18 @@ public abstract class JobsDAO { prest.setString(1, jobsname); ResultSet res = prest.executeQuery(); while (res.next()) { - jobs.add(new TopList(res.getString(1), res.getInt(2), res.getInt(3), res.getBytes(4))); + + Player player = Bukkit.getPlayer(res.getString(1)); + if (player != null) { + + JobsPlayer jobsinfo = Jobs.getPlayerManager().getJobsPlayer(player); + Job job = Jobs.getJob(jobsname); + if (job != null) { + JobProgression prog = jobsinfo.getJobProgression(job); + jobs.add(new TopList(player.getName(), prog.getLevel(), (int) prog.getExperience(), UUIDUtil.toBytes(player.getUniqueId()))); + } + } else + jobs.add(new TopList(res.getString(1), res.getInt(2), res.getInt(3), res.getBytes(4))); } prest.close(); } catch (SQLException e) { diff --git a/com/gamingmesh/jobs/dao/JobsDAOMySQL.java b/com/gamingmesh/jobs/dao/JobsDAOMySQL.java index db764793..5c165c71 100644 --- a/com/gamingmesh/jobs/dao/JobsDAOMySQL.java +++ b/com/gamingmesh/jobs/dao/JobsDAOMySQL.java @@ -22,8 +22,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; -import java.util.UUID; - import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; @@ -97,7 +95,6 @@ public class JobsDAOMySQL extends JobsDAO { } } - @SuppressWarnings("deprecation") @Override protected synchronized void checkUpdate1() throws SQLException { JobsConnection conn = getConnection(); diff --git a/com/gamingmesh/jobs/dao/JobsDAOSQLite.java b/com/gamingmesh/jobs/dao/JobsDAOSQLite.java index f19c6de1..3c595345 100644 --- a/com/gamingmesh/jobs/dao/JobsDAOSQLite.java +++ b/com/gamingmesh/jobs/dao/JobsDAOSQLite.java @@ -23,8 +23,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; -import java.util.UUID; - import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; diff --git a/com/gamingmesh/jobs/economy/BufferedEconomy.java b/com/gamingmesh/jobs/economy/BufferedEconomy.java index 8076c064..405974f8 100644 --- a/com/gamingmesh/jobs/economy/BufferedEconomy.java +++ b/com/gamingmesh/jobs/economy/BufferedEconomy.java @@ -26,8 +26,6 @@ import java.util.concurrent.LinkedBlockingQueue; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; - import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.JobsPlugin; import com.gamingmesh.jobs.api.JobsPaymentEvent; diff --git a/com/gamingmesh/jobs/listeners/JobsListener.java b/com/gamingmesh/jobs/listeners/JobsListener.java index b2eaf47d..1db92b6f 100644 --- a/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/com/gamingmesh/jobs/listeners/JobsListener.java @@ -23,7 +23,6 @@ import java.util.regex.Pattern; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.Sign; diff --git a/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index fd9f1584..6eee3075 100644 --- a/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -254,7 +254,7 @@ public class JobsPaymentListener implements Listener { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent event) { - + // remove furnace metadata for broken block Block block = event.getBlock(); if (block == null) @@ -875,7 +875,7 @@ public class JobsPaymentListener implements Listener { 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")) + if (Perm.hasPermission(pDamager, "jobs.petpay") || Perm.hasPermission(pDamager, "jobs.vippetpay")) PetPayMultiplier = ConfigManager.getJobsConfiguration().VipPetPay; else PetPayMultiplier = ConfigManager.getJobsConfiguration().PetPay; diff --git a/com/gamingmesh/jobs/stuff/OfflinePlayerList.java b/com/gamingmesh/jobs/stuff/OfflinePlayerList.java index c169501e..add677dd 100644 --- a/com/gamingmesh/jobs/stuff/OfflinePlayerList.java +++ b/com/gamingmesh/jobs/stuff/OfflinePlayerList.java @@ -1,56 +1,57 @@ -package com.gamingmesh.jobs.stuff; - -import java.util.HashMap; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; - -import com.gamingmesh.jobs.JobsPlugin; -import com.gamingmesh.jobs.config.ConfigManager; - -public class OfflinePlayerList { - - private static HashMap map = new HashMap(); - private static HashMap uuidmap = new HashMap(); - - public static void fillList() { - Bukkit.getScheduler().runTaskAsynchronously(JobsPlugin.instance, new Runnable() { - @Override - public void run() { - OfflinePlayer[] players = Bukkit.getOfflinePlayers(); - for (OfflinePlayer one : players) { - if (one == null) - continue; - map.put(one.getName().toLowerCase(), one); - uuidmap.put(one.getUniqueId(), one); - } - return; - } - }); - } - - public static OfflinePlayer getPlayer(UUID uuid) { - if (!ConfigManager.getJobsConfiguration().LocalOfflinePlayersData) - return Bukkit.getOfflinePlayer(uuid); - - if (uuidmap.containsKey(uuid)) - return uuidmap.get(uuid); - return null; - } - - public static OfflinePlayer getPlayer(String name) { - if (!ConfigManager.getJobsConfiguration().LocalOfflinePlayersData) - return Bukkit.getOfflinePlayer(name); - - if (map.containsKey(name.toLowerCase())) - return map.get(name.toLowerCase()); - return null; - } - - public static void addPlayer(OfflinePlayer player) { - map.put(player.getName().toLowerCase(), player); - uuidmap.put(player.getUniqueId(), player); - } - -} +package com.gamingmesh.jobs.stuff; + +import java.util.HashMap; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; + +import com.gamingmesh.jobs.JobsPlugin; +import com.gamingmesh.jobs.config.ConfigManager; + +public class OfflinePlayerList { + + private static HashMap map = new HashMap(); + private static HashMap uuidmap = new HashMap(); + + public static void fillList() { + Bukkit.getScheduler().runTaskAsynchronously(JobsPlugin.instance, new Runnable() { + @Override + public void run() { + OfflinePlayer[] players = Bukkit.getOfflinePlayers(); + for (OfflinePlayer one : players) { + if (one == null) + continue; + map.put(one.getName().toLowerCase(), one); + uuidmap.put(one.getUniqueId(), one); + } + return; + } + }); + } + + public static OfflinePlayer getPlayer(UUID uuid) { + if (!ConfigManager.getJobsConfiguration().LocalOfflinePlayersData) + return Bukkit.getOfflinePlayer(uuid); + + if (uuidmap.containsKey(uuid)) + return uuidmap.get(uuid); + return null; + } + + @SuppressWarnings("deprecation") + public static OfflinePlayer getPlayer(String name) { + if (!ConfigManager.getJobsConfiguration().LocalOfflinePlayersData) + return Bukkit.getOfflinePlayer(name); + + if (map.containsKey(name.toLowerCase())) + return map.get(name.toLowerCase()); + return null; + } + + public static void addPlayer(OfflinePlayer player) { + map.put(player.getName().toLowerCase(), player); + uuidmap.put(player.getUniqueId(), player); + } + +} diff --git a/com/gamingmesh/jobs/stuff/Scboard.java b/com/gamingmesh/jobs/stuff/Scboard.java index 6d7b51f2..08383133 100644 --- a/com/gamingmesh/jobs/stuff/Scboard.java +++ b/com/gamingmesh/jobs/stuff/Scboard.java @@ -1,48 +1,48 @@ -package com.gamingmesh.jobs.stuff; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.scoreboard.DisplaySlot; - -import com.gamingmesh.jobs.JobsPlugin; -import com.gamingmesh.jobs.config.ConfigManager; - -public class Scboard { - - private static HashMap timerMap = new HashMap(); - - private static void RunScheduler() { - - Iterator> MeinMapIter = timerMap.entrySet().iterator(); - while (MeinMapIter.hasNext()) { - Entry Map = MeinMapIter.next(); - - if (System.currentTimeMillis() > Map.getValue() + (ConfigManager.getJobsConfiguration().ToplistInScoreboardInterval * 1000)) { - Player player = Bukkit.getPlayer(Map.getKey()); - if (player != null) { - player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR); - } - timerMap.remove(Map.getKey()); - } - } - - if (timerMap.size() > 0) - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(JobsPlugin.instance, new Runnable() { - public void run() { - RunScheduler(); - return; - } - }, 20L); - return; - } - - public static void addNew(Player player) { - timerMap.put(player.getName(), System.currentTimeMillis()); - RunScheduler(); - } - -} +package com.gamingmesh.jobs.stuff; + +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scoreboard.DisplaySlot; + +import com.gamingmesh.jobs.JobsPlugin; +import com.gamingmesh.jobs.config.ConfigManager; + +public class Scboard { + + private static ConcurrentHashMap timerMap = new ConcurrentHashMap(); + + private static void RunScheduler() { + + Iterator> MeinMapIter = timerMap.entrySet().iterator(); + while (MeinMapIter.hasNext()) { + Entry Map = MeinMapIter.next(); + + if (System.currentTimeMillis() > Map.getValue() + (ConfigManager.getJobsConfiguration().ToplistInScoreboardInterval * 1000)) { + Player player = Bukkit.getPlayer(Map.getKey()); + if (player != null) { + player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR); + } + timerMap.remove(Map.getKey()); + } + } + + if (timerMap.size() > 0) + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(JobsPlugin.instance, new Runnable() { + public void run() { + RunScheduler(); + return; + } + }, 20L); + return; + } + + public static void addNew(Player player) { + timerMap.put(player.getName(), System.currentTimeMillis()); + RunScheduler(); + } + +} diff --git a/plugin.yml b/plugin.yml index e2ea51bd..f842fd0e 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,150 +1,150 @@ -name: Jobs -description: Jobs Plugin for the BukkitAPI -main: com.gamingmesh.jobs.JobsPlugin -version: 2.51.0 -author: phrstbrn -softdepend: [Vault] -commands: - jobs: - description: Jobs - usage: /jobs -permissions: - jobs.*: - description: Grants access to all Jobs commands - children: - jobs.admin: true - jobs.admin: - description: Grants permissions as an admin - default: false - children: - jobs.use: true - jobs.command.*: true - jobs.use: - description: Grants ability to use this plugin - default: true - jobs.command.*: - description: Grants player access to all commands - default: false - children: - jobs.command.browse: true - jobs.command.stats: true - jobs.command.admin.stats: true - jobs.command.admin.archive: true - jobs.command.archive: true - jobs.command.join: true - jobs.command.leave: true - jobs.command.leaveall: true - jobs.command.info: true - jobs.command.playerinfo: true - jobs.command.fire: true - jobs.command.fireall: true - jobs.command.employ: true - jobs.command.promote: true - jobs.command.demote: true - jobs.command.grantxp: true - jobs.command.removexp: true - jobs.command.transfer: true - jobs.command.reload: true - jobs.command.help: true - jobs.command.top: true - jobs.command.gtop: true - jobs.command.toggle: true - jobs.command.limit: true - jobs.command.give: true - jobs.command.signs: true - jobs.command.signupdate: true - jobs.command.moneyboost: true - jobs.command.expboost: true - jobs.command.browse: - description: Grants access to the browse command - default: true - jobs.command.top: - description: Grants access to the top command - default: true - jobs.command.gtop: - description: Grants access to the gtop command - default: true - jobs.command.stats: - description: Grants access to the stats command - default: true - jobs.command.archive: - description: Grants access to the archive command - default: true - jobs.command.admin.archive: - description: Grants access to the archive command on other players - default: true - jobs.command.admin.stats: - description: Grants access to the stats command on other players - default: true - jobs.command.join: - description: Grants access to the join command - default: true - jobs.command.leave: - description: Grants access to the leave command - default: true - jobs.command.leaveall: - description: Grants access to the leaveall command - default: true - jobs.command.info: - description: Grants access to the info command - default: true - jobs.command.playerinfo: - description: Grants access to the playerinfo command - default: op - jobs.command.fire: - description: Grants access to the fire command - default: op - jobs.command.fireall: - description: Grants access to the fireall command - default: op - jobs.command.employ: - description: Grants access to the employ command - default: op - jobs.command.promote: - description: Grants access to the promote command - default: op - jobs.command.demote: - description: Grants access to the demote command - default: op - jobs.command.grantxp: - description: Grants access to the grantxp command - default: op - jobs.command.removexp: - description: Grants access to the removexp command - default: op - jobs.command.transfer: - description: Grants access to the transfer command - default: op - jobs.command.reload: - description: Grants access to the reload command - default: op - jobs.command.signupdate: - description: Grants access to the reload command - default: op - jobs.command.give: - description: Grants access to the give command - default: op - jobs.command.expboost: - description: Grants access to the expboost command - default: op - jobs.command.moneyboost: - description: Grants access to the moneyboost command - default: op - jobs.command.help: - description: Grants access to the help command - default: true - jobs.command.toggle: - description: Grants access to the toggle command - default: true - jobs.command.limit: - description: Grants access to the limit command - default: true - jobs.command.log: - description: Grants access to the log command - default: true - jobs.command.log.others: - description: Grants access to the log command - default: op - jobs.command.glog: - description: Grants access to the glog command +name: Jobs +description: Jobs Plugin for the BukkitAPI +main: com.gamingmesh.jobs.JobsPlugin +version: 2.51.2 +author: phrstbrn +softdepend: [Vault] +commands: + jobs: + description: Jobs + usage: /jobs +permissions: + jobs.*: + description: Grants access to all Jobs commands + children: + jobs.admin: true + jobs.admin: + description: Grants permissions as an admin + default: false + children: + jobs.use: true + jobs.command.*: true + jobs.use: + description: Grants ability to use this plugin + default: true + jobs.command.*: + description: Grants player access to all commands + default: false + children: + jobs.command.browse: true + jobs.command.stats: true + jobs.command.admin.stats: true + jobs.command.admin.archive: true + jobs.command.archive: true + jobs.command.join: true + jobs.command.leave: true + jobs.command.leaveall: true + jobs.command.info: true + jobs.command.playerinfo: true + jobs.command.fire: true + jobs.command.fireall: true + jobs.command.employ: true + jobs.command.promote: true + jobs.command.demote: true + jobs.command.grantxp: true + jobs.command.removexp: true + jobs.command.transfer: true + jobs.command.reload: true + jobs.command.help: true + jobs.command.top: true + jobs.command.gtop: true + jobs.command.toggle: true + jobs.command.limit: true + jobs.command.give: true + jobs.command.signs: true + jobs.command.signupdate: true + jobs.command.moneyboost: true + jobs.command.expboost: true + jobs.command.browse: + description: Grants access to the browse command + default: true + jobs.command.top: + description: Grants access to the top command + default: true + jobs.command.gtop: + description: Grants access to the gtop command + default: true + jobs.command.stats: + description: Grants access to the stats command + default: true + jobs.command.archive: + description: Grants access to the archive command + default: true + jobs.command.admin.archive: + description: Grants access to the archive command on other players + default: true + jobs.command.admin.stats: + description: Grants access to the stats command on other players + default: true + jobs.command.join: + description: Grants access to the join command + default: true + jobs.command.leave: + description: Grants access to the leave command + default: true + jobs.command.leaveall: + description: Grants access to the leaveall command + default: true + jobs.command.info: + description: Grants access to the info command + default: true + jobs.command.playerinfo: + description: Grants access to the playerinfo command + default: op + jobs.command.fire: + description: Grants access to the fire command + default: op + jobs.command.fireall: + description: Grants access to the fireall command + default: op + jobs.command.employ: + description: Grants access to the employ command + default: op + jobs.command.promote: + description: Grants access to the promote command + default: op + jobs.command.demote: + description: Grants access to the demote command + default: op + jobs.command.grantxp: + description: Grants access to the grantxp command + default: op + jobs.command.removexp: + description: Grants access to the removexp command + default: op + jobs.command.transfer: + description: Grants access to the transfer command + default: op + jobs.command.reload: + description: Grants access to the reload command + default: op + jobs.command.signupdate: + description: Grants access to the reload command + default: op + jobs.command.give: + description: Grants access to the give command + default: op + jobs.command.expboost: + description: Grants access to the expboost command + default: op + jobs.command.moneyboost: + description: Grants access to the moneyboost command + default: op + jobs.command.help: + description: Grants access to the help command + default: true + jobs.command.toggle: + description: Grants access to the toggle command + default: true + jobs.command.limit: + description: Grants access to the limit command + default: true + jobs.command.log: + description: Grants access to the log command + default: true + jobs.command.log.others: + description: Grants access to the log command + default: op + jobs.command.glog: + description: Grants access to the glog command default: op \ No newline at end of file