diff --git a/CustomJoinAndQuitMessages/config.yml b/CustomJoinAndQuitMessages/config.yml index acceed5..c37b824 100644 --- a/CustomJoinAndQuitMessages/config.yml +++ b/CustomJoinAndQuitMessages/config.yml @@ -26,7 +26,7 @@ Config: Debug: false # |Type| the type is a way of knowing what is being used whether in the [normal] | [group] | [default] | [none] format - Type: normal + Type: group # # | Join | @@ -39,7 +39,7 @@ Join: Text: '&b[<#83FF6F>+&b] <#A157FF>' # |Type| Here you can find two types that are [ normal | modify ] - Type: normal + Type: modify # |HoverEvent| This section allows you to modify the hover events in the chat HoverEvent: @@ -91,7 +91,7 @@ Join: Pitch: 1 # |Volume| This is the volume of the sound that you will hear when the chat mentions it - Volume: 10 + Volume: 20 # |Title| In this section you can configure the title of the join Title: @@ -100,7 +100,7 @@ Join: Enabled: true # |Title| here you can set the title text - Title: 'Welcome to Server' + Title: 'Welcome to Server' # |SubTitle| here you can set the subtitle text SubTitle: '' @@ -130,7 +130,7 @@ Quit: Enabled: true # |Text| This is where Join customizable message is located - Text: '&b[<#83FF6F>+&b] <#A157FF>' + Text: '&b[<#FF8E8E>+&b] <#A157FF>' # |Type| Here you can find two types that are [ normal | modify ] Type: normal @@ -186,7 +186,8 @@ Quit: # |Volume| This is the volume of the sound that you will hear when the chat mentions it Volume: 10 - +# +# |Welcome| Welcome: # |Enabled| Here you can enable or disable this feature @@ -194,14 +195,14 @@ Welcome: # |Text| Text: - - '&b&m=========================================&r' + - '&m=========================================&r' - '<0>' - '&e> &7Welcome To The Server &b' - '<0>' - '&e> &cShop: shop-example.com' - '&e> &7Use &b/skin to put on a skin' - '<0>' - - '&b&m=========================================&r' + - '&m=========================================&r' # # |Groups| # currently only join and quit functions are available for the group system @@ -210,13 +211,16 @@ Groups: Default: # |Join-Text| This is where Join customizable message is located - Join-Text: '' + Join-Text: '&b[<#83FF6F>+&b] <#A157FF>' # |Quit-Text| This is where Quit customizable message is located - Quit-Text: '' + Quit-Text: '&b[<#FF8E8E>+&b] <#A157FF>' + + # |Permission| Here the group permission is defined so that the player can use it + Permission: 'my.group.default' # |Type| Here you can find two types that are [ normal | modify ] - Type: normal + Type: modify # |HoverEvent| This section allows you to modify the hover events in the chat HoverEvent: @@ -277,7 +281,102 @@ Groups: Enabled: true # |Title| here you can set the title text - Title: 'Welcome to Server' + Title: 'Welcome to Server' + + # |SubTitle| here you can set the subtitle text + SubTitle: '' + + # |FadeIn| here you can set the input time of the title + FadeIn: 20 + + # |Stay| here you can set how long the title stays + Stay: 40 + + # |FadeOut| here you can set the title output time + FadeOut: 20 + + # |ActionBar| In this section you can configure the Actionbar of the join + ActionBar: + + # |Enabled| Here you can enable or disable this feature + Enabled: true + + # |Text| + Text: 'Welcome to the server' + Admin: + + # |Join-Text| This is where Join customizable message is located + Join-Text: '&b[<#83FF6F>+&b] <#A157FF>' + + # |Quit-Text| This is where Quit customizable message is located + Quit-Text: '&b[<#FF8E8E>+&b] <#A157FF>' + + # |Permission| Here the group permission is defined so that the player can use it + Permission: 'my.group.admin' + + # |Type| Here you can find two types that are [ normal | modify ] + Type: normal + + # |HoverEvent| This section allows you to modify the hover events in the chat + HoverEvent: + + # |Enabled| Here you can enable or disable this feature + Enabled: true + + # |Hover| This section allows you to define the hover text + Hover: + - '&6> &aHello &b [Admin0]' + - '&6> &e%player_exp_to_level%' + - '&6> &dadd more lines like these' + + # |ClickEvent| This section allows you to modify chat click events + ClickEvent: + + # |Enabled| Here you can enable or disable this feature + Enabled: true + + # |Mode| there are three different modes which are [ command | suggest | url ] + Mode: command + + # |Actions| This is where are the available events that you can use + Actions: + + # |Command| Clicking on the chat will execute the command defined in the config + Command: '/say hello server' + + # |Url| Clicking on the chat opens a link + Url: 'https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' + + # |Suggest-Command| Clicking on the chat suggests a command that you define in the config + Suggest-Command: '/msg ' + + # |Sound| In this section you can configure the sound of the join + # |Sound list: https://www.spigotmc.org/wiki/cc-sounds-list/ + Sound: + + # |Enabled| Here you can enable or disable this feature + Enabled: true + + # |Send-To-All| When active, the sound will be sent to all players connected to the server + Send-To-All: true + + # |Name| This is the name of the sound you will hear when it is mentioned to you in chat. + Name: 'BLOCK_NOTE_BLOCK_PLING' + + # |Pitch| This is the pitch of the sound that you will hear when mentioned in the chat + Pitch: 1 + + # |Volume| This is the volume of the sound that you will hear when the chat mentions it + Volume: 10 + + # |Title| In this section you can configure the title of the join + Title: + + # |Enabled| Here you can enable or disable this feature + Enabled: true + + # |Title| here you can set the title text + Title: 'Welcome to Server' # |SubTitle| here you can set the subtitle text SubTitle: '' @@ -299,6 +398,7 @@ Groups: # |Text| Text: 'Welcome to the server' + # # |> This is the end of the configuration ... [-_-] more things coming soon # diff --git a/CustomJoinAndQuitMessages/src/com/iridium/iridiumcolorapi/patterns/SolidPattern.java b/CustomJoinAndQuitMessages/src/com/iridium/iridiumcolorapi/patterns/SolidPattern.java index 97193b6..6156343 100644 --- a/CustomJoinAndQuitMessages/src/com/iridium/iridiumcolorapi/patterns/SolidPattern.java +++ b/CustomJoinAndQuitMessages/src/com/iridium/iridiumcolorapi/patterns/SolidPattern.java @@ -7,7 +7,7 @@ public class SolidPattern implements IPattern { - Pattern pattern = Pattern.compile("<#([0-9A-Fa-f]{6})>"); + Pattern pattern = Pattern.compile(""); public String process(String string) { Matcher matcher = pattern.matcher(string); diff --git a/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java b/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java index eb78f40..3eb790c 100644 --- a/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java +++ b/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java @@ -38,7 +38,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String }else if(args[0].equalsIgnoreCase("reload")) { plugin.getPreConfigLoader().loadConfig(); plugin.getPreConfigLoader().loadLangs(); - plugin.reloadConfig(); + plugin.getConfigFile().reloadConfig(); Utils.sendColorMessage(EventsUtils.getConsoleSender(), Utils.getPrefix() + " " + plugin.Locale().reload); }else if(args[0].equalsIgnoreCase("info")) { Utils.sendColorMessage(EventsUtils.getConsoleSender(), "&5 <||=-=-=-=-="+Utils.getPrefix()+"&5=-=-=-=-=-=-"); @@ -75,7 +75,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String if((j.isOp()) || (j.hasPermission("Cjm.Reload"))) { plugin.getPreConfigLoader().loadConfig(); plugin.getPreConfigLoader().loadLangs(); - plugin.reloadConfig(); + plugin.getConfigFile().reloadConfig(); Utils.sendColorMessage(j, Utils.getPrefixPlayer() + " " + plugin.Locale().reload); }else { Utils.sendTextComponent116Hover(j, "TEXT", plugin.Locale().No_Permission, plugin.Locale().No_Permission_Label); diff --git a/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/events/JoinListener.java b/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/events/JoinListener.java index 46b2648..0d29620 100644 --- a/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/events/JoinListener.java +++ b/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/events/JoinListener.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Sound; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -60,9 +61,8 @@ public void onJoin(PlayerJoinEvent e) { String text = (String) List_Text.get(i); text = Utils.color(text); text = Utils.getVar(p, text); - Utils.sendColorMessage(text); + Utils.sendColorMessage(p, text); } - } if(isEnabled) { @@ -90,7 +90,7 @@ public void onJoin(PlayerJoinEvent e) { boolean isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); boolean isTitle = config.getString("Join.Title.Enabled").equals("true"); boolean isSound = config.getString("Join.Sound.Enabled").equals("true"); - boolean isActionBar = config.getString("Join.ActionBar").equals("true"); + boolean isActionBar = config.getString("Join.ActionBar.Enabled").equals("true"); boolean isSoundAll = config.getString("Join.Sound.Send-To-All").equals("true"); List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); @@ -162,101 +162,103 @@ public void onJoin(PlayerJoinEvent e) { }else if(isGroup) { e.setJoinMessage(null); - for(String key : config.getConfigurationSection("Groups").getKeys(false)) { + ConfigurationSection sections = config.getConfigurationSection("Groups"); + + for(String section : sections.getKeys(false)) { - boolean isNormalType = config.getString("Groups." + key + ".Type").equalsIgnoreCase("normal"); - boolean isModifyType = config.getString("Groups." + key + ".Type").equalsIgnoreCase("modify"); + ConfigurationSection key = sections.getConfigurationSection(section); - String text = config.getString("Groups." + key + ".Join-Text"); - String isPermission = config.getString("Groups." + key + ".Permission"); + boolean isNormalType = key.getString("Type").equalsIgnoreCase("normal"); + boolean isModifyType = key.getString("Type").equalsIgnoreCase("modify"); + + String text = key.getString("Join-Text"); + String isPermission = key.getString("Permission"); text = Utils.color(text); text = Utils.getVar(p, text); Json json = new Json(p, text); - if(isNormalType) { - - if(p.hasPermission(isPermission)); - - json.sendToAll(); - return; - }else if(isModifyType) { - - boolean isHover = config.getString("Groups." + key + ".HoverEvent.Enabled").equals("true"); - boolean isClick = config.getString("Groups." + key + ".ClickEvent.Enabled").equals("true"); - boolean isTitle = config.getString("Groups." + key + ".Title.Enabled").equals("true"); - boolean isSound = config.getString("Groups." + key + ".Sound.Enabled").equals("true"); - boolean isActionBar = config.getString("Groups." + key + ".ActionBar").equals("true"); - boolean isSoundAll = config.getString("Groups." + key + ".Sound.Send-To-All").equals("true"); - - List Hover_Text = config.getStringList("Groups." + key + ".HoverEvent.Hover"); - - String isClick_Mode = config.getString("Groups." + key + ".ClickEvent.Mode"); - String Action_Command = config.getString("Groups." + key + ".ClickEvent.Actions.Command"); - String Action_Url = config.getString("Groups." + key + ".ClickEvent.Actions.Url"); - String Action_Suggest= config.getString("Groups." + key + ".ClickEvent.Actions.Suggest-Command"); - String Title_Text = config.getString("Groups." + key + ".Title.Title"); - String SubTitle_Text = config.getString("Groups." + key + ".Title.SubTitle"); - String Actionbar_Text = config.getString("Groups." + key + ".ActionBar.Text"); - String Sound_Name = config.getString("Groups." + key + ".Sound.Name"); - - int FadeIn = config.getInt("Groups." + key + ".Title.FadeIn"); - int Stay = config.getInt("Groups." + key + ".Title.Stay"); - int FadeOut = config.getInt("Groups." + key + ".Title.FadeOut"); - int Sound_Volume = config.getInt("Groups." + key + ".Sound.Volume"); - - float Sound_Pitch = Float.valueOf(config.getString("Groups." + key + ".Sound.Pitch")); - - if(p.hasPermission(isPermission)); - - if(isHover) { - if(isClick) { - if(isClick_Mode.equalsIgnoreCase("command")) { - json.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); - }else if(isClick_Mode.equalsIgnoreCase("url")) { - json.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); - }else if(isClick_Mode.equalsIgnoreCase("suggest")) { - json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); + if(p.hasPermission(isPermission)) { + if(isNormalType) { + json.sendToAll(); + return; + }else if(isModifyType) { + + boolean isHover = key.getString("HoverEvent.Enabled").equals("true"); + boolean isClick = key.getString("ClickEvent.Enabled").equals("true"); + boolean isTitle = key.getString("Title.Enabled").equals("true"); + boolean isSound = key.getString("Sound.Enabled").equals("true"); + boolean isActionBar = key.getString("ActionBar").equals("true"); + boolean isSoundAll = key.getString("Sound.Send-To-All").equals("true"); + + List Hover_Text = key.getStringList("HoverEvent.Hover"); + + String isClick_Mode = key.getString("ClickEvent.Mode"); + String Action_Command = key.getString("ClickEvent.Actions.Command"); + String Action_Url = key.getString("ClickEvent.Actions.Url"); + String Action_Suggest= key.getString("ClickEvent.Actions.Suggest-Command"); + String Title_Text = key.getString("Title.Title"); + String SubTitle_Text = key.getString("Title.SubTitle"); + String Actionbar_Text = key.getString("ActionBar.Text"); + String Sound_Name = key.getString("Sound.Name"); + + int FadeIn = key.getInt("Title.FadeIn"); + int Stay = key.getInt("Title.Stay"); + int FadeOut = key.getInt("Title.FadeOut"); + int Sound_Volume = key.getInt("Sound.Volume"); + + float Sound_Pitch = Float.valueOf(key.getString("Sound.Pitch")); + + + if(isHover) { + if(isClick) { + if(isClick_Mode.equalsIgnoreCase("command")) { + json.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + }else if(isClick_Mode.equalsIgnoreCase("url")) { + json.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + }else if(isClick_Mode.equalsIgnoreCase("suggest")) { + json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); + } + }else { + json.setHover(Hover_Text).sendToAll(); } - }else { - json.setHover(Hover_Text).sendToAll(); - } - }else{ - if(isClick) { - if(isClick_Mode.equalsIgnoreCase("command")) { - json.setExecuteCommand(Action_Command).sendToAll(); - }else if(isClick_Mode.equalsIgnoreCase("url")) { - json.setOpenURL(Action_Url).sendToAll(); - }else if(isClick_Mode.equalsIgnoreCase("suggest")) { - json.setSuggestCommand(Action_Suggest).sendToAll(); + }else{ + if(isClick) { + if(isClick_Mode.equalsIgnoreCase("command")) { + json.setExecuteCommand(Action_Command).sendToAll(); + }else if(isClick_Mode.equalsIgnoreCase("url")) { + json.setOpenURL(Action_Url).sendToAll(); + }else if(isClick_Mode.equalsIgnoreCase("suggest")) { + json.setSuggestCommand(Action_Suggest).sendToAll(); + } + }else { + json.sendToAll(); } - }else { - json.sendToAll(); } - } - - if(isTitle) { - Titles.sendTitle(p, FadeIn, Stay, FadeOut, Utils.color(Utils.getVar(p, Title_Text)), Utils.color(Utils.getVar(p, SubTitle_Text))); - } - - if(isActionBar) { - ActionBar.sendActionBar(p, Utils.color(Utils.getVar(p, Actionbar_Text))); - } - - if(isSound) { - if(isSoundAll) { - Location location = p.getLocation(); - p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - }else { - for(Player pp : Bukkit.getOnlinePlayers()) { + + if(isTitle) { + Titles.sendTitle(p, FadeIn, Stay, FadeOut, Utils.color(Utils.getVar(p, Title_Text)), Utils.color(Utils.getVar(p, SubTitle_Text))); + } + + if(isActionBar) { + ActionBar.sendActionBar(p, Utils.color(Utils.getVar(p, Actionbar_Text))); + } + + if(isSound) { + if(isSoundAll) { Location location = p.getLocation(); - pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); + p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); + }else { + for(Player pp : Bukkit.getOnlinePlayers()) { + Location location = p.getLocation(); + pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); + } } - } + } + return; } - } - + } } return; }else if(isNone) { @@ -266,7 +268,7 @@ public void onJoin(PlayerJoinEvent e) { } if(isUpdate) { - if(p.isOp() || p.hasPermission("Cjm.Update.Notify")) { + if((p.isOp()) || (p.hasPermission("Cjm.Update.Notify"))) { new UpdateChecker(CustomJoinAndQuitMessages.getPlugin(), UpdateSettings.ID).getUpdateVersion(version ->{ if(!CustomJoinAndQuitMessages.getPlugin().getDescription().getVersion().equalsIgnoreCase(version)) { TextComponent component = new TextComponent(Utils.color(Utils.getPrefixPlayer() + " &aThere is a new version available for download")); diff --git a/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/json/Json.java b/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/json/Json.java index e95ffcb..6623b26 100644 --- a/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/json/Json.java +++ b/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/json/Json.java @@ -67,7 +67,7 @@ public Json setOpenURL(String url) { } public void send() { - TextComponent component = new TextComponent(Utils.color(this.text)); + TextComponent component = new TextComponent(TextComponent.fromLegacyText(this.text)); if(this.hoverText != null) { component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, this.hoverText)); } @@ -84,7 +84,7 @@ public void send() { } public void sendToAll() { - TextComponent component = new TextComponent(Utils.color(this.text)); + TextComponent component = new TextComponent(TextComponent.fromLegacyText(this.text)); if(this.hoverText != null) { component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, this.hoverText)); } diff --git a/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/utils/Utils.java b/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/utils/Utils.java index 922c8fa..80419d7 100644 --- a/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/utils/Utils.java +++ b/CustomJoinAndQuitMessages/src/jss/customjoinandquitmessages/utils/Utils.java @@ -111,7 +111,7 @@ public static void setEnabled(String version) { sendEnable(prefix , "&5 <|| &c* &bThe plugin is &d[&aSuccessfully activated&d]"); sendEnable(prefix , "&5 <|| &c* &bVersion: &e[&a" + version + "&e]"); sendEnable(prefix , "&5 <|| &c* &bBy: &e[&bjonagamerpro1234&e]"); - sendEnable(prefix , "&5 <|| &c* &bTested Versions &3|&d1.7.x&3|&a1.8.x&3|&a1.9.x&3|&a1.10.x&3|&a1.11.x&3|&a1.12.x&3|&a1.13.x&3|&a1.14.x&3|&a1.15.x&3|&a1.16.x&e|&51.17.x"); + sendEnable(prefix , "&5 <|| &c* &bTested Versions &3|&d1.7.x&3|&a1.8.x&3|&a1.9.x&3|&a1.10.x&3|&a1.11.x&3|&a1.12.x&3|&a1.13.x&3|&a1.14.x&3|&a1.15.x&3|&a1.16.x&e|&a1.17.x"); sendEnable(prefix , "&5 <||============================================----"); } @@ -120,7 +120,7 @@ public static void setDisabled(String version) { sendEnable(prefix , "&5 <|| &c* &bThe plugin is &d[&cSuccessfully disabled&c]"); sendEnable(prefix , "&5 <|| &c* &bVersion: &e[&a" + version + "&e]"); sendEnable(prefix , "&5 <|| &c* &bBy: &e[&bjonagamerpro1234&e]"); - sendEnable(prefix , "&5 <|| &c* &bTested Versions &3|&d1.7.x&3|&a1.8.x&3|&a1.9.x&3|&a1.10.x&3|&a1.11.x&3|&a1.12.x&3|&a1.13.x&3|&a1.14.x&3|&a1.15.x&3|&a1.16.x&e|&51.17.x"); + sendEnable(prefix , "&5 <|| &c* &bTested Versions &3|&d1.7.x&3|&a1.8.x&3|&a1.9.x&3|&a1.10.x&3|&a1.11.x&3|&a1.12.x&3|&a1.13.x&3|&a1.14.x&3|&a1.15.x&3|&a1.16.x&e|&a1.17.x"); sendEnable(prefix , "&5 <||============================================----"); } @@ -218,10 +218,11 @@ public static String getActionClickType(String arg) { public static String getVar(Player player, String text) { text = text.replace("", player.getName()); text = text.replace("", player.getDisplayName()); - text = text.replace("", player.getName()); - text = text.replace("", player.getDisplayName()); text = text.replaceAll("", player.getWorld().getName()); - text = text.replaceAll("", player.getWorld().getName()); + text = text.replace("<0>", " "); + text = text.replace("", "" + player.getExpToLevel()); + text = text.replace("", "" + player.getExp()); + text = text.replace("", "" + player.getPing()); text = placeholderReplace(text, player); text = getOnlinePlayers(text); return text;