# Useful Methods

## Obtain Max Enchantment Limit for the ItamStack object (ItemLimits.java)

```java
/*
Obtain the current maximum enchantment limit of the ItemStack object. The maximum enchantment limit is stored in the item NBT.
If it cannot be obtained, the default slot value is used.

Plugin has built-in default slot system, you can use ConfigReader.getDefaultLimits(player, itemID) method to default slot in this item.
For itemID parameter: You can first use checkValid(ItemStack item) method to parse it into String object here.
 */
public static int getMaxEnchantments(@NotNull ItemStack item, int defaultSlot, @NotNull ItemStack itemID) {
    return 0;
}
/*
Similar to getMaxEnchantments method, but cannot obtain maximum enchantment limit, we will just return 0 instead of return a default value.
 */
public static int getRealMaxEnchantments(@NotNull ItemStack item) {
    return 0;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://enchantmentslots.superiormc.cn/for-4.1.8/develop/useful-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
