mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-28 11:29:15 +00:00
Added bedrock requirements
This commit is contained in:
@@ -77,11 +77,13 @@ public class EffectModifierImpl implements EffectModifier {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Builder requirements(List<Requirement<Player>> requirements) {
|
public Builder requirements(List<Requirement<Player>> requirements) {
|
||||||
|
if (requirements == null) return this;
|
||||||
this.requirements.addAll(requirements);
|
this.requirements.addAll(requirements);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Builder modifiers(List<TriConsumer<Effect, Context<Player>, Integer>> modifiers) {
|
public Builder modifiers(List<TriConsumer<Effect, Context<Player>, Integer>> modifiers) {
|
||||||
|
if (modifiers == null) return this;
|
||||||
this.modifiers.addAll(modifiers);
|
this.modifiers.addAll(modifiers);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ repositories {
|
|||||||
maven("https://nexus.betonquest.org/repository/betonquest/") // betonquest
|
maven("https://nexus.betonquest.org/repository/betonquest/") // betonquest
|
||||||
maven("https://repo.dmulloy2.net/repository/public/") // betonquest needs packet wrapper?
|
maven("https://repo.dmulloy2.net/repository/public/") // betonquest needs packet wrapper?
|
||||||
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
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 {
|
dependencies {
|
||||||
@@ -47,6 +49,7 @@ dependencies {
|
|||||||
compileOnly(files("libs/BattlePass-4.0.6-api.jar"))
|
compileOnly(files("libs/BattlePass-4.0.6-api.jar"))
|
||||||
compileOnly(files("libs/ClueScrolls-4.8.7-api.jar"))
|
compileOnly(files("libs/ClueScrolls-4.8.7-api.jar"))
|
||||||
compileOnly(files("libs/notquests-5.17.1.jar"))
|
compileOnly(files("libs/notquests-5.17.1.jar"))
|
||||||
|
compileOnly(files("libs/beautyquests-1.0.4.jar"))
|
||||||
compileOnly("org.betonquest:betonquest:2.1.3")
|
compileOnly("org.betonquest:betonquest:2.1.3")
|
||||||
// item
|
// item
|
||||||
compileOnly(files("libs/zaphkiel-2.0.24.jar"))
|
compileOnly(files("libs/zaphkiel-2.0.24.jar"))
|
||||||
@@ -72,6 +75,10 @@ dependencies {
|
|||||||
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9")
|
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9")
|
||||||
// cache
|
// cache
|
||||||
compileOnly("com.github.ben-manes.caffeine:caffeine:${rootProject.properties["caffeine_version"]}")
|
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 {
|
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);
|
return new ItemStack(Material.AIR);
|
||||||
} else if (selectedLoot instanceof EntityLoot entityLoot && fishHook != null) {
|
} else if (selectedLoot instanceof EntityLoot entityLoot && fishHook != null) {
|
||||||
giveFishingEntityLoot(context.holder(), entityLoot, source, skill, fishHook);
|
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;
|
import java.util.List;
|
||||||
|
|
||||||
public class BukkitIntegrationManager implements IntegrationManager {
|
public class BukkitIntegrationManager implements IntegrationManager {
|
||||||
|
private static BukkitIntegrationManager instance;
|
||||||
private final BukkitCustomFishingPlugin plugin;
|
private final BukkitCustomFishingPlugin plugin;
|
||||||
private final HashMap<String, LevelerProvider> levelerProviders = new HashMap<>();
|
private final HashMap<String, LevelerProvider> levelerProviders = new HashMap<>();
|
||||||
private final HashMap<String, EnchantmentProvider> enchantmentProviders = new HashMap<>();
|
private final HashMap<String, EnchantmentProvider> enchantmentProviders = new HashMap<>();
|
||||||
private SeasonProvider seasonProvider;
|
private SeasonProvider seasonProvider;
|
||||||
|
private boolean hasFloodGate;
|
||||||
|
private boolean hasGeyser;
|
||||||
|
|
||||||
public BukkitIntegrationManager(BukkitCustomFishingPlugin plugin) {
|
public BukkitIntegrationManager(BukkitCustomFishingPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@@ -66,9 +68,23 @@ public class BukkitIntegrationManager implements IntegrationManager {
|
|||||||
this.load();
|
this.load();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
plugin.getPluginLogger().warn("Failed to load integrations", 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
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
this.enchantmentProviders.clear();
|
this.enchantmentProviders.clear();
|
||||||
@@ -195,6 +211,12 @@ public class BukkitIntegrationManager implements IntegrationManager {
|
|||||||
if (isHooked("ShopGUIPlus")) {
|
if (isHooked("ShopGUIPlus")) {
|
||||||
ShopGUIHook.register();
|
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) {
|
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.mechanic.totem.ActiveTotemList;
|
||||||
import net.momirealms.customfishing.api.util.MiscUtils;
|
import net.momirealms.customfishing.api.util.MiscUtils;
|
||||||
import net.momirealms.customfishing.api.util.MoonPhase;
|
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.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.ClassUtils;
|
||||||
import net.momirealms.customfishing.common.util.ListUtils;
|
import net.momirealms.customfishing.common.util.ListUtils;
|
||||||
import net.momirealms.customfishing.common.util.Pair;
|
import net.momirealms.customfishing.common.util.Pair;
|
||||||
@@ -208,6 +211,33 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
this.registerIsFirstLootRequirement();
|
this.registerIsFirstLootRequirement();
|
||||||
this.registerHasPlayerLootRequirement();
|
this.registerHasPlayerLootRequirement();
|
||||||
this.registerLootOrderRequirement();
|
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() {
|
private void registerImpossibleRequirement() {
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ mechanics:
|
|||||||
value:
|
value:
|
||||||
- blacklist_world
|
- blacklist_world
|
||||||
# If you want to allow some players to skip the game, set skip requirements here
|
# 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:
|
skip-game-requirements:
|
||||||
impossible_requirement:
|
bedrock_requirement:
|
||||||
type: 'impossible'
|
type: 'is-bedrock-player'
|
||||||
|
value: true
|
||||||
# Conditions for enabling auto-fishing
|
# Conditions for enabling auto-fishing
|
||||||
auto-fishing-requirements:
|
auto-fishing-requirements:
|
||||||
impossible_requirement:
|
impossible_requirement:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Project settings
|
# Project settings
|
||||||
# Rule: [major update].[feature update].[bug fix]
|
# Rule: [major update].[feature update].[bug fix]
|
||||||
project_version=2.3.5
|
project_version=2.3.6
|
||||||
config_version=38
|
config_version=38
|
||||||
project_group=net.momirealms
|
project_group=net.momirealms
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user