Skip to content

Commit

Permalink
Added api-version, Switched to AsyncChatEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
notTamion committed Sep 18, 2023
1 parent 072e6ae commit e62e9d4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 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>de.tamion</groupId>
<artifactId>DiscordConnector</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
<packaging>jar</packaging>

<name>DiscordConnector</name>
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/de/tamion/minecraft/listeners/MCChat.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

import de.tamion.minecraft.MCMain;
import de.tamion.others.Utils;
import io.papermc.paper.event.player.AsyncChatEvent;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;

public class MCChat implements Listener {
@EventHandler
public void onChat(PlayerChatEvent e) {
public void onChat(AsyncChatEvent e) {
Player p = e.getPlayer();
FileConfiguration config = MCMain.getPlugin().getConfig();
if(!e.isCancelled()) {
Utils.sendtochat(config.getString("Bot.dcsyntax").replaceAll("\\{username}", e.getPlayer().getName()).replaceAll("\\{message}", e.getMessage()));
Utils.sendtochat(config.getString("Bot.dcsyntax").replaceAll("\\{username}", e.getPlayer().getName()).replaceAll("\\{message}", PlainTextComponentSerializer.plainText().serialize(e.message())));
}
}
}
3 changes: 2 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: DiscordConnector
version: '${project.version}'
main: de.tamion.minecraft.MCMain
authors: [ Tamion ]
api-version: '1.13'
description: Uses JDA to combine Minecraft and Discord
load: STARTUP
load: STARTUPbe
commands:
setbottoken:
setmcsyntax:
Expand Down

0 comments on commit e62e9d4

Please sign in to comment.