Chat-Einstellungen, Tabliste fürs Netzwerk, Fixes aus dem Review
This commit is contained in:
1 parent
0a07f0bf7c
commit
735dc8867d
13 files changed
+390
-71
No files matched your search
@@ -13,19 +13,23 @@ import net.luckperms.api.LuckPermsProvider;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Plugin(
|
||||
id = "chat-bridge",
|
||||
name = "chat-bridge",
|
||||
version = "1.0.0",
|
||||
description = "Serverübergreifender Chat: öffentlicher Chat, /msg, Adminchat, Mute und Join/Leave",
|
||||
version = "1.1.0",
|
||||
description = "Serverübergreifender Chat und Tabliste: öffentlicher Chat, /msg, Adminchat, Mute, Join/Leave",
|
||||
authors = {"MHSL"},
|
||||
dependencies = {@Dependency(id = "luckperms")}
|
||||
)
|
||||
public final class ChatBridge {
|
||||
/** Backend → Proxy: Rang-Prefixe aus spawn ({@code "prefix"}, danach Adventure-JSON oder leer). */
|
||||
/** Kanal zu spawn (Appliance NetworkChat): Rang-Prefixe und Chat-Einstellungen, Format siehe dort. */
|
||||
static final ChannelIdentifier CHANNEL = MinecraftChannelIdentifier.create("craftattack", "chat");
|
||||
|
||||
/** Abgleich der Tablisten; nach Join, Wechsel und Quit zusätzlich kurz danach. */
|
||||
static final long TAB_REFRESH_SECONDS = 2;
|
||||
|
||||
private final ProxyServer proxy;
|
||||
private final Logger logger;
|
||||
private final Path dataDirectory;
|
||||
@@ -47,13 +51,24 @@ public final class ChatBridge {
|
||||
return;
|
||||
}
|
||||
|
||||
ChatSettings settings;
|
||||
try {
|
||||
settings = new ChatSettings(this.dataDirectory, this.logger);
|
||||
} catch (Exception e) {
|
||||
this.logger.error("settings.properties nicht lesbar, chat-bridge ist aus", e);
|
||||
return;
|
||||
}
|
||||
|
||||
Names names = new Names(config);
|
||||
Mutes mutes = new Mutes(LuckPermsProvider.get());
|
||||
Chat chat = new Chat(this.proxy, this.logger, config, names, mutes);
|
||||
Chat chat = new Chat(this.proxy, this.logger, config, names, mutes, settings);
|
||||
PrivateMessages privateMessages = new PrivateMessages(this.proxy, this.logger, config, names, chat);
|
||||
|
||||
TabLists tabLists = new TabLists(this.proxy, config, names);
|
||||
|
||||
this.proxy.getChannelRegistrar().register(CHANNEL);
|
||||
this.proxy.getEventManager().register(this, new ChatListener(this, this.proxy, this.logger, names, chat, privateMessages));
|
||||
this.proxy.getEventManager().register(this, new ChatListener(this, this.proxy, this.logger, config, names, chat, privateMessages, settings, tabLists));
|
||||
this.proxy.getScheduler().buildTask(this, tabLists::refresh).repeat(TAB_REFRESH_SECONDS, TimeUnit.SECONDS).schedule();
|
||||
Commands.register(this, this.proxy, this.logger, config, names, chat, privateMessages, mutes);
|
||||
|
||||
this.logger.info("chat-bridge aktiv, Kürzel {}, ohne Silencer {}", config.serverTags(), config.unsilencedServers());
|
||||
|
||||
Reference in new issue
Block a user