forked from fzorb/noThankYouMicrosoft
first commit
This commit is contained in:
commit
32693b9590
8 changed files with 277 additions and 0 deletions
|
@ -0,0 +1,24 @@
|
|||
package xyz.fzorb.noThankYouMicrosoft;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class NoThankYouMicrosoft extends JavaPlugin {
|
||||
|
||||
private static JavaPlugin instance;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
this.saveDefaultConfig();
|
||||
this.getServer().getPluginManager().registerEvents(new messageListener(), this);
|
||||
}
|
||||
|
||||
public static JavaPlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package xyz.fzorb.noThankYouMicrosoft;
|
||||
|
||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class messageListener implements Listener {
|
||||
@EventHandler
|
||||
public static void onMesasge(AsyncChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String message = MiniMessage.miniMessage().serialize(event.message());
|
||||
event.setCancelled(true);
|
||||
String format = NoThankYouMicrosoft.getInstance().getConfig().getString("format");
|
||||
Bukkit.getServer().broadcast(MiniMessage.miniMessage().deserialize(format.replace("{{username}}", player.getDisplayName()).replace("{{message}}", message)));
|
||||
}
|
||||
}
|
1
src/main/resources/config.yml
Normal file
1
src/main/resources/config.yml
Normal file
|
@ -0,0 +1 @@
|
|||
format: "<{{username}}> {{message}}" #you can use MiniMessage!
|
8
src/main/resources/plugin.yml
Normal file
8
src/main/resources/plugin.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
name: noThankYouMicrosoft
|
||||
version: '1.0'
|
||||
main: xyz.fzorb.noThankYouMicrosoft.NoThankYouMicrosoft
|
||||
api-version: '1.21'
|
||||
prefix: nTYM
|
||||
authors: [ fzorb ]
|
||||
description: Rewrites your Minecraft messages to make them unreportable
|
||||
website: https://git.fzorb.xyz/fzorb/noThankYouMicrosoft
|
Loading…
Add table
Add a link
Reference in a new issue