mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-12-31 18:17:49 +01:00
Fix a bug where the items from the backpack could be dropped on the wrong location with a very very slow database
This commit is contained in:
parent
f8dd837012
commit
c96e7a4b59
@ -21,6 +21,8 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Backpack;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
@ -40,6 +42,8 @@ public void onDeath(PlayerDeathEvent event)
|
||||
final Player player = event.getEntity();
|
||||
if (!player.hasPermission("backpack.keepOnDeath"))
|
||||
{
|
||||
final World world = player.getWorld();
|
||||
final Location location = player.getLocation();
|
||||
plugin.getBackpack(player, new Callback<Backpack>()
|
||||
{
|
||||
@Override
|
||||
@ -50,7 +54,7 @@ public void onResult(Backpack backpack)
|
||||
{
|
||||
if(i != null)
|
||||
{
|
||||
player.getWorld().dropItemNaturally(player.getLocation(), i);
|
||||
world.dropItemNaturally(location, i);
|
||||
backpackInventory.remove(i);
|
||||
backpack.setChanged();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user