mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 15:09:23 +00:00
compatibility with Libsdisguises
This commit is contained in:
@@ -7,7 +7,7 @@ plugins {
|
||||
|
||||
allprojects {
|
||||
|
||||
version = "2.3.3.0"
|
||||
version = "2.3.3.1"
|
||||
|
||||
apply<JavaPlugin>()
|
||||
apply(plugin = "java")
|
||||
@@ -44,6 +44,7 @@ allprojects {
|
||||
maven("https://repo.oraxen.com/releases/")
|
||||
maven("https://nexus.codecrafter47.de/content/repositories/public/")
|
||||
maven("https://repo.opencollab.dev/main/")
|
||||
maven("https://repo.md-5.net/content/groups/public/")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ dependencies {
|
||||
compileOnly("com.github.FrancoBM12:API-MagicCosmetics:2.2.5")
|
||||
compileOnly("commons-io:commons-io:2.15.1")
|
||||
compileOnly("org.geysermc.geyser:api:2.2.0-SNAPSHOT")
|
||||
compileOnly("LibsDisguises:LibsDisguises:10.0.42")
|
||||
|
||||
// chat channels
|
||||
compileOnly(files("libs/VentureChat-3.7.1.jar"))
|
||||
|
||||
@@ -41,6 +41,7 @@ import net.momirealms.customnameplates.paper.mechanic.bubble.image.ItemsAdderIma
|
||||
import net.momirealms.customnameplates.paper.mechanic.bubble.image.OraxenImageImpl;
|
||||
import net.momirealms.customnameplates.paper.mechanic.bubble.provider.*;
|
||||
import net.momirealms.customnameplates.paper.setting.CNConfig;
|
||||
import net.momirealms.customnameplates.paper.util.DisguiseUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -257,6 +258,10 @@ public class BubbleManagerImpl implements BubbleManager, Listener {
|
||||
|| !player.hasPermission("bubbles.use")
|
||||
) return;
|
||||
|
||||
if (CNConfig.hasLibsDisguise && DisguiseUtils.isDisguised(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
String finalText = text;
|
||||
CustomNameplatesPlugin.get().getScheduler().runTaskAsync(() -> onChat(player, finalText));
|
||||
|
||||
@@ -65,7 +65,7 @@ public class UnlimitedPlayer extends UnlimitedEntity implements EntityTagPlayer
|
||||
return;
|
||||
}
|
||||
staticTags.add(tag);
|
||||
dynamicTagVectorToArray();
|
||||
staticTagVectorToArray();
|
||||
for (Player all : getNearbyPlayers()) {
|
||||
if (tag.getComeRule().isPassed(all, owner)) {
|
||||
tag.addPlayerToViewers(all);
|
||||
|
||||
@@ -174,6 +174,7 @@ public class UnlimitedTagManagerImpl implements UnlimitedTagManager {
|
||||
if (spawned == null) return;
|
||||
UnlimitedEntity unlimitedEntity = getUnlimitedObject(spawned.getUniqueId());
|
||||
if (unlimitedEntity == null) return;
|
||||
if (receiver == spawned) return;
|
||||
unlimitedEntity.addNearbyPlayerNaturally(receiver);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,10 @@ import net.momirealms.customnameplates.api.util.LogUtils;
|
||||
import net.momirealms.customnameplates.common.Pair;
|
||||
import net.momirealms.customnameplates.paper.CustomNameplatesPluginImpl;
|
||||
import net.momirealms.customnameplates.paper.mechanic.requirement.papi.PapiCondition;
|
||||
import net.momirealms.customnameplates.paper.setting.CNConfig;
|
||||
import net.momirealms.customnameplates.paper.util.ClassUtils;
|
||||
import net.momirealms.customnameplates.paper.util.ConfigUtils;
|
||||
import net.momirealms.customnameplates.paper.util.DisguiseUtils;
|
||||
import net.momirealms.customnameplates.paper.util.GeyserUtils;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@@ -123,6 +125,7 @@ public class RequirementManagerImpl implements RequirementManager {
|
||||
this.registerInListRequirement();
|
||||
this.registerGameModeRequirement();
|
||||
this.registerGeyserRequirement();
|
||||
this.registerDisguisedRequirement();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,6 +307,20 @@ public class RequirementManagerImpl implements RequirementManager {
|
||||
});
|
||||
}
|
||||
|
||||
private void registerDisguisedRequirement() {
|
||||
registerRequirement("self-disguised", (args) -> {
|
||||
boolean arg = (boolean) args;
|
||||
return condition -> {
|
||||
if (!CNConfig.hasLibsDisguise) return true;
|
||||
if (arg) {
|
||||
return DisguiseUtils.isDisguised(condition.getOfflinePlayer().getPlayer());
|
||||
} else {
|
||||
return !DisguiseUtils.isDisguised(condition.getOfflinePlayer().getPlayer());
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private void registerBiomeRequirement() {
|
||||
registerRequirement("biome", (args) -> {
|
||||
HashSet<String> biomes = new HashSet<>(ConfigUtils.stringListArgs(args));
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.momirealms.customnameplates.api.mechanic.character.CharacterArranger;
|
||||
import net.momirealms.customnameplates.api.util.FontUtils;
|
||||
import net.momirealms.customnameplates.api.util.LogUtils;
|
||||
import net.momirealms.customnameplates.paper.mechanic.bossbar.BarColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -85,6 +86,7 @@ public class CNConfig {
|
||||
public static boolean enableShader;
|
||||
public static boolean huskChatChannel;
|
||||
public static boolean carbonChatChannel;
|
||||
public static boolean hasLibsDisguise;
|
||||
|
||||
public static void load() {
|
||||
try {
|
||||
@@ -176,6 +178,8 @@ public class CNConfig {
|
||||
|
||||
legacyColorSupport = config.getBoolean("other-settings.legacy-color-code-support");
|
||||
createRealTeam = config.getBoolean("other-settings.create-real-teams", false);
|
||||
|
||||
hasLibsDisguise = Bukkit.getPluginManager().getPlugin("LibsDisguises") != null;
|
||||
}
|
||||
|
||||
public static boolean isOtherTeamPluginHooked() {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.paper.util;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DisguiseUtils {
|
||||
|
||||
public static boolean isDisguised(Player player) {
|
||||
return DisguiseAPI.isSelfDisguised(player);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ unlimited:
|
||||
# Conditions (Owner side)
|
||||
owner-conditions:
|
||||
potion-effect: "INVISIBILITY<0"
|
||||
self-disguised: false # Requires LibsDisguises
|
||||
# Conditions (Viewer side)
|
||||
viewer-conditions: { }
|
||||
tag_2:
|
||||
@@ -42,6 +43,7 @@ unlimited:
|
||||
check-frequency: 20 # Decides the frequency of the condition check
|
||||
owner-conditions:
|
||||
potion-effect: "INVISIBILITY<0"
|
||||
self-disguised: false
|
||||
viewer-conditions:
|
||||
condition_1:
|
||||
type: permission
|
||||
|
||||
Reference in New Issue
Block a user