mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 22:38:06 +01:00
Fixed issue with sign top list not being updated in "real" time
Changed some data storage methods for better performance and possible small issue fixing. Changed jobs.petpay permission to jobs.vippetpay to be more accurate for what it stands.
This commit is contained in:
parent
da358aef0b
commit
ba506a1e62
@ -45,7 +45,6 @@ import com.gamingmesh.jobs.economy.Economy;
|
|||||||
import com.gamingmesh.jobs.economy.PaymentData;
|
import com.gamingmesh.jobs.economy.PaymentData;
|
||||||
import com.gamingmesh.jobs.i18n.Language;
|
import com.gamingmesh.jobs.i18n.Language;
|
||||||
import com.gamingmesh.jobs.stuff.ActionBar;
|
import com.gamingmesh.jobs.stuff.ActionBar;
|
||||||
import com.gamingmesh.jobs.stuff.Debug;
|
|
||||||
import com.gamingmesh.jobs.stuff.JobsClassLoader;
|
import com.gamingmesh.jobs.stuff.JobsClassLoader;
|
||||||
import com.gamingmesh.jobs.stuff.Loging;
|
import com.gamingmesh.jobs.stuff.Loging;
|
||||||
import com.gamingmesh.jobs.tasks.BufferedPaymentThread;
|
import com.gamingmesh.jobs.tasks.BufferedPaymentThread;
|
||||||
|
@ -28,9 +28,6 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
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.JobsJoinEvent;
|
||||||
import com.gamingmesh.jobs.api.JobsLeaveEvent;
|
import com.gamingmesh.jobs.api.JobsLeaveEvent;
|
||||||
import com.gamingmesh.jobs.api.JobsLevelUpEvent;
|
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.ChatColor;
|
||||||
import com.gamingmesh.jobs.stuff.PerformCommands;
|
import com.gamingmesh.jobs.stuff.PerformCommands;
|
||||||
|
|
||||||
import net.milkbowl.vault.Vault;
|
|
||||||
|
|
||||||
public class PlayerManager {
|
public class PlayerManager {
|
||||||
private Map<String, JobsPlayer> players = Collections.synchronizedMap(new HashMap<String, JobsPlayer>());
|
private Map<String, JobsPlayer> players = Collections.synchronizedMap(new HashMap<String, JobsPlayer>());
|
||||||
//private Map<String, JobsPlayer> players = new HashMap<String, JobsPlayer>();
|
//private Map<String, JobsPlayer> players = new HashMap<String, JobsPlayer>();
|
||||||
|
@ -24,7 +24,6 @@ import java.lang.reflect.Method;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -59,7 +58,6 @@ import com.gamingmesh.jobs.container.TopList;
|
|||||||
import com.gamingmesh.jobs.economy.PaymentData;
|
import com.gamingmesh.jobs.economy.PaymentData;
|
||||||
import com.gamingmesh.jobs.i18n.Language;
|
import com.gamingmesh.jobs.i18n.Language;
|
||||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||||
import com.gamingmesh.jobs.stuff.Debug;
|
|
||||||
import com.gamingmesh.jobs.stuff.GiveItem;
|
import com.gamingmesh.jobs.stuff.GiveItem;
|
||||||
import com.gamingmesh.jobs.stuff.OfflinePlayerList;
|
import com.gamingmesh.jobs.stuff.OfflinePlayerList;
|
||||||
import com.gamingmesh.jobs.stuff.Perm;
|
import com.gamingmesh.jobs.stuff.Perm;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.gamingmesh.jobs.container;
|
package com.gamingmesh.jobs.container;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||||
|
@ -26,6 +26,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -639,6 +640,17 @@ public abstract class JobsDAO {
|
|||||||
prest.setString(1, jobsname);
|
prest.setString(1, jobsname);
|
||||||
ResultSet res = prest.executeQuery();
|
ResultSet res = prest.executeQuery();
|
||||||
while (res.next()) {
|
while (res.next()) {
|
||||||
|
|
||||||
|
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)));
|
jobs.add(new TopList(res.getString(1), res.getInt(2), res.getInt(3), res.getBytes(4)));
|
||||||
}
|
}
|
||||||
prest.close();
|
prest.close();
|
||||||
|
@ -22,8 +22,6 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
@ -97,7 +95,6 @@ public class JobsDAOMySQL extends JobsDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
@Override
|
||||||
protected synchronized void checkUpdate1() throws SQLException {
|
protected synchronized void checkUpdate1() throws SQLException {
|
||||||
JobsConnection conn = getConnection();
|
JobsConnection conn = getConnection();
|
||||||
|
@ -23,8 +23,6 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
|
@ -26,8 +26,6 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.JobsPlugin;
|
import com.gamingmesh.jobs.JobsPlugin;
|
||||||
import com.gamingmesh.jobs.api.JobsPaymentEvent;
|
import com.gamingmesh.jobs.api.JobsPaymentEvent;
|
||||||
|
@ -23,7 +23,6 @@ import java.util.regex.Pattern;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
@ -875,7 +875,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
Tameable t = (Tameable) ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager();
|
Tameable t = (Tameable) ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager();
|
||||||
if (t.isTamed() && t.getOwner() instanceof Player) {
|
if (t.isTamed() && t.getOwner() instanceof Player) {
|
||||||
pDamager = (Player) t.getOwner();
|
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;
|
PetPayMultiplier = ConfigManager.getJobsConfiguration().VipPetPay;
|
||||||
else
|
else
|
||||||
PetPayMultiplier = ConfigManager.getJobsConfiguration().PetPay;
|
PetPayMultiplier = ConfigManager.getJobsConfiguration().PetPay;
|
||||||
|
@ -39,6 +39,7 @@ public class OfflinePlayerList {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static OfflinePlayer getPlayer(String name) {
|
public static OfflinePlayer getPlayer(String name) {
|
||||||
if (!ConfigManager.getJobsConfiguration().LocalOfflinePlayersData)
|
if (!ConfigManager.getJobsConfiguration().LocalOfflinePlayersData)
|
||||||
return Bukkit.getOfflinePlayer(name);
|
return Bukkit.getOfflinePlayer(name);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.gamingmesh.jobs.stuff;
|
package com.gamingmesh.jobs.stuff;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -13,7 +13,7 @@ import com.gamingmesh.jobs.config.ConfigManager;
|
|||||||
|
|
||||||
public class Scboard {
|
public class Scboard {
|
||||||
|
|
||||||
private static HashMap<String, Long> timerMap = new HashMap<String, Long>();
|
private static ConcurrentHashMap<String, Long> timerMap = new ConcurrentHashMap<String, Long>();
|
||||||
|
|
||||||
private static void RunScheduler() {
|
private static void RunScheduler() {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: Jobs
|
name: Jobs
|
||||||
description: Jobs Plugin for the BukkitAPI
|
description: Jobs Plugin for the BukkitAPI
|
||||||
main: com.gamingmesh.jobs.JobsPlugin
|
main: com.gamingmesh.jobs.JobsPlugin
|
||||||
version: 2.51.0
|
version: 2.51.2
|
||||||
author: phrstbrn
|
author: phrstbrn
|
||||||
softdepend: [Vault]
|
softdepend: [Vault]
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user