mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
1.0.4
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'net.momirealms'
|
||||
version = '1.0'
|
||||
version = '1.0.4'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -17,12 +17,6 @@
|
||||
|
||||
package net.momirealms.customfishing;
|
||||
|
||||
import dev.dejvokep.boostedyaml.YamlDocument;
|
||||
import dev.dejvokep.boostedyaml.dvs.versioning.BasicVersioning;
|
||||
import dev.dejvokep.boostedyaml.settings.dumper.DumperSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.general.GeneralSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
import net.momirealms.customfishing.competition.CompetitionConfig;
|
||||
import net.momirealms.customfishing.competition.Goal;
|
||||
@@ -30,13 +24,10 @@ import net.momirealms.customfishing.competition.bossbar.BossBarConfig;
|
||||
import net.momirealms.customfishing.competition.reward.CommandImpl;
|
||||
import net.momirealms.customfishing.competition.reward.MessageImpl;
|
||||
import net.momirealms.customfishing.competition.reward.Reward;
|
||||
import net.momirealms.customfishing.helper.Log;
|
||||
import net.momirealms.customfishing.hook.Placeholders;
|
||||
import net.momirealms.customfishing.hook.skill.*;
|
||||
import net.momirealms.customfishing.titlebar.Difficulty;
|
||||
import net.momirealms.customfishing.titlebar.Layout;
|
||||
import net.momirealms.customfishing.hook.skill.Aurelium;
|
||||
import net.momirealms.customfishing.hook.skill.MMOCore;
|
||||
import net.momirealms.customfishing.hook.skill.SkillXP;
|
||||
import net.momirealms.customfishing.hook.skill.mcMMO;
|
||||
import net.momirealms.customfishing.item.Bait;
|
||||
import net.momirealms.customfishing.item.Loot;
|
||||
import net.momirealms.customfishing.item.Rod;
|
||||
@@ -53,7 +44,6 @@ import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class ConfigReader{
|
||||
@@ -70,6 +60,7 @@ public class ConfigReader{
|
||||
public static HashMap<String, CompetitionConfig> Competitions = new HashMap<>();
|
||||
public static HashMap<String, CompetitionConfig> CompetitionsCommand = new HashMap<>();
|
||||
|
||||
|
||||
public static YamlConfiguration getConfig(String configName) {
|
||||
File file = new File(CustomFishing.instance.getDataFolder(), configName);
|
||||
if (!file.exists()) {
|
||||
@@ -106,15 +97,10 @@ public class ConfigReader{
|
||||
public static int fishFinderCoolDown;
|
||||
public static double timeMultiply;
|
||||
public static SkillXP skillXP;
|
||||
public static int version;
|
||||
|
||||
public static void loadConfig() {
|
||||
|
||||
try {
|
||||
YamlDocument.create(new File(CustomFishing.instance.getDataFolder(), "config.yml"), CustomFishing.instance.getResource("config.yml"), GeneralSettings.DEFAULT, LoaderSettings.builder().setAutoUpdate(true).build(), DumperSettings.DEFAULT, UpdaterSettings.builder().setVersioning(new BasicVersioning("config-version")).build());
|
||||
}catch (IOException e){
|
||||
Log.warn(e.getMessage());
|
||||
}
|
||||
|
||||
CustomFishing.instance.saveDefaultConfig();
|
||||
CustomFishing.instance.reloadConfig();
|
||||
FileConfiguration config = CustomFishing.instance.getConfig();
|
||||
@@ -142,8 +128,6 @@ public class ConfigReader{
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") == null){
|
||||
AdventureManager.consoleMessage("<red>[CustomFishing] Failed to initialize PlaceholderAPI!</red>");
|
||||
papi = false;
|
||||
}else {
|
||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>PlaceholderAPI <color:#E1FFFF>Hooked!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +138,7 @@ public class ConfigReader{
|
||||
CustomFishing.instance.getLogger().warning("Failed to initialize mcMMO!");
|
||||
}else {
|
||||
skillXP = new mcMMO();
|
||||
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><gold>mcMMO <color:#FFEBCD>Hooked!");
|
||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>mcMMO <color:#E1FFFF>Hooked!");
|
||||
}
|
||||
}
|
||||
if(config.getBoolean("config.integrations.AureliumSkills",false)){
|
||||
@@ -162,7 +146,7 @@ public class ConfigReader{
|
||||
CustomFishing.instance.getLogger().warning("Failed to initialize AureliumSkills!");
|
||||
}else {
|
||||
skillXP = new Aurelium();
|
||||
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><gold>AureliumSkills <color:#FFEBCD>Hooked!");
|
||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>AureliumSkills <color:#E1FFFF>Hooked!");
|
||||
}
|
||||
}
|
||||
if(config.getBoolean("config.integrations.MMOCore",false)){
|
||||
@@ -170,7 +154,15 @@ public class ConfigReader{
|
||||
CustomFishing.instance.getLogger().warning("Failed to initialize MMOCore!");
|
||||
}else {
|
||||
skillXP = new MMOCore();
|
||||
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><gold>MMOCore <color:#FFEBCD>Hooked!");
|
||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>MMOCore <color:#E1FFFF>Hooked!");
|
||||
}
|
||||
}
|
||||
if(config.getBoolean("config.integrations.EcoSkills",false)){
|
||||
if(Bukkit.getPluginManager().getPlugin("EcoSkills") == null){
|
||||
CustomFishing.instance.getLogger().warning("Failed to initialize EcoSkills!");
|
||||
}else {
|
||||
skillXP = new EcoSkill();
|
||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>EcoSkills <color:#E1FFFF>Hooked!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,6 +182,7 @@ public class ConfigReader{
|
||||
needOpenWater = config.getBoolean("config.need-open-water");
|
||||
needSpecialRod = config.getBoolean("config.need-special-rod");
|
||||
|
||||
version = config.getInt("config-version");
|
||||
fishFinderCoolDown = config.getInt("config.fishfinder-cooldown");
|
||||
timeMultiply = config.getDouble("config.time-multiply");
|
||||
lang = config.getString("config.lang","cn");
|
||||
@@ -366,9 +359,13 @@ public class ConfigReader{
|
||||
loot.setScore((float) config.getDouble("items." + key + ".score",0));
|
||||
|
||||
if (config.contains("items." + key + ".action.message"))
|
||||
loot.setMsg(config.getString("items." + key + ".action.message"));
|
||||
loot.setMsg(config.getStringList("items." + key + ".action.message"));
|
||||
if (config.contains("items." + key + ".action.command"))
|
||||
loot.setCommands(config.getStringList("items." + key + ".action.command"));
|
||||
if (config.contains("items." + key + ".action-hook.message"))
|
||||
loot.setHookMsg(config.getStringList("items." + key + ".action-hook.message"));
|
||||
if (config.contains("items." + key + ".action-hook.command"))
|
||||
loot.setHookCommands(config.getStringList("items." + key + ".action-hook.command"));
|
||||
if (config.contains("items." + key + ".action.exp"))
|
||||
loot.setExp(config.getInt("items." + key + ".action.exp"));
|
||||
if (config.contains("items." + key + ".layout"))
|
||||
@@ -486,9 +483,13 @@ public class ConfigReader{
|
||||
if (config.contains("mobs." + key + ".level"))
|
||||
loot.setMmLevel(config.getInt("mobs." + key + ".level", 0));
|
||||
if (config.contains("mobs." + key + ".action.message"))
|
||||
loot.setMsg(config.getString("mobs." + key + ".action.message"));
|
||||
loot.setMsg(config.getStringList("mobs." + key + ".action.message"));
|
||||
if (config.contains("mobs." + key + ".action.command"))
|
||||
loot.setCommands(config.getStringList("mobs." + key + ".action.command"));
|
||||
if (config.contains("mobs." + key + ".action-hook.message"))
|
||||
loot.setHookMsg(config.getStringList("mobs." + key + ".action-hook.message"));
|
||||
if (config.contains("mobs." + key + ".action-hook.command"))
|
||||
loot.setHookCommands(config.getStringList("mobs." + key + ".action-hook.command"));
|
||||
if (config.contains("mobs." + key + ".action.exp"))
|
||||
loot.setExp(config.getInt("mobs." + key + ".action.exp"));
|
||||
if (config.contains("mobs." + key + ".skill-xp"))
|
||||
@@ -790,6 +791,15 @@ public class ConfigReader{
|
||||
if (config.contains(key + ".broadcast.end")){
|
||||
competitionConfig.setEndMessage(config.getStringList(key + ".broadcast.end"));
|
||||
}
|
||||
if (config.contains(key + ".command.join")){
|
||||
competitionConfig.setJoinCommand(config.getStringList(key + ".command.join"));
|
||||
}
|
||||
if (config.contains(key + ".command.start")){
|
||||
competitionConfig.setStartCommand(config.getStringList(key + ".command.start"));
|
||||
}
|
||||
if (config.contains(key + ".command.end")){
|
||||
competitionConfig.setEndCommand(config.getStringList(key + ".command.end"));
|
||||
}
|
||||
if (config.contains(key + ".min-players")){
|
||||
competitionConfig.setMinPlayers(config.getInt(key + ".min-players"));
|
||||
}
|
||||
|
||||
@@ -24,9 +24,12 @@ import net.momirealms.customfishing.command.TabComplete;
|
||||
import net.momirealms.customfishing.competition.CompetitionSchedule;
|
||||
import net.momirealms.customfishing.competition.bossbar.BossBarManager;
|
||||
import net.momirealms.customfishing.helper.LibraryLoader;
|
||||
import net.momirealms.customfishing.hook.Placeholders;
|
||||
import net.momirealms.customfishing.listener.MMOItemsConverter;
|
||||
import net.momirealms.customfishing.listener.PapiReload;
|
||||
import net.momirealms.customfishing.listener.PlayerListener;
|
||||
import net.momirealms.customfishing.utils.AdventureManager;
|
||||
import net.momirealms.customfishing.utils.UpdateConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@@ -38,6 +41,7 @@ public final class CustomFishing extends JavaPlugin {
|
||||
public static BukkitAudiences adventure;
|
||||
public static MiniMessage miniMessage;
|
||||
private CompetitionSchedule competitionSchedule;
|
||||
public static Placeholders placeholders;
|
||||
|
||||
@Override
|
||||
public void onLoad(){
|
||||
@@ -55,6 +59,7 @@ public final class CustomFishing extends JavaPlugin {
|
||||
Objects.requireNonNull(Bukkit.getPluginCommand("customfishing")).setTabCompleter(new TabComplete());
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerListener(),this);
|
||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#E1FFFF>Running on " + Bukkit.getVersion());
|
||||
|
||||
ConfigReader.Reload();
|
||||
if (ConfigReader.Config.competition){
|
||||
competitionSchedule = new CompetitionSchedule();
|
||||
@@ -64,12 +69,22 @@ public final class CustomFishing extends JavaPlugin {
|
||||
if (ConfigReader.Config.convertMMOItems){
|
||||
Bukkit.getPluginManager().registerEvents(new MMOItemsConverter(), this);
|
||||
}
|
||||
if (ConfigReader.Config.papi){
|
||||
placeholders = new Placeholders();
|
||||
placeholders.register();
|
||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>PlaceholderAPI <color:#E1FFFF>Hooked!");
|
||||
Bukkit.getPluginManager().registerEvents(new PapiReload(), this);
|
||||
}
|
||||
ConfigReader.tryEnableJedis();
|
||||
if (ConfigReader.Config.version != 2){
|
||||
UpdateConfig.update();
|
||||
}
|
||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#E1FFFF>Plugin Enabled!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
|
||||
if (competitionSchedule != null){
|
||||
competitionSchedule.stopCheck();
|
||||
competitionSchedule = null;
|
||||
|
||||
@@ -47,6 +47,9 @@ public class Competition {
|
||||
private final BossBarConfig bossBarConfig;
|
||||
private final List<String> startMessage;
|
||||
private final List<String> endMessage;
|
||||
private final List<String> endCommand;
|
||||
private final List<String> startCommand;
|
||||
private final List<String> joinCommand;
|
||||
private final HashMap<String, List<Reward>> rewardsMap;
|
||||
|
||||
public static long remainingTime;
|
||||
@@ -61,6 +64,9 @@ public class Competition {
|
||||
this.startMessage = competitionConfig.getStartMessage();
|
||||
this.endMessage = competitionConfig.getEndMessage();
|
||||
this.rewardsMap = competitionConfig.getRewards();
|
||||
this.startCommand = competitionConfig.getStartCommand();
|
||||
this.endCommand = competitionConfig.getEndCommand();
|
||||
this.joinCommand = competitionConfig.getJoinCommand();
|
||||
}
|
||||
|
||||
public void begin(boolean forceStart) {
|
||||
@@ -86,6 +92,11 @@ public class Competition {
|
||||
});
|
||||
});
|
||||
}
|
||||
if (startCommand != null){
|
||||
startCommand.forEach(command -> {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
playerCollections.forEach(player -> {
|
||||
@@ -148,6 +159,11 @@ public class Competition {
|
||||
});
|
||||
});
|
||||
}
|
||||
if (endCommand != null){
|
||||
endCommand.forEach(command -> {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
});
|
||||
}
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(CustomFishing.instance, ()-> {
|
||||
ranking.clear();
|
||||
}, 300);
|
||||
@@ -211,4 +227,5 @@ public class Competition {
|
||||
public boolean isGoingOn() {return status;}
|
||||
public BossBarConfig getBossBarConfig() {return bossBarConfig;}
|
||||
public Ranking getRanking() {return ranking;}
|
||||
}
|
||||
public List<String> getJoinCommand() {return joinCommand;}
|
||||
}
|
||||
@@ -29,6 +29,9 @@ public class CompetitionConfig {
|
||||
private int minPlayers;
|
||||
private List<String> startMessage;
|
||||
private List<String> endMessage;
|
||||
private List<String> startCommand;
|
||||
private List<String> endCommand;
|
||||
private List<String> joinCommand;
|
||||
private Goal goal;
|
||||
private BossBarConfig bossBarConfig;
|
||||
private final boolean enableBossBar;
|
||||
@@ -41,6 +44,9 @@ public class CompetitionConfig {
|
||||
public void setGoal(Goal goal) {this.goal = goal;}
|
||||
public void setEndMessage(List<String> endMessage) {this.endMessage = endMessage;}
|
||||
public void setStartMessage(List<String> startMessage) {this.startMessage = startMessage;}
|
||||
public void setStartCommand(List<String> startCommand) {this.startCommand = startCommand;}
|
||||
public void setEndCommand(List<String> endCommand) {this.endCommand = endCommand;}
|
||||
public void setJoinCommand(List<String> joinCommand) {this.joinCommand = joinCommand;}
|
||||
public void setMinPlayers(int minPlayers) {this.minPlayers = minPlayers;}
|
||||
public HashMap<String, List<Reward>> getRewards() {return rewards;}
|
||||
|
||||
@@ -52,4 +58,7 @@ public class CompetitionConfig {
|
||||
public List<String> getEndMessage() {return endMessage;}
|
||||
public List<String> getStartMessage() {return startMessage;}
|
||||
public void setRewards(HashMap<String, List<Reward>> rewards) {this.rewards = rewards;}
|
||||
public List<String> getEndCommand() {return endCommand;}
|
||||
public List<String> getJoinCommand() {return joinCommand;}
|
||||
public List<String> getStartCommand() {return startCommand;}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package net.momirealms.customfishing.competition.bossbar;
|
||||
import net.momirealms.customfishing.ConfigReader;
|
||||
import net.momirealms.customfishing.competition.CompetitionSchedule;
|
||||
import net.momirealms.customfishing.utils.AdventureManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -66,6 +67,11 @@ public class BossBarManager implements Listener {
|
||||
if (cache.get(player) == null) {
|
||||
BossBarTimer timerTask = new BossBarTimer(player, CompetitionSchedule.competition.getBossBarConfig());
|
||||
cache.put(player, timerTask);
|
||||
if (CompetitionSchedule.competition.getJoinCommand() != null){
|
||||
CompetitionSchedule.competition.getJoinCommand().forEach(command -> {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command.replace("{player}", player.getName()));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,5 +17,47 @@
|
||||
|
||||
package net.momirealms.customfishing.hook;
|
||||
|
||||
public class Placeholders {
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import net.momirealms.customfishing.ConfigReader;
|
||||
import net.momirealms.customfishing.competition.Competition;
|
||||
import net.momirealms.customfishing.competition.CompetitionSchedule;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class Placeholders extends PlaceholderExpansion {
|
||||
@Override
|
||||
public @NotNull String getIdentifier() {
|
||||
return "competition";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getAuthor() {
|
||||
return "XiaoMoMi";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getVersion() {
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onRequest(OfflinePlayer player, String params) {
|
||||
if (params.equalsIgnoreCase("timeleft")){
|
||||
if (CompetitionSchedule.competition != null && CompetitionSchedule.competition.isGoingOn()){
|
||||
return String.valueOf(Competition.remainingTime);
|
||||
}else {
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
if (params.equalsIgnoreCase("rank")){
|
||||
if (CompetitionSchedule.competition != null && CompetitionSchedule.competition.isGoingOn()){
|
||||
return Optional.ofNullable(CompetitionSchedule.competition.getRanking().getPlayerRank(player.getName())).orElse(ConfigReader.Message.noRank);
|
||||
}else {
|
||||
return ConfigReader.Message.noRank;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.momirealms.customfishing.hook.skill;
|
||||
|
||||
import com.willfp.ecoskills.api.EcoSkillsAPI;
|
||||
import com.willfp.ecoskills.skills.Skills;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class EcoSkill implements SkillXP{
|
||||
|
||||
@Override
|
||||
public void addXp(Player player, double amount) {
|
||||
EcoSkillsAPI.getInstance().giveSkillExperience(player, Skills.FISHING, amount);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@ public class Loot implements Item {
|
||||
private List<String> lore;
|
||||
private Map<String,Object> nbt;
|
||||
private String material;
|
||||
private String msg;
|
||||
private String mm;
|
||||
private String layout;
|
||||
private VectorUtil vectorUtil;
|
||||
@@ -42,7 +41,10 @@ public class Loot implements Item {
|
||||
private final int time;
|
||||
private int mmLevel;
|
||||
private int exp;
|
||||
private List<String> msg;
|
||||
private List<String> commands;
|
||||
private List<String> hookCommands;
|
||||
private List<String> hookMsg;
|
||||
private String group;
|
||||
private List<net.momirealms.customfishing.utils.Enchantment> enchantment;
|
||||
private List<ItemFlag> itemFlags;
|
||||
@@ -61,7 +63,7 @@ public class Loot implements Item {
|
||||
|
||||
public String getKey(){return this.key;}
|
||||
public String getNick(){return this.nick;}
|
||||
public String getMsg(){return this.msg;}
|
||||
public List<String> getMsg(){return this.msg;}
|
||||
public String getLayout(){return this.layout;}
|
||||
public String getMm(){return this.mm;}
|
||||
public boolean isShowInFinder() {return this.showInFinder;}
|
||||
@@ -76,6 +78,8 @@ public class Loot implements Item {
|
||||
public int getExp() {return exp;}
|
||||
public double getSkillXP() {return skillXP;}
|
||||
public float getScore() {return score;}
|
||||
public List<String> getHookCommands() {return hookCommands;}
|
||||
public List<String> getHookMsg() {return hookMsg;}
|
||||
|
||||
@Override
|
||||
public List<String> getLore(){return this.lore;}
|
||||
@@ -101,7 +105,7 @@ public class Loot implements Item {
|
||||
public void setRequirements(List<Requirement> requirements) {this.requirements = requirements;}
|
||||
public void setMaterial(String material){this.material = material;}
|
||||
public void setNick(String nick){this.nick = nick;}
|
||||
public void setMsg(String msg){this.msg = msg;}
|
||||
public void setMsg(List<String> msg){this.msg = msg;}
|
||||
public void setMm(String mm){this.mm = mm;}
|
||||
public void setLayout(String layout){this.layout = layout;}
|
||||
public void setVectorUtil(VectorUtil vectorUtil){this.vectorUtil = vectorUtil;}
|
||||
@@ -115,4 +119,6 @@ public class Loot implements Item {
|
||||
public void setUnbreakable(boolean unbreakable){this.unbreakable = unbreakable;}
|
||||
public void setSkillXP(double skillXP) {this.skillXP = skillXP;}
|
||||
public void setScore(float score) {this.score = score;}
|
||||
public void setHookMsg(List<String> hookMsg) {this.hookMsg = hookMsg;}
|
||||
public void setHookCommands(List<String> hookCommands) {this.hookCommands = hookCommands;}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.momirealms.customfishing.listener;
|
||||
|
||||
import net.momirealms.customfishing.CustomFishing;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class PapiReload implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onReload(me.clip.placeholderapi.events.ExpansionUnregisterEvent event){
|
||||
if (CustomFishing.placeholders != null){
|
||||
if (event.getExpansion().equals(CustomFishing.placeholders)){
|
||||
CustomFishing.placeholders.register();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,6 @@ public class PlayerListener implements Listener {
|
||||
nextLoot.put(player, availableLoots.get(pos));
|
||||
return;
|
||||
}
|
||||
|
||||
nextLoot.put(player, null);
|
||||
});
|
||||
}
|
||||
@@ -267,12 +266,21 @@ public class PlayerListener implements Listener {
|
||||
difficulty = 1;
|
||||
}
|
||||
Difficulty difficult = new Difficulty(lootInstance.getDifficulty().getTimer(), difficulty);
|
||||
|
||||
fishingPlayers.put(player,
|
||||
new FishingPlayer(System.currentTimeMillis() + lootInstance.getTime(),
|
||||
new Timer(player, difficult, layout)
|
||||
)
|
||||
);
|
||||
if (lootInstance.getHookCommands() != null){
|
||||
lootInstance.getHookCommands().forEach(command ->{
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("{player}", player.getName()));
|
||||
});
|
||||
}
|
||||
if (lootInstance.getHookMsg() != null){
|
||||
lootInstance.getHookMsg().forEach(msg -> {
|
||||
AdventureManager.playerMessage(player, msg.replace("{loot}",lootInstance.getNick()).replace("{player}", player.getName()));
|
||||
});
|
||||
}
|
||||
Bukkit.getScheduler().runTask(CustomFishing.instance, ()->{
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, lootInstance.getTime()/50,3));
|
||||
});
|
||||
@@ -290,7 +298,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
Loot lootInstance = nextLoot.get(player);
|
||||
Layout layout = ConfigReader.LAYOUT.get(fishingPlayers.get(player).getTimer().getLayout());
|
||||
int last = (fishingPlayers.get(player).getTimer().getTimerTask().getProgress() + 1)/layout.getRange();
|
||||
int last = (fishingPlayers.get(player).getTimer().getTimerTask().getProgress())/layout.getRange();
|
||||
fishingPlayers.remove(player);
|
||||
player.removePotionEffect(PotionEffectType.SLOW);
|
||||
if (ConfigReader.Config.needOpenWater && !event.getHook().isInOpenWater()){
|
||||
@@ -317,8 +325,9 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
if (lootInstance.getMsg() != null){
|
||||
//发送消息
|
||||
AdventureManager.playerMessage(player, ConfigReader.Message.prefix + lootInstance.getMsg().replace("{loot}",lootInstance.getNick()).replace("{player}", player.getName()));
|
||||
lootInstance.getMsg().forEach(msg -> {
|
||||
AdventureManager.playerMessage(player, msg.replace("{loot}",lootInstance.getNick()).replace("{player}", player.getName()));
|
||||
});
|
||||
}
|
||||
if (lootInstance.getCommands() != null){
|
||||
//执行指令
|
||||
@@ -327,7 +336,7 @@ public class PlayerListener implements Listener {
|
||||
replaceAll("\\{x}", String.valueOf(Math.round(location.getX()))).
|
||||
replaceAll("\\{y}", String.valueOf(Math.round(location.getY()))).
|
||||
replaceAll("\\{z}", String.valueOf(Math.round(location.getZ()))).
|
||||
replaceAll("\\{player}", event.getPlayer().getName()).
|
||||
replaceAll("\\{player}", player.getName()).
|
||||
replaceAll("\\{world}", player.getWorld().getName()).
|
||||
replaceAll("\\{loot}", lootInstance.getNick());
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), finalCommand);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package net.momirealms.customfishing.utils;
|
||||
|
||||
import dev.dejvokep.boostedyaml.YamlDocument;
|
||||
import dev.dejvokep.boostedyaml.dvs.versioning.BasicVersioning;
|
||||
import dev.dejvokep.boostedyaml.settings.dumper.DumperSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.general.GeneralSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
||||
import net.momirealms.customfishing.CustomFishing;
|
||||
import net.momirealms.customfishing.helper.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class UpdateConfig {
|
||||
|
||||
public static void update(){
|
||||
try {
|
||||
YamlDocument.create(new File(CustomFishing.instance.getDataFolder(), "config.yml"), CustomFishing.instance.getResource("config.yml"), GeneralSettings.DEFAULT, LoaderSettings.builder().setAutoUpdate(true).build(), DumperSettings.DEFAULT, UpdaterSettings.builder().setVersioning(new BasicVersioning("config-version")).build());
|
||||
}catch (IOException e){
|
||||
Log.warn(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@ bar1:
|
||||
range: 16
|
||||
title: 'The fish is hooked, focus on it!'
|
||||
subtitle:
|
||||
# <font:Namespace:Font>
|
||||
# It's not recommended to use minecraft:default
|
||||
# If you insists on that, use <font:minecraft:default>
|
||||
start: '<font:customfishing:default>'
|
||||
bar: '뀄'
|
||||
pointer_offset: '뀂'
|
||||
|
||||
@@ -16,9 +16,20 @@ example:
|
||||
enable: true
|
||||
color: YELLOW
|
||||
overlay: PROGRESS
|
||||
#https://docs.adventure.kyori.net/minimessage/format.html
|
||||
text: '<gray>Time Left: <gold>{time}s <gray>Rank: <gold>{rank} <gray>Time Left: <gold>{minute}m{second}s <gray>Points: <gold>{point}'
|
||||
refresh-rate: 10
|
||||
|
||||
command:
|
||||
start:
|
||||
- 'say competition started!'
|
||||
end:
|
||||
- 'say competition ended!'
|
||||
# When player join the competition
|
||||
# You can execute some commands on that player
|
||||
join:
|
||||
- 'money give {player} 10'
|
||||
|
||||
broadcast:
|
||||
start:
|
||||
- '<red> <red>⚠<aqua><bold>Fishing competition<red>⚠'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# don't change
|
||||
config-version: 1
|
||||
config-version: 2
|
||||
|
||||
config:
|
||||
#en/es/cn
|
||||
@@ -12,22 +12,24 @@ config:
|
||||
mcMMO: false
|
||||
MMOCore: false
|
||||
AureliumSkills: false
|
||||
EcoSkills: false
|
||||
|
||||
season:
|
||||
enable: false
|
||||
# Season Papi
|
||||
papi: '%customcrops_season%'
|
||||
|
||||
# If there's no custom fish in this place
|
||||
# Should players get vanilla loots?
|
||||
vanilla-loot-when-no-custom-fish: false
|
||||
|
||||
# The same to vanilla
|
||||
need-open-water: true
|
||||
|
||||
# Players must use rods with CustomFishing's NBT Tags
|
||||
need-special-rod: false
|
||||
|
||||
# If there's no custom fish in this place or players don't have a special rod
|
||||
# Should players get loots in vanilla way?
|
||||
# This should be compatible with other fishing plugin's loot system
|
||||
vanilla-loot-when-no-custom-fish: false
|
||||
|
||||
# Cool down time of fish finder
|
||||
fishfinder-cooldown: 3000
|
||||
|
||||
|
||||
@@ -30,6 +30,12 @@ items:
|
||||
command:
|
||||
- 'say 玩家 {player} 在 {world}, {x},{y},{z} 钓到了一条 {loot}!'
|
||||
exp: 10
|
||||
# Action to be triggered when fish is hooked
|
||||
action-hook:
|
||||
message:
|
||||
- 'The fish is hooked!'
|
||||
command:
|
||||
- 'effect give {player} minecraft:slowness 30 10'
|
||||
# The weight(relative chance) of getting this fish
|
||||
weight: 10
|
||||
# Optional
|
||||
|
||||
@@ -10,6 +10,7 @@ softdepend:
|
||||
- mcMMO
|
||||
- AureliumSkills
|
||||
- MMOCore
|
||||
- EcoSkills
|
||||
commands:
|
||||
customfishing:
|
||||
usage: /customfishing
|
||||
|
||||
Reference in New Issue
Block a user