mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-06 19:18:07 +01:00
Add size debug command
This commit is contained in:
parent
b1235c4b74
commit
8bbbc39d18
@ -125,7 +125,7 @@ public Backpack(final OfflinePlayer owner, ItemStack[] backpack, final int ID)
|
||||
return Bukkit.getServer().getPlayer(ownerId);
|
||||
}
|
||||
|
||||
private void checkResize()
|
||||
public void checkResize()
|
||||
{
|
||||
Player owner = Bukkit.getServer().getPlayer(this.ownerId);
|
||||
if(owner != null)
|
||||
|
@ -25,6 +25,7 @@
|
||||
import at.pcgamingfreaks.Message.MessageColor;
|
||||
import at.pcgamingfreaks.Message.MessageFormat;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
@ -153,6 +154,47 @@ public void execute(@NotNull CommandSender commandSender, @NotNull String mainCo
|
||||
}
|
||||
commandSender.sendMessage("###############################");
|
||||
}
|
||||
else if (args.length == 2 && args[0].equals("size"))
|
||||
{
|
||||
Player player = Bukkit.getServer().getPlayer(args[1]);
|
||||
if (player == null)
|
||||
{
|
||||
commandSender.sendMessage("Player " + args[1] + " is offline.");
|
||||
return;
|
||||
}
|
||||
Backpack bp = Minepacks.getInstance().getBackpackCachedOnly(player);
|
||||
int bpSize = -1, bpInvSize = -1, sizeShouldBe = Minepacks.getInstance().getBackpackPermSize(player);
|
||||
String actualSize = "backpack not loaded", actualSizeInventory = "backpack not loaded";
|
||||
if (bp != null)
|
||||
{
|
||||
bpSize = bp.getSize();
|
||||
bpInvSize = bp.getInventory().getSize();
|
||||
actualSize = String.valueOf(bpSize);
|
||||
actualSizeInventory = String.valueOf(bpInvSize);
|
||||
}
|
||||
commandSender.sendMessage("### Backpack size for " + player.getName() + " ###");
|
||||
commandSender.sendMessage("Size: " + actualSize);
|
||||
commandSender.sendMessage("Inventory Size: " + actualSizeInventory);
|
||||
commandSender.sendMessage("Should be: " + sizeShouldBe);
|
||||
if (bpSize != sizeShouldBe)
|
||||
{
|
||||
commandSender.sendMessage("Size missmatch detected, attempt resize ...");
|
||||
((at.pcgamingfreaks.Minepacks.Bukkit.Backpack) bp).checkResize();
|
||||
if (bp.getSize() != sizeShouldBe)
|
||||
{
|
||||
commandSender.sendMessage("Failed to resize backpack.");
|
||||
}
|
||||
else
|
||||
{
|
||||
commandSender.sendMessage("Resized backpack successfully.");
|
||||
}
|
||||
}
|
||||
if (bp != null && bp.getSize() != bp.getInventory().getSize())
|
||||
{
|
||||
commandSender.sendMessage("Inventory size does not match backpack size!");
|
||||
}
|
||||
commandSender.sendMessage("###############################");
|
||||
}
|
||||
else
|
||||
debugSystem(commandSender);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user