From 7ca30596227d5b91c4f65970dc7ee6c467816a0e Mon Sep 17 00:00:00 2001 From: SoRadGaming <47128515+SoRadGaming@users.noreply.github.com> Date: Tue, 19 Jan 2021 11:58:26 +1100 Subject: [PATCH 1/3] Added Lang Options --- src/lang.yml | 6 +++++- src/me/ryandw11/ultrachat/api/Lang.java | 11 ++++++++--- src/me/ryandw11/ultrachat/commands/ChannelCmd.java | 11 ++++++----- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/lang.yml b/src/lang.yml index 826af88..cba4130 100644 --- a/src/lang.yml +++ b/src/lang.yml @@ -34,4 +34,8 @@ sjoin-other-show: '&b%p Join/Leave message will now be shown!' sjoin-other-hide: '&b%p Join/Leave message will no longer be shown!' help-page-error: '&cThere are only two help pages!' chat-color-change: 'Your chat color has been changed!' - +no-perm-channel: '&cYou do not have permission for this command.' +no-perm-join: "You do not have permission to join that channel." +channel-null: "That channel does not exist!" +error-channel-in: "Error: you are currently in the channel" +channel-change: "You are now in the channel %s !" \ No newline at end of file diff --git a/src/me/ryandw11/ultrachat/api/Lang.java b/src/me/ryandw11/ultrachat/api/Lang.java index 2895da1..fb5a3db 100644 --- a/src/me/ryandw11/ultrachat/api/Lang.java +++ b/src/me/ryandw11/ultrachat/api/Lang.java @@ -40,10 +40,15 @@ public enum Lang { SJOIN_OTHER_SHOW("sjoin-other-show", "&b%p Join/Leave message will now be shown!"), SJOIN_OTHER_HIDE("sjoin-other-hide", "&b%p Join/Leave message will no longer be shown!"), HELP_PAGE_ERROR("help-page-error", "&cThere are only two help pages!"), - CHAT_COLOR_CHANGE("chat-color-change", "Your chat color has been changed!"); + CHAT_COLOR_CHANGE("chat-color-change", "Your chat color has been changed!"), + NO_PERM_CHANNEL("no-perm-channel", "&cYou do not have permission for this command."), + NO_PERM_JOIN("no-perm-join", "You do not have permission to join that channel." ), + CHANNEL_NULL("channel-null", "That channel does not exist!"), + ERROR_CHANNEL_IN("error-channel-in", "&cError: you are currently in the channel"), + CHANNEL_CHANGE("channel-change", "You are now in the channel %s !"); - - private String path; + + private String path; private String def; private static YamlConfiguration LANG; diff --git a/src/me/ryandw11/ultrachat/commands/ChannelCmd.java b/src/me/ryandw11/ultrachat/commands/ChannelCmd.java index 4971cdf..5630988 100644 --- a/src/me/ryandw11/ultrachat/commands/ChannelCmd.java +++ b/src/me/ryandw11/ultrachat/commands/ChannelCmd.java @@ -26,7 +26,7 @@ public class ChannelCmd implements CommandExecutor { plugin = UltraChat.plugin; } @Override - public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) { + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String s, @NotNull String[] args) { Player p = (Player) sender; @@ -66,19 +66,20 @@ public class ChannelCmd implements CommandExecutor { } else{ if(!plugin.channel.contains(args[0])){ - p.sendMessage(ChatColor.RED + "That channel does not exsist!"); + p.sendMessage(Lang.CHANNEL_NULL.toString()); return true; } if(plugin.data.getString(p.getUniqueId() + ".channel").equalsIgnoreCase(args[0])){ - p.sendMessage(ChatColor.RED + "Error: you are currently in the channel"); + p.sendMessage(Lang.ERROR_CHANNEL_IN.toString()); } else if(p.hasPermission(plugin.channel.getString(args[0] + ".permission")) || plugin.channel.getString(args[0] + ".permission").equalsIgnoreCase("none")){ plugin.data.set(p.getUniqueId() + ".channel", args[0]); plugin.saveFile(); - p.sendMessage(ChatColor.BLUE + "You are now in the channel " + args[0] + "!"); + p.sendMessage(Lang.CHANNEL_CHANGE.toString().replace("%s", args[0])); } else{ - p.sendMessage(ChatColor.RED + "You do not have permission to join that channel."); + p.sendMessage(Lang.NO_PERM_JOIN.toString()); + p.sendMessage(Lang.NO_PERM_CHANNEL.toString()); } } return false; From 0a2eddcc46a3e1b83c703cae5df643f343550c40 Mon Sep 17 00:00:00 2001 From: SoRadGaming <47128515+SoRadGaming@users.noreply.github.com> Date: Tue, 19 Jan 2021 12:00:07 +1100 Subject: [PATCH 2/3] quick fix added line at end --- src/lang.yml | 2 +- src/me/ryandw11/ultrachat/api/Lang.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lang.yml b/src/lang.yml index cba4130..db5fe58 100644 --- a/src/lang.yml +++ b/src/lang.yml @@ -38,4 +38,4 @@ no-perm-channel: '&cYou do not have permission for this command.' no-perm-join: "You do not have permission to join that channel." channel-null: "That channel does not exist!" error-channel-in: "Error: you are currently in the channel" -channel-change: "You are now in the channel %s !" \ No newline at end of file +channel-change: "You are now in the channel %s !" diff --git a/src/me/ryandw11/ultrachat/api/Lang.java b/src/me/ryandw11/ultrachat/api/Lang.java index fb5a3db..4201e79 100644 --- a/src/me/ryandw11/ultrachat/api/Lang.java +++ b/src/me/ryandw11/ultrachat/api/Lang.java @@ -48,7 +48,7 @@ public enum Lang { CHANNEL_CHANGE("channel-change", "You are now in the channel %s !"); - private String path; + private String path; private String def; private static YamlConfiguration LANG; From 8da82e577ec2789f0de78b5cecfdf47526acb156 Mon Sep 17 00:00:00 2001 From: SoRadGaming <47128515+SoRadGaming@users.noreply.github.com> Date: Tue, 19 Jan 2021 13:06:20 +1100 Subject: [PATCH 3/3] resloves pull rquest issue --- src/lang.yml | 1 - src/me/ryandw11/ultrachat/api/Lang.java | 1 - src/me/ryandw11/ultrachat/commands/ChannelCmd.java | 1 - 3 files changed, 3 deletions(-) diff --git a/src/lang.yml b/src/lang.yml index db5fe58..e316966 100644 --- a/src/lang.yml +++ b/src/lang.yml @@ -35,7 +35,6 @@ sjoin-other-hide: '&b%p Join/Leave message will no longer be shown!' help-page-error: '&cThere are only two help pages!' chat-color-change: 'Your chat color has been changed!' no-perm-channel: '&cYou do not have permission for this command.' -no-perm-join: "You do not have permission to join that channel." channel-null: "That channel does not exist!" error-channel-in: "Error: you are currently in the channel" channel-change: "You are now in the channel %s !" diff --git a/src/me/ryandw11/ultrachat/api/Lang.java b/src/me/ryandw11/ultrachat/api/Lang.java index 4201e79..69a3ebf 100644 --- a/src/me/ryandw11/ultrachat/api/Lang.java +++ b/src/me/ryandw11/ultrachat/api/Lang.java @@ -42,7 +42,6 @@ public enum Lang { HELP_PAGE_ERROR("help-page-error", "&cThere are only two help pages!"), CHAT_COLOR_CHANGE("chat-color-change", "Your chat color has been changed!"), NO_PERM_CHANNEL("no-perm-channel", "&cYou do not have permission for this command."), - NO_PERM_JOIN("no-perm-join", "You do not have permission to join that channel." ), CHANNEL_NULL("channel-null", "That channel does not exist!"), ERROR_CHANNEL_IN("error-channel-in", "&cError: you are currently in the channel"), CHANNEL_CHANGE("channel-change", "You are now in the channel %s !"); diff --git a/src/me/ryandw11/ultrachat/commands/ChannelCmd.java b/src/me/ryandw11/ultrachat/commands/ChannelCmd.java index 5630988..a76eb7d 100644 --- a/src/me/ryandw11/ultrachat/commands/ChannelCmd.java +++ b/src/me/ryandw11/ultrachat/commands/ChannelCmd.java @@ -78,7 +78,6 @@ public class ChannelCmd implements CommandExecutor { p.sendMessage(Lang.CHANNEL_CHANGE.toString().replace("%s", args[0])); } else{ - p.sendMessage(Lang.NO_PERM_JOIN.toString()); p.sendMessage(Lang.NO_PERM_CHANNEL.toString()); } }