Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
1.61
Browse files Browse the repository at this point in the history
  • Loading branch information
Arasple committed Nov 30, 2019
1 parent dc22925 commit f64d8c2
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.arasple.mc</groupId>
<artifactId>TrChat</artifactId>
<version>1.6</version>
<version>1.61</version>
<packaging>jar</packaging>

<name>TrChat</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/arasple/mc/trchat/TrChat.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class TrChat extends TrChatPlugin {
private static TrChatLoader loader;

public static double getTrVersion() {
return 1.6;
return 1.61;
}

}
7 changes: 4 additions & 3 deletions src/main/java/me/arasple/mc/trchat/TrChatPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import java.util.zip.ZipFile;

/**
* @Author 坏黑
* @Since 2019-07-05 9:03
* @author 坏黑
* @since 2019-07-05 9:03
*/
public abstract class TrChatPlugin extends JavaPlugin {

Expand Down Expand Up @@ -168,7 +168,7 @@ public static String readFully(InputStream inputStream, Charset charset) throws
public static byte[] readFully(InputStream inputStream) throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int len = 0;
int len;
while ((len = inputStream.read(buf)) > 0) {
stream.write(buf, 0, len);
}
Expand Down Expand Up @@ -562,4 +562,5 @@ public static Class forName(String name, boolean initialize, ClassLoader loader)
return null;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public String convertHoverText(Object object) {
StringBuilder hover = new StringBuilder();
hovers.forEach(l -> hover.append(l).append("\n"));
String result = hover.toString();
result = result.substring(0, result.length() - 2);
result = result.substring(0, result.length() - 1);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private boolean checkLimits(Player p, String message) {
long itemShowCooldown = Users.getCooldownLeft(p.getUniqueId(), Cooldowns.CooldownType.ITEM_SHOW);
if (TrChatFiles.getFunction().getStringList("GENERAL.ITEM-SHOW.KEYS").stream().anyMatch(message::contains)) {
if (itemShowCooldown > 0) {
TLocale.sendTo(p, "GENERAL.COOLDOWNS.ITEM-SHOW", String.valueOf(itemShowCooldown / 1000D));
TLocale.sendTo(p, "COOLDOWNS.ITEM-SHOW", String.valueOf(itemShowCooldown / 1000D));
return false;
} else {
Users.updateCooldown(p.getUniqueId(), Cooldowns.CooldownType.ITEM_SHOW, (long) (TrChatFiles.getFunction().getDouble("GENERAL.ITEM-SHOW.COOLDOWNS") * 1000));
Expand All @@ -87,7 +87,7 @@ private boolean checkLimits(Player p, String message) {
if (!p.hasPermission("trchat.bypass.chatcd")) {
long chatCooldown = Users.getCooldownLeft(p.getUniqueId(), Cooldowns.CooldownType.CHAT);
if (chatCooldown > 0) {
TLocale.sendTo(p, "GENERAL.COOLDOWNS.CHAT", String.valueOf(chatCooldown / 1000D));
TLocale.sendTo(p, "COOLDOWNS.CHAT", String.valueOf(chatCooldown / 1000D));
return false;
} else {
Users.updateCooldown(p.getUniqueId(), Cooldowns.CooldownType.CHAT, (long) (TrChatFiles.getSettings().getDouble("CHAT-CONTROL.COOLDOWN") * 1000));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package me.arasple.mc.trchat.chat.listeners;

import io.izzel.taboolib.module.inject.TListener;
import io.izzel.taboolib.module.locale.TLocale;
import io.izzel.taboolib.util.Strings;
import io.izzel.taboolib.util.lite.SoundPack;
import me.arasple.mc.trchat.TrChat;
import me.arasple.mc.trchat.chat.ChatFormats;
import me.arasple.mc.trchat.filter.ChatFilter;
import me.arasple.mc.trchat.func.ChatFunctions;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;

/**
* @author Arasple
* @date 2019/11/30 21:56
*/
@TListener
public class ListenerTrChatInfo implements Listener {

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onChat(AsyncPlayerChatEvent e) {
e.setCancelled(react(e.getPlayer(), e.getMessage().startsWith("#") ? e.getMessage().substring(1) : null));

if ("#TRCHAT-RELOAD".equals(e.getMessage()) && e.getPlayer().hasPermission("trchat.admin")) {
ChatFormats.loadFormats(e.getPlayer());
ChatFilter.loadFilter(true, e.getPlayer());
ChatFunctions.loadFunctions(e.getPlayer());
e.setCancelled(true);
}
}

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onCommand(PlayerCommandPreprocessEvent e) {
e.setCancelled(react(e.getPlayer(), e.getMessage().substring(1)));
}

private boolean react(Player p, String message) {
if (!Strings.isBlank(message) && ("trchatr".equalsIgnoreCase(message) || "trixeychat".equalsIgnoreCase(message))) {
TLocale.Display.sendTitle(p, "§3§lTr§b§lChat", "§7Designed by §6Arasple", 10, 35, 10);
TLocale.Display.sendActionBar(p, Strings.replaceWithOrder(
"§2Running version §av{0}§7",
TrChat.getTrVersion()
));
new SoundPack("BLOCK_NOTE_BLOCK_PLING-1-2").play(p);
return true;
}
return false;
}

}
2 changes: 1 addition & 1 deletion src/main/java/me/arasple/mc/trchat/filter/ChatFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ChatFilter {
"https://raw.githubusercontent.com/Arasple/TrChat-Cloud/master/database.json",
};

@TSchedule(delay = 20 * 60, period = 30 * 60 * 20)
@TSchedule(delay = 20 * 120, period = 30 * 60 * 20)
static void asyncRefreshCloud() {
loadCloudFilter(0);
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/updates.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# TrChat Update Logs #

#### VERSION 1.6
- ##### 1.6 :)
- DATE: 2019.11.30
- OVERVIEW:
- 修正裁剪了敏感词库
- 修复了监听格式错误
- 修复了 JSON 模块悬浮信息末尾少了字符
- 新增手动重载方式,聊天框内喊:"#TRCHAT-RELOAD"
- ##### 1.6 :)
- DATE: 2019.11.30
- OVERVIEW:
Expand Down

0 comments on commit f64d8c2

Please sign in to comment.