File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
src/main/java/pro/cloudnode/smp/cloudnodemsg/command Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 11package pro .cloudnode .smp .cloudnodemsg .command ;
22
3- import org .bukkit .OfflinePlayer ;
43import org .bukkit .command .CommandSender ;
4+ import org .bukkit .entity .Player ;
55import org .jetbrains .annotations .NotNull ;
66import org .jetbrains .annotations .Nullable ;
77import pro .cloudnode .smp .cloudnodemsg .CloudnodeMSG ;
88import pro .cloudnode .smp .cloudnodemsg .Permission ;
99import pro .cloudnode .smp .cloudnodemsg .error .NoPermissionError ;
10+ import pro .cloudnode .smp .cloudnodemsg .error .NotPlayerError ;
1011import pro .cloudnode .smp .cloudnodemsg .message .Message ;
1112
1213import java .util .List ;
@@ -18,6 +19,7 @@ public class ToggleMessageCommand extends Command {
1819 @ Override
1920 public boolean run (@ NotNull CommandSender sender , @ NotNull String label , @ NotNull String [] args ) {
2021 if (!sender .hasPermission (Permission .TOGGLE ) || (args .length == 1 && !sender .hasPermission (Permission .TOGGLE_OTHER ))) return new NoPermissionError ().send (sender );
22+ if (!(sender instanceof final @ NotNull Player player )) return new NotPlayerError ().send (sender );
2123 if (args .length == 1 ) {
2224 final @ NotNull OfflinePlayer recipient = CloudnodeMSG .getInstance ().getServer ().getOfflinePlayer (args [0 ]);
2325
You can’t perform that action at this time.
0 commit comments