9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-28 19:39:06 +00:00
This commit is contained in:
Xiao-MoMi
2023-03-24 01:37:26 +08:00
parent 48ba5d8c01
commit 71b60ac0e2
18 changed files with 352 additions and 71 deletions

View File

@@ -17,21 +17,47 @@
package net.momirealms.customfishing.api;
import de.tr7zw.changeme.nbtapi.NBTCompound;
import de.tr7zw.changeme.nbtapi.NBTItem;
import net.momirealms.customfishing.CustomFishing;
import net.momirealms.customfishing.fishing.FishingCondition;
import net.momirealms.customfishing.fishing.competition.Competition;
import net.momirealms.customfishing.fishing.loot.DroppedItem;
import net.momirealms.customfishing.fishing.loot.Item;
import net.momirealms.customfishing.fishing.loot.Loot;
import net.momirealms.customfishing.manager.ConfigManager;
import net.momirealms.customfishing.util.ItemStackUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.UUID;
public class CustomFishingAPI {
/**
* get plugin instance
* @return plugin instance
*/
public static CustomFishing getPluginInstance() {
return CustomFishing.getInstance();
}
/**
* Is there a competition ongoing
* @return is or not
*/
public static boolean isCompetitionGoingOn() {
return Competition.getCurrentCompetition() != null;
}
/**
* Get the current competition
* return null if there's no competition
* @return competition
*/
@@ -48,14 +74,6 @@ public class CustomFishingAPI {
return CustomFishing.getInstance().getFishingManager().getSize(fish);
}
/**
* get plugin instance
* @return plugin instance
*/
public static CustomFishing getPluginInstance() {
return CustomFishing.getInstance();
}
/**
* get an item's price
* @param itemStack item to sell
@@ -65,42 +83,6 @@ public class CustomFishingAPI {
return CustomFishing.getInstance().getSellManager().getSingleItemPrice(itemStack);
}
/**
* get items directly from item library
* return AIR if the loot does not exist
* @param id item_id
* @return itemStack
*/
@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);
}
/**
* If an item exists in item library
* @param type type
@@ -116,4 +98,146 @@ public class CustomFishingAPI {
default -> false;
};
}
/**
* If a world allow new fishing
* @param world world
* @return allow or not
*/
public static boolean isFishingWorld(World world) {
return ConfigManager.getWorldsList().contains(world.getName());
}
/**
* Get all the possible loots for a certain player at a certain location
* @param location location
* @param player player
* @return loots
*/
public static List<Loot> getLootsAt(Location location, Player player) {
return CustomFishing.getInstance().getFishingManager().getPossibleLootList(new FishingCondition(location, player), false, CustomFishing.getInstance().getLootManager().getAllLoots());
}
/**
* Get all the possible loots at a certain location
* @param location location
* @return loots
*/
public static List<Loot> getLootsAt(Location location) {
return CustomFishing.getInstance().getFishingManager().getPossibleLootList(new FishingCondition(location, null), false, CustomFishing.getInstance().getLootManager().getAllLoots());
}
/**
* Get a loot from Loot Manager
* @param id id
* @return loot
*/
public static Loot getLootByID(String id) {
return CustomFishing.getInstance().getLootManager().getLoot(id);
}
/**
* get items directly from item library
* return AIR if the loot does not exist
* @param id item_id
* @return itemStack
*/
@NotNull
public static ItemStack getLootItemByID(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 getLootItemByID(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 rods directly from item library
* return null if the rod does not exist
* @param id rod_id
* @return itemStack
*/
public static ItemStack getRodItemByID(String id) {
Item item = CustomFishing.getInstance().getEffectManager().getRodItem(id);
return item == null ? null : ItemStackUtil.getFromItem(item);
}
/**
* get baits directly from item library
* return null if the bait does not exist
* @param id bait_id
* @return itemStack
*/
public static ItemStack getBaitItemByID(String id) {
Item item = CustomFishing.getInstance().getEffectManager().getBaitItem(id);
return item == null ? null : ItemStackUtil.getFromItem(item);
}
/**
* get utils directly from item library
* return null if the util does not exist
* @param id util_id
* @return itemStack
*/
public static ItemStack getUtilItemByID(String id) {
Item item = CustomFishing.getInstance().getEffectManager().getUtilItem(id);
return item == null ? null : ItemStackUtil.getFromItem(item);
}
/**
* 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);
}
/**
* If the item is CustomFishing item
* @param itemStack itemStack
* @return is or not
*/
public static boolean isCustomFishingItem(ItemStack itemStack) {
if (itemStack == null || itemStack.getType() == Material.AIR) return false;
NBTItem nbtItem = new NBTItem(itemStack);
NBTCompound nbtCompound = nbtItem.getCompound("CustomFishing");
return nbtCompound != null;
}
/**
* Add CustomFishing tag to an item
* @param itemStack itemStack
* @param type type
* @param id id
*/
public static void addCustomFishingTagToItem(ItemStack itemStack, String type, String id) {
if (itemStack == null || itemStack.getType() == Material.AIR) return;
NBTItem nbtItem = new NBTItem(itemStack);
NBTCompound nbtCompound = nbtItem.addCompound("CustomFishing");
nbtCompound.setString("type", type);
nbtCompound.setString("id", id);
itemStack.setItemMeta(nbtItem.getItem().getItemMeta());
}
/**
* Get a player's earnings
* @param player player
* @return earnings
*/
public static double getTodayEarning(Player player) {
return CustomFishing.getInstance().getSellManager().getTodayEarning(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.commands;
import net.momirealms.customfishing.manager.MessageManager;

View File

@@ -31,5 +31,6 @@ public class MainCommand extends AbstractMainCommand {
regSubCommand(OpenBagCommand.INSTANCE);
regSubCommand(StatisticsCommand.INSTANCE);
regSubCommand(HelpCommand.INSTANCE);
regSubCommand(AboutCommand.INSTANCE);
}
}

View File

@@ -0,0 +1,44 @@
/*
* 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.commands.subcmd;
import net.momirealms.customfishing.CustomFishing;
import net.momirealms.customfishing.commands.AbstractSubCommand;
import net.momirealms.customfishing.util.AdventureUtil;
import org.bukkit.command.CommandSender;
import java.util.List;
public class AboutCommand extends AbstractSubCommand {
public static final AboutCommand INSTANCE = new AboutCommand();
public AboutCommand() {
super("about");
}
@Override
public boolean onCommand(CommandSender sender, List<String> args) {
AdventureUtil.sendMessage(sender, "<#00BFFF>\uD83C\uDFA3 CustomFishing <gray>- <#87CEEB>" + CustomFishing.getInstance().getVersionHelper().getPluginVersion());
AdventureUtil.sendMessage(sender, "<#B0C4DE>A fishing plugin that provides innovative mechanics and powerful loot system");
AdventureUtil.sendMessage(sender, "<#DA70D6>\uD83E\uDDEA Author: <#FFC0CB>XiaoMoMi");
AdventureUtil.sendMessage(sender, "<#FF7F50>\uD83D\uDD25 Contributors: <#FFA07A>0ft3n<white>, <#FFA07A>Peng_Lx<white>, <#FFA07A>Masaki");
AdventureUtil.sendMessage(sender, "<#FFD700>⭐ <click:open_url:https://mo-mi.gitbook.io/xiaomomi-plugins/plugin-wiki/customfishing>Document</click> <#A9A9A9>| <#FAFAD2>⛏ <click:open_url:https://github.com/Xiao-MoMi/Custom-Fishing>Github</click> <#A9A9A9>| <#48D1CC>\uD83D\uDD14 <click:open_url:https://polymart.org/resource/customfishing.2723>Polymart</click>");
return true;
}
}

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.commands.subcmd;
import net.momirealms.customfishing.commands.AbstractSubCommand;
@@ -16,33 +33,38 @@ public class HelpCommand extends AbstractSubCommand {
@Override
public boolean onCommand(CommandSender sender, List<String> args) {
AdventureUtil.sendMessage(sender, "<#4169E1>Command usage:");
AdventureUtil.sendMessage(sender, " <gray>├─<#FFFACD><Required Augument> ");
AdventureUtil.sendMessage(sender, " <gray>└─<#FFFACD><#E1FFFF>[Optional Augument]");
AdventureUtil.sendMessage(sender, "<#4169E1>/customfishing");
AdventureUtil.sendMessage(sender, " <gray>├─<white>help");
AdventureUtil.sendMessage(sender, " <gray>├─<white>about");
AdventureUtil.sendMessage(sender, " <gray>├─<white>reload <#87CEFA>Reload the plugin");
AdventureUtil.sendMessage(sender, " <gray>├─<white>forceopenbag <player> <#87CEFA>Force a player to open his fishing bag");
AdventureUtil.sendMessage(sender, " <gray>├─<white>sellshop <player> <#87CEFA>Force a player to open sell shop");
AdventureUtil.sendMessage(sender, " <gray>├─<white>forceopenbag <#FFFACD><player> <#87CEFA>Force a player to open his fishing bag");
AdventureUtil.sendMessage(sender, " <gray>├─<white>sellshop <#FFFACD><player> <#87CEFA>Force a player to open sell shop");
AdventureUtil.sendMessage(sender, " <gray>├─<white>competition");
AdventureUtil.sendMessage(sender, " <gray>│ ├─<white>start <id> <#87CEFA>Start a competition");
AdventureUtil.sendMessage(sender, " <gray>│ ├─<white>start <#FFFACD><id> <#87CEFA>Start a competition");
AdventureUtil.sendMessage(sender, " <gray>│ ├─<white>end <#87CEFA>End the ongoing competition");
AdventureUtil.sendMessage(sender, " <gray>│ └─<white>cancel <#87CEFA>Cancel the ongoing competition");
AdventureUtil.sendMessage(sender, " <gray>├─<white>items");
AdventureUtil.sendMessage(sender, " <gray>│ ├─<white>loot");
AdventureUtil.sendMessage(sender, " <gray>│ │ ├─<white>get <id> [amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ ├─<white>give <player> <id> [amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ └─<white>import <key> <#87CEFA>Import the item in hand");
AdventureUtil.sendMessage(sender, " <gray>│ │ ├─<white>get <#FFFACD><id> <#E1FFFF>[amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ ├─<white>give <#FFFACD><player> <id> <#E1FFFF>[amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ └─<white>import <#FFFACD><key> <#87CEFA>Import the item in hand");
AdventureUtil.sendMessage(sender, " <gray>│ ├─<white>rod");
AdventureUtil.sendMessage(sender, " <gray>│ │ ├─<white>get <id> [amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ └─<white>give <player> <id> [amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ ├─<white>get <#FFFACD><id> <#E1FFFF>[amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ └─<white>give <#FFFACD><player> <id> <#E1FFFF>[amount]");
AdventureUtil.sendMessage(sender, " <gray>│ ├─<white>bait");
AdventureUtil.sendMessage(sender, " <gray>│ │ ├─<white>get <id> [amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ └─<white>give <player> <id> [amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ ├─<white>get <#FFFACD><id> <#E1FFFF>[amount]");
AdventureUtil.sendMessage(sender, " <gray>│ │ └─<white>give <#FFFACD><player> <id> <#E1FFFF>[amount]");
AdventureUtil.sendMessage(sender, " <gray>│ └─<white>util");
AdventureUtil.sendMessage(sender, " <gray>│ ├─<white>et <id> [amount]");
AdventureUtil.sendMessage(sender, " <gray>│ └─<white>give <player> <id> [amount]");
AdventureUtil.sendMessage(sender, " <gray>│ ├─<white>get <#FFFACD><id> <#E1FFFF>[amount]");
AdventureUtil.sendMessage(sender, " <gray>│ └─<white>give <#FFFACD><player> <id> <#E1FFFF>[amount]");
AdventureUtil.sendMessage(sender, " <gray>└─<white>statistics");
AdventureUtil.sendMessage(sender, " <gray>├─<white>reset <player> <#87CEFA>Reset a player's statistics");
AdventureUtil.sendMessage(sender, " <gray>└─<white>set <player> <id> <value> <#87CEFA>Set certain statistics' value");
AdventureUtil.sendMessage(sender, " <gray>├─<white>reset <#FFFACD><player> <#87CEFA>Reset a player's statistics");
AdventureUtil.sendMessage(sender, " <gray>└─<white>set <#FFFACD><player> <id> <value> <#87CEFA>Set certain statistics' value");
AdventureUtil.sendMessage(sender, "<#4169E1>/fishingbag");
AdventureUtil.sendMessage(sender, " <gray>└─<white>open [player] <#87CEFA>Open the fishing bag");
AdventureUtil.sendMessage(sender, " <gray>└─<white>open <#E1FFFF>[player] <#87CEFA>Open the fishing bag");
AdventureUtil.sendMessage(sender, "<#4169E1>/sellshop <#87CEFA>Open the sell shop");
return true;
}

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.commands.subcmd;
import net.momirealms.customfishing.CustomFishing;

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.commands.subcmd;
import net.momirealms.customfishing.CustomFishing;

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.commands.subcmd;
import net.momirealms.customfishing.CustomFishing;

View File

@@ -34,6 +34,10 @@ public class FishingCondition{
public FishingCondition(Location location, Player player) {
this.location = location;
this.player = player;
if (player == null) {
papiMap = new HashMap<>();
return;
}
PlaceholderManager placeholderManager = CustomFishing.getInstance().getIntegrationManager().getPlaceholderManager();
this.papiMap = new HashMap<>();
for (String papi : CustomPapi.allPapi) {

View File

@@ -53,12 +53,10 @@ public class ModeOneGame extends FishingGame {
@Override
public void showBar() {
String bar =
"<font:" + modeOneBar.getFont() + ">" + modeOneBar.getBarImage()
String bar = "<font:" + modeOneBar.getFont() + ">" + modeOneBar.getBarImage()
+ "<font:" + offsetManager.getFont() + ">" + offsetManager.getOffsetChars(modeOneBar.getPointerOffset() + progress) + "</font>"
+ modeOneBar.getPointerImage()
+ "<font:" + offsetManager.getFont() + ">" + offsetManager.getOffsetChars(modeOneBar.getTotalWidth() - progress - modeOneBar.getPointerWidth()) + "</font></font>";
AdventureUtil.playerTitle(player, title, bar,0,500,0);
}

View File

@@ -72,6 +72,7 @@ public class CustomPapi extends Requirement implements RequirementInterface {
@Override
public boolean isConditionMet(FishingCondition fishingCondition) {
if (fishingCondition.getPlayer() == null) return true;
return papiRequirement.isMet(fishingCondition.getPapiMap(), fishingCondition.getPlayer());
}

View File

@@ -17,7 +17,7 @@ public class JobLevelImpl extends Requirement implements RequirementInterface {
@Override
public boolean isConditionMet(FishingCondition fishingCondition) {
JobInterface jobInterface = CustomFishing.getInstance().getIntegrationManager().getJobInterface();
if (jobInterface == null) return true;
if (jobInterface == null || fishingCondition.getPlayer() == null) return true;
if (jobInterface.getLevel(fishingCondition.getPlayer()) >= level) {
return true;
}

View File

@@ -35,7 +35,7 @@ public class PermissionImpl extends Requirement implements RequirementInterface
@Override
public boolean isConditionMet(FishingCondition fishingCondition) {
if (fishingCondition.getPlayer().hasPermission(permission)) {
if (fishingCondition.getPlayer() == null || fishingCondition.getPlayer().hasPermission(permission)) {
return true;
}
notMetMessage(fishingCondition.getPlayer());

View File

@@ -30,7 +30,7 @@ public abstract class Requirement {
}
public void notMetMessage(Player player) {
if (msg != null) {
if (msg != null && player != null) {
for (String str : msg) {
AdventureUtil.playerMessage(player, str);
}

View File

@@ -17,7 +17,7 @@ public class SkillLevelImpl extends Requirement implements RequirementInterface
@Override
public boolean isConditionMet(FishingCondition fishingCondition) {
SkillInterface skillInterface = CustomFishing.getInstance().getIntegrationManager().getSkillInterface();
if (skillInterface == null) return true;
if (skillInterface == null || fishingCondition.getPlayer() == null) return true;
if (skillInterface.getLevel(fishingCondition.getPlayer()) >= level) {
return true;
}

View File

@@ -34,21 +34,23 @@ import java.net.URLConnection;
public class VersionHelper {
private boolean isNewerThan1_19_R2;
private String version;
private String serverVersion;
private final CustomFishing plugin;
private final boolean isSpigot;
private final String pluginVersion;
public VersionHelper(CustomFishing plugin) {
this.plugin = plugin;
isVersionNewerThan1_19_R2();
disableUseLessInfo();
isSpigot = plugin.getServer().getName().equals("CraftBukkit");
pluginVersion = plugin.getDescription().getVersion();
}
public boolean isVersionNewerThan1_19_R2() {
if (version == null) {
version = plugin.getServer().getClass().getPackage().getName().split("\\.")[3];
String[] split = version.split("_");
if (serverVersion == null) {
serverVersion = plugin.getServer().getClass().getPackage().getName().split("\\.")[3];
String[] split = serverVersion.split("_");
int main_ver = Integer.parseInt(split[1]);
if (main_ver >= 20) isNewerThan1_19_R2 = true;
else if (main_ver == 19) isNewerThan1_19_R2 = Integer.parseInt(split[2].substring(1)) >= 2;
@@ -66,7 +68,7 @@ public class VersionHelper {
field.setAccessible(true);
MinecraftVersion minecraftVersion;
try {
minecraftVersion = MinecraftVersion.valueOf(version.replace("v", "MC"));
minecraftVersion = MinecraftVersion.valueOf(serverVersion.replace("v", "MC"));
} catch (IllegalArgumentException ex) {
minecraftVersion = MinecraftVersion.UNKNOWN;
}
@@ -174,4 +176,8 @@ public class VersionHelper {
public boolean isSpigot() {
return isSpigot;
}
public String getPluginVersion() {
return pluginVersion;
}
}

View File

@@ -441,6 +441,18 @@ public class SellManager extends DataFunction {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd.replace("{player}", player.getName()).replace("{money}", String.format("%.2f", earnings)).replace("{remains}", sellLimitation ? String.format("%.2f", remains) : "unlimited"));
}
public double getTodayEarning(Player player) {
PlayerSellData playerSellData = sellDataMap.get(player.getUniqueId());
if (playerSellData == null) return 0d;
Calendar calendar = Calendar.getInstance();
int currentDate = (calendar.get(Calendar.MONTH) + 1) * 100 + calendar.get(Calendar.DATE);
if (currentDate != playerSellData.getDate()) {
playerSellData.setDate(currentDate);
playerSellData.setMoney(0);
}
return playerSellData.getMoney();
}
@Override
public void onWindowTitlePacketSend(PacketContainer packet, Player player) {
StructureModifier<WrappedChatComponent> wrappedChatComponentStructureModifier = packet.getChatComponents();

View File

@@ -205,6 +205,7 @@ public class ItemStackUtil {
File file = new File(CustomFishing.getInstance().getDataFolder(), File.separator + "loots" + File.separator + "imported.yml");
YamlConfiguration data = ConfigUtil.readData(file);
data.set(key + ".material", itemStack.getType().toString());
data.set(key + ".amount", itemStack.getAmount());
NBTItem nbtItem = new NBTItem(itemStack);
Map<String, Object> map0 = compoundToMap(nbtItem);
if (map0.size() != 0) {