mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
Added bedrock requirements
This commit is contained in:
@@ -77,11 +77,13 @@ public class EffectModifierImpl implements EffectModifier {
|
||||
}
|
||||
@Override
|
||||
public Builder requirements(List<Requirement<Player>> requirements) {
|
||||
if (requirements == null) return this;
|
||||
this.requirements.addAll(requirements);
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Builder modifiers(List<TriConsumer<Effect, Context<Player>, Integer>> modifiers) {
|
||||
if (modifiers == null) return this;
|
||||
this.modifiers.addAll(modifiers);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ repositories {
|
||||
maven("https://nexus.betonquest.org/repository/betonquest/") // betonquest
|
||||
maven("https://repo.dmulloy2.net/repository/public/") // betonquest needs packet wrapper?
|
||||
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
||||
maven("https://repo.opencollab.dev/main/") // geyser
|
||||
maven("https://repo.codemc.org/repository/maven-public/") // beauty quest
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -47,6 +49,7 @@ dependencies {
|
||||
compileOnly(files("libs/BattlePass-4.0.6-api.jar"))
|
||||
compileOnly(files("libs/ClueScrolls-4.8.7-api.jar"))
|
||||
compileOnly(files("libs/notquests-5.17.1.jar"))
|
||||
compileOnly(files("libs/beautyquests-1.0.4.jar"))
|
||||
compileOnly("org.betonquest:betonquest:2.1.3")
|
||||
// item
|
||||
compileOnly(files("libs/zaphkiel-2.0.24.jar"))
|
||||
@@ -72,6 +75,10 @@ dependencies {
|
||||
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9")
|
||||
// cache
|
||||
compileOnly("com.github.ben-manes.caffeine:caffeine:${rootProject.properties["caffeine_version"]}")
|
||||
// Geyser
|
||||
compileOnly("org.geysermc.geyser:api:2.4.2-SNAPSHOT")
|
||||
// Floodgate
|
||||
compileOnly("org.geysermc.floodgate:api:2.2.3-SNAPSHOT")
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
BIN
compatibility/libs/beautyquests-1.0.4.jar
Normal file
BIN
compatibility/libs/beautyquests-1.0.4.jar
Normal file
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) <2024> <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.customfishing.bukkit.integration.bedrock;
|
||||
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class FloodGateUtils {
|
||||
|
||||
public static boolean isBedrockPlayer(UUID uuid) {
|
||||
return FloodgateApi.getInstance().isFloodgatePlayer(uuid);
|
||||
}
|
||||
}
|
||||
@@ -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.customfishing.bukkit.integration.bedrock;
|
||||
|
||||
import org.geysermc.api.Geyser;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class GeyserUtils {
|
||||
|
||||
public static boolean isBedrockPlayer(UUID uuid) {
|
||||
return Geyser.api().isBedrockPlayer(uuid);
|
||||
}
|
||||
}
|
||||
@@ -127,8 +127,9 @@ public class AuraSkillItemProvider implements ItemProvider {
|
||||
return new ItemStack(Material.AIR);
|
||||
} else if (selectedLoot instanceof EntityLoot entityLoot && fishHook != null) {
|
||||
giveFishingEntityLoot(context.holder(), entityLoot, source, skill, fishHook);
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
break;
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,11 +54,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class BukkitIntegrationManager implements IntegrationManager {
|
||||
|
||||
private static BukkitIntegrationManager instance;
|
||||
private final BukkitCustomFishingPlugin plugin;
|
||||
private final HashMap<String, LevelerProvider> levelerProviders = new HashMap<>();
|
||||
private final HashMap<String, EnchantmentProvider> enchantmentProviders = new HashMap<>();
|
||||
private SeasonProvider seasonProvider;
|
||||
private boolean hasFloodGate;
|
||||
private boolean hasGeyser;
|
||||
|
||||
public BukkitIntegrationManager(BukkitCustomFishingPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
@@ -66,9 +68,23 @@ public class BukkitIntegrationManager implements IntegrationManager {
|
||||
this.load();
|
||||
} catch (Exception e) {
|
||||
plugin.getPluginLogger().warn("Failed to load integrations", e);
|
||||
} finally {
|
||||
instance = this;
|
||||
}
|
||||
}
|
||||
|
||||
public static BukkitIntegrationManager instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public boolean hasFloodGate() {
|
||||
return hasFloodGate;
|
||||
}
|
||||
|
||||
public boolean hasGeyser() {
|
||||
return hasGeyser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
this.enchantmentProviders.clear();
|
||||
@@ -195,6 +211,12 @@ public class BukkitIntegrationManager implements IntegrationManager {
|
||||
if (isHooked("ShopGUIPlus")) {
|
||||
ShopGUIHook.register();
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Geyser-Spigot") != null) {
|
||||
this.hasGeyser = true;
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("floodgate") != null) {
|
||||
this.hasFloodGate = true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isHooked(String hooked) {
|
||||
|
||||
@@ -37,7 +37,10 @@ import net.momirealms.customfishing.api.mechanic.requirement.RequirementManager;
|
||||
import net.momirealms.customfishing.api.mechanic.totem.ActiveTotemList;
|
||||
import net.momirealms.customfishing.api.util.MiscUtils;
|
||||
import net.momirealms.customfishing.api.util.MoonPhase;
|
||||
import net.momirealms.customfishing.bukkit.integration.BukkitIntegrationManager;
|
||||
import net.momirealms.customfishing.bukkit.integration.VaultHook;
|
||||
import net.momirealms.customfishing.bukkit.integration.bedrock.FloodGateUtils;
|
||||
import net.momirealms.customfishing.bukkit.integration.bedrock.GeyserUtils;
|
||||
import net.momirealms.customfishing.common.util.ClassUtils;
|
||||
import net.momirealms.customfishing.common.util.ListUtils;
|
||||
import net.momirealms.customfishing.common.util.Pair;
|
||||
@@ -208,6 +211,33 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
||||
this.registerIsFirstLootRequirement();
|
||||
this.registerHasPlayerLootRequirement();
|
||||
this.registerLootOrderRequirement();
|
||||
this.registerIsBedrockPlayerRequirement();
|
||||
}
|
||||
|
||||
private void registerIsBedrockPlayerRequirement() {
|
||||
registerRequirement(((args, actions, runActions) -> context -> {
|
||||
boolean arg = (boolean) args;
|
||||
if (BukkitIntegrationManager.instance().hasGeyser()) {
|
||||
boolean is = GeyserUtils.isBedrockPlayer(context.holder().getUniqueId());
|
||||
if (is && arg) {
|
||||
return true;
|
||||
}
|
||||
if (!is && !arg) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (BukkitIntegrationManager.instance().hasFloodGate()) {
|
||||
boolean is = FloodGateUtils.isBedrockPlayer(context.holder().getUniqueId());
|
||||
if (is && arg) {
|
||||
return true;
|
||||
}
|
||||
if (!is && !arg) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (runActions) ActionManager.trigger(context, actions);
|
||||
return false;
|
||||
}), "is-bedrock-player");
|
||||
}
|
||||
|
||||
private void registerImpossibleRequirement() {
|
||||
|
||||
@@ -18,10 +18,10 @@ mechanics:
|
||||
value:
|
||||
- blacklist_world
|
||||
# If you want to allow some players to skip the game, set skip requirements here
|
||||
# We've used the 'impossible' requirement here, meaning players cannot skip the game if it exists
|
||||
skip-game-requirements:
|
||||
impossible_requirement:
|
||||
type: 'impossible'
|
||||
bedrock_requirement:
|
||||
type: 'is-bedrock-player'
|
||||
value: true
|
||||
# Conditions for enabling auto-fishing
|
||||
auto-fishing-requirements:
|
||||
impossible_requirement:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Project settings
|
||||
# Rule: [major update].[feature update].[bug fix]
|
||||
project_version=2.3.5
|
||||
project_version=2.3.6
|
||||
config_version=38
|
||||
project_group=net.momirealms
|
||||
|
||||
|
||||
Reference in New Issue
Block a user