Skip to content

Commit

Permalink
Fixing
Browse files Browse the repository at this point in the history
- a Player cannot pick up items when using /tpdeath
- the inventory now opens for the right player when using /inventoryShow
  • Loading branch information
Cookieblasterxx committed Jan 10, 2024
1 parent 2f062df commit 90b3b0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command
return true;
}

Inventory showInventory = Bukkit.createInventory(null, 9 * 6, player.getName());
Inventory showInventory = Bukkit.createInventory(null, 9 * 6, player.getName() + "´s Inventory");
for (int i = 0; i < 9; i++) {
showInventory.setItem(9 * 3 + i, timedInventorySave.getInventory()[i]);
}
Expand All @@ -54,7 +54,7 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command
showInventory.setItem(9 * 4 + 3 - (i % 9), timedInventorySave.getInventory()[i]);
}
showInventory.setItem(9 * 4 + 4, timedInventorySave.getInventory()[40]);
player.openInventory(showInventory);
((Player) commandSender).openInventory(showInventory);

commandSender.sendMessage(ConfigUtil.getPrefixedTrans("commands.inventoryShow.success", "player", strings[0]));
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command
if (lastDeathLocation != null) {
if (lastDeathLocation.getY() < -60) lastDeathLocation.setY(-60);
player.setVelocity(new Vector(0, 0, 0));
player.setCanPickupItems(false);
player.teleport(lastDeathLocation.add(0.5, 0, 0.5));
player.sendMessage(ConfigUtil.getPrefixedTrans("commands.tpDeath.success", "player", deathPlayer.getName()));
(new BukkitRunnable() {
@Override
public void run() {
player.setGameMode(GameMode.SPECTATOR);
player.setCanPickupItems(true);
}
}).runTaskLater(CansteinSupportUtils.getInstance(), 5);
} else
Expand Down

0 comments on commit 90b3b0d

Please sign in to comment.