mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-28 19:39:06 +00:00
1.3.0.1
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'net.momirealms'
|
||||
version = '1.3.0'
|
||||
version = '1.3.0.1'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -19,9 +19,16 @@ package net.momirealms.customfishing.api;
|
||||
|
||||
import net.momirealms.customfishing.CustomFishing;
|
||||
import net.momirealms.customfishing.fishing.competition.Competition;
|
||||
import net.momirealms.customfishing.fishing.loot.DroppedItem;
|
||||
import net.momirealms.customfishing.fishing.loot.Loot;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class CustomFishingAPI {
|
||||
|
||||
/**
|
||||
@@ -45,7 +52,7 @@ public class CustomFishingAPI {
|
||||
* get plugin instance
|
||||
* @return plugin instance
|
||||
*/
|
||||
public static CustomFishing getInstance() {
|
||||
public static CustomFishing getPluginInstance() {
|
||||
return CustomFishing.getInstance();
|
||||
}
|
||||
|
||||
@@ -59,11 +66,38 @@ public class CustomFishingAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* build an itemStack instance from key
|
||||
* get items directly from item library
|
||||
* return AIR if the loot does not exist
|
||||
* @param id item_id
|
||||
* @return itemStack
|
||||
*/
|
||||
public static ItemStack buildItem(String id) {
|
||||
@NotNull
|
||||
public static ItemStack getLootByID(String id) {
|
||||
return CustomFishing.getInstance().getIntegrationManager().build(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* get items obtained by fishing
|
||||
* return AIR if the loot does not exist
|
||||
* @param id item_id
|
||||
* @param player player
|
||||
* @return itemStack
|
||||
*/
|
||||
@NotNull
|
||||
public static ItemStack getLootByID(String id, @Nullable Player player) {
|
||||
Loot loot = CustomFishing.getInstance().getLootManager().getLoot(id);
|
||||
if (!(loot instanceof DroppedItem droppedItem)) return new ItemStack(Material.AIR);
|
||||
return CustomFishing.getInstance().getFishingManager().getCustomFishingLootItemStack(droppedItem, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the catch amount of a certain loot
|
||||
* return -1 if player's data is not loaded
|
||||
* @param id loot id
|
||||
* @param uuid uuid
|
||||
* @return amount
|
||||
*/
|
||||
public static int getCertainLootCatchAmount(String id, UUID uuid) {
|
||||
return CustomFishing.getInstance().getStatisticsManager().getFishAmount(uuid, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class RodCastEvent extends PlayerEvent implements Cancellable {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Effect getBonus() {
|
||||
public Effect getEffect() {
|
||||
return effect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,14 +586,14 @@ public class FishingManager extends Function {
|
||||
return getCustomFishingLootItemStack(droppedItem, player, 1);
|
||||
}
|
||||
|
||||
public ItemStack getCustomFishingLootItemStack(DroppedItem droppedItem, Player player, double sizeMultiplier) {
|
||||
public ItemStack getCustomFishingLootItemStack(DroppedItem droppedItem, @Nullable Player player, double sizeMultiplier) {
|
||||
ItemStack drop = plugin.getIntegrationManager().build(droppedItem.getMaterial());
|
||||
if (drop.getType() != Material.AIR) {
|
||||
if (droppedItem.getRandomEnchants() != null)
|
||||
ItemStackUtil.addRandomEnchants(drop, droppedItem.getRandomEnchants());
|
||||
if (droppedItem.isRandomDurability())
|
||||
ItemStackUtil.addRandomDamage(drop);
|
||||
if (ConfigManager.preventPickUp)
|
||||
if (ConfigManager.preventPickUp && player != null)
|
||||
ItemStackUtil.addOwner(drop, player.getName());
|
||||
ItemStackUtil.addExtraMeta(drop, droppedItem, sizeMultiplier);
|
||||
}
|
||||
|
||||
@@ -323,8 +323,8 @@ public class SellManager extends DataFunction {
|
||||
playerItem.setAmount(0);
|
||||
}
|
||||
|
||||
sellData.setMoney(totalPrice + sell);
|
||||
doActions(player, sellFishEvent.getMoney(), upperLimit - sell - totalPrice);
|
||||
sellData.setMoney(sellFishEvent.getMoney() + sell);
|
||||
doActions(player, sellFishEvent.getMoney(), upperLimit - sell - sellFishEvent.getMoney());
|
||||
inventory.close();
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user