9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-29 03:49:07 +00:00
This commit is contained in:
Xiao-MoMi
2022-08-29 17:02:22 +08:00
parent 73b21baffa
commit a7832c63b9
8 changed files with 41 additions and 14 deletions

View File

@@ -118,14 +118,14 @@ public class ConfigReader{
if (config.getBoolean("config.integrations.WorldGuard")){
if (Bukkit.getPluginManager().getPlugin("WorldGuard") == null) AdventureUtil.consoleMessage("<red>[CustomFishing] Failed to initialize WorldGuard!</red>");
else {
AdventureUtil.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>WorldGuard <color:#E1FFFF>Hooked!");
AdventureUtil.consoleMessage("[CustomFishing] <color:#00BFFF>WorldGuard <color:#E1FFFF>Hooked!");
wg = true;
}
}
if (config.getBoolean("config.integrations.MythicMobs")){
if (Bukkit.getPluginManager().getPlugin("MythicMobs") == null) AdventureUtil.consoleMessage("<red>[CustomFishing] Failed to initialize MythicMobs!</red>");
else {
AdventureUtil.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>MythicMobs <color:#E1FFFF>Hooked!");
AdventureUtil.consoleMessage("[CustomFishing] <color:#00BFFF>MythicMobs <color:#E1FFFF>Hooked!");
mm = true;
}
}
@@ -139,28 +139,28 @@ public class ConfigReader{
if (Bukkit.getPluginManager().getPlugin("mcMMO") == null) CustomFishing.instance.getLogger().warning("Failed to initialize mcMMO!");
else {
skillXP = new mcMMO();
AdventureUtil.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>mcMMO <color:#E1FFFF>Hooked!");
AdventureUtil.consoleMessage("[CustomFishing] <color:#00BFFF>mcMMO <color:#E1FFFF>Hooked!");
}
}
if(config.getBoolean("config.integrations.AureliumSkills",false)){
if (Bukkit.getPluginManager().getPlugin("AureliumSkills") == null) CustomFishing.instance.getLogger().warning("Failed to initialize AureliumSkills!");
else {
skillXP = new Aurelium();
AdventureUtil.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>AureliumSkills <color:#E1FFFF>Hooked!");
AdventureUtil.consoleMessage("[CustomFishing] <color:#00BFFF>AureliumSkills <color:#E1FFFF>Hooked!");
}
}
if(config.getBoolean("config.integrations.MMOCore",false)){
if (Bukkit.getPluginManager().getPlugin("MMOCore") == null) CustomFishing.instance.getLogger().warning("Failed to initialize MMOCore!");
else {
skillXP = new MMOCore();
AdventureUtil.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>MMOCore <color:#E1FFFF>Hooked!");
AdventureUtil.consoleMessage("[CustomFishing] <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();
AdventureUtil.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>EcoSkills <color:#E1FFFF>Hooked!");
AdventureUtil.consoleMessage("[CustomFishing] <color:#00BFFF>EcoSkills <color:#E1FFFF>Hooked!");
}
}
@@ -169,14 +169,14 @@ public class ConfigReader{
if (Bukkit.getPluginManager().getPlugin("RealisticSeasons") == null) Log.warn("Failed to initialize RealisticSeasons!");
else {
season = new RealisticSeason();
AdventureUtil.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>RealisticSeasons <color:#E1FFFF>Hooked!");
AdventureUtil.consoleMessage("[CustomFishing] <color:#00BFFF>RealisticSeasons <color:#E1FFFF>Hooked!");
}
}
if (config.getBoolean("config.integrations.CustomCrops",false)){
if (Bukkit.getPluginManager().getPlugin("CustomCrops") == null) Log.warn("Failed to initialize CustomCrops!");
else {
season = new CustomCropsSeason();
AdventureUtil.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><color:#00BFFF>CustomCrops <color:#E1FFFF>Hooked!");
AdventureUtil.consoleMessage("[CustomFishing] <color:#00BFFF>CustomCrops <color:#E1FFFF>Hooked!");
}
}
@@ -502,7 +502,7 @@ public class ConfigReader{
AdventureUtil.consoleMessage("<red>[CustomFishing] Error! Failed to create mobs folder...</red>");
return;
}
CustomFishing.instance.saveResource("loots" + File.separator + "ExampleMob.yml", false);
CustomFishing.instance.saveResource("mobs" + File.separator + "example.yml", false);
}
File[] mobFiles = mob_file.listFiles();
if (mobFiles != null) {

View File

@@ -0,0 +1,13 @@
package net.momirealms.customfishing.api;
import net.momirealms.customfishing.ConfigReader;
import net.momirealms.customfishing.object.loot.Loot;
import org.jetbrains.annotations.Nullable;
public class CustomFishingAPI {
@Nullable
public static Loot getLoot(String key){
return ConfigReader.LOOT.get(key);
}
}

View File

@@ -470,7 +470,7 @@ public class FishListener implements Listener {
}
}
}
else if (vanillaLoot == null) {
else {
fail(player, loot);
}
}

View File

@@ -3,6 +3,7 @@ package net.momirealms.customfishing.listener;
import de.tr7zw.changeme.nbtapi.NBTItem;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.PlayerAttemptPickupItemEvent;
import org.bukkit.inventory.ItemStack;
@@ -24,4 +25,14 @@ public class PickUpListener implements Listener {
}
}
}
@EventHandler
public void onMove(InventoryPickupItemEvent event){
ItemStack itemStack = event.getItem().getItemStack();
NBTItem nbtItem = new NBTItem(itemStack);
if (nbtItem.hasKey("M_Owner")){
nbtItem.removeKey("M_Owner");
itemStack.setItemMeta(nbtItem.getItem().getItemMeta());
}
}
}

View File

@@ -22,8 +22,10 @@ import de.tr7zw.changeme.nbtapi.NBTItem;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.momirealms.customfishing.CustomFishing;
import net.momirealms.customfishing.object.Item;
import net.momirealms.customfishing.object.LeveledEnchantment;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;