mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-07 19:28:11 +01:00
Refactor debug command
This commit is contained in:
parent
032f22a3df
commit
222e122eda
@ -70,7 +70,7 @@ public DebugCommand(final @NotNull Minepacks plugin)
|
||||
builder = new MessageBuilder("All data has been collected!", MessageColor.GREEN, MessageFormat.BOLD).appendNewLine();
|
||||
builder.append("You can now interact with your game again.").appendNewLine();
|
||||
builder.append("The collected data can be found in your plugins directory inside the 'debug.txt' file.").appendNewLine();
|
||||
builder.append("Please upload this fiel to ");
|
||||
builder.append("Please upload this file to ");
|
||||
builder.append("https://pastebin.com/", MessageColor.YELLOW, MessageFormat.UNDERLINE).onClick(MessageClickEvent.ClickEventAction.OPEN_URL, "https://pastebin.com/");
|
||||
builder.append(" and send the link to the developer.");
|
||||
messageDone = builder.getMessage();
|
||||
@ -157,10 +157,20 @@ public void execute(@NotNull CommandSender commandSender, @NotNull String mainCo
|
||||
}
|
||||
else if (args.length == 2 && args[0].equals("size"))
|
||||
{
|
||||
Player player = Bukkit.getServer().getPlayer(args[1]);
|
||||
executeSize(commandSender, args[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
debugSystem(commandSender);
|
||||
}
|
||||
}
|
||||
|
||||
void executeSize(final @NotNull CommandSender commandSender, final @NotNull String playerName)
|
||||
{
|
||||
Player player = Bukkit.getServer().getPlayer(playerName);
|
||||
if (player == null)
|
||||
{
|
||||
commandSender.sendMessage("Player " + args[1] + " is offline.");
|
||||
commandSender.sendMessage("Player " + playerName + " is offline.");
|
||||
return;
|
||||
}
|
||||
Backpack bp = Minepacks.getInstance().getBackpackCachedOnly(player);
|
||||
@ -177,9 +187,9 @@ else if (args.length == 2 && args[0].equals("size"))
|
||||
commandSender.sendMessage("Size: " + actualSize);
|
||||
commandSender.sendMessage("Inventory Size: " + actualSizeInventory);
|
||||
commandSender.sendMessage("Should be: " + sizeShouldBe);
|
||||
if (bpSize != sizeShouldBe)
|
||||
if (bpSize != sizeShouldBe && bp != null)
|
||||
{
|
||||
commandSender.sendMessage("Size missmatch detected, attempt resize ...");
|
||||
commandSender.sendMessage("Size mismatch detected, attempt resize ...");
|
||||
((at.pcgamingfreaks.Minepacks.Bukkit.Backpack) bp).checkResize();
|
||||
if (bp.getSize() != sizeShouldBe)
|
||||
{
|
||||
@ -197,9 +207,6 @@ else if (args.length == 2 && args[0].equals("size"))
|
||||
commandSender.sendMessage("Player class: " + player.getClass().getName());
|
||||
commandSender.sendMessage("###############################");
|
||||
}
|
||||
else
|
||||
debugSystem(commandSender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender commandSender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
||||
|
Loading…
Reference in New Issue
Block a user