Compare commits
3 Commits
main
...
mauberries
Author | SHA1 | Date |
---|---|---|
benamaurer | ddd7286046 | |
mauberries | 4721b31092 | |
benamaurer | 354bb77f9d |
|
@ -6,6 +6,8 @@ import org.bukkit.event.EventHandler;
|
|||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.advancement.Advancement;
|
||||
import org.bukkit.Namespacedkey;
|
||||
import xyz.etztech.qol.QoL;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -48,6 +50,16 @@ public class AsyncPlayerChatListener implements Listener {
|
|||
String chat = event.getMessage();
|
||||
boolean escape = false;
|
||||
|
||||
//Checking if player has been awarded the chat advancement, if not, message is searched for triggers
|
||||
Advancement adv = Bukkit.getAdvancement(new Namespacedkey("canopy", "chat_advancement"));
|
||||
|
||||
if (!player.getAdvancementProgress(adv).isDone()) {
|
||||
List<String> advancementTriggerList = plugin.getConfig().getStringList("chat-advancement-triggers");
|
||||
if (advancementTriggerList.stream().anyMatch(t -> chat.toLowerCase().contains(t.toLowerCase()))) {
|
||||
player.getAdvancementProgress(adv).awardCriteria("win");
|
||||
}
|
||||
}
|
||||
|
||||
// Escape
|
||||
if (chat.startsWith("\\")) {
|
||||
escape = true;
|
||||
|
|
|
@ -104,3 +104,7 @@ dynmap:
|
|||
defaults:
|
||||
map: "surface"
|
||||
zoom: 5
|
||||
|
||||
# A list of words/phrases which will award the chant advancement to the message author
|
||||
chat-advancement-triggers:
|
||||
- chat_advancment_test
|
||||
|
|
Loading…
Reference in New Issue