⚡
xShyo_ Plugins Wiki
  • 👋 Welcome
  • PREMIUM PLUGINS
    • 🏠 PsMenu
      • Home
      • Installation
      • Commands & Permissions
      • Plugin´s Files
      • Flags
      • FAQ
    • 🛒 ShopMaster
      • Home
      • Installation
      • Commands & Permissions
      • item Creation
      • Economy Symbols Configuration
      • Menu Customization
      • Plugin´s Files
      • Development Portal
        • API Getting Started
        • Events
    • 🛠️ TheItemSkin
      • Home
      • Installation
      • Commands & Permissions
      • Plugin´s Files
      • Templates Skin
      • Development Portal
        • API Getting Started
        • Events
    • 🔴 NameGradient
      • Home
      • Installation
      • Commands & Permissions
      • PlaceholderAPI Support
      • Plugin´s Files
      • Format Gradient
      • Development Portal
        • API Getting Started
        • Events
  • FREE PLUGINS
    • 🎁 TheRewards
      • Home
      • Installation
      • Commands & Permissions
      • PlaceholderAPI Support
      • Layouts
      • Reward
      • Plugin´s Files
      • Addons
        • VoucherAddon
      • Development Portal
        • API Getting Started
        • Events
        • Addons
    • ✨ TheGlow
      • Home
      • Installation
      • Commands & Permissions
      • PlaceholderAPI Support
      • Plugin´s Files
    • 🏷️ TheTags
      • Home
      • Installation
      • Commands & Permissions
      • PlaceholderAPI Support
      • Plugin´s Files
      • Tags
    • ♂️ PlayerGender
      • Home
      • Installation
      • Commands & Permissions
      • PlaceholderAPI Support
      • Gender
      • Plugin´s Files
  • Setups
    • 🏃 Parkour Setup
      • Home
      • Installation
      • Frequently Asked Questions
    • ⛏️ Survival Setup
  • GENERAL
    • ❔ FAQ
    • ⚙️ Items | Custom Items
    • 📙 Support
Powered by GitBook
On this page
  • Introduction
  • Maven
  • Getting an API instance
  • API
  1. PREMIUM PLUGINS
  2. 🛠️ TheItemSkin
  3. Development Portal

API Getting Started

Introduction

TheItemSkin contains an API to get the skins and events when equipping, removing and returning skins.

Maven

Replace VERSION with the plugin version

<dependencies>
        <dependency>
            <groupId>xshyo.com</groupId>
            <artifactId>TheItemSkin</artifactId>
            <version>1.0.8-STABLE</version>
            <scope>provided</scope>
        </dependency>
</dependencies>

In your plugin.yml file you must add as a dependency

depend: [TheItemSkin]

Getting an API instance

import xshyo.com.theitemskin.TheItemSkinAPI;
import xshyo.com.theitemskin.TheItemSkin;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Example extends JavaPlugin {

    private TheItemSkinAPI api;    
        
    @Override
    public void onEnable() {
        if (Bukkit.getPluginManager().isPluginEnabled("TheItemSkin")) {
            this.api = TheItemSkin.getInstance().getApi();
        }

        if (this.api != null) {
    
        }
        
    }
}

API

/**
 * Retrieves a skin by name.
 *
 * @param name Name of the Skin to be searched.
 * @return The ItemSkin corresponding to the name provided, or null if not found.
 */
public ItemSkin getItemSkinByName(String name) {
    if (name == null || name.isEmpty()) return null;
    if (theItemSkin.getItemSkinManager().getItemSkinHashMap().containsKey(name)) {
        return theItemSkin.getItemSkinManager().getItemSkinHashMap().get(name);
    }
    return null;
}

/**
 * Check if a skin exists by name.
 *
 * @param name Name of the Skin you want to check.
 * @return true if the skin exists, false otherwise.
 */
public boolean isItemSkin(String name) {
    if (name == null || name.isEmpty()) return false;
    return !theItemSkin.getItemSkinManager().getItemSkinHashMap().containsKey(name);
}

/**
 * Check whether the player is in a preview
 *
 * @param player Instance of the player to be checked
 * @return true if the player is in preview, false otherwise.
 */
public boolean inPreview(Player player) {
    if (player == null) return false;
    if(!player.isOnline()) return false;
    return !theItemSkin.getArmorStandManager().getPlayerArmorStands().containsKey(player.getUniqueId());
}

PreviousDevelopment PortalNextEvents

Last updated 1 year ago