mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 15:09:23 +00:00
2.3.0.3
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
package net.momirealms.customnameplates.api.mechanic.placeholder;
|
package net.momirealms.customnameplates.api.mechanic.placeholder;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -41,9 +42,9 @@ public class SwitchText {
|
|||||||
this.toParse = toParse;
|
this.toParse = toParse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue(Player player) {
|
public String getValue(OfflinePlayer player) {
|
||||||
String parsed = PlaceholderAPI.setPlaceholders(player, toParse);
|
String parsed = PlaceholderAPI.setPlaceholders(player, toParse);
|
||||||
return valueMap.getOrDefault(parsed, defaultValue);
|
return PlaceholderAPI.setPlaceholders(player, valueMap.getOrDefault(parsed, defaultValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|||||||
@@ -18,12 +18,10 @@
|
|||||||
package net.momirealms.customnameplates.api.mechanic.placeholder;
|
package net.momirealms.customnameplates.api.mechanic.placeholder;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import net.momirealms.customnameplates.api.CustomNameplatesPlugin;
|
|
||||||
import net.momirealms.customnameplates.api.mechanic.font.OffsetFont;
|
import net.momirealms.customnameplates.api.mechanic.font.OffsetFont;
|
||||||
import net.momirealms.customnameplates.api.util.FontUtils;
|
import net.momirealms.customnameplates.api.util.FontUtils;
|
||||||
import net.momirealms.customnameplates.api.util.LogUtils;
|
import net.momirealms.customnameplates.api.util.LogUtils;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class VanillaHud {
|
public class VanillaHud {
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|
||||||
version = "2.3.0.2"
|
version = "2.3.0.3"
|
||||||
|
|
||||||
apply<JavaPlugin>()
|
apply<JavaPlugin>()
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
public static CommandAPICommand getListCommand() {
|
public static CommandAPICommand getListCommand() {
|
||||||
return new CommandAPICommand("list")
|
return new CommandAPICommand("list")
|
||||||
.withPermission("bubbles.list")
|
.withPermission("bubbles.command.list")
|
||||||
.executesPlayer((player, args) -> {
|
.executesPlayer((player, args) -> {
|
||||||
if (!CNConfig.bubbleModule) return;
|
if (!CNConfig.bubbleModule) return;
|
||||||
List<String> bubbles = CustomNameplatesPlugin.get().getBubbleManager().getAvailableBubblesDisplayNames(player);
|
List<String> bubbles = CustomNameplatesPlugin.get().getBubbleManager().getAvailableBubblesDisplayNames(player);
|
||||||
@@ -125,15 +125,22 @@ public class CommandManager {
|
|||||||
|
|
||||||
public static CommandAPICommand getEquipCommand() {
|
public static CommandAPICommand getEquipCommand() {
|
||||||
return new CommandAPICommand("equip")
|
return new CommandAPICommand("equip")
|
||||||
.withPermission("bubbles.equip")
|
.withPermission("bubbles.command.equip")
|
||||||
.withArguments(new StringArgument("bubble").replaceSuggestions(ArgumentSuggestions.strings(commandSenderSuggestionInfo -> CustomNameplatesPlugin.get().getBubbleManager().getAvailableBubbles((Player) commandSenderSuggestionInfo.sender()).toArray(new String[0]))))
|
.withArguments(new StringArgument("bubble").replaceSuggestions(ArgumentSuggestions.strings(commandSenderSuggestionInfo -> CustomNameplatesPlugin.get().getBubbleManager().getAvailableBubbles((Player) commandSenderSuggestionInfo.sender()).toArray(new String[0]))))
|
||||||
.executesPlayer((player, args) -> {
|
.executesPlayer((player, args) -> {
|
||||||
if (!CNConfig.bubbleModule) return;
|
if (!CNConfig.bubbleModule) return;
|
||||||
String bubble = (String) args.get("bubble");
|
String bubble = (String) args.get("bubble");
|
||||||
if (!CustomNameplatesPlugin.get().getBubbleManager().equipBubble(player, bubble)) {
|
if (!CustomNameplatesPlugin.get().getBubbleManager().containsBubble(bubble)) {
|
||||||
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_BUBBLE_NOT_EXIST);
|
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_BUBBLE_NOT_EXIST);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CustomNameplatesPlugin.get().getBubbleManager().hasBubble(player, bubble)) {
|
||||||
|
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_BUBBLE_NOT_AVAILABLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomNameplatesPlugin.get().getBubbleManager().equipBubble(player, bubble);
|
||||||
Bubble bubbleInstance = CustomNameplatesPlugin.get().getBubbleManager().getBubble(bubble);
|
Bubble bubbleInstance = CustomNameplatesPlugin.get().getBubbleManager().getBubble(bubble);
|
||||||
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_EQUIP_BUBBLE.replace("{Bubble}", bubbleInstance.getDisplayName()));
|
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_EQUIP_BUBBLE.replace("{Bubble}", bubbleInstance.getDisplayName()));
|
||||||
});
|
});
|
||||||
@@ -141,7 +148,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
public static CommandAPICommand getUnEquipCommand() {
|
public static CommandAPICommand getUnEquipCommand() {
|
||||||
return new CommandAPICommand("unequip")
|
return new CommandAPICommand("unequip")
|
||||||
.withPermission("bubbles.unequip")
|
.withPermission("bubbles.command.unequip")
|
||||||
.executesPlayer((player, args) -> {
|
.executesPlayer((player, args) -> {
|
||||||
if (!CNConfig.bubbleModule) return;
|
if (!CNConfig.bubbleModule) return;
|
||||||
CustomNameplatesPlugin.get().getBubbleManager().unEquipBubble(player);
|
CustomNameplatesPlugin.get().getBubbleManager().unEquipBubble(player);
|
||||||
@@ -218,7 +225,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
public static CommandAPICommand getPreviewCommand() {
|
public static CommandAPICommand getPreviewCommand() {
|
||||||
return new CommandAPICommand("preview")
|
return new CommandAPICommand("preview")
|
||||||
.withPermission("nameplates.preview")
|
.withPermission("nameplates.command.preview")
|
||||||
.executesPlayer((player, args) -> {
|
.executesPlayer((player, args) -> {
|
||||||
if (!CNConfig.nameplateModule) return;
|
if (!CNConfig.nameplateModule) return;
|
||||||
NameplatePlayer nameplatePlayer = CustomNameplatesPlugin.get().getNameplateManager().getNameplatePlayer(player.getUniqueId());
|
NameplatePlayer nameplatePlayer = CustomNameplatesPlugin.get().getNameplateManager().getNameplatePlayer(player.getUniqueId());
|
||||||
@@ -290,15 +297,23 @@ public class CommandManager {
|
|||||||
|
|
||||||
public static CommandAPICommand getEquipCommand() {
|
public static CommandAPICommand getEquipCommand() {
|
||||||
return new CommandAPICommand("equip")
|
return new CommandAPICommand("equip")
|
||||||
.withPermission("nameplates.equip")
|
.withPermission("nameplates.command.equip")
|
||||||
.withArguments(new StringArgument("nameplate").replaceSuggestions(ArgumentSuggestions.strings(commandSenderSuggestionInfo -> CustomNameplatesPlugin.get().getNameplateManager().getAvailableNameplates((Player) commandSenderSuggestionInfo.sender()).toArray(new String[0]))))
|
.withArguments(new StringArgument("nameplate").replaceSuggestions(ArgumentSuggestions.strings(commandSenderSuggestionInfo -> CustomNameplatesPlugin.get().getNameplateManager().getAvailableNameplates((Player) commandSenderSuggestionInfo.sender()).toArray(new String[0]))))
|
||||||
.executesPlayer((player, args) -> {
|
.executesPlayer((player, args) -> {
|
||||||
if (!CNConfig.nameplateModule) return;
|
if (!CNConfig.nameplateModule) return;
|
||||||
String nameplate = (String) args.get("nameplate");
|
String nameplate = (String) args.get("nameplate");
|
||||||
if (!CustomNameplatesPlugin.get().getNameplateManager().equipNameplate(player, nameplate, false)) {
|
|
||||||
|
if (!CustomNameplatesPlugin.get().getNameplateManager().containsNameplate(nameplate)) {
|
||||||
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_NAMEPLATE_NOT_EXISTS);
|
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_NAMEPLATE_NOT_EXISTS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CustomNameplatesPlugin.get().getNameplateManager().hasNameplate(player, nameplate)) {
|
||||||
|
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_NAMEPLATE_NOT_AVAILABLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomNameplatesPlugin.get().getNameplateManager().equipNameplate(player, nameplate, false);
|
||||||
Nameplate nameplateInstance = CustomNameplatesPlugin.get().getNameplateManager().getNameplate(nameplate);
|
Nameplate nameplateInstance = CustomNameplatesPlugin.get().getNameplateManager().getNameplate(nameplate);
|
||||||
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_EQUIP_NAMEPLATE.replace("{Nameplate}", nameplateInstance.getDisplayName()));
|
AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CNLocale.MSG_EQUIP_NAMEPLATE.replace("{Nameplate}", nameplateInstance.getDisplayName()));
|
||||||
});
|
});
|
||||||
@@ -306,7 +321,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
public static CommandAPICommand getUnEquipCommand() {
|
public static CommandAPICommand getUnEquipCommand() {
|
||||||
return new CommandAPICommand("unequip")
|
return new CommandAPICommand("unequip")
|
||||||
.withPermission("nameplates.unequip")
|
.withPermission("nameplates.command.unequip")
|
||||||
.executesPlayer((player, args) -> {
|
.executesPlayer((player, args) -> {
|
||||||
if (!CNConfig.nameplateModule) return;
|
if (!CNConfig.nameplateModule) return;
|
||||||
CustomNameplatesPlugin.get().getNameplateManager().unEquipNameplate(player, false);
|
CustomNameplatesPlugin.get().getNameplateManager().unEquipNameplate(player, false);
|
||||||
@@ -316,7 +331,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
public static CommandAPICommand getListCommand() {
|
public static CommandAPICommand getListCommand() {
|
||||||
return new CommandAPICommand("list")
|
return new CommandAPICommand("list")
|
||||||
.withPermission("nameplates.list")
|
.withPermission("nameplates.command.list")
|
||||||
.executesPlayer((player, args) -> {
|
.executesPlayer((player, args) -> {
|
||||||
if (!CNConfig.nameplateModule) return;
|
if (!CNConfig.nameplateModule) return;
|
||||||
List<String> nameplates = CustomNameplatesPlugin.get().getNameplateManager().getAvailableNameplateDisplayNames(player);
|
List<String> nameplates = CustomNameplatesPlugin.get().getNameplateManager().getAvailableNameplateDisplayNames(player);
|
||||||
@@ -383,7 +398,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
public static CommandAPICommand getAboutCommand() {
|
public static CommandAPICommand getAboutCommand() {
|
||||||
return new CommandAPICommand("about")
|
return new CommandAPICommand("about")
|
||||||
.withPermission("customnameplates.about")
|
.withPermission("customnameplates.admin")
|
||||||
.executes((sender, args) -> {
|
.executes((sender, args) -> {
|
||||||
AdventureManagerImpl.getInstance().sendMessage(sender, "<#3CB371>⚓ CustomNameplates <gray>- <#98FB98>" + CustomNameplatesPlugin.getInstance().getVersionManager().getPluginVersion());
|
AdventureManagerImpl.getInstance().sendMessage(sender, "<#3CB371>⚓ CustomNameplates <gray>- <#98FB98>" + CustomNameplatesPlugin.getInstance().getVersionManager().getPluginVersion());
|
||||||
AdventureManagerImpl.getInstance().sendMessage(sender, "<#7FFFAA>A plugin that provides adjustable images for texts");
|
AdventureManagerImpl.getInstance().sendMessage(sender, "<#7FFFAA>A plugin that provides adjustable images for texts");
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ import com.comphenix.protocol.wrappers.EnumWrappers;
|
|||||||
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
import com.destroystokyo.paper.profile.PlayerProfile;
|
|
||||||
import net.momirealms.customnameplates.api.CustomNameplatesPlugin;
|
import net.momirealms.customnameplates.api.CustomNameplatesPlugin;
|
||||||
import net.momirealms.customnameplates.paper.mechanic.nameplate.NameplateManagerImpl;
|
|
||||||
import net.momirealms.customnameplates.paper.mechanic.nameplate.tag.team.TeamTagManagerImpl;
|
import net.momirealms.customnameplates.paper.mechanic.nameplate.tag.team.TeamTagManagerImpl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@@ -119,6 +119,11 @@ public class PluginPlaceholders extends PlaceholderExpansion {
|
|||||||
if (vanillaHud == null) return "Vanilla text not exists: " + mainArg;
|
if (vanillaHud == null) return "Vanilla text not exists: " + mainArg;
|
||||||
return vanillaHud.getValue(offlinePlayer);
|
return vanillaHud.getValue(offlinePlayer);
|
||||||
}
|
}
|
||||||
|
case "switch" -> {
|
||||||
|
SwitchText switchText = placeholderManager.getSwitchText(mainArg);
|
||||||
|
if (switchText == null) return "Switch text not exists: " + mainArg;
|
||||||
|
return switchText.getValue(offlinePlayer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Player onlinePlayer = offlinePlayer.getPlayer();
|
Player onlinePlayer = offlinePlayer.getPlayer();
|
||||||
|
|||||||
@@ -18,10 +18,11 @@
|
|||||||
package net.momirealms.customnameplates.paper.mechanic.team.provider;
|
package net.momirealms.customnameplates.paper.mechanic.team.provider;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.*;
|
import com.comphenix.protocol.events.ListenerPriority;
|
||||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import net.momirealms.customnameplates.api.CustomNameplatesPlugin;
|
import net.momirealms.customnameplates.api.CustomNameplatesPlugin;
|
||||||
import net.momirealms.customnameplates.common.team.TeamColor;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -32,7 +33,6 @@ import org.bukkit.scoreboard.Scoreboard;
|
|||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
public class UnknownProvider extends PacketAdapter implements TeamProvider, Listener {
|
public class UnknownProvider extends PacketAdapter implements TeamProvider, Listener {
|
||||||
|
|
||||||
|
|||||||
@@ -17,17 +17,13 @@
|
|||||||
|
|
||||||
package net.momirealms.customnameplates.paper.util;
|
package net.momirealms.customnameplates.paper.util;
|
||||||
|
|
||||||
import com.comphenix.protocol.utility.MinecraftFields;
|
|
||||||
import com.comphenix.protocol.utility.MinecraftMethods;
|
|
||||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
|
||||||
import net.momirealms.customnameplates.api.util.LogUtils;
|
import net.momirealms.customnameplates.api.util.LogUtils;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class ReflectionUtils {
|
public class ReflectionUtils {
|
||||||
|
|
||||||
|
|||||||
@@ -7,34 +7,34 @@ folia-supported: true
|
|||||||
depend: [ ProtocolLib ,PlaceholderAPI ]
|
depend: [ ProtocolLib ,PlaceholderAPI ]
|
||||||
softdepend: [ MagicCosmetics, TAB, CMI, TrChat, ItemsAdder, Oraxen ]
|
softdepend: [ MagicCosmetics, TAB, CMI, TrChat, ItemsAdder, Oraxen ]
|
||||||
permissions:
|
permissions:
|
||||||
nameplates.*:
|
nameplates.command.*:
|
||||||
description: Gives access to all nameplate user commands
|
description: Gives access to all nameplate user commands
|
||||||
children:
|
children:
|
||||||
nameplates.equip: true
|
nameplates.command.equip: true
|
||||||
nameplates.unequip: true
|
nameplates.command.unequip: true
|
||||||
nameplates.preview: true
|
nameplates.command.preview: true
|
||||||
nameplates.list: true
|
nameplates.command.list: true
|
||||||
nameplates.equip:
|
nameplates.command.equip:
|
||||||
default: true
|
default: true
|
||||||
nameplates.unequip:
|
nameplates.command.unequip:
|
||||||
default: true
|
default: true
|
||||||
nameplates.preview:
|
nameplates.command.preview:
|
||||||
default: true
|
default: true
|
||||||
nameplates.list:
|
nameplates.command.list:
|
||||||
default: true
|
default: true
|
||||||
customnameplates.admin:
|
customnameplates.admin:
|
||||||
default: op
|
default: op
|
||||||
bubbles.*:
|
bubbles.command.*:
|
||||||
description: Gives access to bubble all user commands
|
description: Gives access to bubble all user commands
|
||||||
children:
|
children:
|
||||||
bubbles.equip: true
|
bubbles.equip: true
|
||||||
bubbles.unequip: true
|
bubbles.unequip: true
|
||||||
bubbles.list: true
|
bubbles.list: true
|
||||||
bubbles.equip:
|
bubbles.command.equip:
|
||||||
default: true
|
default: true
|
||||||
bubbles.unequip:
|
bubbles.command.unequip:
|
||||||
default: true
|
default: true
|
||||||
bubbles.list:
|
bubbles.command.list:
|
||||||
default: true
|
default: true
|
||||||
bubbles.use:
|
bubbles.use:
|
||||||
default: false
|
default: true
|
||||||
Reference in New Issue
Block a user