-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
carm
committed
Sep 26, 2021
1 parent
9a620d7
commit e14901a
Showing
10 changed files
with
91 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/cc/carm/plugin/userprefix/listener/ChatListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cc.carm.plugin.userprefix.listener; | ||
|
||
import cc.carm.plugin.userprefix.Main; | ||
import cc.carm.plugin.userprefix.configuration.PrefixConfig; | ||
import cc.carm.plugin.userprefix.util.MessageUtil; | ||
import me.clip.placeholderapi.PlaceholderAPI; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.AsyncPlayerChatEvent; | ||
|
||
public class ChatListener implements Listener { | ||
|
||
@EventHandler | ||
public void onChat(AsyncPlayerChatEvent event) { | ||
if (!PrefixConfig.Functions.Chat.ENABLE.get()) return; | ||
String format = PrefixConfig.Functions.Chat.FORMAT.get(); | ||
if (format == null || format.length() < 1) return; | ||
|
||
if (!MessageUtil.hasPlaceholderAPI()) return; | ||
|
||
try { | ||
event.setFormat(PlaceholderAPI.setPlaceholders(event.getPlayer(), format)); | ||
} catch (Exception exception) { | ||
Main.log("Please check the chat configuration."); | ||
Main.log("请检查配置文件中聊天相关是否配置正确。"); | ||
exception.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters