mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 06:28:49 +00:00
Adjust /rtp <player> permission checks
This commit is contained in:
1 parent
d985fb9742
commit
36703c55f5
2 files changed
+5
-5
No files matched your search
@@ -24,16 +24,16 @@ public class RtpCommand extends CommandBase implements ConsoleExecutable {
|
|||||||
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
||||||
OnlineUser target = onlineUser;
|
OnlineUser target = onlineUser;
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
|
if (!onlineUser.hasPermission(Permission.COMMAND_RTP_OTHER.node)) {
|
||||||
|
plugin.getLocales().getLocale("error_no_permission").ifPresent(onlineUser::sendMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Optional<OnlineUser> foundUser = plugin.findPlayer(args[0]);
|
Optional<OnlineUser> foundUser = plugin.findPlayer(args[0]);
|
||||||
if (foundUser.isEmpty()) {
|
if (foundUser.isEmpty()) {
|
||||||
plugin.getLocales().getLocale("error_player_not_found", args[0])
|
plugin.getLocales().getLocale("error_player_not_found", args[0])
|
||||||
.ifPresent(onlineUser::sendMessage);
|
.ifPresent(onlineUser::sendMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!onlineUser.hasPermission(Permission.COMMAND_RTP_OTHER.node)) {
|
|
||||||
plugin.getLocales().getLocale("error_no_permission").ifPresent(onlineUser::sendMessage);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
target = foundUser.get();
|
target = foundUser.get();
|
||||||
} else if (args.length > 1) {
|
} else if (args.length > 1) {
|
||||||
plugin.getLocales().getLocale("error_invalid_syntax", "/rtp [player]")
|
plugin.getLocales().getLocale("error_invalid_syntax", "/rtp [player]")
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public enum Permission {
|
|||||||
* Lets the user randomly teleport in the world they are in ({@code /rtp})
|
* Lets the user randomly teleport in the world they are in ({@code /rtp})
|
||||||
*/
|
*/
|
||||||
COMMAND_RTP("huskhomes.command.rtp", DefaultAccess.EVERYONE),
|
COMMAND_RTP("huskhomes.command.rtp", DefaultAccess.EVERYONE),
|
||||||
COMMAND_RTP_OTHER("huskhomes.command.rtp.other", DefaultAccess.EVERYONE),
|
COMMAND_RTP_OTHER("huskhomes.command.rtp.other", DefaultAccess.OPERATORS),
|
||||||
/**
|
/**
|
||||||
* Lets the user teleport to the defined spawn position ({@code /spawn})
|
* Lets the user teleport to the defined spawn position ({@code /spawn})
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user