mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
2.1.0.3
This commit is contained in:
@@ -39,6 +39,12 @@ public interface AdventureManager {
|
|||||||
*/
|
*/
|
||||||
void sendMessage(CommandSender sender, String msg);
|
void sendMessage(CommandSender sender, String msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a message with prefix
|
||||||
|
*
|
||||||
|
* @param sender command sender
|
||||||
|
* @param s message
|
||||||
|
*/
|
||||||
void sendMessageWithPrefix(CommandSender sender, String s);
|
void sendMessageWithPrefix(CommandSender sender, String s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public interface BagManager {
|
public interface BagManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is bag enabled
|
||||||
|
*
|
||||||
|
* @return enabled or not
|
||||||
|
*/
|
||||||
boolean isEnabled();
|
boolean isEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +44,12 @@ public interface BagManager {
|
|||||||
*/
|
*/
|
||||||
Inventory getOnlineBagInventory(UUID uuid);
|
Inventory getOnlineBagInventory(UUID uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the rows of a player's fishing bag
|
||||||
|
*
|
||||||
|
* @param player player who owns the bag
|
||||||
|
* @return rows
|
||||||
|
*/
|
||||||
int getBagInventoryRows(Player player);
|
int getBagInventoryRows(Player player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,15 +60,45 @@ public interface BagManager {
|
|||||||
*/
|
*/
|
||||||
void editOfflinePlayerBag(Player admin, OfflineUser userData);
|
void editOfflinePlayerBag(Player admin, OfflineUser userData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the actions to perform when loot is automatically collected
|
||||||
|
*
|
||||||
|
* @return actions
|
||||||
|
*/
|
||||||
Action[] getCollectLootActions();
|
Action[] getCollectLootActions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the actions to perform when bag is full
|
||||||
|
*
|
||||||
|
* @return actions
|
||||||
|
*/
|
||||||
Action[] getBagFullActions();
|
Action[] getBagFullActions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If bag can store fishing loots
|
||||||
|
*
|
||||||
|
* @return can store or not
|
||||||
|
*/
|
||||||
boolean doesBagStoreLoots();
|
boolean doesBagStoreLoots();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the fishing bag's title
|
||||||
|
*
|
||||||
|
* @return title
|
||||||
|
*/
|
||||||
String getBagTitle();
|
String getBagTitle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of allowed items in bag
|
||||||
|
*
|
||||||
|
* @return whitelisted items
|
||||||
|
*/
|
||||||
List<Material> getBagWhiteListItems();
|
List<Material> getBagWhiteListItems();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the requirements for automatically collecting loots
|
||||||
|
*
|
||||||
|
* @return requirements
|
||||||
|
*/
|
||||||
Requirement[] getCollectRequirements();
|
Requirement[] getCollectRequirements();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,13 @@ public interface ItemManager {
|
|||||||
@Nullable
|
@Nullable
|
||||||
BuildableItem getBuildableItem(String namespace, String value);
|
BuildableItem getBuildableItem(String namespace, String value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an itemStack's appearance (material + custom model data)
|
||||||
|
*
|
||||||
|
* @param player player
|
||||||
|
* @param material id
|
||||||
|
* @return appearance
|
||||||
|
*/
|
||||||
ItemStack getItemStackAppearance(Player player, String material);
|
ItemStack getItemStackAppearance(Player player, String material);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ public interface MarketManager {
|
|||||||
*/
|
*/
|
||||||
int getCachedDate();
|
int getCachedDate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the current date as an integer in the format MMDD (e.g., September 21 as 0921).
|
||||||
|
*
|
||||||
|
* @return An integer representing the current date.
|
||||||
|
*/
|
||||||
int getDate();
|
int getDate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -62,6 +62,14 @@ public interface RequirementManager {
|
|||||||
*/
|
*/
|
||||||
@Nullable Requirement[] getRequirements(ConfigurationSection section, boolean advanced);
|
@Nullable Requirement[] getRequirements(ConfigurationSection section, boolean advanced);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a requirement type exists
|
||||||
|
*
|
||||||
|
* @param type type
|
||||||
|
* @return exists or not
|
||||||
|
*/
|
||||||
|
boolean hasRequirement(String type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a Requirement object based on a configuration section and advanced flag.
|
* Retrieves a Requirement object based on a configuration section and advanced flag.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ public interface StorageManager {
|
|||||||
*/
|
*/
|
||||||
@Nullable OnlineUser getOnlineUser(UUID uuid);
|
@Nullable OnlineUser getOnlineUser(UUID uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the online users
|
||||||
|
*
|
||||||
|
* @return online users
|
||||||
|
*/
|
||||||
Collection<OnlineUser> getOnlineUsers();
|
Collection<OnlineUser> getOnlineUsers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|
||||||
version = "2.1.0.2"
|
version = "2.1.0.3"
|
||||||
|
|
||||||
apply<JavaPlugin>()
|
apply<JavaPlugin>()
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
|
|||||||
@@ -280,6 +280,7 @@ public class RequirementManagerImpl implements RequirementManager {
|
|||||||
return requirements.toArray(new Requirement[0]);
|
return requirements.toArray(new Requirement[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasRequirement(String type) {
|
public boolean hasRequirement(String type) {
|
||||||
return requirementBuilderMap.containsKey(type);
|
return requirementBuilderMap.containsKey(type);
|
||||||
}
|
}
|
||||||
@@ -1361,7 +1362,6 @@ public class RequirementManagerImpl implements RequirementManager {
|
|||||||
* Loads requirement expansions from external JAR files located in the expansion folder.
|
* Loads requirement expansions from external JAR files located in the expansion folder.
|
||||||
* Each expansion JAR should contain classes that extends the RequirementExpansion class.
|
* Each expansion JAR should contain classes that extends the RequirementExpansion class.
|
||||||
* Expansions are registered and used to create custom requirements.
|
* Expansions are registered and used to create custom requirements.
|
||||||
* If an error occurs while loading or initializing an expansion, a warning message is logged.
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
private void loadExpansions() {
|
private void loadExpansions() {
|
||||||
|
|||||||
@@ -20,12 +20,9 @@ package net.momirealms.customfishing.scheduler;
|
|||||||
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
||||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||||
import net.momirealms.customfishing.api.scheduler.CancellableTask;
|
import net.momirealms.customfishing.api.scheduler.CancellableTask;
|
||||||
import net.momirealms.customfishing.util.LocationUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scheduler implementation for "synchronous" tasks using Folia's RegionScheduler.
|
* A scheduler implementation for "synchronous" tasks using Folia's RegionScheduler.
|
||||||
*/
|
*/
|
||||||
@@ -45,7 +42,11 @@ public class FoliaSchedulerImpl implements SyncScheduler {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void runSyncTask(Runnable runnable, Location location) {
|
public void runSyncTask(Runnable runnable, Location location) {
|
||||||
Bukkit.getRegionScheduler().execute(plugin, Optional.ofNullable(location).orElse(LocationUtils.getAnyLocationInstance()), runnable);
|
if (location == null) {
|
||||||
|
Bukkit.getGlobalRegionScheduler().execute(plugin, runnable);
|
||||||
|
} else {
|
||||||
|
Bukkit.getRegionScheduler().execute(plugin, location, runnable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +60,9 @@ public class FoliaSchedulerImpl implements SyncScheduler {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CancellableTask runTaskSyncTimer(Runnable runnable, Location location, long delay, long period) {
|
public CancellableTask runTaskSyncTimer(Runnable runnable, Location location, long delay, long period) {
|
||||||
|
if (location == null) {
|
||||||
|
return new FoliaCancellableTask(Bukkit.getGlobalRegionScheduler().runAtFixedRate(plugin, (scheduledTask -> runnable.run()), delay, period));
|
||||||
|
}
|
||||||
return new FoliaCancellableTask(Bukkit.getRegionScheduler().runAtFixedRate(plugin, location, (scheduledTask -> runnable.run()), delay, period));
|
return new FoliaCancellableTask(Bukkit.getRegionScheduler().runAtFixedRate(plugin, location, (scheduledTask -> runnable.run()), delay, period));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +77,13 @@ public class FoliaSchedulerImpl implements SyncScheduler {
|
|||||||
@Override
|
@Override
|
||||||
public CancellableTask runTaskSyncLater(Runnable runnable, Location location, long delay) {
|
public CancellableTask runTaskSyncLater(Runnable runnable, Location location, long delay) {
|
||||||
if (delay == 0) {
|
if (delay == 0) {
|
||||||
return new FoliaSchedulerImpl.FoliaCancellableTask(Bukkit.getRegionScheduler().run(plugin, location, (scheduledTask -> runnable.run())));
|
if (location == null) {
|
||||||
|
return new FoliaCancellableTask(Bukkit.getGlobalRegionScheduler().run(plugin, (scheduledTask -> runnable.run())));
|
||||||
|
}
|
||||||
|
return new FoliaCancellableTask(Bukkit.getRegionScheduler().run(plugin, location, (scheduledTask -> runnable.run())));
|
||||||
|
}
|
||||||
|
if (location == null) {
|
||||||
|
return new FoliaCancellableTask(Bukkit.getGlobalRegionScheduler().runDelayed(plugin, (scheduledTask -> runnable.run()), delay));
|
||||||
}
|
}
|
||||||
return new FoliaCancellableTask(Bukkit.getRegionScheduler().runDelayed(plugin, location, (scheduledTask -> runnable.run()), delay));
|
return new FoliaCancellableTask(Bukkit.getRegionScheduler().runDelayed(plugin, location, (scheduledTask -> runnable.run()), delay));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user