mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-18 07:59:13 +00:00
Scripting for Item Attributes, Controller, ItemStack, IPlayer
This commit is contained in:
1 parent
c7a74a3e0e
commit
dfa15687d0
6 files changed
+432
-35
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package noppes.npcs.api.handler.data;
|
||||
|
||||
/**
|
||||
* Defines the blueprint for an attribute.
|
||||
* <p>
|
||||
* An attribute definition contains identifying information such as a unique key,
|
||||
* a human-readable display name, a translation key for localization, and a color code.
|
||||
* </p>
|
||||
*/
|
||||
public interface IAttributeDefinition {
|
||||
|
||||
/**
|
||||
* Returns the unique key that identifies this attribute.
|
||||
*
|
||||
* @return a String representing the attribute key
|
||||
*/
|
||||
String getKey();
|
||||
|
||||
/**
|
||||
* Returns the human-readable display name for this attribute.
|
||||
*
|
||||
* @return a String representing the display name
|
||||
*/
|
||||
String getDisplayName();
|
||||
|
||||
/**
|
||||
* Returns the translation key used for localizing this attribute.
|
||||
*
|
||||
* @return a String representing the translation key
|
||||
*/
|
||||
String getTranslationKey();
|
||||
|
||||
/**
|
||||
* Returns the color code associated with this attribute.
|
||||
*
|
||||
* @return a char representing the color code
|
||||
*/
|
||||
char getColorCode();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package noppes.npcs.api.handler.data;
|
||||
|
||||
/**
|
||||
* Represents an instance of a custom attribute.
|
||||
* <p>
|
||||
* A custom attribute instance encapsulates an {@link IAttributeDefinition}
|
||||
* along with its current calculated value (which may be affected by modifiers).
|
||||
* </p>
|
||||
*/
|
||||
public interface ICustomAttribute {
|
||||
|
||||
/**
|
||||
* Returns the attribute definition associated with this custom attribute.
|
||||
*
|
||||
* @return the {@link IAttributeDefinition} instance defining this attribute
|
||||
*/
|
||||
IAttributeDefinition getAttribute();
|
||||
|
||||
/**
|
||||
* Returns the current value of this attribute.
|
||||
*
|
||||
* @return the float value representing the attribute's current state
|
||||
*/
|
||||
float getValue();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package noppes.npcs.api.handler.data;
|
||||
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
|
||||
/**
|
||||
* Represents a collection of a player's custom attributes.
|
||||
* <p>
|
||||
* Expose methods to retrieve all attribute instances as an array, look up individual attributes by key,
|
||||
* and check for the presence of a specific attribute.
|
||||
* </p>
|
||||
*/
|
||||
public interface IPlayerAttributes {
|
||||
|
||||
/**
|
||||
* Recalulates Item Attributes on a Player
|
||||
*/
|
||||
void recalculate(IPlayer player);
|
||||
|
||||
/**
|
||||
* Returns an array of all custom attribute instances associated with the player.
|
||||
*
|
||||
* @return an array of {@link ICustomAttribute} objects
|
||||
*/
|
||||
ICustomAttribute[] getAttributes();
|
||||
|
||||
/**
|
||||
* Returns the value of the attribute identified by the given key.
|
||||
*
|
||||
* @param key the attribute key (e.g., "health", "movement_speed")
|
||||
* @return the float value of the attribute, or 0 if the attribute is not found
|
||||
*/
|
||||
float getAttributeValue(String key);
|
||||
|
||||
/**
|
||||
* Checks whether an attribute with the given key exists.
|
||||
*
|
||||
* @param key the attribute key to check
|
||||
* @return true if the attribute exists, false otherwise
|
||||
*/
|
||||
boolean hasAttribute(String key);
|
||||
|
||||
/**
|
||||
* Returns the custom attribute instance identified by the given key.
|
||||
*
|
||||
* @param key the attribute key (e.g., "health", "movement_speed")
|
||||
* @return the corresponding {@link ICustomAttribute} instance, or null if not found
|
||||
*/
|
||||
ICustomAttribute getAttribute(String key);
|
||||
}
|
||||
Reference in new issue
Block a user