Fix pet name tags
This commit is contained in:
1 parent
2e31ddf215
commit
aa08469971
3 files changed
+9
-38
No files matched your search
+3
-3
@@ -52,9 +52,9 @@ repositories {
|
||||
/* ---------------------- Java project deps ---------------------------- */
|
||||
dependencies {
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Declare Purpur API version to be packaged.
|
||||
implementation("net.kyori:adventure-platform-bukkit:4.3.2") // Import Adventure Platform API.
|
||||
implementation("net.kyori:adventure-text-minimessage:4.13.1") // Import MiniMessage API.
|
||||
implementation("net.kyori:adventure-platform-bukkit:4.3.2") // Import verbose Minimessage API.
|
||||
compileOnly(
|
||||
"net.kyori:adventure-text-minimessage:4.13.1"
|
||||
) // MiniMessage API (provided by Purpur at runtime - do NOT shade/relocate).
|
||||
implementation(project(":libs:MCShared-OG")) // Import TrueOG Network MCShared-OG API (from source).
|
||||
compileOnlyApi(project(":libs:Utilities-OG")) // Import TrueOG Network Utilities-OG Java API (from source).
|
||||
compileOnlyApi(project(":libs:DiamondBank-OG")) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.hm.mcshared.file.CommentedYamlConfiguration;
|
||||
import com.hm.petmaster.command.EnableDisableCommand;
|
||||
@@ -37,7 +36,6 @@ import com.hm.petmaster.listener.PlayerQuitListener;
|
||||
import com.hm.petmaster.listener.PlayerTameListener;
|
||||
import com.hm.petmaster.utils.MessageSender;
|
||||
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.trueog.diamondbankog.api.DiamondBankAPIJava;
|
||||
@@ -90,7 +88,6 @@ public class PetMaster extends JavaPlugin {
|
||||
private PetSkillCommand petSkillCommand;
|
||||
|
||||
// Messaging System.
|
||||
private BukkitAudiences adventure;
|
||||
private MessageSender messageSender;
|
||||
|
||||
// Plugin instance.
|
||||
@@ -99,18 +96,6 @@ public class PetMaster extends JavaPlugin {
|
||||
// DiamondBank-OG Economy.
|
||||
private static DiamondBankAPIJava diamondBankAPI;
|
||||
|
||||
public @NotNull BukkitAudiences adventure() {
|
||||
|
||||
if (this.adventure == null) {
|
||||
|
||||
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
|
||||
|
||||
}
|
||||
|
||||
return this.adventure;
|
||||
|
||||
}
|
||||
|
||||
public static DiamondBankAPIJava getDiamondBankAPI() {
|
||||
|
||||
return diamondBankAPI;
|
||||
@@ -145,8 +130,7 @@ public class PetMaster extends JavaPlugin {
|
||||
// Assign the active instance of DiamondBank-OG to the API handler.
|
||||
diamondBankAPI = provider.getProvider();
|
||||
|
||||
// Initializing the Messaging System
|
||||
this.adventure = BukkitAudiences.create(this);
|
||||
// Initializing the Messaging System (Purpur provides Adventure natively).
|
||||
this.messageSender = new MessageSender(this);
|
||||
|
||||
getLogger().info("Server version..." + Bukkit.getServer().getBukkitVersion());
|
||||
@@ -314,14 +298,6 @@ public class PetMaster extends JavaPlugin {
|
||||
|
||||
}
|
||||
|
||||
// Closing Adventure API
|
||||
if (this.adventure != null) {
|
||||
|
||||
this.adventure.close();
|
||||
this.adventure = null;
|
||||
|
||||
}
|
||||
|
||||
getLogger().info("PetMaster has been disabled.");
|
||||
|
||||
}
|
||||
|
||||
@@ -38,8 +38,7 @@ public class MessageSender {
|
||||
|
||||
public void sendComponent(Player player, Component component) {
|
||||
|
||||
final Audience audience = plugin.adventure().player(player);
|
||||
audience.sendMessage(component);
|
||||
player.sendMessage(component);
|
||||
|
||||
}
|
||||
|
||||
@@ -51,29 +50,25 @@ public class MessageSender {
|
||||
|
||||
public void sendMessage(Player player, String key, TagResolver... tagResolvers) {
|
||||
|
||||
final Audience audience = plugin.adventure().player(player);
|
||||
sendMessage(audience, key, tagResolvers);
|
||||
sendMessage((Audience) player, key, tagResolvers);
|
||||
|
||||
}
|
||||
|
||||
public void sendMessage(CommandSender sender, String key, TagResolver... tagResolvers) {
|
||||
|
||||
final Audience audience = plugin.adventure().sender(sender);
|
||||
sendMessage(audience, key, tagResolvers);
|
||||
sendMessage((Audience) sender, key, tagResolvers);
|
||||
|
||||
}
|
||||
|
||||
public void sendNewLine(CommandSender sender, boolean sendPrefix) {
|
||||
|
||||
final Audience audience = plugin.adventure().sender(sender);
|
||||
|
||||
if (sendPrefix) {
|
||||
|
||||
sendMessage(audience, "petmaster-prefix");
|
||||
sendMessage((Audience) sender, "petmaster-prefix");
|
||||
|
||||
} else {
|
||||
|
||||
audience.sendMessage(Component.newline());
|
||||
sender.sendMessage(Component.newline());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user