Sueta

del

1.3.2.38

del

·Plugin

✨ SagaLoreStats Plugin ✨
[1.20.1-1.21.8]
Your Ultimate Lore-Driven Custom Attribute System for Minecraft!

1.2.0.11 + [Paper] [1.21.4-1.21.8]
1.0.0.111 [ Bukkit ] [1.20.1-1.21.3]

These plugins are extensions for SagaLoreStats
SagaSets

LiteLevels
SagaAccessories

API
package com.saga.sagalorestats.api;

import com.saga.sagalorestats.SagaLoreStats;
import com.saga.sagalorestats.attribute.AttributeData;
import com.saga.sagalorestats.attribute.AttributeType;
import com.saga.sagalorestats.script.api.AttributeAPI;
import org.bukkit.Bukkit;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

import java.util.List;
import java.util.Map;

/**
* SagaLoreStats Public API Interface
* Provides unified API interface for other plugins to call
*
* Usage Examples:
* ```java
* // Get player attribute value
* double attack = SagaLoreStatsAPI.getPlayerAttributeValue(player, "attack");
*
* // Add temporary attributes
* List<String> attributes = Arrays.asList("Attack: +50", "Health: +100");
* SagaLoreStatsAPI.addTemporaryAttributes(player, "Temporary BUFF", attributes);
*
* // Remove temporary attributes
* SagaLoreStatsAPI.removeTemporaryAttributes(player, "Temporary BUFF");
* ```
*/
public class SagaLoreStatsAPI {
 
    private static SagaLoreStats plugin;
 
    /**
     * Initialize API (called internally by plugin)
     * @param plugin Plugin instance
     */
    public static void init(SagaLoreStats plugin);
 
    /**
     * Get plugin instance
     * @return Plugin instance, returns null if plugin is not enabled
     */
    public static SagaLoreStats getPlugin();
 
    /**
     * Check if plugin is available
     * @return Whether plugin is available
     */
    public static boolean isAvailable();
 
    // ==================== Player Attribute API ====================
 
    /**
     * Get player attribute value (includes equipment attributes and script API attributes)
     * @param player Player
     * @param attributeKey Attribute key (e.g.: "attack", "defense", "health", etc.)
     * @return Attribute value, returns 0.0 if attribute doesn't exist
     */
    public static double getPlayerAttributeValue(Player player, String attributeKey);

    /**
     * Get all player attributes (includes equipment attributes and script API attributes)
     * @param player Player
     * @return Attribute mapping, key is attribute key, value is attribute value
     */
    public static Map<String, Double> getPlayerAttributes(Player player);

    /**
     * Get player combat power
     * @param player Player
     * @return Combat power value
     */
    public static double getPlayerCombatPower(Player player);
 
    // ==================== Entity Attribute API ====================
 
    /**
     * Get entity attribute value (supports players and monsters)
     * @param entity Entity
     * @param attributeKey Attribute key
     * @return Attribute value, returns 0.0 if attribute doesn't exist
     */
    public static double getEntityAttributeValue(LivingEntity entity, String attributeKey);

    /**
     * Get all entity attributes (supports players and monsters)
     * @param entity Entity
     * @return Attribute mapping, key is attribute key, value is attribute value
     */
    public static Map<String, Double> getEntityAttributes(LivingEntity entity);
 
    // ==================== Temporary Attribute API ====================
 
    /**
     * Add temporary attribute source to entity
     * @param entity Entity
     * @param sourceName Attribute source name (used for identification and removal)
     * @param attributes Attribute list, format like ["Attack: +50", "Health: +100"]
     */
    public static void addTemporaryAttributes(LivingEntity entity, String sourceName, List<String> attributes);
 
    /**
     * Remove temporary attribute source from entity
     * @param entity Entity
     * @param sourceName Attribute source name
     */
    public static void removeTemporaryAttributes(LivingEntity entity, String sourceName);
 
    /**
     * Get all temporary attribute sources of entity
     * @param entity Entity
     * @return Attribute source mapping, key is source name, value is attribute list
     */
    public static Map<String, List<String>> getTemporaryAttributeSources(LivingEntity entity);
 
    /**
     * Clear all temporary attribute sources of entity
     * @param entity Entity
     */
    public static void clearTemporaryAttributes(LivingEntity entity);
 
    // ==================== Attribute Registration API ====================
 
    /**
     * Dynamically register script attribute
     * @param attributeKey Attribute key
     * @param attributeName Attribute name
     * @param attributeType Attribute type
     * @param priority Priority
     * @param combatPower Combat power coefficient
     * @param placeholder PlaceholderAPI placeholder
     */
    public static void registerScriptAttribute(String attributeKey, String attributeName,
                                             AttributeType attributeType, int priority,
                                             double combatPower, String placeholder);
 
    /**
     * Unregister script attribute
     * @param attributeKey Attribute key
     */
    public static void unregisterScriptAttribute(String attributeKey);
 
    // ==================== Attribute Data API ====================
 
    /**
     * Get attribute data
     * @param attributeKey Attribute key
     * @return Attribute data, returns null if doesn't exist
     */
    public static AttributeData getAttributeData(String attributeKey);
 
    /**
     * Get all attribute data
     * @return Attribute data mapping, key is attribute key, value is attribute data
     */
    public static Map<String, AttributeData> getAllAttributeData();
 
    /**
     * Get attribute data by specified type
     * @param type Attribute type
     * @return Attribute data list
     */
    public static List<AttributeData> getAttributeDataByType(AttributeType type);
 
    // ==================== Cache Management API ====================
 
    /**
     * Clear player attribute cache
     * @param player Player
     */
    public static void clearPlayerCache(Player player);
 
    /**
     * Force refresh player attribute cache
     * @param player Player
     */
    public static void refreshPlayerAttributes(Player player);
 
    /**
     * Force refresh all online players' attribute cache
     */
    public static void refreshAllPlayersAttributes();
 
    // ==================== Utility Method API ====================
 
    /**
     * Calculate attribute effect
     * @param attributeKey Attribute key
     * @param attacker Attacker
     * @param entity Defender
     * @param attackerDamage Damage dealt by attacker
     * @param entityDamage Damage dealt by defender
     * @param value Attribute value
     * @return Calculation result
     */
    public static double calculateAttributeEffect(String attributeKey, LivingEntity attacker,
                                                LivingEntity entity, double attackerDamage,
                                                double entityDamage, double value);
 
    /**
     * Update player attributes
     * @param player Player
     */
    public static void updatePlayerAttributes(Player player);
}

Introduction

SagaLoreStats is a powerful custom attribute plugin for Minecraft servers, driven by item Lore recognition. It allows server administrators to create a deep and engaging item system by granting players various attribute bonuses (like Attack Power, Defense, Health, etc.) based on specific text found in an item's Lore.

Core Features

  • Lore-Driven Attribute System: Attributes are dynamically applied by recognizing specific text patterns in item Lores.
  • Diverse Attribute Types: Supports Attack/Defense, Other, Update (time-based), and Runtime (script-based) attributes.
  • Customizable Attribute Formulas: Define your own calculation formulas for attributes, offering fine-grained control over game balance.
  • Combat Power System: Calculates a player's overall combat strength based on their equipped attributes.
  • Equipment Restriction System: Set limits on gear usage based on level, class, item type, and more.
  • Attribute GUI Panel: An intuitive interface (`/sls stats`) for players to view their current attributes.
  • Powerful Scripting System: Extend and create custom attribute functionalities using JavaScript.
  • PlaceholderAPI Support: Provides a rich set of placeholders for integration with other plugins.
  • Probability-Based Trigger System: Implement attributes with chance-based effects (e.g., Critical Hit, Dodge).
  • Advanced Combat Attributes: Includes Armor Penetration, Armor Strength, Armor Break, Critical Evasion, Crit Damage Resistance, and more.
  • Vitality Attribute System: Manage health bonuses, health regeneration per second, and other life-related stats.
  • MythicMobs Compatibility: Seamlessly integrates with MythicMobs.

Attribute System Explained

Attribute Types & Priority
SagaLoreStats categorizes attributes to manage their application and calculation order. Higher priority numbers are processed first.

Similar projects

Plugin →