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