1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Merge pull request #2350 from TheSilentPro/backpack-changes

Separate player-only and no-permission messages
This commit is contained in:
TheBusyBiscuit 2020-09-27 00:00:11 +02:00 committed by GitHub
commit dc551907d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,11 +26,8 @@ class BackpackCommand extends SubCommand {
@Override @Override
public void onExecute(CommandSender sender, String[] args) { public void onExecute(CommandSender sender, String[] args) {
if (!(sender instanceof Player) || !sender.hasPermission("slimefun.command.backpack")) { if (sender instanceof Player) {
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true); if (sender.hasPermission("slimefun.command.backpack")) {
return;
}
if (args.length != 3) { if (args.length != 3) {
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack <Player> <ID>")); SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack <Player> <ID>"));
return; return;
@ -65,4 +62,12 @@ class BackpackCommand extends SubCommand {
}); });
}); });
} }
else {
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
}
else {
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
}
}
} }