mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-28 19:39:11 +00:00
添加api方法
This commit is contained in:
@@ -27,10 +27,28 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public final class CraftEngineBlocks {
|
||||
|
||||
private CraftEngineBlocks() {}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns an unmodifiable map of all currently loaded custom blocks.
|
||||
* The map keys represent unique identifiers, and the values are the corresponding CustomBlock instances.
|
||||
*
|
||||
* <p><strong>Important:</strong> Do not attempt to access this method during the onEnable phase
|
||||
* as it will be empty. Instead, listen for the {@code CraftEngineReloadEvent} and use this method
|
||||
* after the event is fired to obtain the complete block list.
|
||||
*
|
||||
* @return a non-null map containing all loaded custom blocks
|
||||
*/
|
||||
@NotNull
|
||||
public static Map<Key, CustomBlock> loadedBlocks() {
|
||||
return BukkitBlockManager.instance().loadedBlocks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a custom block by ID
|
||||
*
|
||||
|
||||
@@ -27,11 +27,27 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class CraftEngineFurniture {
|
||||
|
||||
private CraftEngineFurniture() {}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable map of all currently loaded custom furniture.
|
||||
* The map keys represent unique identifiers, and the values are the corresponding CustomFurniture instances.
|
||||
*
|
||||
* <p><strong>Important:</strong> Do not attempt to access this method during the onEnable phase
|
||||
* as it will be empty. Instead, listen for the {@code CraftEngineReloadEvent} and use this method
|
||||
* after the event is fired to obtain the complete furniture list.
|
||||
*
|
||||
* @return a non-null map containing all loaded custom furniture
|
||||
*/
|
||||
@NotNull
|
||||
public static Map<Key, CustomFurniture> loadedFurniture() {
|
||||
return BukkitFurnitureManager.instance().loadedFurniture();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets custom furniture by ID
|
||||
*
|
||||
|
||||
@@ -8,10 +8,28 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public final class CraftEngineItems {
|
||||
|
||||
private CraftEngineItems() {}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable map of all currently loaded custom items.
|
||||
* The map keys represent unique identifiers, and the values are the corresponding CustomItem instances.
|
||||
*
|
||||
* <p><strong>Important:</strong> Do not attempt to access this method during the onEnable phase
|
||||
* as it will be empty. Instead, listen for the {@code CraftEngineReloadEvent} and use this method
|
||||
* after the event is fired to obtain the complete item list.
|
||||
*
|
||||
* @return a non-null map containing all loaded custom items
|
||||
* @throws IllegalStateException if the BukkitItemManager instance is not available
|
||||
*/
|
||||
@NotNull
|
||||
public static Map<Key, CustomItem<ItemStack>> loadedItems() {
|
||||
return BukkitItemManager.instance().loadedItems();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a custom item by ID
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user