9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-28 11:29:15 +00:00
This commit is contained in:
Xiao-MoMi
2023-01-09 20:05:07 +08:00
parent 2ad24b0659
commit 97fd04b017
19 changed files with 105 additions and 35 deletions

View File

@@ -4,7 +4,7 @@ plugins {
}
group = 'net.momirealms'
version = '1.2.17.1'
version = '1.2.17.2'
repositories {
mavenCentral()

View File

@@ -1,3 +1,20 @@
/*
* 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.api.event;
import org.bukkit.entity.Player;

View File

@@ -1,3 +1,20 @@
/*
* 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.data;
public class PlayerSellData {

View File

@@ -1,3 +1,20 @@
/*
* 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.data.storage;
public class SqlConstants {

View File

@@ -19,7 +19,6 @@ package net.momirealms.customfishing.integration.item;
import io.lumine.mythic.bukkit.MythicBukkit;
import io.lumine.mythic.core.items.ItemExecutor;
import io.lumine.mythic.core.items.MythicItem;
import net.momirealms.customfishing.integration.ItemInterface;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

View File

@@ -18,14 +18,10 @@
package net.momirealms.customfishing.integration.quest;
import io.github.battlepass.BattlePlugin;
import io.github.battlepass.objects.quests.variable.QuestResult;
import io.github.battlepass.quests.quests.external.executor.ExternalQuestExecutor;
import io.github.battlepass.registry.quest.QuestRegistry;
import net.momirealms.customfishing.CustomFishing;
import net.momirealms.customfishing.api.event.FishResultEvent;
import net.momirealms.customfishing.object.fishing.FishResult;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -34,10 +30,7 @@ public class BattlePassCFQuest extends ExternalQuestExecutor implements Listener
public static void register() {
QuestRegistry questRegistry = BattlePlugin.getApi().getQuestRegistry();
questRegistry.hook("customfishing", instance -> {
BattlePassCFQuest battlePassCFQuest = new BattlePassCFQuest(instance);
return battlePassCFQuest;
});
questRegistry.hook("customfishing", BattlePassCFQuest::new);
}
public BattlePassCFQuest(BattlePlugin battlePlugin) {

View File

@@ -17,5 +17,5 @@
package net.momirealms.customfishing.integration.quest;
public class BetonQuestHook {
public class BetonQuestCFQuest {
}

View File

@@ -25,13 +25,13 @@ import net.momirealms.customfishing.object.fishing.FishResult;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class ClueScrollHook implements Listener {
public class ClueScrollCFQuest implements Listener {
private final CustomClue fishClue;
private final CustomClue mobClue;
private final CustomClue commonClue;
public ClueScrollHook () {
public ClueScrollCFQuest() {
commonClue = ClueScrollsAPI.getInstance().registerCustomClue(CustomFishing.plugin, "fish");
fishClue = ClueScrollsAPI.getInstance().registerCustomClue(CustomFishing.plugin, "catch_fish");
mobClue = ClueScrollsAPI.getInstance().registerCustomClue(CustomFishing.plugin, "catch_mob");

View File

@@ -906,8 +906,9 @@ public class FishingManager extends Function {
int timer;
int time;
if (loot != null){
speed = loot.getDifficulty().speed();
timer = loot.getDifficulty().timer();
Difficulty difficulty = loot.getDifficulty()[new Random().nextInt(loot.getDifficulty().length)];
speed = difficulty.speed();
timer = difficulty.timer();
time = loot.getTime();
}
else {

View File

@@ -28,7 +28,7 @@ import net.momirealms.customfishing.integration.item.*;
import net.momirealms.customfishing.integration.mob.MythicMobsMobImpl;
import net.momirealms.customfishing.integration.papi.PlaceholderManager;
import net.momirealms.customfishing.integration.quest.BattlePassCFQuest;
import net.momirealms.customfishing.integration.quest.ClueScrollHook;
import net.momirealms.customfishing.integration.quest.ClueScrollCFQuest;
import net.momirealms.customfishing.integration.season.CustomCropsSeasonImpl;
import net.momirealms.customfishing.integration.season.RealisticSeasonsImpl;
import net.momirealms.customfishing.integration.skill.*;
@@ -213,8 +213,8 @@ public class IntegrationManager extends Function {
public void registerQuests() {
if (Bukkit.getPluginManager().isPluginEnabled("ClueScrolls")) {
ClueScrollHook clueScrollHook = new ClueScrollHook();
Bukkit.getPluginManager().registerEvents(clueScrollHook, CustomFishing.plugin);
ClueScrollCFQuest clueScrollCFQuest = new ClueScrollCFQuest();
Bukkit.getPluginManager().registerEvents(clueScrollCFQuest, CustomFishing.plugin);
hookMessage("ClueScrolls");
}
if (Bukkit.getPluginManager().isPluginEnabled("BetonQuest")) {

View File

@@ -87,13 +87,26 @@ public class LootManager extends Function {
for (String key : keys) {
if (!config.getBoolean(key + ".enable", true)) continue;
// Bar mechanic
String[] diff = StringUtils.split(config.getString(key + ".difficulty", "1-1"),"-");
Difficulty difficulty = new Difficulty(Integer.parseInt(diff[0]), Integer.parseInt(diff[1]));
List<Difficulty> difficulties = new ArrayList<>();
List<String> difficultyList = config.getStringList(key + ".difficulty");
if (difficultyList.size() == 0) {
String[] diff = StringUtils.split(config.getString(key + ".difficulty", "1-1"),"-");
Difficulty difficulty = new Difficulty(Integer.parseInt(diff[0]), Integer.parseInt(diff[1]));
difficulties.add(difficulty);
}
else {
for (String difficultyStr : difficultyList) {
String[] diff = StringUtils.split(difficultyStr,"-");
Difficulty difficulty = new Difficulty(Integer.parseInt(diff[0]), Integer.parseInt(diff[1]));
difficulties.add(difficulty);
}
}
int weight = config.getInt(key + ".weight",10);
int time = config.getInt(key + ".time",10000);
Mob loot = new Mob(
key,
difficulty,
difficulties.toArray(new Difficulty[0]),
time,
weight,
config.getString(key + ".mobID", key),
@@ -132,13 +145,25 @@ public class LootManager extends Function {
String material = config.getString(key + ".material","COD");
// Bar mechanic
String[] diff = StringUtils.split(config.getString(key + ".difficulty", "1-1"),"-");
Difficulty difficulty = new Difficulty(Integer.parseInt(diff[0]), Integer.parseInt(diff[1]));
List<Difficulty> difficulties = new ArrayList<>();
List<String> difficultyList = config.getStringList(key + ".difficulty");
if (difficultyList.size() == 0) {
String[] diff = StringUtils.split(config.getString(key + ".difficulty", "1-1"),"-");
Difficulty difficulty = new Difficulty(Integer.parseInt(diff[0]), Integer.parseInt(diff[1]));
difficulties.add(difficulty);
}
else {
for (String difficultyStr : difficultyList) {
String[] diff = StringUtils.split(difficultyStr,"-");
Difficulty difficulty = new Difficulty(Integer.parseInt(diff[0]), Integer.parseInt(diff[1]));
difficulties.add(difficulty);
}
}
int weight = config.getInt(key + ".weight",10);
int time = config.getInt(key + ".time",10000);
DroppedItem loot = new DroppedItem(
key,
difficulty,
difficulties.toArray(new Difficulty[0]),
time,
weight,
material.contains(":") ? material : key);

View File

@@ -58,7 +58,7 @@ public class SellManager extends Function {
private final WindowPacketListener windowPacketListener;
private final InventoryListener inventoryListener;
private SimpleListener simpleListener;
private final SimpleListener simpleListener;
public static String formula;
public static String title;
public static int guiSize;

View File

@@ -29,7 +29,7 @@ public class DroppedItem extends Loot{
private float basicPrice;
private float sizeBonus;
public DroppedItem(String key, Difficulty difficulty, int time, int weight, String material) {
public DroppedItem(String key, Difficulty[] difficulty, int time, int weight, String material) {
super(key, difficulty, time, weight);
this.material = material;
}

View File

@@ -24,11 +24,11 @@ import net.momirealms.customfishing.object.requirements.RequirementInterface;
public class Loot {
public static Loot EMPTY = new Loot("empty", new Difficulty(1,1), 5000, 10);
public static Loot EMPTY = new Loot("empty", new Difficulty[]{new Difficulty(1, 1)}, 5000, 10);
protected String key;
protected String nick;
protected Difficulty difficulty;
protected Difficulty[] difficulty;
protected String group;
protected boolean showInFinder;
protected Layout[] layout;
@@ -40,7 +40,7 @@ public class Loot {
protected RequirementInterface[] requirements;
protected double score;
public Loot(String key, Difficulty difficulty, int time, int weight) {
public Loot(String key, Difficulty[] difficulty, int time, int weight) {
this.key = key;
this.difficulty = difficulty;
this.time = time;
@@ -58,11 +58,11 @@ public class Loot {
this.nick = nick;
}
public Difficulty getDifficulty() {
public Difficulty[] getDifficulty() {
return difficulty;
}
public void setDifficulty(Difficulty difficulty) {
public void setDifficulty(Difficulty[] difficulty) {
this.difficulty = difficulty;
}

View File

@@ -26,7 +26,7 @@ public class Mob extends Loot{
private final int mobLevel;
private final MobVector mobVector;
public Mob(String key, Difficulty difficulty, int time, int weight, String mobID, int level, MobVector vector) {
public Mob(String key, Difficulty[] difficulty, int time, int weight, String mobID, int level, MobVector vector) {
super(key, difficulty, time, weight);
this.mobID = mobID;
this.mobLevel = level;

View File

@@ -36,7 +36,7 @@ public class FinalModel {
public String toString() {
StringBuilder stringBuilder = new StringBuilder("FinalModel:");
for (int i = 0; i < height; i++) {
stringBuilder.append("\nlayer: "+ (i+1));
stringBuilder.append("\nlayer: ").append(i + 1);
for (int j = 0; j < width; j++) {
stringBuilder.append("\n");
for (int k = 0; k < height; k++) {

View File

@@ -39,7 +39,7 @@ public class OriginalModel {
public String toString() {
StringBuilder stringBuilder = new StringBuilder("TotemModel:");
for (int i = 0; i < height; i++) {
stringBuilder.append("\nlayer: "+ (i+1));
stringBuilder.append("\nlayer: ").append(i + 1);
for (int j = 0; j < width; j++) {
stringBuilder.append("\n");
for (int k = 0; k < height; k++) {

View File

@@ -55,7 +55,7 @@ rainbow_fish:
id: '(String) rainbow_fish'
# Available events: success/failure/hook
# Available actions: message/command/exp/mending/skill-xp
# Available actions: message/command/exp/mending/skill-xp/sound
action:
success:
message:

View File

@@ -32,6 +32,7 @@ softdepend:
- Vault
- BattlePass
- ClueScrolls
- BetonQuest
commands:
customfishing: