we don't have the technology

This commit is contained in:
MD 2022-08-02 21:11:45 +01:00
parent a0eba932d5
commit 808f677547
6 changed files with 24 additions and 2 deletions

View File

@ -2,6 +2,10 @@ plugins {
id("essentials.module-conventions")
}
essentials {
injectPlaceholderApi = true
}
dependencies {
compileOnly project(':EssentialsX')
}

View File

@ -6,6 +6,7 @@ import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.chat.EssentialsChat;
import com.earth2me.essentials.utils.FormatUtil;
import me.clip.placeholderapi.PlaceholderAPI;
import net.ess3.api.events.LocalChatSpyEvent;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -28,12 +29,14 @@ public abstract class AbstractChatHandler {
protected final Essentials ess;
protected final EssentialsChat essChat;
protected final boolean isPapi;
protected final Server server;
protected final ChatProcessingCache cache;
protected AbstractChatHandler(Essentials ess, EssentialsChat essChat) {
this.ess = ess;
this.essChat = essChat;
this.isPapi = essChat.getServer().getPluginManager().getPlugin("PlaceholderAPI") != null;
this.server = ess.getServer();
this.cache = new ChatProcessingCache();
}
@ -83,6 +86,9 @@ public abstract class AbstractChatHandler {
format = format.replace("{7}", suffix);
format = format.replace("{8}", username);
format = format.replace("{9}", nickname == null ? username : nickname);
if (isPapi) {
format = PlaceholderAPI.setPlaceholders(event.getPlayer(), format);
}
synchronized (format) {
event.setFormat(format);
}

View File

@ -7,6 +7,7 @@ website: https://essentialsx.net/
description: Provides chat control features for Essentials. Requires Permissions.
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy, Iaccidentally, mdcfe, JRoy, triagonal]
depend: [Essentials]
softdepend: [PlaceholderAPI]
api-version: 1.13
commands:
toggleshout:

View File

@ -2,6 +2,10 @@ plugins {
id("essentials.shadow-module")
}
essentials {
injectPlaceholderApi = true
}
dependencies {
compileOnly project(':EssentialsX')
implementation('net.dv8tion:JDA:4.4.0_350') {
@ -10,7 +14,6 @@ dependencies {
implementation 'com.vdurmont:emoji-java:5.1.1'
implementation 'club.minnced:discord-webhooks:0.7.2'
compileOnly 'org.apache.logging.log4j:log4j-core:2.15.0'
compileOnly 'me.clip:placeholderapi:2.10.9'
}
shadowJar {

View File

@ -5,4 +5,5 @@ import org.gradle.kotlin.dsl.property
abstract class EssentialsBaseExtension(private val project: Project) {
val injectBukkitApi: Property<Boolean> = project.objects.property<Boolean>().convention(true)
val injectBstats: Property<Boolean> = project.objects.property<Boolean>().convention(true)
val injectPlaceholderApi: Property<Boolean> = project.objects.property<Boolean>().convention(false)
}

View File

@ -13,6 +13,8 @@ val checkstyleVersion = "8.36.2"
val spigotVersion = "1.19.1-R0.1-SNAPSHOT"
val junit5Version = "5.7.0"
val mockitoVersion = "3.2.0"
val bstatsVersion = "1.8"
val placeholderApiVersion = "2.11.2"
dependencies {
testImplementation("org.junit.jupiter", "junit-jupiter", junit5Version)
@ -34,7 +36,12 @@ afterEvaluate {
}
if (baseExtension.injectBstats.get()) {
dependencies {
implementation("org.bstats", "bstats-bukkit", "1.8")
implementation("org.bstats", "bstats-bukkit", bstatsVersion)
}
}
if (baseExtension.injectPlaceholderApi.get()) {
dependencies {
compileOnly("me.clip", "placeholderapi", placeholderApiVersion)
}
}
}