mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 12:05:16 +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>
|
||||||
|
60
.project
60
.project
@ -1,27 +1,33 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>Jobs</name>
|
<name>Jobs</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||||
<triggers>full,incremental,</triggers>
|
<triggers>full,incremental,</triggers>
|
||||||
<arguments>
|
<arguments>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>LaunchConfigHandle</key>
|
<key>LaunchConfigHandle</key>
|
||||||
<value><project>/.externalToolBuilders/Create jar file.launch</value>
|
<value><project>/.externalToolBuilders/Create jar file.launch</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
<buildCommand>
|
||||||
<natures>
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<arguments>
|
||||||
</natures>
|
</arguments>
|
||||||
</projectDescription>
|
</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
|
//need to update bp
|
||||||
BlockProtection bp = BpManager.getBp(block.getLocation());
|
if (block != null) {
|
||||||
if (bp != null)
|
BlockProtection bp = BpManager.getBp(block.getLocation());
|
||||||
bp.setPaid(true);
|
if (bp != null)
|
||||||
|
bp.setPaid(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
@ -414,7 +423,7 @@ public class GeneralConfigManager {
|
|||||||
"Player data is always periodically auto-saved and autosaved during a clean shutdown.",
|
"Player data is always periodically auto-saved and autosaved during a clean shutdown.",
|
||||||
"Only enable this if you have a multi-server setup, or have a really good reason for enabling this.", "Turning this on will decrease database performance.");
|
"Only enable this if you have a multi-server setup, or have a really good reason for enabling this.", "Turning this on will decrease database performance.");
|
||||||
saveOnDisconnect = c.get("save-on-disconnect", false);
|
saveOnDisconnect = c.get("save-on-disconnect", false);
|
||||||
|
|
||||||
c.getW().addComment("selectionTool", "Tool used when selecting bounds for restricted area");
|
c.getW().addComment("selectionTool", "Tool used when selecting bounds for restricted area");
|
||||||
getSelectionTooldID = c.get("selectionTool", 294);
|
getSelectionTooldID = c.get("selectionTool", 294);
|
||||||
if (Material.getMaterial(Jobs.getGCManager().getSelectionTooldID) == null)
|
if (Material.getMaterial(Jobs.getGCManager().getSelectionTooldID) == null)
|
||||||
|
@ -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