Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
1de5301f71 | |||
4d8b7e16ca | |||
71b9d85f3c | |||
85014a68b7 | |||
aec2de9305 | |||
7ffd227fa4 | |||
81f3ba5a5f | |||
810649c0a1 | |||
99ed66cbab | |||
d8e6ab016a | |||
e0292702d7 | |||
1042618392 | |||
1b863a9786 |
@@ -1,80 +1,80 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>de.viper</groupId>
|
<groupId>de.viper</groupId>
|
||||||
<artifactId>globalchat</artifactId>
|
<artifactId>globalchat</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>GlobalChat</name>
|
<name>GlobalChat</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<!-- LuckPerms Repository -->
|
<!-- LuckPerms Repository -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>luck-repo</id>
|
<id>luck-repo</id>
|
||||||
<url>https://repo.lucko.me/</url>
|
<url>https://repo.lucko.me/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- BungeeCord API -->
|
<!-- BungeeCord API -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-api</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.21-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- LuckPerms API -->
|
<!-- LuckPerms API -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.luckperms</groupId>
|
<groupId>net.luckperms</groupId>
|
||||||
<artifactId>api</artifactId>
|
<artifactId>api</artifactId>
|
||||||
<version>5.4</version>
|
<version>5.4</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- Compiler Plugin -->
|
<!-- Compiler Plugin -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- Shade Plugin -->
|
<!-- Shade Plugin -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.4</version>
|
<version>3.2.4</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>shade</goal>
|
<goal>shade</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
File diff suppressed because it is too large
Load Diff
@@ -1,35 +1,35 @@
|
|||||||
name: GlobalChat
|
name: GlobalChat
|
||||||
main: de.viper.globalchat.GlobalChat
|
main: de.viper.globalchat.GlobalChat
|
||||||
version: 1.1
|
version: 1.1
|
||||||
author: M_Viper
|
author: M_Viper
|
||||||
depend: [LuckPerms]
|
depend: [LuckPerms]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
globalreload:
|
globalreload:
|
||||||
description: Lädt den Filter neu
|
description: Lädt den Filter neu
|
||||||
usage: /globalreload
|
usage: /globalreload
|
||||||
permission: globalchat.reload
|
permission: globalchat.reload
|
||||||
globalmute:
|
globalmute:
|
||||||
description: Schaltet den globalen Chat an/aus
|
description: Schaltet den globalen Chat an/aus
|
||||||
usage: /globalmute
|
usage: /globalmute
|
||||||
permission: globalchat.mute
|
permission: globalchat.mute
|
||||||
support:
|
support:
|
||||||
description: Sendet eine Support-Nachricht an das Team
|
description: Sendet eine Support-Nachricht an das Team
|
||||||
usage: /support <Nachricht>
|
usage: /support <Nachricht>
|
||||||
reply:
|
reply:
|
||||||
description: Antwortet auf eine Support-Nachricht
|
description: Antwortet auf eine Support-Nachricht
|
||||||
usage: /reply <Nachricht>
|
usage: /reply <Nachricht>
|
||||||
info:
|
info:
|
||||||
description: Zeigt Plugin-Informationen an
|
description: Zeigt Plugin-Informationen an
|
||||||
usage: /info
|
usage: /info
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
globalchat.reload:
|
globalchat.reload:
|
||||||
description: Erlaubt das Neuladen des Filters
|
description: Erlaubt das Neuladen des Filters
|
||||||
default: op
|
default: op
|
||||||
globalchat.mute:
|
globalchat.mute:
|
||||||
description: Erlaubt das Aktivieren/Deaktivieren des globalen Mutes
|
description: Erlaubt das Aktivieren/Deaktivieren des globalen Mutes
|
||||||
default: op
|
default: op
|
||||||
globalchat.bypass:
|
globalchat.bypass:
|
||||||
description: Umgeht den globalen Mute
|
description: Umgeht den globalen Mute
|
||||||
default: op
|
default: op
|
@@ -1,6 +1,6 @@
|
|||||||
name: GlobalChatSpigot
|
name: GlobalChatSpigot
|
||||||
main: de.viper.globalchat.GlobalChatSpigot
|
main: de.viper.globalchat.GlobalChatSpigot
|
||||||
version: 1.1
|
version: 1.1
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
description: Spigot helper for GlobalChat Bungee (sends coords, handles teleport requests)
|
description: Spigot helper for GlobalChat Bungee (sends coords, handles teleport requests)
|
||||||
authors: [M_Viper]
|
authors: [M_Viper]
|
42
GlobalChatSuppressor/pom.xml
Normal file
42
GlobalChatSuppressor/pom.xml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||||
|
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>de.viper.globalchat</groupId>
|
||||||
|
<artifactId>GlobalChatSuppressor</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>GlobalChatSuppressor</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
<spigot.version>1.21.1-R0.1-SNAPSHOT</spigot.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>${spigot.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.13.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@@ -0,0 +1,79 @@
|
|||||||
|
package de.viper.globalchat.suppressor;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class GlobalChatSuppressor extends JavaPlugin implements PluginMessageListener, Listener {
|
||||||
|
|
||||||
|
private static final String CHANNEL = "global:control";
|
||||||
|
private final Set<UUID> suppressJoinQuit = new HashSet<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
getServer().getMessenger().registerIncomingPluginChannel(this, CHANNEL, this);
|
||||||
|
getServer().getMessenger().registerOutgoingPluginChannel(this, CHANNEL);
|
||||||
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
|
getLogger().info("GlobalChatSuppressor aktiviert!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
getServer().getMessenger().unregisterIncomingPluginChannel(this, CHANNEL);
|
||||||
|
getServer().getMessenger().unregisterOutgoingPluginChannel(this, CHANNEL);
|
||||||
|
getLogger().info("GlobalChatSuppressor deaktiviert!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
|
if (!channel.equals(CHANNEL)) return;
|
||||||
|
|
||||||
|
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.");
|
||||||
|
// Entferne die Unterdrückung nach 2 Sekunden (synchron mit BungeeCord)
|
||||||
|
getServer().getScheduler().runTaskLater(this, () -> {
|
||||||
|
suppressJoinQuit.remove(playerUUID);
|
||||||
|
getLogger().info("Suppress für Spieler UUID: " + playerUUID + " entfernt.");
|
||||||
|
}, 40L); // 40 Ticks = 2 Sekunden
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (suppressJoinQuit.contains(player.getUniqueId())) {
|
||||||
|
event.setJoinMessage(null);
|
||||||
|
getLogger().info("Join-Nachricht für " + player.getName() + " unterdrückt.");
|
||||||
|
suppressJoinQuit.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (suppressJoinQuit.contains(player.getUniqueId())) {
|
||||||
|
event.setQuitMessage(null);
|
||||||
|
getLogger().info("Quit-Nachricht für " + player.getName() + " unterdrückt.");
|
||||||
|
suppressJoinQuit.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,35 @@
|
|||||||
|
package de.viper.globalchat.suppressor;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class SuppressManager {
|
||||||
|
|
||||||
|
private static final Set<UUID> suppressedPlayers = Collections.synchronizedSet(new HashSet<>());
|
||||||
|
|
||||||
|
public static void register(GlobalChatSuppressor plugin) {
|
||||||
|
// Nichts weiter nötig, die Nachrichten werden beim Join/Quit-Event unterdrückt
|
||||||
|
// via AsyncPlayerPreLogin oder PlayerJoin/Leave in Hauptplugin
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void suppress(UUID playerUUID) {
|
||||||
|
suppressedPlayers.add(playerUUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void unsuppress(UUID playerUUID) {
|
||||||
|
suppressedPlayers.remove(playerUUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSuppressed(UUID playerUUID) {
|
||||||
|
return suppressedPlayers.contains(playerUUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<UUID> getSuppressedPlayers() {
|
||||||
|
return suppressedPlayers;
|
||||||
|
}
|
||||||
|
}
|
6
GlobalChatSuppressor/src/main/resources/plugin.yml
Normal file
6
GlobalChatSuppressor/src/main/resources/plugin.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: GlobalChatSuppressor
|
||||||
|
version: 1.0.0
|
||||||
|
main: de.viper.globalchat.suppressor.GlobalChatSuppressor
|
||||||
|
api-version: 1.21
|
||||||
|
author: M_Viper
|
||||||
|
commands: {}
|
Reference in New Issue
Block a user