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 {
|
allprojects {
|
||||||
|
|
||||||
version = "2.3.3.0"
|
version = "2.3.3.1"
|
||||||
|
|
||||||
apply<JavaPlugin>()
|
apply<JavaPlugin>()
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
@@ -44,6 +44,7 @@ allprojects {
|
|||||||
maven("https://repo.oraxen.com/releases/")
|
maven("https://repo.oraxen.com/releases/")
|
||||||
maven("https://nexus.codecrafter47.de/content/repositories/public/")
|
maven("https://nexus.codecrafter47.de/content/repositories/public/")
|
||||||
maven("https://repo.opencollab.dev/main/")
|
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("com.github.FrancoBM12:API-MagicCosmetics:2.2.5")
|
||||||
compileOnly("commons-io:commons-io:2.15.1")
|
compileOnly("commons-io:commons-io:2.15.1")
|
||||||
compileOnly("org.geysermc.geyser:api:2.2.0-SNAPSHOT")
|
compileOnly("org.geysermc.geyser:api:2.2.0-SNAPSHOT")
|
||||||
|
compileOnly("LibsDisguises:LibsDisguises:10.0.42")
|
||||||
|
|
||||||
// chat channels
|
// chat channels
|
||||||
compileOnly(files("libs/VentureChat-3.7.1.jar"))
|
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.image.OraxenImageImpl;
|
||||||
import net.momirealms.customnameplates.paper.mechanic.bubble.provider.*;
|
import net.momirealms.customnameplates.paper.mechanic.bubble.provider.*;
|
||||||
import net.momirealms.customnameplates.paper.setting.CNConfig;
|
import net.momirealms.customnameplates.paper.setting.CNConfig;
|
||||||
|
import net.momirealms.customnameplates.paper.util.DisguiseUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@@ -257,6 +258,10 @@ public class BubbleManagerImpl implements BubbleManager, Listener {
|
|||||||
|| !player.hasPermission("bubbles.use")
|
|| !player.hasPermission("bubbles.use")
|
||||||
) return;
|
) return;
|
||||||
|
|
||||||
|
if (CNConfig.hasLibsDisguise && DisguiseUtils.isDisguised(player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Bukkit.isPrimaryThread()) {
|
if (Bukkit.isPrimaryThread()) {
|
||||||
String finalText = text;
|
String finalText = text;
|
||||||
CustomNameplatesPlugin.get().getScheduler().runTaskAsync(() -> onChat(player, finalText));
|
CustomNameplatesPlugin.get().getScheduler().runTaskAsync(() -> onChat(player, finalText));
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class UnlimitedPlayer extends UnlimitedEntity implements EntityTagPlayer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
staticTags.add(tag);
|
staticTags.add(tag);
|
||||||
dynamicTagVectorToArray();
|
staticTagVectorToArray();
|
||||||
for (Player all : getNearbyPlayers()) {
|
for (Player all : getNearbyPlayers()) {
|
||||||
if (tag.getComeRule().isPassed(all, owner)) {
|
if (tag.getComeRule().isPassed(all, owner)) {
|
||||||
tag.addPlayerToViewers(all);
|
tag.addPlayerToViewers(all);
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ public class UnlimitedTagManagerImpl implements UnlimitedTagManager {
|
|||||||
if (spawned == null) return;
|
if (spawned == null) return;
|
||||||
UnlimitedEntity unlimitedEntity = getUnlimitedObject(spawned.getUniqueId());
|
UnlimitedEntity unlimitedEntity = getUnlimitedObject(spawned.getUniqueId());
|
||||||
if (unlimitedEntity == null) return;
|
if (unlimitedEntity == null) return;
|
||||||
|
if (receiver == spawned) return;
|
||||||
unlimitedEntity.addNearbyPlayerNaturally(receiver);
|
unlimitedEntity.addNearbyPlayerNaturally(receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ import net.momirealms.customnameplates.api.util.LogUtils;
|
|||||||
import net.momirealms.customnameplates.common.Pair;
|
import net.momirealms.customnameplates.common.Pair;
|
||||||
import net.momirealms.customnameplates.paper.CustomNameplatesPluginImpl;
|
import net.momirealms.customnameplates.paper.CustomNameplatesPluginImpl;
|
||||||
import net.momirealms.customnameplates.paper.mechanic.requirement.papi.PapiCondition;
|
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.ClassUtils;
|
||||||
import net.momirealms.customnameplates.paper.util.ConfigUtils;
|
import net.momirealms.customnameplates.paper.util.ConfigUtils;
|
||||||
|
import net.momirealms.customnameplates.paper.util.DisguiseUtils;
|
||||||
import net.momirealms.customnameplates.paper.util.GeyserUtils;
|
import net.momirealms.customnameplates.paper.util.GeyserUtils;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@@ -123,6 +125,7 @@ public class RequirementManagerImpl implements RequirementManager {
|
|||||||
this.registerInListRequirement();
|
this.registerInListRequirement();
|
||||||
this.registerGameModeRequirement();
|
this.registerGameModeRequirement();
|
||||||
this.registerGeyserRequirement();
|
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() {
|
private void registerBiomeRequirement() {
|
||||||
registerRequirement("biome", (args) -> {
|
registerRequirement("biome", (args) -> {
|
||||||
HashSet<String> biomes = new HashSet<>(ConfigUtils.stringListArgs(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.FontUtils;
|
||||||
import net.momirealms.customnameplates.api.util.LogUtils;
|
import net.momirealms.customnameplates.api.util.LogUtils;
|
||||||
import net.momirealms.customnameplates.paper.mechanic.bossbar.BarColor;
|
import net.momirealms.customnameplates.paper.mechanic.bossbar.BarColor;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@@ -85,6 +86,7 @@ public class CNConfig {
|
|||||||
public static boolean enableShader;
|
public static boolean enableShader;
|
||||||
public static boolean huskChatChannel;
|
public static boolean huskChatChannel;
|
||||||
public static boolean carbonChatChannel;
|
public static boolean carbonChatChannel;
|
||||||
|
public static boolean hasLibsDisguise;
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
try {
|
try {
|
||||||
@@ -176,6 +178,8 @@ public class CNConfig {
|
|||||||
|
|
||||||
legacyColorSupport = config.getBoolean("other-settings.legacy-color-code-support");
|
legacyColorSupport = config.getBoolean("other-settings.legacy-color-code-support");
|
||||||
createRealTeam = config.getBoolean("other-settings.create-real-teams", false);
|
createRealTeam = config.getBoolean("other-settings.create-real-teams", false);
|
||||||
|
|
||||||
|
hasLibsDisguise = Bukkit.getPluginManager().getPlugin("LibsDisguises") != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOtherTeamPluginHooked() {
|
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)
|
# Conditions (Owner side)
|
||||||
owner-conditions:
|
owner-conditions:
|
||||||
potion-effect: "INVISIBILITY<0"
|
potion-effect: "INVISIBILITY<0"
|
||||||
|
self-disguised: false # Requires LibsDisguises
|
||||||
# Conditions (Viewer side)
|
# Conditions (Viewer side)
|
||||||
viewer-conditions: { }
|
viewer-conditions: { }
|
||||||
tag_2:
|
tag_2:
|
||||||
@@ -42,6 +43,7 @@ unlimited:
|
|||||||
check-frequency: 20 # Decides the frequency of the condition check
|
check-frequency: 20 # Decides the frequency of the condition check
|
||||||
owner-conditions:
|
owner-conditions:
|
||||||
potion-effect: "INVISIBILITY<0"
|
potion-effect: "INVISIBILITY<0"
|
||||||
|
self-disguised: false
|
||||||
viewer-conditions:
|
viewer-conditions:
|
||||||
condition_1:
|
condition_1:
|
||||||
type: permission
|
type: permission
|
||||||
|
|||||||
Reference in New Issue
Block a user