Skip to content

Commit

Permalink
Add permission required message for reload command & rename permissio…
Browse files Browse the repository at this point in the history
…n required message for toggle
  • Loading branch information
axemwa committed Aug 16, 2019
1 parent 647e94f commit 0923bf4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
if (sender.hasPermission("nostrip.reload")) {
cfgUtils.reloadConfig(sender);
}
if (!sender.hasPermission("nostrip.reload")) {
sender.sendMessage(cfgUtils.color(cfgUtils.prefix + " " + cfgUtils.noPermission));
}
return true;

}

if (args[0].equalsIgnoreCase("toggle")) {
Expand All @@ -62,7 +66,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
String permission;
if (!player.hasPermission("nostrip.toggle")) {
permission = "&cnostrip.toggle";
player.sendMessage(cfgUtils.color(cfgUtils.prefix + " " + cfgUtils.noPermission
player.sendMessage(cfgUtils.color(cfgUtils.prefix + " " + cfgUtils.noTogglePermission
.replace("{permission}", permission)));
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void onInteract(PlayerInteractEvent event) {
event.getPlayer().sendMessage(cfgUtils.color(cfgUtils.prefix + " " + cfgUtils.toggleMessage
.replace("{status}", status
.replace("{astatus}", astatus))));
event.getPlayer().sendMessage(cfgUtils.color(cfgUtils.noPermission
event.getPlayer().sendMessage(cfgUtils.color(cfgUtils.noTogglePermission
.replace("{permission}", permission)));
}
event.setCancelled(true);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/me/shanodekono/nostrip/utils/ConfigUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public ConfigUtils(NoStrip pl) {
public String unknownCommand;
public String mustBePlayer;
public String noPermission;
public String noTogglePermission;
public String noAxePermission;
public String toggleMessage;

Expand All @@ -45,6 +46,7 @@ public void loadConfig() {
unknownCommand = messages.getString("unknown-command");
mustBePlayer = messages.getString("must-be-player");
noPermission = messages.getString("no-permission");
noTogglePermission = messages.getString("no-toggle-permission");
noAxePermission = messages.getString("no-axe-permission");
toggleMessage = messages.getString("toggle-message");
configReloaded = messages.getString("config-reloaded");
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ messages:
prefix: '&8&l[&c&l⦸ &4&lNo&c&lStrip &c&l⦸&8&l]'
unknown-command: '&cUnknown Command'
must-be-player: '&cYou Must Be A Player To Use This Command!'
no-permission: '&cPermission {permission} Required! Contact server admin!'
no-permission: '&cYou do not have permission to use that command'
no-toggle-permission: '&cPermission {permission} Required! Contact server admin!'
no-axe-permission: '&cAxe Is Denied! Permission Required!'
toggle-message: '&2Log Stripping {status}'
config-reloaded: '&2Config Reloaded!'

0 comments on commit 0923bf4

Please sign in to comment.