diff --git a/UltimateChat-Spigot/pom.xml b/UltimateChat-Spigot/pom.xml index 8a886030..e16cedcb 100644 --- a/UltimateChat-Spigot/pom.xml +++ b/UltimateChat-Spigot/pom.xml @@ -145,19 +145,19 @@ br.net.fabiozumbi12.UltimateChat UltimateChat-Bungee - 1.9.1 + 1.9.2 compile br.net.fabiozumbi12.UltimateChat UltimateFancy - 1.9.1 + 1.9.2 compile br.net.fabiozumbi12.UltimateChat UltimateChat-Velocity - 1.9.1 + 1.9.2 compile diff --git a/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/API/uChatAPI.java b/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/API/uChatAPI.java index d62c2656..1ec75700 100644 --- a/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/API/uChatAPI.java +++ b/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/API/uChatAPI.java @@ -75,7 +75,7 @@ public boolean registerNewChannel(String chName, String chAlias, boolean crossWo if (tagBuilder == null || tagBuilder.equals("")) { tagBuilder = UChat.get().getUCConfig().getString("general.default-tag-builder"); } - UCChannel ch = new UCChannel(chName, chAlias, crossWorlds, distance, color, tagBuilder, needFocus, receiverMsg, cost, bungee, true, false, false, "player", "", new ArrayList<>(), "", ddmode, ddmcformat, mcddformat, ddhover, ddallowcmds, true, dynenable, mcdynformat, dynmcformat); + UCChannel ch = new UCChannel(chName, chAlias, crossWorlds, distance, color, tagBuilder, needFocus, receiverMsg, cost, bungee, true, false, false, "player", "", new ArrayList<>(), "", ddmode, ddmcformat, mcddformat, ddhover, ddallowcmds, true, dynenable, mcdynformat, dynmcformat, false); UChat.get().getUCConfig().addChannel(ch); UChat.get().reload(); return true; diff --git a/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/UCChatProtection.java b/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/UCChatProtection.java index 7faa0683..1b01082d 100644 --- a/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/UCChatProtection.java +++ b/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/UCChatProtection.java @@ -64,7 +64,7 @@ public static String filterChatMessage(Player p, String msg, UCChannel ch) { chatSpam.put(p, msg); Bukkit.getScheduler().scheduleSyncDelayedTask(UChat.get(), () -> { chatSpam.remove(p); - }, UChat.get().getUCConfig().getProtInt("chat-protection.antispam.time-between-messages") * 20); + }, UChat.get().getUCConfig().getProtInt("chat-protection.antispam.time-between-messages") * 20L); } else if (!chatSpam.get(p).equalsIgnoreCase(msg)) { UChat.get().getLang().sendMessage(p, UChat.get().getUCConfig().getProtMsg("chat-protection.antispam.cooldown-msg")); return null; @@ -76,7 +76,7 @@ public static String filterChatMessage(Player p, String msg, UCChannel ch) { final String nmsg = msg; Bukkit.getScheduler().scheduleSyncDelayedTask(UChat.get(), () -> { msgSpam.remove(nmsg); - }, UChat.get().getUCConfig().getProtInt("chat-protection.antispam.time-between-same-messages") * 20); + }, UChat.get().getUCConfig().getProtInt("chat-protection.antispam.time-between-same-messages") * 20L); } else { msgSpam.put(msg, msgSpam.get(msg) + 1); if (msgSpam.get(msg) >= UChat.get().getUCConfig().getProtInt("chat-protection.antispam.count-of-same-message")) { @@ -248,11 +248,10 @@ private static void addURLspam(final Player p) { @EventHandler public void onPlayerChat(SendChannelMessageEvent e) { - if (!(e.getSender() instanceof Player)) { + if (!(e.getSender() instanceof Player p)) { return; } - final Player p = (Player) e.getSender(); String msg = e.getMessage(); UCChannel ch = e.getChannel(); diff --git a/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/UCMessages.java b/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/UCMessages.java index 089b1459..b42041ee 100644 --- a/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/UCMessages.java +++ b/UltimateChat-Spigot/src/main/java/br/net/fabiozumbi12/UltimateChat/Bukkit/UCMessages.java @@ -121,7 +121,7 @@ static void sendFancyMessage(String[] format, String msg, UCChannel channel, Com for (Player play : ((Player) sender).getNearbyEntities(ch.getDistance(), ch.getDistance(), ch.getDistance()).stream() .filter(ent -> ent instanceof Player) .map(ent -> (Player) ent) - .collect(Collectors.toList())) { + .toList()) { if (UCPerms.channelReadPerm(play, ch)) { if (!ch.availableWorlds().isEmpty() && !ch.availableInWorld(play.getWorld())) { continue; @@ -417,10 +417,10 @@ public static UltimateFancy sendMessage(CommandSender sender, Object receiver, S if (ch.allowHand() && UChat.get().getUCConfig().getBoolean("general.item-hand.enable") && msg.contains(UChat.get().getUCConfig().getString("general.item-hand.placeholder")) && sender instanceof Player && UCPerms.hasPerm(sender, "chat.hand")) { if (!((Player) sender).getItemInHand().getType().equals(Material.AIR) && !UChat.get().getUCConfig().hasBlackListed(((Player) sender).getItemInHand())) fanci.text(format).hoverShowItem(((Player) sender).getItemInHand()).next(); - } else if (!msg.equals(mention(sender, (CommandSender) receiver, msg)) && UChat.get().getUCConfig().getString("mention.hover-message").length() > 0 && msg.toLowerCase().contains(((CommandSender) receiver).getName().toLowerCase())) { + } else if (!msg.equals(mention(sender, (CommandSender) receiver, msg)) && !UChat.get().getUCConfig().getString("mention.hover-message").isEmpty() && msg.toLowerCase().contains(((CommandSender) receiver).getName().toLowerCase())) { tooltip = new StringBuilder(formatTags("", UChat.get().getUCConfig().getString("mention.hover-message"), sender, receiver, msg, ch)); fanci.text(format).hoverShowText(tooltip.toString()).next(); - } else if (tooltip.length() > 0) { + } else if (!tooltip.isEmpty()) { fanci.text(format).hoverShowText(tooltip.toString()).next(); } else { fanci.text(format).next(); @@ -428,7 +428,7 @@ public static UltimateFancy sendMessage(CommandSender sender, Object receiver, S } else { format = formatTags(tag, format, sender, receiver, msg, ch); tooltip = new StringBuilder(formatTags("", tooltip.toString(), sender, receiver, msg, ch)); - if (tooltip.length() > 0) { + if (!tooltip.isEmpty()) { fanci.text(format).hoverShowText(tooltip.toString()).next(); } else { fanci.text(format).next();