mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
Fix for incorrect player data caching on player quit and delayed save
Small fix for bp check and NULL block
This commit is contained in:
parent
a84161585d
commit
9635ade759
37
.classpath
37
.classpath
@ -1,16 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path=""/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/Vault1.5.3.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/mcMMO#127.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/CoreProtect_2.12.0.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/CheckMyInventory/lib/spigot-1.11.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Residence/lib/iConomy7.0.6.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Residence/lib/worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/craftconomy3-3.3.1-20160221.070622-13.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/MythicMobs-4.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/MythicMobs-2.1.8.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/MyPet-2.3.0-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
<classpathentry kind="src" path="" />
|
||||
<classpathentry kind="con"
|
||||
path="org.eclipse.jdt.launching.JRE_CONTAINER" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/Jobs/lib/Vault1.5.3.jar" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/Jobs/lib/mcMMO#127.jar" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/Jobs/lib/CoreProtect_2.12.0.jar" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/CheckMyInventory/lib/spigot-1.11.jar" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/Residence/lib/iConomy7.0.6.jar" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/Residence/lib/worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/Jobs/lib/craftconomy3-3.3.1-20160221.070622-13.jar" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/Jobs/lib/MythicMobs-4.1.0.jar" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/Jobs/lib/MythicMobs-2.1.8.jar" />
|
||||
<classpathentry kind="lib"
|
||||
path="C:/Users/Arte/Desktop/Jobs/lib/MyPet-2.3.0-SNAPSHOT.jar" />
|
||||
<classpathentry kind="output" path="" />
|
||||
</classpath>
|
||||
|
6
.project
6
.project
@ -20,8 +20,14 @@
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
@ -1041,9 +1041,11 @@ public class Jobs extends JavaPlugin {
|
||||
}
|
||||
|
||||
//need to update bp
|
||||
BlockProtection bp = BpManager.getBp(block.getLocation());
|
||||
if (bp != null)
|
||||
bp.setPaid(true);
|
||||
if (block != null) {
|
||||
BlockProtection bp = BpManager.getBp(block.getLocation());
|
||||
if (bp != null)
|
||||
bp.setPaid(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,15 +175,12 @@ public class PlayerManager {
|
||||
* @param playername
|
||||
*/
|
||||
public void playerQuit(Player player) {
|
||||
JobsPlayer jPlayer = this.removePlayer(player);
|
||||
if (jPlayer == null)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
JobsPlayer jPlayer = this.getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
addPlayerToCache(jPlayer);
|
||||
if (Jobs.getGCManager().saveOnDisconnect()) {
|
||||
jPlayer.save();
|
||||
jPlayer.onDisconnect();
|
||||
jPlayer.save();
|
||||
} else {
|
||||
jPlayer.onDisconnect();
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -283,6 +284,14 @@ public class GeneralConfigManager {
|
||||
return locale;
|
||||
}
|
||||
|
||||
public boolean canPerformActionInWorld(Entity ent) {
|
||||
if (ent == null)
|
||||
return true;
|
||||
if (ent.getWorld() == null)
|
||||
return true;
|
||||
return canPerformActionInWorld(ent.getWorld());
|
||||
}
|
||||
|
||||
public boolean canPerformActionInWorld(Player player) {
|
||||
if (player == null)
|
||||
return true;
|
||||
|
@ -168,8 +168,14 @@ public class JobsPlayer {
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
if (this.playerUUID != null)
|
||||
this.player = Bukkit.getPlayer(this.playerUUID);
|
||||
if (this.playerUUID != null){
|
||||
Player p = Bukkit.getPlayer(this.playerUUID);
|
||||
if (p != null){
|
||||
this.player = p;
|
||||
this.OffPlayer = p;
|
||||
this.userName = player.getName();
|
||||
}
|
||||
}
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@ -625,6 +631,11 @@ public class JobsPlayer {
|
||||
dao.recordPlayersLimits(this);
|
||||
dao.updateSeen(this);
|
||||
setSaved(true);
|
||||
|
||||
if (this.getPlayer() == null || !this.getPlayer().isOnline()){
|
||||
Jobs.getPlayerManager().addPlayerToCache(this);
|
||||
Jobs.getPlayerManager().removePlayer(this.getPlayer());
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
@ -644,6 +655,7 @@ public class JobsPlayer {
|
||||
// Jobs.getJobsDAO().savePoints(this);
|
||||
clearBossMaps();
|
||||
isOnline = false;
|
||||
Jobs.getPlayerManager().addPlayerToCache(this);
|
||||
}
|
||||
|
||||
public void clearBossMaps() {
|
||||
|
@ -53,6 +53,7 @@ import com.gamingmesh.jobs.container.PlayerInfo;
|
||||
import com.gamingmesh.jobs.container.PlayerPoints;
|
||||
import com.gamingmesh.jobs.container.TopList;
|
||||
import com.gamingmesh.jobs.economy.PaymentData;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
|
||||
/**
|
||||
@ -923,6 +924,7 @@ public abstract class JobsDAO {
|
||||
* @param jobInfo - the information getting saved
|
||||
*/
|
||||
public void save(JobsPlayer player) {
|
||||
Debug.D("saving player data " + player.getUserName());
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return;
|
||||
@ -1277,7 +1279,7 @@ public abstract class JobsDAO {
|
||||
Jobs.getBpManager().timer += System.currentTimeMillis() - t;
|
||||
}
|
||||
if (i > 0) {
|
||||
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] loaded " + i + " block protection entries. " + Jobs.getBpManager().timer);
|
||||
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] loaded " + i + " block protection entries. " + Jobs.getBpManager().timer);
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(message);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
@ -1041,7 +1041,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onTntExplode(EntityExplodeEvent event) {
|
||||
//disabling plugin in world
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity()))
|
||||
return;
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
|
Loading…
Reference in New Issue
Block a user