Skip to content

Commit

Permalink
geyser
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiao-MoMi committed Feb 2, 2024
1 parent c279c9a commit 22a440a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ allprojects {
maven("https://repo.kryptonmc.org/releases")
maven("https://repo.oraxen.com/releases/")
maven("https://nexus.codecrafter47.de/content/repositories/public/")
maven("https://repo.opencollab.dev/main/")
}
}

Expand Down
1 change: 1 addition & 0 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
compileOnly("io.th0rgal:oraxen:1.165.0")
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")

// chat channels
compileOnly(files("libs/VentureChat-3.7.1.jar"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.momirealms.customnameplates.paper.mechanic.requirement.papi.PapiCondition;
import net.momirealms.customnameplates.paper.util.ClassUtils;
import net.momirealms.customnameplates.paper.util.ConfigUtils;
import net.momirealms.customnameplates.paper.util.GeyserUtils;
import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.potion.PotionEffect;
Expand Down Expand Up @@ -121,6 +122,7 @@ private void registerInbuiltRequirements() {
this.registerPapiRequirement();
this.registerInListRequirement();
this.registerGameModeRequirement();
this.registerGeyserRequirement();
}

/**
Expand Down Expand Up @@ -289,6 +291,19 @@ private void registerRandomRequirement() {
});
}

private void registerGeyserRequirement() {
registerRequirement("geyser", (args) -> {
boolean arg = (boolean) args;
return condition -> {
if (arg) {
return GeyserUtils.isBedrockPlayer(condition.getOfflinePlayer().getUniqueId());
} else {
return !GeyserUtils.isBedrockPlayer(condition.getOfflinePlayer().getUniqueId());
}
};
});
}

private void registerBiomeRequirement() {
registerRequirement("biome", (args) -> {
HashSet<String> biomes = new HashSet<>(ConfigUtils.stringListArgs(args));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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 org.geysermc.api.Geyser;

import java.util.UUID;

public class GeyserUtils {

public static boolean isBedrockPlayer(UUID uuid) {
return Geyser.api().isBedrockPlayer(uuid);
}
}

0 comments on commit 22a440a

Please sign in to comment.