mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
No longer loading the backpack on disconnect
This commit is contained in:
parent
f45fa903df
commit
1f3f1ae748
2
pom.xml
2
pom.xml
@ -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>
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user