mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
1.3.2.1
This commit is contained in:
@@ -8,4 +8,4 @@ https://afdian.net/@xiaomomi
|
|||||||
https://polymart.org/resource/customfishing.2723
|
https://polymart.org/resource/customfishing.2723
|
||||||
|
|
||||||
### About compilation
|
### About compilation
|
||||||
Some premium plugins are used as local libraries, but I give the links because I can't leak them on github.
|
./gradlew build
|
||||||
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'net.momirealms'
|
group = 'net.momirealms'
|
||||||
version = '1.3.2.0-hotfix'
|
version = '1.3.2.1'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {name = "aliyun-repo"; url = "https://maven.aliyun.com/repository/public/"}
|
maven {name = "aliyun-repo"; url = "https://maven.aliyun.com/repository/public/"}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import net.momirealms.customfishing.fishing.FishingCondition;
|
|||||||
import net.momirealms.customfishing.fishing.competition.Competition;
|
import net.momirealms.customfishing.fishing.competition.Competition;
|
||||||
import net.momirealms.customfishing.fishing.loot.DroppedItem;
|
import net.momirealms.customfishing.fishing.loot.DroppedItem;
|
||||||
import net.momirealms.customfishing.fishing.loot.Item;
|
import net.momirealms.customfishing.fishing.loot.Item;
|
||||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import net.momirealms.customfishing.manager.ConfigManager;
|
import net.momirealms.customfishing.manager.ConfigManager;
|
||||||
import net.momirealms.customfishing.util.ItemStackUtils;
|
import net.momirealms.customfishing.util.ItemStackUtils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -114,7 +114,7 @@ public class CustomFishingAPI {
|
|||||||
* @param player player
|
* @param player player
|
||||||
* @return loots
|
* @return loots
|
||||||
*/
|
*/
|
||||||
public static List<Loot> getLootsAt(Location location, Player player) {
|
public static List<LootImpl> getLootsAt(Location location, Player player) {
|
||||||
return CustomFishing.getInstance().getFishingManager().getPossibleLootList(new FishingCondition(location, player, null, null), false, CustomFishing.getInstance().getLootManager().getAllLoots());
|
return CustomFishing.getInstance().getFishingManager().getPossibleLootList(new FishingCondition(location, player, null, null), false, CustomFishing.getInstance().getLootManager().getAllLoots());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ public class CustomFishingAPI {
|
|||||||
* @param location location
|
* @param location location
|
||||||
* @return loots
|
* @return loots
|
||||||
*/
|
*/
|
||||||
public static List<Loot> getLootsAt(Location location) {
|
public static List<LootImpl> getLootsAt(Location location) {
|
||||||
return CustomFishing.getInstance().getFishingManager().getPossibleLootList(new FishingCondition(location, null, null, null), false, CustomFishing.getInstance().getLootManager().getAllLoots());
|
return CustomFishing.getInstance().getFishingManager().getPossibleLootList(new FishingCondition(location, null, null, null), false, CustomFishing.getInstance().getLootManager().getAllLoots());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ public class CustomFishingAPI {
|
|||||||
* @param id id
|
* @param id id
|
||||||
* @return loot
|
* @return loot
|
||||||
*/
|
*/
|
||||||
public static Loot getLootByID(String id) {
|
public static LootImpl getLootByID(String id) {
|
||||||
return CustomFishing.getInstance().getLootManager().getLoot(id);
|
return CustomFishing.getInstance().getLootManager().getLoot(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ public class CustomFishingAPI {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static ItemStack getLootItemByID(String id) {
|
public static ItemStack getLootItemByID(String id) {
|
||||||
return CustomFishing.getInstance().getIntegrationManager().build(id);
|
return CustomFishing.getInstance().getIntegrationManager().build(id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,7 +156,7 @@ public class CustomFishingAPI {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static ItemStack getLootItemByID(String id, @Nullable Player player) {
|
public static ItemStack getLootItemByID(String id, @Nullable Player player) {
|
||||||
Loot loot = CustomFishing.getInstance().getLootManager().getLoot(id);
|
LootImpl loot = CustomFishing.getInstance().getLootManager().getLoot(id);
|
||||||
if (!(loot instanceof DroppedItem droppedItem)) return new ItemStack(Material.AIR);
|
if (!(loot instanceof DroppedItem droppedItem)) return new ItemStack(Material.AIR);
|
||||||
return CustomFishing.getInstance().getFishingManager().getCustomFishingLootItemStack(droppedItem, player);
|
return CustomFishing.getInstance().getFishingManager().getCustomFishingLootItemStack(droppedItem, player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
package net.momirealms.customfishing.api.event;
|
package net.momirealms.customfishing.api.event;
|
||||||
|
|
||||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@@ -31,9 +31,9 @@ public class FishFinderEvent extends PlayerEvent implements Cancellable {
|
|||||||
private static final HandlerList handlerList = new HandlerList();
|
private static final HandlerList handlerList = new HandlerList();
|
||||||
|
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private final List<Loot> loots;
|
private final List<LootImpl> loots;
|
||||||
|
|
||||||
public FishFinderEvent(@NotNull Player who, List<Loot> loots) {
|
public FishFinderEvent(@NotNull Player who, List<LootImpl> loots) {
|
||||||
super(who);
|
super(who);
|
||||||
this.cancelled = false;
|
this.cancelled = false;
|
||||||
this.loots = loots;
|
this.loots = loots;
|
||||||
@@ -59,7 +59,7 @@ public class FishFinderEvent extends PlayerEvent implements Cancellable {
|
|||||||
return getHandlerList();
|
return getHandlerList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Loot> getLoots() {
|
public List<LootImpl> getLoots() {
|
||||||
return loots;
|
return loots;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
package net.momirealms.customfishing.api.event;
|
package net.momirealms.customfishing.api.event;
|
||||||
|
|
||||||
import net.momirealms.customfishing.fishing.FishResult;
|
import net.momirealms.customfishing.fishing.FishResult;
|
||||||
|
import net.momirealms.customfishing.fishing.loot.Loot;
|
||||||
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@@ -31,17 +33,19 @@ public class FishResultEvent extends PlayerEvent implements Cancellable {
|
|||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private boolean isDouble;
|
private boolean isDouble;
|
||||||
private final FishResult result;
|
private final FishResult result;
|
||||||
private final ItemStack loot;
|
private final ItemStack itemStack;
|
||||||
private final String loot_id;
|
private final String loot_id;
|
||||||
|
private final Loot loot;
|
||||||
private static final HandlerList handlerList = new HandlerList();
|
private static final HandlerList handlerList = new HandlerList();
|
||||||
|
|
||||||
public FishResultEvent(@NotNull Player who, FishResult result, boolean isDouble, @Nullable ItemStack loot, @Nullable String loot_id) {
|
public FishResultEvent(@NotNull Player who, FishResult result, boolean isDouble, @Nullable ItemStack itemStack, @Nullable String loot_id, @Nullable Loot loot) {
|
||||||
super(who);
|
super(who);
|
||||||
this.cancelled = false;
|
this.cancelled = false;
|
||||||
this.result = result;
|
this.result = result;
|
||||||
this.isDouble = isDouble;
|
this.isDouble = isDouble;
|
||||||
this.loot = loot;
|
this.itemStack = itemStack;
|
||||||
this.loot_id = loot_id;
|
this.loot_id = loot_id;
|
||||||
|
this.loot = loot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -78,8 +82,8 @@ public class FishResultEvent extends PlayerEvent implements Cancellable {
|
|||||||
* @return loot id
|
* @return loot id
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public ItemStack getLoot() {
|
public ItemStack getItemStack() {
|
||||||
return loot;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDouble(boolean willDouble) {
|
public void setDouble(boolean willDouble) {
|
||||||
@@ -100,4 +104,8 @@ public class FishResultEvent extends PlayerEvent implements Cancellable {
|
|||||||
public String getLootID() {
|
public String getLootID() {
|
||||||
return loot_id;
|
return loot_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Loot getLoot() {
|
||||||
|
return loot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
package net.momirealms.customfishing.api.event;
|
package net.momirealms.customfishing.api.event;
|
||||||
|
|
||||||
import net.momirealms.customfishing.fishing.Effect;
|
import net.momirealms.customfishing.fishing.Effect;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import net.momirealms.customfishing.CustomFishing;
|
|||||||
import net.momirealms.customfishing.api.CustomFishingAPI;
|
import net.momirealms.customfishing.api.CustomFishingAPI;
|
||||||
import net.momirealms.customfishing.commands.AbstractSubCommand;
|
import net.momirealms.customfishing.commands.AbstractSubCommand;
|
||||||
import net.momirealms.customfishing.fishing.Effect;
|
import net.momirealms.customfishing.fishing.Effect;
|
||||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import net.momirealms.customfishing.integration.SeasonInterface;
|
import net.momirealms.customfishing.integration.SeasonInterface;
|
||||||
import net.momirealms.customfishing.util.AdventureUtils;
|
import net.momirealms.customfishing.util.AdventureUtils;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -62,13 +62,13 @@ public class DebugCommand extends AbstractSubCommand {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> getLootProbability(Effect initialEffect, List<Loot> possibleLoots) {
|
public ArrayList<String> getLootProbability(Effect initialEffect, List<LootImpl> possibleLoots) {
|
||||||
List<Loot> availableLoots = new ArrayList<>();
|
List<LootImpl> availableLoots = new ArrayList<>();
|
||||||
HashMap<String, Integer> as = initialEffect.getWeightAS();
|
HashMap<String, Integer> as = initialEffect.getWeightAS();
|
||||||
HashMap<String, Double> md = initialEffect.getWeightMD();
|
HashMap<String, Double> md = initialEffect.getWeightMD();
|
||||||
double[] weights = new double[possibleLoots.size()];
|
double[] weights = new double[possibleLoots.size()];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Loot loot : possibleLoots){
|
for (LootImpl loot : possibleLoots){
|
||||||
double weight = loot.getWeight();
|
double weight = loot.getWeight();
|
||||||
String group = loot.getGroup();
|
String group = loot.getGroup();
|
||||||
if (group != null){
|
if (group != null){
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package net.momirealms.customfishing.commands.subcmd;
|
|||||||
|
|
||||||
import net.momirealms.customfishing.CustomFishing;
|
import net.momirealms.customfishing.CustomFishing;
|
||||||
import net.momirealms.customfishing.commands.AbstractSubCommand;
|
import net.momirealms.customfishing.commands.AbstractSubCommand;
|
||||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import net.momirealms.customfishing.manager.ConfigManager;
|
import net.momirealms.customfishing.manager.ConfigManager;
|
||||||
import net.momirealms.customfishing.manager.MessageManager;
|
import net.momirealms.customfishing.manager.MessageManager;
|
||||||
import net.momirealms.customfishing.util.AdventureUtils;
|
import net.momirealms.customfishing.util.AdventureUtils;
|
||||||
@@ -59,7 +59,7 @@ public class StatisticsCommand extends AbstractSubCommand {
|
|||||||
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.negativeStatistics);
|
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.negativeStatistics);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Loot loot = CustomFishing.getInstance().getLootManager().getLoot(args.get(1));
|
LootImpl loot = CustomFishing.getInstance().getLootManager().getLoot(args.get(1));
|
||||||
if (loot == null || loot.isDisableStats()) {
|
if (loot == null || loot.isDisableStats()) {
|
||||||
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.statisticsNotExists);
|
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.statisticsNotExists);
|
||||||
return true;
|
return true;
|
||||||
@@ -79,7 +79,7 @@ public class StatisticsCommand extends AbstractSubCommand {
|
|||||||
if (args.size() == 2) {
|
if (args.size() == 2) {
|
||||||
return CustomFishing.getInstance().getLootManager().getAllLoots().stream()
|
return CustomFishing.getInstance().getLootManager().getAllLoots().stream()
|
||||||
.filter(loot -> loot.getKey().startsWith(args.get(1)) && !loot.isDisableStats())
|
.filter(loot -> loot.getKey().startsWith(args.get(1)) && !loot.isDisableStats())
|
||||||
.map(Loot::getKey)
|
.map(LootImpl::getKey)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
if (args.size() == 3) {
|
if (args.size() == 3) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package net.momirealms.customfishing.data;
|
|||||||
|
|
||||||
import net.momirealms.customfishing.CustomFishing;
|
import net.momirealms.customfishing.CustomFishing;
|
||||||
import net.momirealms.customfishing.fishing.action.Action;
|
import net.momirealms.customfishing.fishing.action.Action;
|
||||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -68,7 +68,7 @@ public class PlayerStatisticsData {
|
|||||||
return joiner.toString();
|
return joiner.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFishAmount(Loot loot, UUID uuid, int amount) {
|
public void addFishAmount(LootImpl loot, UUID uuid, int amount) {
|
||||||
Integer previous = amountMap.get(loot.getKey());
|
Integer previous = amountMap.get(loot.getKey());
|
||||||
if (previous == null) previous = 0;
|
if (previous == null) previous = 0;
|
||||||
int after = previous + amount;
|
int after = previous + amount;
|
||||||
@@ -79,7 +79,7 @@ public class PlayerStatisticsData {
|
|||||||
doSuccessTimesAction(previous, after, player, loot);
|
doSuccessTimesAction(previous, after, player, loot);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSuccessTimesAction(Integer previous, int after, Player player, Loot vanilla) {
|
private void doSuccessTimesAction(Integer previous, int after, Player player, LootImpl vanilla) {
|
||||||
HashMap<Integer, Action[]> actionMap = vanilla.getSuccessTimesActions();
|
HashMap<Integer, Action[]> actionMap = vanilla.getSuccessTimesActions();
|
||||||
if (actionMap != null) {
|
if (actionMap != null) {
|
||||||
for (Map.Entry<Integer, Action[]> entry : actionMap.entrySet()) {
|
for (Map.Entry<Integer, Action[]> entry : actionMap.entrySet()) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package net.momirealms.customfishing.fishing;
|
|||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
import net.kyori.adventure.sound.Sound;
|
import net.kyori.adventure.sound.Sound;
|
||||||
import net.momirealms.customfishing.CustomFishing;
|
import net.momirealms.customfishing.CustomFishing;
|
||||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import net.momirealms.customfishing.manager.ConfigManager;
|
import net.momirealms.customfishing.manager.ConfigManager;
|
||||||
import net.momirealms.customfishing.manager.FishingManager;
|
import net.momirealms.customfishing.manager.FishingManager;
|
||||||
import net.momirealms.customfishing.util.AdventureUtils;
|
import net.momirealms.customfishing.util.AdventureUtils;
|
||||||
@@ -140,7 +140,7 @@ public class BobberCheckTask implements Runnable {
|
|||||||
if (fishHook.isInWater()) {
|
if (fishHook.isInWater()) {
|
||||||
stop();
|
stop();
|
||||||
plugin.getScheduler().runTaskAsync(() -> {
|
plugin.getScheduler().runTaskAsync(() -> {
|
||||||
List<Loot> possibleLoots = new ArrayList<>();
|
List<LootImpl> possibleLoots = new ArrayList<>();
|
||||||
if (!(ConfigManager.needRodForLoot && !effect.hasSpecialRod())) {
|
if (!(ConfigManager.needRodForLoot && !effect.hasSpecialRod())) {
|
||||||
possibleLoots = fishingManager.getPossibleLootList(new FishingCondition(fishHook.getLocation(), player, rod, bait), false, plugin.getLootManager().getWaterLoots().values());
|
possibleLoots = fishingManager.getPossibleLootList(new FishingCondition(fishHook.getLocation(), player, rod, bait), false, plugin.getLootManager().getWaterLoots().values());
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ public class BobberCheckTask implements Runnable {
|
|||||||
|
|
||||||
private void randomTime() {
|
private void randomTime() {
|
||||||
plugin.getScheduler().runTaskAsync(() -> {
|
plugin.getScheduler().runTaskAsync(() -> {
|
||||||
List<Loot> possibleLoots = new ArrayList<>();
|
List<LootImpl> possibleLoots = new ArrayList<>();
|
||||||
if (!(ConfigManager.needRodForLoot && !effect.hasSpecialRod())) {
|
if (!(ConfigManager.needRodForLoot && !effect.hasSpecialRod())) {
|
||||||
possibleLoots = fishingManager.getPossibleLootList(new FishingCondition(fishHook.getLocation(), player, rod, bait), false, plugin.getLootManager().getLavaLoots().values());
|
possibleLoots = fishingManager.getPossibleLootList(new FishingCondition(fishHook.getLocation(), player, rod, bait), false, plugin.getLootManager().getLavaLoots().values());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import net.momirealms.customfishing.fishing.MiniGameConfig;
|
|||||||
import net.momirealms.customfishing.object.LeveledEnchantment;
|
import net.momirealms.customfishing.object.LeveledEnchantment;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class DroppedItem extends Loot {
|
public class DroppedItem extends LootImpl {
|
||||||
|
|
||||||
private final boolean randomDurability;
|
private final boolean randomDurability;
|
||||||
private LeveledEnchantment[] randomEnchants;
|
private LeveledEnchantment[] randomEnchants;
|
||||||
|
|||||||
@@ -1,20 +1,3 @@
|
|||||||
/*
|
|
||||||
* 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.fishing.loot;
|
package net.momirealms.customfishing.fishing.loot;
|
||||||
|
|
||||||
import net.momirealms.customfishing.fishing.MiniGameConfig;
|
import net.momirealms.customfishing.fishing.MiniGameConfig;
|
||||||
@@ -23,122 +6,35 @@ import net.momirealms.customfishing.fishing.requirements.RequirementInterface;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class Loot {
|
public interface Loot {
|
||||||
|
|
||||||
public static Loot EMPTY = new Loot("null", "null", new MiniGameConfig[0], 0, false, 0d, false, true);
|
MiniGameConfig[] getFishingGames();
|
||||||
|
|
||||||
protected final String key;
|
String getKey();
|
||||||
protected final String nick;
|
|
||||||
protected String group;
|
|
||||||
protected boolean disableStats;
|
|
||||||
protected boolean disableBar;
|
|
||||||
protected final boolean showInFinder;
|
|
||||||
protected Action[] successActions;
|
|
||||||
protected Action[] failureActions;
|
|
||||||
protected Action[] hookActions;
|
|
||||||
protected Action[] consumeActions;
|
|
||||||
protected HashMap<Integer, Action[]> successTimesActions;
|
|
||||||
protected RequirementInterface[] requirements;
|
|
||||||
protected final MiniGameConfig[] fishingGames;
|
|
||||||
protected final int weight;
|
|
||||||
protected final double score;
|
|
||||||
|
|
||||||
public Loot(String key, String nick, MiniGameConfig[] fishingGames, int weight, boolean showInFinder, double score, boolean disableBar, boolean disableStats) {
|
String getNick();
|
||||||
this.key = key;
|
|
||||||
this.nick = nick;
|
|
||||||
this.weight = weight;
|
|
||||||
this.showInFinder = showInFinder;
|
|
||||||
this.score = score;
|
|
||||||
this.fishingGames = fishingGames;
|
|
||||||
this.disableBar = disableBar;
|
|
||||||
this.disableStats = disableStats;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MiniGameConfig[] getFishingGames() {
|
String getGroup();
|
||||||
return fishingGames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey() {
|
boolean isShowInFinder();
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNick() {
|
Action[] getSuccessActions();
|
||||||
return nick;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGroup() {
|
public Action[] getFailureActions();
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroup(String group) {
|
public Action[] getConsumeActions();
|
||||||
this.group = group;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isShowInFinder() {
|
public Action[] getHookActions();
|
||||||
return showInFinder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action[] getSuccessActions() {
|
public int getWeight();
|
||||||
return successActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessActions(Action[] successActions) {
|
public double getScore();
|
||||||
this.successActions = successActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action[] getFailureActions() {
|
public RequirementInterface[] getRequirements();
|
||||||
return failureActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action[] getConsumeActions() {
|
public boolean isDisableBar();
|
||||||
return consumeActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConsumeActions(Action[] consumeActions) {
|
HashMap<Integer, Action[]> getSuccessTimesActions();
|
||||||
this.consumeActions = consumeActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFailureActions(Action[] failureActions) {
|
boolean isDisableStats();
|
||||||
this.failureActions = failureActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action[] getHookActions() {
|
|
||||||
return hookActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHookActions(Action[] hookActions) {
|
|
||||||
this.hookActions = hookActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWeight() {
|
|
||||||
return weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getScore() {
|
|
||||||
return score;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RequirementInterface[] getRequirements() {
|
|
||||||
return requirements;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRequirements(RequirementInterface[] requirements) {
|
|
||||||
this.requirements = requirements;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDisableBar() {
|
|
||||||
return disableBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<Integer, Action[]> getSuccessTimesActions() {
|
|
||||||
return successTimesActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccessTimesActions(HashMap<Integer, Action[]> successTimesActions) {
|
|
||||||
this.successTimesActions = successTimesActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDisableStats() {
|
|
||||||
return disableStats;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* 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.fishing.loot;
|
||||||
|
|
||||||
|
import net.momirealms.customfishing.fishing.MiniGameConfig;
|
||||||
|
import net.momirealms.customfishing.fishing.action.Action;
|
||||||
|
import net.momirealms.customfishing.fishing.requirements.RequirementInterface;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class LootImpl implements Loot {
|
||||||
|
|
||||||
|
public static LootImpl EMPTY = new LootImpl("null", "null", new MiniGameConfig[0], 0, false, 0d, false, true);
|
||||||
|
|
||||||
|
protected final String key;
|
||||||
|
protected final String nick;
|
||||||
|
protected String group;
|
||||||
|
protected boolean disableStats;
|
||||||
|
protected boolean disableBar;
|
||||||
|
protected final boolean showInFinder;
|
||||||
|
protected Action[] successActions;
|
||||||
|
protected Action[] failureActions;
|
||||||
|
protected Action[] hookActions;
|
||||||
|
protected Action[] consumeActions;
|
||||||
|
protected HashMap<Integer, Action[]> successTimesActions;
|
||||||
|
protected RequirementInterface[] requirements;
|
||||||
|
protected final MiniGameConfig[] fishingGames;
|
||||||
|
protected final int weight;
|
||||||
|
protected final double score;
|
||||||
|
|
||||||
|
public LootImpl(String key, String nick, MiniGameConfig[] fishingGames, int weight, boolean showInFinder, double score, boolean disableBar, boolean disableStats) {
|
||||||
|
this.key = key;
|
||||||
|
this.nick = nick;
|
||||||
|
this.weight = weight;
|
||||||
|
this.showInFinder = showInFinder;
|
||||||
|
this.score = score;
|
||||||
|
this.fishingGames = fishingGames;
|
||||||
|
this.disableBar = disableBar;
|
||||||
|
this.disableStats = disableStats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MiniGameConfig[] getFishingGames() {
|
||||||
|
return fishingGames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNick() {
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroup(String group) {
|
||||||
|
this.group = group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShowInFinder() {
|
||||||
|
return showInFinder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action[] getSuccessActions() {
|
||||||
|
return successActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccessActions(Action[] successActions) {
|
||||||
|
this.successActions = successActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action[] getFailureActions() {
|
||||||
|
return failureActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action[] getConsumeActions() {
|
||||||
|
return consumeActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConsumeActions(Action[] consumeActions) {
|
||||||
|
this.consumeActions = consumeActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFailureActions(Action[] failureActions) {
|
||||||
|
this.failureActions = failureActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action[] getHookActions() {
|
||||||
|
return hookActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHookActions(Action[] hookActions) {
|
||||||
|
this.hookActions = hookActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWeight() {
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getScore() {
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequirementInterface[] getRequirements() {
|
||||||
|
return requirements;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequirements(RequirementInterface[] requirements) {
|
||||||
|
this.requirements = requirements;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDisableBar() {
|
||||||
|
return disableBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<Integer, Action[]> getSuccessTimesActions() {
|
||||||
|
return successTimesActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccessTimesActions(HashMap<Integer, Action[]> successTimesActions) {
|
||||||
|
this.successTimesActions = successTimesActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDisableStats() {
|
||||||
|
return disableStats;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@ package net.momirealms.customfishing.fishing.loot;
|
|||||||
import net.momirealms.customfishing.fishing.MiniGameConfig;
|
import net.momirealms.customfishing.fishing.MiniGameConfig;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Mob extends Loot{
|
public class Mob extends LootImpl {
|
||||||
|
|
||||||
private final String mobID;
|
private final String mobID;
|
||||||
private final int mobLevel;
|
private final int mobLevel;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.momirealms.customfishing.integration;
|
package net.momirealms.customfishing.integration;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
public interface ItemInterface {
|
public interface ItemInterface {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
ItemStack build(String id);
|
ItemStack build(String id, Player player);
|
||||||
|
|
||||||
boolean loseCustomDurability(ItemStack itemStack, Player player);
|
boolean loseCustomDurability(ItemStack itemStack, Player player);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class CustomFishingItemImpl implements ItemInterface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public ItemStack build(String material) {
|
public ItemStack build(String material, Player player) {
|
||||||
if (material.contains(":")) return null;
|
if (material.contains(":")) return null;
|
||||||
return plugin.getLootManager().build(material);
|
return plugin.getLootManager().build(material);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class ItemsAdderItemImpl implements ItemInterface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public ItemStack build(String material) {
|
public ItemStack build(String material, Player player) {
|
||||||
if (!material.startsWith("ItemsAdder:")) return null;
|
if (!material.startsWith("ItemsAdder:")) return null;
|
||||||
material = material.substring(11);
|
material = material.substring(11);
|
||||||
CustomStack customStack = CustomStack.getInstance(material);
|
CustomStack customStack = CustomStack.getInstance(material);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class MMOItemsItemImpl implements ItemInterface {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ItemStack build(String material) {
|
public ItemStack build(String material, Player player) {
|
||||||
if (!material.startsWith("MMOItems:")) return null;
|
if (!material.startsWith("MMOItems:")) return null;
|
||||||
material = material.substring(9);
|
material = material.substring(9);
|
||||||
String[] split = material.split(":");
|
String[] split = material.split(":");
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class MythicMobsItemImpl implements ItemInterface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public ItemStack build(String material) {
|
public ItemStack build(String material, Player player) {
|
||||||
if (!material.startsWith("MythicMobs:")) return null;
|
if (!material.startsWith("MythicMobs:")) return null;
|
||||||
material = material.substring(11);
|
material = material.substring(11);
|
||||||
if (mythicBukkit == null || mythicBukkit.isClosed()) {
|
if (mythicBukkit == null || mythicBukkit.isClosed()) {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package net.momirealms.customfishing.integration.item;
|
||||||
|
|
||||||
|
import net.momirealms.customfishing.integration.ItemInterface;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import pers.neige.neigeitems.item.ItemDurability;
|
||||||
|
import pers.neige.neigeitems.item.ItemInfo;
|
||||||
|
import pers.neige.neigeitems.manager.ItemManager;
|
||||||
|
import pers.neige.neigeitems.utils.ItemUtils;
|
||||||
|
|
||||||
|
public class NeigeItemsImpl implements ItemInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable ItemStack build(String material, Player player) {
|
||||||
|
if (!material.startsWith("NeigeItems:")) return null;
|
||||||
|
material = material.substring(11);
|
||||||
|
return ItemManager.INSTANCE.getItemStack(material, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean loseCustomDurability(ItemStack itemStack, Player player) {
|
||||||
|
ItemInfo itemInfo = ItemUtils.isNiItem(itemStack);
|
||||||
|
if (itemInfo == null) return false;
|
||||||
|
ItemDurability.INSTANCE.damage(player, itemStack, 1, true, null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getID(ItemStack itemStack) {
|
||||||
|
ItemInfo itemInfo = ItemUtils.isNiItem(itemStack);
|
||||||
|
if (itemInfo != null) {
|
||||||
|
return itemInfo.getId();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ public class OraxenItemImpl implements ItemInterface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public ItemStack build(String material) {
|
public ItemStack build(String material, Player player) {
|
||||||
if (!material.startsWith("Oraxen:")) return null;
|
if (!material.startsWith("Oraxen:")) return null;
|
||||||
material = material.substring(7);
|
material = material.substring(7);
|
||||||
ItemBuilder itemBuilder = OraxenItems.getItemById(material);
|
ItemBuilder itemBuilder = OraxenItems.getItemById(material);
|
||||||
|
|||||||
@@ -21,21 +21,31 @@ import com.electro2560.dev.cluescrolls.api.*;
|
|||||||
import net.momirealms.customfishing.CustomFishing;
|
import net.momirealms.customfishing.CustomFishing;
|
||||||
import net.momirealms.customfishing.api.event.FishResultEvent;
|
import net.momirealms.customfishing.api.event.FishResultEvent;
|
||||||
import net.momirealms.customfishing.fishing.FishResult;
|
import net.momirealms.customfishing.fishing.FishResult;
|
||||||
|
import net.momirealms.customfishing.fishing.loot.Loot;
|
||||||
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
public class ClueScrollCFQuest implements Listener {
|
public class ClueScrollCFQuest implements Listener {
|
||||||
|
|
||||||
private final CustomClue commonClue;
|
private final CustomClue idClue;
|
||||||
|
private final CustomClue groupClue;
|
||||||
|
|
||||||
public ClueScrollCFQuest() {
|
public ClueScrollCFQuest() {
|
||||||
commonClue = ClueScrollsAPI.getInstance().registerCustomClue(CustomFishing.getInstance(), "fish", new ClueConfigData("fish_id", DataType.STRING));
|
idClue = ClueScrollsAPI.getInstance().registerCustomClue(CustomFishing.getInstance(), "fish", new ClueConfigData("fish_id", DataType.STRING));
|
||||||
|
groupClue = ClueScrollsAPI.getInstance().registerCustomClue(CustomFishing.getInstance(), "group", new ClueConfigData("fish_group", DataType.STRING));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFish(FishResultEvent event) {
|
public void onFish(FishResultEvent event) {
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
if (event.getResult() == FishResult.FAILURE) return;
|
if (event.getResult() == FishResult.FAILURE) return;
|
||||||
commonClue.handle(event.getPlayer(), event.isDouble() ? 2 : 1, new ClueDataPair("fish_id", event.getLoot_id()));
|
if (event.getLootID() != null) {
|
||||||
|
idClue.handle(event.getPlayer(), event.isDouble() ? 2 : 1, new ClueDataPair("fish_id", event.getLootID()));
|
||||||
|
}
|
||||||
|
Loot loot = event.getLoot();
|
||||||
|
if (loot != null && loot.getGroup() != null) {
|
||||||
|
groupClue.handle(event.getPlayer(), event.isDouble() ? 2 : 1, new ClueDataPair("fish_group", loot.getGroup()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import net.momirealms.customfishing.fishing.bar.ModeTwoBar;
|
|||||||
import net.momirealms.customfishing.fishing.competition.Competition;
|
import net.momirealms.customfishing.fishing.competition.Competition;
|
||||||
import net.momirealms.customfishing.fishing.competition.CompetitionGoal;
|
import net.momirealms.customfishing.fishing.competition.CompetitionGoal;
|
||||||
import net.momirealms.customfishing.fishing.loot.DroppedItem;
|
import net.momirealms.customfishing.fishing.loot.DroppedItem;
|
||||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import net.momirealms.customfishing.fishing.loot.Mob;
|
import net.momirealms.customfishing.fishing.loot.Mob;
|
||||||
import net.momirealms.customfishing.fishing.mode.FishingGame;
|
import net.momirealms.customfishing.fishing.mode.FishingGame;
|
||||||
import net.momirealms.customfishing.fishing.mode.ModeOneGame;
|
import net.momirealms.customfishing.fishing.mode.ModeOneGame;
|
||||||
@@ -91,7 +91,7 @@ public class FishingManager extends Function {
|
|||||||
private final BreakBlockListener breakBlockListener;
|
private final BreakBlockListener breakBlockListener;
|
||||||
private final HashMap<UUID, Long> coolDown;
|
private final HashMap<UUID, Long> coolDown;
|
||||||
private final HashMap<UUID, FishHook> hooks;
|
private final HashMap<UUID, FishHook> hooks;
|
||||||
private final HashMap<UUID, Loot> nextLoot;
|
private final HashMap<UUID, LootImpl> nextLoot;
|
||||||
private final HashMap<UUID, Effect> nextEffect;
|
private final HashMap<UUID, Effect> nextEffect;
|
||||||
private final HashMap<UUID, VanillaLoot> vanillaLoot;
|
private final HashMap<UUID, VanillaLoot> vanillaLoot;
|
||||||
private final ConcurrentHashMap<UUID, FishingGame> fishingPlayerMap;
|
private final ConcurrentHashMap<UUID, FishingGame> fishingPlayerMap;
|
||||||
@@ -247,7 +247,7 @@ public class FishingManager extends Function {
|
|||||||
|
|
||||||
this.nextEffect.put(player.getUniqueId(), initialEffect);
|
this.nextEffect.put(player.getUniqueId(), initialEffect);
|
||||||
if (ConfigManager.needRodToFish && !initialEffect.hasSpecialRod()) {
|
if (ConfigManager.needRodToFish && !initialEffect.hasSpecialRod()) {
|
||||||
this.nextLoot.put(player.getUniqueId(), Loot.EMPTY);
|
this.nextLoot.put(player.getUniqueId(), LootImpl.EMPTY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,8 +268,8 @@ public class FishingManager extends Function {
|
|||||||
showBar(event.getPlayer());
|
showBar(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getNextLoot(Player player, Effect initialEffect, List<Loot> possibleLoots) {
|
public void getNextLoot(Player player, Effect initialEffect, List<LootImpl> possibleLoots) {
|
||||||
List<Loot> availableLoots = new ArrayList<>();
|
List<LootImpl> availableLoots = new ArrayList<>();
|
||||||
if (possibleLoots.size() == 0){
|
if (possibleLoots.size() == 0){
|
||||||
nextLoot.put(player.getUniqueId(), null);
|
nextLoot.put(player.getUniqueId(), null);
|
||||||
return;
|
return;
|
||||||
@@ -280,7 +280,7 @@ public class FishingManager extends Function {
|
|||||||
|
|
||||||
double[] weights = new double[possibleLoots.size()];
|
double[] weights = new double[possibleLoots.size()];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Loot loot : possibleLoots){
|
for (LootImpl loot : possibleLoots){
|
||||||
double weight = loot.getWeight();
|
double weight = loot.getWeight();
|
||||||
String group = loot.getGroup();
|
String group = loot.getGroup();
|
||||||
if (group != null){
|
if (group != null){
|
||||||
@@ -330,8 +330,8 @@ public class FishingManager extends Function {
|
|||||||
// if the player is noy playing the game
|
// if the player is noy playing the game
|
||||||
if (fishingGame == null) {
|
if (fishingGame == null) {
|
||||||
// get his next loot
|
// get his next loot
|
||||||
Loot loot = nextLoot.get(uuid);
|
LootImpl loot = nextLoot.get(uuid);
|
||||||
if (loot == Loot.EMPTY) return;
|
if (loot == LootImpl.EMPTY) return;
|
||||||
|
|
||||||
if (ConfigManager.enableVanillaLoot) {
|
if (ConfigManager.enableVanillaLoot) {
|
||||||
// Not a vanilla loot
|
// Not a vanilla loot
|
||||||
@@ -407,8 +407,8 @@ public class FishingManager extends Function {
|
|||||||
//not in fishing game
|
//not in fishing game
|
||||||
BobberCheckTask bobberCheckTask = hookCheckTaskMap.get(uuid);
|
BobberCheckTask bobberCheckTask = hookCheckTaskMap.get(uuid);
|
||||||
if (bobberCheckTask != null && bobberCheckTask.isHooked()) {
|
if (bobberCheckTask != null && bobberCheckTask.isHooked()) {
|
||||||
Loot loot = nextLoot.get(uuid);
|
LootImpl loot = nextLoot.get(uuid);
|
||||||
if (loot == Loot.EMPTY || loot == null) return;
|
if (loot == LootImpl.EMPTY || loot == null) return;
|
||||||
if (loot.isDisableBar()) {
|
if (loot.isDisableBar()) {
|
||||||
noBarLavaReelIn(event);
|
noBarLavaReelIn(event);
|
||||||
return;
|
return;
|
||||||
@@ -445,7 +445,7 @@ public class FishingManager extends Function {
|
|||||||
event.setExpToDrop(0);
|
event.setExpToDrop(0);
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
Loot loot = nextLoot.remove(uuid);
|
LootImpl loot = nextLoot.remove(uuid);
|
||||||
VanillaLoot vanilla = vanillaLoot.remove(uuid);
|
VanillaLoot vanilla = vanillaLoot.remove(uuid);
|
||||||
Effect effect = nextEffect.remove(uuid);
|
Effect effect = nextEffect.remove(uuid);
|
||||||
if (vanilla != null) {
|
if (vanilla != null) {
|
||||||
@@ -467,7 +467,7 @@ public class FishingManager extends Function {
|
|||||||
final UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
BobberCheckTask bobberCheckTask = hookCheckTaskMap.remove(uuid);
|
BobberCheckTask bobberCheckTask = hookCheckTaskMap.remove(uuid);
|
||||||
if (bobberCheckTask != null && bobberCheckTask.isHooked()) {
|
if (bobberCheckTask != null && bobberCheckTask.isHooked()) {
|
||||||
Loot loot = nextLoot.remove(uuid);
|
LootImpl loot = nextLoot.remove(uuid);
|
||||||
VanillaLoot vanilla = vanillaLoot.remove(uuid);
|
VanillaLoot vanilla = vanillaLoot.remove(uuid);
|
||||||
Effect effect = nextEffect.remove(uuid);
|
Effect effect = nextEffect.remove(uuid);
|
||||||
if (vanilla != null) {
|
if (vanilla != null) {
|
||||||
@@ -488,7 +488,7 @@ public class FishingManager extends Function {
|
|||||||
public void proceedReelIn(Location hookLoc, Player player, FishingGame fishingGame) {
|
public void proceedReelIn(Location hookLoc, Player player, FishingGame fishingGame) {
|
||||||
fishingGame.cancel();
|
fishingGame.cancel();
|
||||||
final UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
Loot loot = nextLoot.remove(uuid);
|
LootImpl loot = nextLoot.remove(uuid);
|
||||||
VanillaLoot vanilla = vanillaLoot.remove(uuid);
|
VanillaLoot vanilla = vanillaLoot.remove(uuid);
|
||||||
Effect effect = nextEffect.remove(uuid);
|
Effect effect = nextEffect.remove(uuid);
|
||||||
player.removePotionEffect(PotionEffectType.SLOW);
|
player.removePotionEffect(PotionEffectType.SLOW);
|
||||||
@@ -516,7 +516,7 @@ public class FishingManager extends Function {
|
|||||||
|
|
||||||
private void dropCustomFishingLoot(Player player, Location location, DroppedItem droppedItem, boolean isDouble, double scoreMultiplier, double sizeMultiplier) {
|
private void dropCustomFishingLoot(Player player, Location location, DroppedItem droppedItem, boolean isDouble, double scoreMultiplier, double sizeMultiplier) {
|
||||||
ItemStack drop = getCustomFishingLootItemStack(droppedItem, player, sizeMultiplier);
|
ItemStack drop = getCustomFishingLootItemStack(droppedItem, player, sizeMultiplier);
|
||||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CATCH_SPECIAL_ITEM, isDouble, drop, droppedItem.getKey());
|
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CATCH_SPECIAL_ITEM, isDouble, drop, droppedItem.getKey(), droppedItem);
|
||||||
Bukkit.getPluginManager().callEvent(fishResultEvent);
|
Bukkit.getPluginManager().callEvent(fishResultEvent);
|
||||||
if (fishResultEvent.isCancelled()) {
|
if (fishResultEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@@ -547,7 +547,7 @@ public class FishingManager extends Function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getCustomFishingLootItemStack(DroppedItem droppedItem, @Nullable Player player, double sizeMultiplier) {
|
public ItemStack getCustomFishingLootItemStack(DroppedItem droppedItem, @Nullable Player player, double sizeMultiplier) {
|
||||||
ItemStack drop = plugin.getIntegrationManager().build(droppedItem.getMaterial());
|
ItemStack drop = plugin.getIntegrationManager().build(droppedItem.getMaterial(), player);
|
||||||
if (drop.getType() != Material.AIR) {
|
if (drop.getType() != Material.AIR) {
|
||||||
if (droppedItem.getRandomEnchants() != null)
|
if (droppedItem.getRandomEnchants() != null)
|
||||||
ItemStackUtils.addRandomEnchants(drop, droppedItem.getRandomEnchants());
|
ItemStackUtils.addRandomEnchants(drop, droppedItem.getRandomEnchants());
|
||||||
@@ -564,7 +564,7 @@ public class FishingManager extends Function {
|
|||||||
ItemStack itemStack = McMMOTreasure.getTreasure(player);
|
ItemStack itemStack = McMMOTreasure.getTreasure(player);
|
||||||
if (itemStack == null) return false;
|
if (itemStack == null) return false;
|
||||||
|
|
||||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CATCH_VANILLA_ITEM, isDouble, itemStack, "vanilla");
|
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CATCH_VANILLA_ITEM, isDouble, itemStack, "mcMMO", null);
|
||||||
Bukkit.getPluginManager().callEvent(fishResultEvent);
|
Bukkit.getPluginManager().callEvent(fishResultEvent);
|
||||||
if (fishResultEvent.isCancelled()) {
|
if (fishResultEvent.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
@@ -584,7 +584,7 @@ public class FishingManager extends Function {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CATCH_VANILLA_ITEM, isDouble, itemStack, "vanilla");
|
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CATCH_VANILLA_ITEM, isDouble, itemStack, "vanilla", null);
|
||||||
Bukkit.getPluginManager().callEvent(fishResultEvent);
|
Bukkit.getPluginManager().callEvent(fishResultEvent);
|
||||||
if (fishResultEvent.isCancelled()) {
|
if (fishResultEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@@ -600,7 +600,7 @@ public class FishingManager extends Function {
|
|||||||
Competition.currentCompetition.tryJoinCompetition(player);
|
Competition.currentCompetition.tryJoinCompetition(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
Loot vanilla = plugin.getLootManager().getVanilla_loot();
|
LootImpl vanilla = plugin.getLootManager().getVanilla_loot();
|
||||||
addStats(player, vanilla, isDouble ? 2 : 1);
|
addStats(player, vanilla, isDouble ? 2 : 1);
|
||||||
|
|
||||||
if (vanilla.getSuccessActions() != null)
|
if (vanilla.getSuccessActions() != null)
|
||||||
@@ -630,18 +630,18 @@ public class FishingManager extends Function {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addStats(Player player, Loot loot, int amount) {
|
private void addStats(Player player, LootImpl loot, int amount) {
|
||||||
player.setStatistic(Statistic.FISH_CAUGHT, player.getStatistic(Statistic.FISH_CAUGHT) + 1);
|
player.setStatistic(Statistic.FISH_CAUGHT, player.getStatistic(Statistic.FISH_CAUGHT) + 1);
|
||||||
if (!ConfigManager.enableStatistics) return;
|
if (!ConfigManager.enableStatistics) return;
|
||||||
if (loot.isDisableStats()) return;
|
if (loot.isDisableStats()) return;
|
||||||
plugin.getStatisticsManager().addFishAmount(player.getUniqueId(), loot, amount);
|
plugin.getStatisticsManager().addFishAmount(player.getUniqueId(), loot, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void summonMob(Player player, Loot loot, Location location, Mob mob, double scoreMultiplier) {
|
private void summonMob(Player player, LootImpl loot, Location location, Mob mob, double scoreMultiplier) {
|
||||||
MobInterface mobInterface = plugin.getIntegrationManager().getMobInterface();
|
MobInterface mobInterface = plugin.getIntegrationManager().getMobInterface();
|
||||||
if (mobInterface == null) return;
|
if (mobInterface == null) return;
|
||||||
|
|
||||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CATCH_MOB, false, null, loot.getKey());
|
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CATCH_MOB, false, null, loot.getKey(), loot);
|
||||||
if (fishResultEvent.isCancelled()) {
|
if (fishResultEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -731,8 +731,8 @@ public class FishingManager extends Function {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fail(Player player, Loot loot, boolean isVanilla) {
|
public void fail(Player player, LootImpl loot, boolean isVanilla) {
|
||||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.FAILURE, false, null, null);
|
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.FAILURE, false, null, null, null);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(fishResultEvent);
|
Bukkit.getServer().getPluginManager().callEvent(fishResultEvent);
|
||||||
if (fishResultEvent.isCancelled()) {
|
if (fishResultEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@@ -757,9 +757,9 @@ public class FishingManager extends Function {
|
|||||||
public void showBar(Player player) {
|
public void showBar(Player player) {
|
||||||
final UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
if (fishingPlayerMap.get(uuid) != null) return;
|
if (fishingPlayerMap.get(uuid) != null) return;
|
||||||
Loot loot = nextLoot.get(uuid);
|
LootImpl loot = nextLoot.get(uuid);
|
||||||
if (loot != null) {
|
if (loot != null) {
|
||||||
if (loot == Loot.EMPTY) return;
|
if (loot == LootImpl.EMPTY) return;
|
||||||
showFishingBar(player, loot);
|
showFishingBar(player, loot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -778,10 +778,10 @@ public class FishingManager extends Function {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Loot> getPossibleLootList(FishingCondition fishingCondition, boolean finder, Collection<Loot> values) {
|
public List<LootImpl> getPossibleLootList(FishingCondition fishingCondition, boolean finder, Collection<LootImpl> values) {
|
||||||
Stream<Loot> stream = values.stream();
|
Stream<LootImpl> stream = values.stream();
|
||||||
if (finder) {
|
if (finder) {
|
||||||
stream = stream.filter(Loot::isShowInFinder);
|
stream = stream.filter(LootImpl::isShowInFinder);
|
||||||
}
|
}
|
||||||
return stream.filter(loot -> {
|
return stream.filter(loot -> {
|
||||||
RequirementInterface[] requirements = loot.getRequirements();
|
RequirementInterface[] requirements = loot.getRequirements();
|
||||||
@@ -868,7 +868,7 @@ public class FishingManager extends Function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FishingCondition fishingCondition = new FishingCondition(player.getLocation(), player, null, null);
|
FishingCondition fishingCondition = new FishingCondition(player.getLocation(), player, null, null);
|
||||||
List<Loot> possibleLoots = getPossibleLootList(fishingCondition, true, plugin.getLootManager().getAllLoots());
|
List<LootImpl> possibleLoots = getPossibleLootList(fishingCondition, true, plugin.getLootManager().getAllLoots());
|
||||||
|
|
||||||
FishFinderEvent fishFinderEvent = new FishFinderEvent(player, possibleLoots);
|
FishFinderEvent fishFinderEvent = new FishFinderEvent(player, possibleLoots);
|
||||||
Bukkit.getPluginManager().callEvent(fishFinderEvent);
|
Bukkit.getPluginManager().callEvent(fishFinderEvent);
|
||||||
@@ -885,7 +885,7 @@ public class FishingManager extends Function {
|
|||||||
AdventureUtils.playerMessage(player, MessageManager.prefix + MessageManager.possibleLoots + stringJoiner);
|
AdventureUtils.playerMessage(player, MessageManager.prefix + MessageManager.possibleLoots + stringJoiner);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showFishingBar(Player player, @NotNull Loot loot) {
|
private void showFishingBar(Player player, @NotNull LootImpl loot) {
|
||||||
MiniGameConfig game = loot.getFishingGames() != null
|
MiniGameConfig game = loot.getFishingGames() != null
|
||||||
? loot.getFishingGames()[new Random().nextInt(loot.getFishingGames().length)]
|
? loot.getFishingGames()[new Random().nextInt(loot.getFishingGames().length)]
|
||||||
: plugin.getBarMechanicManager().getRandomGame();
|
: plugin.getBarMechanicManager().getRandomGame();
|
||||||
@@ -1013,7 +1013,7 @@ public class FishingManager extends Function {
|
|||||||
if (nbtCompound == null) return;
|
if (nbtCompound == null) return;
|
||||||
if (!nbtCompound.getString("type").equals("loot")) return;
|
if (!nbtCompound.getString("type").equals("loot")) return;
|
||||||
String lootKey = nbtCompound.getString("id");
|
String lootKey = nbtCompound.getString("id");
|
||||||
Loot loot = plugin.getLootManager().getLoot(lootKey);
|
LootImpl loot = plugin.getLootManager().getLoot(lootKey);
|
||||||
if (loot == null) return;
|
if (loot == null) return;
|
||||||
if (!(loot instanceof DroppedItem droppedItem)) return;
|
if (!(loot instanceof DroppedItem droppedItem)) return;
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|||||||
@@ -202,6 +202,10 @@ public class IntegrationManager extends Function {
|
|||||||
itemInterfaceList.add(new MythicMobsItemImpl());
|
itemInterfaceList.add(new MythicMobsItemImpl());
|
||||||
hookMessage("MythicMobs");
|
hookMessage("MythicMobs");
|
||||||
}
|
}
|
||||||
|
if (pluginManager.isPluginEnabled("NeigeItems")) {
|
||||||
|
itemInterfaceList.add(new NeigeItemsImpl());
|
||||||
|
hookMessage("NeigeItems");
|
||||||
|
}
|
||||||
itemInterfaceList.add(new CustomFishingItemImpl(plugin));
|
itemInterfaceList.add(new CustomFishingItemImpl(plugin));
|
||||||
this.itemInterfaces = itemInterfaceList.toArray(new ItemInterface[0]);
|
this.itemInterfaces = itemInterfaceList.toArray(new ItemInterface[0]);
|
||||||
|
|
||||||
@@ -271,7 +275,18 @@ public class IntegrationManager extends Function {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public ItemStack build(String key) {
|
public ItemStack build(String key) {
|
||||||
for (ItemInterface itemInterface : getItemInterfaces()) {
|
for (ItemInterface itemInterface : getItemInterfaces()) {
|
||||||
ItemStack itemStack = itemInterface.build(key);
|
ItemStack itemStack = itemInterface.build(key, null);
|
||||||
|
if (itemStack != null) {
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ItemStack(Material.AIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public ItemStack build(String key, Player player) {
|
||||||
|
for (ItemInterface itemInterface : getItemInterfaces()) {
|
||||||
|
ItemStack itemStack = itemInterface.build(key, player);
|
||||||
if (itemStack != null) {
|
if (itemStack != null) {
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
@@ -282,8 +297,8 @@ public class IntegrationManager extends Function {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public String getItemID(ItemStack itemStack) {
|
public String getItemID(ItemStack itemStack) {
|
||||||
if (itemStack == null || itemStack.getType() == Material.AIR) return null;
|
if (itemStack == null || itemStack.getType() == Material.AIR) return null;
|
||||||
for (ItemInterface itemInterface : getItemInterfaces()) {
|
for (int i = 0, size = itemInterfaces.length; i < size; i++) {
|
||||||
String id = itemInterface.getID(itemStack);
|
String id = itemInterfaces[size - i - 1].getID(itemStack);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ import java.util.*;
|
|||||||
public class LootManager extends Function {
|
public class LootManager extends Function {
|
||||||
|
|
||||||
private final CustomFishing plugin;
|
private final CustomFishing plugin;
|
||||||
private final HashMap<String, Loot> waterLoots;
|
private final HashMap<String, LootImpl> waterLoots;
|
||||||
private final HashMap<String, Loot> lavaLoots;
|
private final HashMap<String, LootImpl> lavaLoots;
|
||||||
private final HashMap<String, Item> lootItems;
|
private final HashMap<String, Item> lootItems;
|
||||||
private final HashMap<String, List<String>> category;
|
private final HashMap<String, List<String>> category;
|
||||||
private Loot vanilla_loot;
|
private LootImpl vanilla_loot;
|
||||||
|
|
||||||
public LootManager(CustomFishing plugin) {
|
public LootManager(CustomFishing plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@@ -64,7 +64,7 @@ public class LootManager extends Function {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
this.vanilla_loot = new Loot(
|
this.vanilla_loot = new LootImpl(
|
||||||
"vanilla",
|
"vanilla",
|
||||||
"vanilla",
|
"vanilla",
|
||||||
null,
|
null,
|
||||||
@@ -91,8 +91,8 @@ public class LootManager extends Function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Loot getLoot(String key) {
|
public LootImpl getLoot(String key) {
|
||||||
Loot loot = this.waterLoots.get(key);
|
LootImpl loot = this.waterLoots.get(key);
|
||||||
if (loot == null) {
|
if (loot == null) {
|
||||||
loot = this.lavaLoots.get(key);
|
loot = this.lavaLoots.get(key);
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,7 @@ public class LootManager extends Function {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setActions(ConfigurationSection section, Loot loot) {
|
private void setActions(ConfigurationSection section, LootImpl loot) {
|
||||||
loot.setSuccessActions(ConfigUtils.getActions(section.getConfigurationSection("action.success"), loot.getNick()));
|
loot.setSuccessActions(ConfigUtils.getActions(section.getConfigurationSection("action.success"), loot.getNick()));
|
||||||
loot.setFailureActions(ConfigUtils.getActions(section.getConfigurationSection("action.failure"), loot.getNick()));
|
loot.setFailureActions(ConfigUtils.getActions(section.getConfigurationSection("action.failure"), loot.getNick()));
|
||||||
loot.setHookActions(ConfigUtils.getActions(section.getConfigurationSection("action.hook"), loot.getNick()));
|
loot.setHookActions(ConfigUtils.getActions(section.getConfigurationSection("action.hook"), loot.getNick()));
|
||||||
@@ -259,7 +259,7 @@ public class LootManager extends Function {
|
|||||||
setSuccessAmountAction(section.getConfigurationSection("action.success-times"), loot);
|
setSuccessAmountAction(section.getConfigurationSection("action.success-times"), loot);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSuccessAmountAction(ConfigurationSection section, Loot loot) {
|
private void setSuccessAmountAction(ConfigurationSection section, LootImpl loot) {
|
||||||
if (section != null) {
|
if (section != null) {
|
||||||
HashMap<Integer, Action[]> actionMap = new HashMap<>();
|
HashMap<Integer, Action[]> actionMap = new HashMap<>();
|
||||||
for (String amount : section.getKeys(false)) {
|
for (String amount : section.getKeys(false)) {
|
||||||
@@ -286,28 +286,28 @@ public class LootManager extends Function {
|
|||||||
return gameConfigs;
|
return gameConfigs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Loot> getWaterLoots() {
|
public HashMap<String, LootImpl> getWaterLoots() {
|
||||||
return waterLoots;
|
return waterLoots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Loot> getLavaLoots() {
|
public HashMap<String, LootImpl> getLavaLoots() {
|
||||||
return lavaLoots;
|
return lavaLoots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Loot> getAllLoots() {
|
public ArrayList<LootImpl> getAllLoots() {
|
||||||
ArrayList<Loot> loots = new ArrayList<>(waterLoots.values());
|
ArrayList<LootImpl> loots = new ArrayList<>(waterLoots.values());
|
||||||
loots.addAll(getLavaLoots().values());
|
loots.addAll(getLavaLoots().values());
|
||||||
return loots;
|
return loots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> getAllKeys() {
|
public ArrayList<String> getAllKeys() {
|
||||||
ArrayList<String> loots = new ArrayList<>();
|
ArrayList<String> loots = new ArrayList<>();
|
||||||
for (Map.Entry<String, Loot> en : waterLoots.entrySet()) {
|
for (Map.Entry<String, LootImpl> en : waterLoots.entrySet()) {
|
||||||
if (en.getValue() instanceof DroppedItem) {
|
if (en.getValue() instanceof DroppedItem) {
|
||||||
loots.add(en.getKey());
|
loots.add(en.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, Loot> en : lavaLoots.entrySet()) {
|
for (Map.Entry<String, LootImpl> en : lavaLoots.entrySet()) {
|
||||||
if (en.getValue() instanceof DroppedItem) {
|
if (en.getValue() instanceof DroppedItem) {
|
||||||
loots.add(en.getKey());
|
loots.add(en.getKey());
|
||||||
}
|
}
|
||||||
@@ -321,7 +321,7 @@ public class LootManager extends Function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Loot getVanilla_loot() {
|
public LootImpl getVanilla_loot() {
|
||||||
return vanilla_loot;
|
return vanilla_loot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package net.momirealms.customfishing.manager;
|
|||||||
|
|
||||||
import net.momirealms.customfishing.CustomFishing;
|
import net.momirealms.customfishing.CustomFishing;
|
||||||
import net.momirealms.customfishing.data.PlayerStatisticsData;
|
import net.momirealms.customfishing.data.PlayerStatisticsData;
|
||||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import net.momirealms.customfishing.listener.JoinQuitListener;
|
import net.momirealms.customfishing.listener.JoinQuitListener;
|
||||||
import net.momirealms.customfishing.object.DataFunction;
|
import net.momirealms.customfishing.object.DataFunction;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -94,7 +94,7 @@ public class StatisticsManager extends DataFunction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFishAmount(UUID uuid, Loot loot, int amount) {
|
public void addFishAmount(UUID uuid, LootImpl loot, int amount) {
|
||||||
PlayerStatisticsData statisticsData = statisticsDataMap.get(uuid);
|
PlayerStatisticsData statisticsData = statisticsDataMap.get(uuid);
|
||||||
if (statisticsData != null) {
|
if (statisticsData != null) {
|
||||||
statisticsData.addFishAmount(loot, uuid, amount);
|
statisticsData.addFishAmount(loot, uuid, amount);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
|||||||
import net.momirealms.customfishing.CustomFishing;
|
import net.momirealms.customfishing.CustomFishing;
|
||||||
import net.momirealms.customfishing.fishing.loot.DroppedItem;
|
import net.momirealms.customfishing.fishing.loot.DroppedItem;
|
||||||
import net.momirealms.customfishing.fishing.loot.Item;
|
import net.momirealms.customfishing.fishing.loot.Item;
|
||||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
import net.momirealms.customfishing.fishing.loot.LootImpl;
|
||||||
import net.momirealms.customfishing.manager.ConfigManager;
|
import net.momirealms.customfishing.manager.ConfigManager;
|
||||||
import net.momirealms.customfishing.object.LeveledEnchantment;
|
import net.momirealms.customfishing.object.LeveledEnchantment;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -172,7 +172,7 @@ public class ItemStackUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int givePlayerLoot(Player player, String key, int amount){
|
public static int givePlayerLoot(Player player, String key, int amount){
|
||||||
Loot loot = CustomFishing.getInstance().getLootManager().getLoot(key);
|
LootImpl loot = CustomFishing.getInstance().getLootManager().getLoot(key);
|
||||||
if (!(loot instanceof DroppedItem droppedItem)) return 0;
|
if (!(loot instanceof DroppedItem droppedItem)) return 0;
|
||||||
ItemStack itemStack = CustomFishing.getInstance().getFishingManager().getCustomFishingLootItemStack(droppedItem, player);
|
ItemStack itemStack = CustomFishing.getInstance().getFishingManager().getCustomFishingLootItemStack(droppedItem, player);
|
||||||
if (itemStack.getType() == Material.AIR) return 0;
|
if (itemStack.getType() == Material.AIR) return 0;
|
||||||
|
|||||||
@@ -10,23 +10,13 @@ simple_bait:
|
|||||||
time: 0.85
|
time: 0.85
|
||||||
difficulty: 1
|
difficulty: 1
|
||||||
|
|
||||||
wild_bait:
|
|
||||||
material: paper
|
|
||||||
display:
|
|
||||||
name: 'Wild Bait'
|
|
||||||
lore:
|
|
||||||
- '<white>Decreases fishing time by 30%.'
|
|
||||||
custom-model-data: 50002
|
|
||||||
effect:
|
|
||||||
time: 0.7
|
|
||||||
|
|
||||||
magnet_bait:
|
magnet_bait:
|
||||||
material: paper
|
material: paper
|
||||||
display:
|
display:
|
||||||
name: '<gray>Magnet Bait'
|
name: '<gray>Magnet Bait'
|
||||||
lore:
|
lore:
|
||||||
- '<white>Increases the probability of better loots by 15%.'
|
- '<white>Increases the probability of better loots by 15%.'
|
||||||
custom-model-data: 50003
|
custom-model-data: 50002
|
||||||
effect:
|
effect:
|
||||||
weight-multiply:
|
weight-multiply:
|
||||||
silver: 1.15
|
silver: 1.15
|
||||||
@@ -42,4 +32,14 @@ magnet_bait:
|
|||||||
- nature_fishing_cane
|
- nature_fishing_cane
|
||||||
- silver_fishing_rod
|
- silver_fishing_rod
|
||||||
- golden_fishing_rod
|
- golden_fishing_rod
|
||||||
- star_fishing_rod
|
- star_fishing_rod
|
||||||
|
|
||||||
|
wild_bait:
|
||||||
|
material: paper
|
||||||
|
display:
|
||||||
|
name: 'Wild Bait'
|
||||||
|
lore:
|
||||||
|
- '<white>Decreases fishing time by 30%.'
|
||||||
|
custom-model-data: 50003
|
||||||
|
effect:
|
||||||
|
time: 0.7
|
||||||
Reference in New Issue
Block a user