No longer loading the backpack on disconnect

This commit is contained in:
GeorgH93 2015-03-28 20:14:40 +01:00
parent f45fa903df
commit 1f3f1ae748
5 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>MinePacks</artifactId>
<version>1.6</version>
<version>1.6.1</version>
<repositories>
<repository>
<id>in-project</id>

View File

@ -62,10 +62,10 @@ public Backpack getBackpack(String title)
return null;
}
public Backpack getBackpack(OfflinePlayer player)
public Backpack getBackpack(OfflinePlayer player, boolean loadedonly)
{
Backpack lbp = findBackpack(player);
if(lbp == null)
if(lbp == null && !loadedonly)
{
lbp = LoadBackpack(player);
if(lbp == null)

View File

@ -51,7 +51,7 @@ public void onDeath(PlayerDeathEvent event)
Player player = event.getEntity();
if (drop_on_death && !player.hasPermission("backpack.KeepOnDeath"))
{
Inventory BP = plugin.DB.getBackpack(player).getBackpack();
Inventory BP = plugin.DB.getBackpack(player, false).getBackpack();
for (ItemStack i : BP.getContents())
{
if (i != null)
@ -111,8 +111,8 @@ public void PlayerLoginEvent(PlayerJoinEvent event)
@EventHandler
public void PlayerLeaveEvent(PlayerQuitEvent event)
{
Backpack bp = plugin.DB.getBackpack(event.getPlayer());
if(!bp.isOpen())
Backpack bp = plugin.DB.getBackpack(event.getPlayer(), true);
if(bp != null && !bp.isOpen())
{
plugin.DB.UnloadBackpack(bp);
}

View File

@ -68,7 +68,7 @@ public void onDisable()
public void OpenBackpack(Player opener, OfflinePlayer owener, boolean editable)
{
OpenBackpack(opener, DB.getBackpack(owener), editable);
OpenBackpack(opener, DB.getBackpack(owener, false), editable);
}
public void OpenBackpack(Player opener, Backpack backpack, boolean editable)

View File

@ -63,7 +63,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String arg, String[]
// Open player backpack
if(player.hasPermission("backpack"))
{
Backpack bp = plugin.DB.getBackpack(player);
Backpack bp = plugin.DB.getBackpack(player, false);
if(bp == null)
{
player.sendMessage(Message_IvalidBackpack);
@ -128,7 +128,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String arg, String[]
{
OP = Bukkit.getOfflinePlayer(args[1]);
}
Backpack BP = plugin.DB.getBackpack(OP);
Backpack BP = plugin.DB.getBackpack(OP, false);
BP.getBackpack().clear();
player.sendMessage(Message_BackpackCleaned);
}