attribute gui save and bug patch
All checks were successful
Build / build (push) Successful in 1m26s

This commit is contained in:
unurled 2024-03-14 17:27:43 +01:00
parent 0af15fbd5a
commit 474318d210
Signed by: unurled
GPG key ID: FDBC9CBE1F82423F
2 changed files with 5 additions and 4 deletions

View file

@ -53,12 +53,12 @@ public class AttributeCommand implements TabExecutor {
@NotNull Command command,
@NotNull String label,
@NotNull String[] args) {
// set, get, remove
// set, get, remove, gui
if (!sender.hasPermission("sr.attributes")) {
sender.sendMessage("Unknown command. Type \"/help\" for help.");
return true;
}
if (args.length <= 2) {
if (args.length < 2) {
sender.sendMessage(
"Usage: /attribute <set|get|remove|gui> <player|item-in-hand> <attribute> [value]");
return true;
@ -159,7 +159,7 @@ public class AttributeCommand implements TabExecutor {
Attribute attribute;
try {
attribute = Attribute.valueOf(args[2].toUpperCase());
} catch (IllegalArgumentException e) {
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
sender.sendMessage("Attribute not found.");
return true;
}
@ -235,7 +235,7 @@ public class AttributeCommand implements TabExecutor {
return null;
}
if (args.length == 1) {
return List.of("set", "get", "remove");
return List.of("set", "get", "gui", "remove");
}
if (args.length == 2) {
List<String> players =

View file

@ -94,6 +94,7 @@ public class AttributeItem extends AbstractItem {
} else if (clickType == ClickType.SHIFT_RIGHT) {
sp.setAttribute(attribute, sp.getAttribute(attribute) - 10);
}
playerManager.savePlayer(sp);
notifyWindows();
}
}