added floodgate uuid check to bedrock utils
This commit is contained in:
1 parent
097222a565
commit
490d8b9891
1 file changed
+15
-4
@@ -5,21 +5,32 @@ import org.geysermc.cumulus.form.SimpleForm;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Floodgate {
|
||||
private static final FloodgateApi instance = FloodgateApi.getInstance();
|
||||
private static FloodgateApi api() {
|
||||
return FloodgateApi.getInstance();
|
||||
}
|
||||
|
||||
public static boolean isBedrock(Player p) {
|
||||
return instance.isFloodgatePlayer(p.getUniqueId());
|
||||
return api().isFloodgatePlayer(p.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the UUID has the format Floodgate uses for Bedrock players (most significant bits zero).
|
||||
* Works without the player being online and without the Floodgate API.
|
||||
*/
|
||||
public static boolean isFloodgateUuid(UUID uuid) {
|
||||
return uuid.getMostSignificantBits() == 0;
|
||||
}
|
||||
|
||||
public static FloodgatePlayer getBedrockPlayer(Player p) {
|
||||
return instance.getPlayer(p.getUniqueId());
|
||||
return api().getPlayer(p.getUniqueId());
|
||||
}
|
||||
|
||||
public static void runBedrockOnly(Player p, Consumer<FloodgatePlayer> callback) {
|
||||
if(isBedrock(p)) callback.accept(instance.getPlayer(p.getUniqueId()));
|
||||
if(isBedrock(p)) callback.accept(api().getPlayer(p.getUniqueId()));
|
||||
}
|
||||
|
||||
public static void runJavaOnly(Player p, Consumer<Player> callback) {
|
||||
|
||||
Reference in new issue
Block a user