Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioZumbi12 committed Aug 6, 2024
1 parent c5062d1 commit bbcb1a9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions UltimateChat-Spigot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,19 @@
<dependency>
<groupId>br.net.fabiozumbi12.UltimateChat</groupId>
<artifactId>UltimateChat-Bungee</artifactId>
<version>1.9.1</version>
<version>1.9.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>br.net.fabiozumbi12.UltimateChat</groupId>
<artifactId>UltimateFancy</artifactId>
<version>1.9.1</version>
<version>1.9.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>br.net.fabiozumbi12.UltimateChat</groupId>
<artifactId>UltimateChat-Velocity</artifactId>
<version>1.9.1</version>
<version>1.9.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")) {
Expand Down Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -417,18 +417,18 @@ 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();
}
} 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();
Expand Down

0 comments on commit bbcb1a9

Please sign in to comment.