Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 581d580f05 | |||
| e4d477042c | |||
| aa0f861d11 | |||
| 8347a60335 | |||
| e6fbd908e7 | |||
| 3f80c0eb1e | |||
| c02866809c |
33
README.md
33
README.md
@@ -6,17 +6,20 @@ Ein leistungsfähiges BungeeCord-Plugin für globalen Chat, Support-Nachrichten
|
|||||||
|
|
||||||
## ⚠️ WICHTIGER HINWEIS
|
## ⚠️ WICHTIGER HINWEIS
|
||||||
|
|
||||||
**Die Kernfunktionalität des GlobalChat wurde in die [StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI) integriert.**
|
**Die Kernfunktionalität des GlobalChat wurde in die [StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI) integriert.** wenn die nur den Chat nutzen möchten können sie auch die GlobalChat herunterladen.
|
||||||
|
**Download**: [GlobalChat](https://git.viper.ipv64.net/M_Viper/GlobalChat)
|
||||||
|
|
||||||
Dieses Plugin (**GlobalChat Suppressor**) dient ab sofort **nur noch als Schnittstelle** für die Unterserver (Spigot/Paper) und leitet die Nachrichten an die StatusAPI weiter. Die Befehle und Funktionen können wie gewohnt weiterverwendet werden.
|
Dieses Plugin (**GlobalChat Suppressor**) dient ab sofort **nur noch als Schnittstelle** für die Unterserver (Spigot/Paper) und leitet die Nachrichten an die StatusAPI weiter. Die Befehle und Funktionen können wie gewohnt weiterverwendet werden.
|
||||||
|
|
||||||
### Was bedeutet das?
|
### Was bedeutet das?
|
||||||
|
|
||||||
- **StatusAPI MUSS installiert sein:** Ohne die [StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI) auf deinem BungeeCord funktioniert der GlobalChat nicht mehr.
|
- **StatusAPI oder GlobalChat MUSS installiert sein:** Ohne die [StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI) oder [GlobalChat](https://git.viper.ipv64.net/M_Viper/GlobalChat) auf deinem BungeeCord funktioniert der GlobalChat nicht.
|
||||||
- **GlobalChat Suppressor:** Dieses Plugin bleibt auf den Unterservern aktiv und kommuniziert mit der StatusAPI.
|
- **GlobalChat Suppressor:** Dieses Plugin bleibt auf den Unterservern aktiv und kommuniziert mit der StatusAPI oder mit GlobalChat.
|
||||||
- **Zentrale Verwaltung:** Alle Chat-Funktionen, Badword-Filter und Support-Nachrichten werden nun zentral über die StatusAPI verwaltet.
|
- **Zentrale Verwaltung:** Alle Chat-Funktionen, Badword-Filter und Support-Nachrichten werden nun zentral über die StatusAPI verwaltet.
|
||||||
|
|
||||||
**Download StatusAPI:** [https://git.viper.ipv64.net/M_Viper/StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI)
|
**Download StatusAPI:** [StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI)
|
||||||
|
|
||||||
|
**Download GlobalChat**: [GlobalChat](https://git.viper.ipv64.net/M_Viper/GlobalChat)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -48,12 +51,11 @@ Dieses Plugin (**GlobalChat Suppressor**) dient ab sofort **nur noch als Schnitt
|
|||||||
|
|
||||||
### Voraussetzung: StatusAPI
|
### Voraussetzung: StatusAPI
|
||||||
|
|
||||||
⚠️ **Die [StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI) MUSS auf deinem BungeeCord-Server installiert sein!**
|
⚠️ **Die [StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI) oder [GlobalChat](https://git.viper.ipv64.net/M_Viper/GlobalChat) MUSS auf deinem BungeeCord-Server installiert sein!**
|
||||||
```text
|
```text
|
||||||
BungeeCord/
|
BungeeCord/
|
||||||
├─ plugins/
|
├─ plugins/
|
||||||
│ ├─ StatusAPI.jar ← PFLICHT
|
│ ├─ StatusAPI.jar oder GlobalChat.jar ← PFLICHT
|
||||||
│ └─ GlobalChat-Bungee.jar ← Optional (nur für BungeeCord)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Schritt-für-Schritt
|
### Schritt-für-Schritt
|
||||||
@@ -94,7 +96,7 @@ Neue Badwords können einfach hinzugefügt werden. Das Plugin muss nach Änderun
|
|||||||
## Architektur
|
## Architektur
|
||||||
```text
|
```text
|
||||||
BungeeCord
|
BungeeCord
|
||||||
└─ StatusAPI (Hauptlogik, Befehle, Filter, Logs)
|
└─ StatusAPI oder GlobalChat (Hauptlogik, Befehle, Filter, Logs)
|
||||||
|
|
||||||
Unterserver (Spigot/Paper)
|
Unterserver (Spigot/Paper)
|
||||||
└─ GlobalChat Suppressor (Schnittstelle, leitet an StatusAPI weiter)
|
└─ GlobalChat Suppressor (Schnittstelle, leitet an StatusAPI weiter)
|
||||||
@@ -102,17 +104,6 @@ Unterserver (Spigot/Paper)
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Migration von alter Version
|
|
||||||
|
|
||||||
Wenn du eine ältere Version des GlobalChat verwendest:
|
|
||||||
|
|
||||||
1. Installiere die neue [StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI) auf BungeeCord
|
|
||||||
2. Kopiere deine `filter.yml` in den StatusAPI-Ordner
|
|
||||||
3. Ersetze das alte GlobalChat-Plugin auf den Unterservern mit dem neuen GlobalChat Suppressor
|
|
||||||
4. Starte alle Server neu
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Lizenz
|
## Lizenz
|
||||||
|
|
||||||
Dieses Plugin ist **proprietär** und darf nicht ohne Erlaubnis des Autors verbreitet oder verändert werden.
|
Dieses Plugin ist **proprietär** und darf nicht ohne Erlaubnis des Autors verbreitet oder verändert werden.
|
||||||
@@ -122,4 +113,6 @@ Dieses Plugin ist **proprietär** und darf nicht ohne Erlaubnis des Autors verbr
|
|||||||
## Support & Weitere Informationen
|
## Support & Weitere Informationen
|
||||||
|
|
||||||
Für detaillierte Informationen zur StatusAPI und deren Konfiguration:
|
Für detaillierte Informationen zur StatusAPI und deren Konfiguration:
|
||||||
**[https://git.viper.ipv64.net/M_Viper/StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI)**
|
**[StatusAPI](https://git.viper.ipv64.net/M_Viper/StatusAPI)**
|
||||||
|
|
||||||
|
**[GlobalChat](https://git.viper.ipv64.net/M_Viper/GlobalChat)**
|
||||||
22
pom.xml
22
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>de.viper.globalchat</groupId>
|
<groupId>de.viper.globalchat</groupId>
|
||||||
<artifactId>GlobalChatSuppressor</artifactId>
|
<artifactId>GlobalChatSuppressor</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>GlobalChatSuppressor</name>
|
<name>GlobalChatSuppressor</name>
|
||||||
@@ -16,6 +16,18 @@
|
|||||||
<spigot.version>1.21.1-R0.1-SNAPSHOT</spigot.version>
|
<spigot.version>1.21.1-R0.1-SNAPSHOT</spigot.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<!-- HINZUGEFÜGT: Repositories, damit Maven die Libs findet -->
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
@@ -23,6 +35,14 @@
|
|||||||
<version>${spigot.version}</version>
|
<version>${spigot.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- HINZUGEFÜGT: Die Dependency für ComponentSerializer -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
|
<version>1.20-R0.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package de.viper.globalchat.suppressor;
|
package de.viper.globalchat.suppressor;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
@@ -11,46 +14,76 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class GlobalChatSuppressor extends JavaPlugin implements PluginMessageListener, Listener {
|
public class GlobalChatSuppressor extends JavaPlugin implements PluginMessageListener, Listener {
|
||||||
|
|
||||||
private static final String CHANNEL = "global:control";
|
private static final String CHANNEL_CONTROL = "global:control";
|
||||||
|
private static final String CHANNEL_CHAT = "global:chat"; // NEU: Kanal für Chat Relay
|
||||||
|
|
||||||
private final Set<UUID> suppressJoinQuit = new HashSet<>();
|
private final Set<UUID> suppressJoinQuit = new HashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
getServer().getMessenger().registerIncomingPluginChannel(this, CHANNEL, this);
|
// Incoming Channels (Daten von BungeeCord)
|
||||||
getServer().getMessenger().registerOutgoingPluginChannel(this, CHANNEL);
|
getServer().getMessenger().registerIncomingPluginChannel(this, CHANNEL_CONTROL, this);
|
||||||
|
getServer().getMessenger().registerIncomingPluginChannel(this, CHANNEL_CHAT, this);
|
||||||
|
|
||||||
|
// Outgoing Channels (Daten zu BungeeCord)
|
||||||
|
getServer().getMessenger().registerOutgoingPluginChannel(this, CHANNEL_CONTROL);
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(this, this);
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
getLogger().info("GlobalChatSuppressor aktiviert!");
|
getLogger().info("GlobalChatSuppressor aktiviert (Chat Relay included)!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
getServer().getMessenger().unregisterIncomingPluginChannel(this, CHANNEL);
|
getServer().getMessenger().unregisterIncomingPluginChannel(this, CHANNEL_CONTROL);
|
||||||
getServer().getMessenger().unregisterOutgoingPluginChannel(this, CHANNEL);
|
getServer().getMessenger().unregisterIncomingPluginChannel(this, CHANNEL_CHAT);
|
||||||
|
getServer().getMessenger().unregisterOutgoingPluginChannel(this, CHANNEL_CONTROL);
|
||||||
getLogger().info("GlobalChatSuppressor deaktiviert!");
|
getLogger().info("GlobalChatSuppressor deaktiviert!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
if (!channel.equals(CHANNEL)) return;
|
if (!channel.equals(CHANNEL_CONTROL) && !channel.equals(CHANNEL_CHAT)) return;
|
||||||
|
|
||||||
try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(message))) {
|
try {
|
||||||
String subChannel = in.readUTF();
|
String data = new String(message, StandardCharsets.UTF_8);
|
||||||
if ("suppress".equalsIgnoreCase(subChannel)) {
|
|
||||||
String uuidStr = in.readUTF();
|
if (channel.equals(CHANNEL_CHAT)) {
|
||||||
UUID playerUUID = UUID.fromString(uuidStr);
|
// ==========================================
|
||||||
suppressJoinQuit.add(playerUUID);
|
// NEU: GLOBAL CHAT RELAY LOGIK
|
||||||
getLogger().info("Suppress für Spieler UUID: " + playerUUID + " aktiviert.");
|
// ==========================================
|
||||||
// Entferne die Unterdrückung nach 2 Sekunden (synchron mit BungeeCord)
|
// Wir empfangen JSON von BungeeCord.
|
||||||
getServer().getScheduler().runTaskLater(this, () -> {
|
BaseComponent[] components = ComponentSerializer.parse(data);
|
||||||
suppressJoinQuit.remove(playerUUID);
|
|
||||||
getLogger().info("Suppress für Spieler UUID: " + playerUUID + " entfernt.");
|
// An alle Spieler auf diesem Server senden.
|
||||||
}, 40L); // 40 Ticks = 2 Sekunden
|
// Da dies eine Server-Nachricht ist, bricht sie die Secure Chain nicht.
|
||||||
|
// Auch der Spieler selbst sieht sie.
|
||||||
|
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||||
|
all.spigot().sendMessage(components);
|
||||||
|
}
|
||||||
|
// ==========================================
|
||||||
|
|
||||||
|
} else if (channel.equals(CHANNEL_CONTROL)) {
|
||||||
|
// Alte Suppress Logik (Join/Quit)
|
||||||
|
try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(message))) {
|
||||||
|
String subChannel = in.readUTF();
|
||||||
|
if ("suppress".equalsIgnoreCase(subChannel)) {
|
||||||
|
String uuidStr = in.readUTF();
|
||||||
|
UUID playerUUID = UUID.fromString(uuidStr);
|
||||||
|
suppressJoinQuit.add(playerUUID);
|
||||||
|
getLogger().info("Suppress für Spieler UUID: " + playerUUID + " aktiviert.");
|
||||||
|
getServer().getScheduler().runTaskLater(this, () -> {
|
||||||
|
suppressJoinQuit.remove(playerUUID);
|
||||||
|
getLogger().info("Suppress für Spieler UUID: " + playerUUID + " entfernt.");
|
||||||
|
}, 40L);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: GlobalChatSuppressor
|
name: GlobalChatSuppressor
|
||||||
version: 1.0.0
|
version: 1.2
|
||||||
main: de.viper.globalchat.suppressor.GlobalChatSuppressor
|
main: de.viper.globalchat.suppressor.GlobalChatSuppressor
|
||||||
api-version: 1.21
|
api-version: 1.21
|
||||||
author: M_Viper
|
author: M_Viper
|
||||||
|
|||||||
Reference in New Issue
Block a user