☄️
Asteroid
  • Overview
    • 🎓Introduction
  • Installation
    • ❗Dependencies
    • ⚡How to install
  • Setup
    • 💼Commands
    • 📎Placeholders
    • 🌟Features
      • UUID Access
      • Command Masker
      • Multiplier
      • Connect or Disconnect Fake Players
      • Easily Generate Real or Cracked UUIDs
      • Import Files + Bedrock Support
      • Randomized Join
      • Randomized Disconnect
      • On-Join Commands
      • One-Time Commands
      • Gravity + Pick-up items
      • Fluctuation
      • Scheduler
      • AI
      • Asteroid Proxy
        • RedisDB + Lettuce
        • MySQL
    • 🍩Addons
      • Ranks
  • Tips
    • 💡Cross-Server Player Count (Proxies using Redis)
  • API
    • 🚀AsteroidAPI
    • 🛠️Usage
      • Extension Development Guide
Powered by GitBook
On this page
  • AsteroidLoadedEvent
  • Schedule
  • FakePlayerEntity
  • FakePlayerRegistry
  • DestroyBlock
  • LoadClass
  • Movement
  • Target
  • Version
  • TargetHandler
  • MinecraftVersion
  • FakePlayerSpawn
  • FakePlayerTick
  • Getting AsteroidAPI
  1. API

AsteroidAPI

Explained usage of the API

Welcome to AsteroidAPI, a powerful API designed to enhance your Minecraft server development experience. AsteroidAPI provides a set of classes that empower developers to manage events, schedules, and even create fake player entities with ease. Let's dive into the core classes that AsteroidAPI offers:

AsteroidLoadedEvent

This class represents a custom event triggered when Asteroid is loaded. Developers can utilize this event to execute specific actions or logic when the Asteroid plugin is loaded on the server.

me.serbob.asteroidapi.Server;

import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

/**
 * Custom event triggered when Asteroid is loaded.
 */
public class AsteroidLoadedEvent extends Event {
    private static final HandlerList handlers = new HandlerList();

    public HandlerList getHandlers() {
        return handlers;
    }

    public static HandlerList getHandlerList() {
        return handlers;
    }
}

Schedule

A scheduling utility for managing tasks associated with player UUIDs. The Schedule class offers methods to add, remove, cancel, and delete tasks associated with specific player UUIDs. Developers can efficiently manage scheduled tasks for a more organized server experience. When a fake player is disconnected, all the schedulers related to his UUID will be stopped.

me.serbob.asteroidapi.Scheduler;

import org.bukkit.Bukkit;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Represents a scheduling utility for managing tasks associated with player UUIDs.
 */
public class Schedule {
    // ... (implementation details)
}

FakePlayerEntity

An interface for defining fake player behavior. Developers can create and control fake players using NMS (net.minecraft.server) implementation. The interface provides methods for moving, setting yaw angles, obtaining player representations, and handling movement, targeting, and block destruction.

me.serbob.asteroidapi.Registries;

import me.serbob.asteroidapi.Handlers.TargetHandler;
import me.serbob.asteroidapi.Interfaces.DestroyBlock;
import me.serbob.asteroidapi.Interfaces.Movement;
import me.serbob.asteroidapi.Interfaces.Target;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;

import java.util.Map;
import java.util.UUID;

/**
 * Represents an interface for defining fake player behavior.
 */
public interface FakePlayerEntity {
    // ... (implementation details)
}

FakePlayerRegistry

A registry class for managing fake players. Developers can add, remove, and check the existence of fake players in the registry. This class ensures a streamlined approach to managing fake player instances.

me.serbob.asteroidapi.Registries;

import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Registry class for managing fake players.
 */
public class FakePlayerRegistry {
    // ... (implementation details)
}

DestroyBlock

An interface for handling block destruction events. Developers can use this interface to target and destroy specific blocks.

me.serbob.asteroidapi.Interfaces;

import org.bukkit.block.Block;

/**
 * Represents an interface for handling block destruction events.
 */
public interface DestroyBlock {
    // ... (implementation details)
}

LoadClass

An annotation for specifying the priority level for loading an extension. Higher values indicate higher priority.

me.serbob.asteroidapi.Interfaces;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

public interface LoadClass {
    // ... (implementation details)
}

Movement

An interface for handling various movement-related actions, combat, velocity, and climbing. Developers can control entity movement, apply knockback, manage velocity, and handle climbing behavior.

me.serbob.asteroidapi.Interfaces;

import org.bukkit.Location;
import org.bukkit.util.Vector;

/**
 * Represents an interface for handling various movement-related actions, combat, velocity, and climbing.
 */
public interface Movement {
    // ... (implementation details)
}

Target

An interface for handling targeting-related actions. Developers can change target handlers for entities and retrieve current target handlers.

me.serbob.asteroidapi.Interfaces;

import me.serbob.asteroidapi.Handlers.TargetHandler;

/**
 * Represents an interface for handling targeting-related actions.
 */
public interface Target {
    // ... (implementation details)
}

Version

An annotation indicating Minecraft version compatibility for a class.

me.serbob.asteroidapi.Interfaces;

import me.serbob.asteroidapi.Enums.MinecraftVersion;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation indicating the Minecraft version compatibility of a class.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Version {
    // ... (implementation details)
}

TargetHandler

Handles targeting for entities and blocks. Developers can obtain the location of the target, considering the type (entity or block).

me.serbob.asteroidapi.Handlers;

import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;

/**
 * Handles targeting for entities and blocks.
 */
public class TargetHandler {
    // ... (implementation details)
}

MinecraftVersion

Enum representing different versions of Minecraft.

me.serbob.asteroidapi.Enums;

/**
 * Enum representing different versions of Minecraft.
 */
public enum MinecraftVersion {
    // ... (implementation details)
}

FakePlayerSpawn

An interface for handling fake player spawning events. Developers can perform actions asynchronously when a fake player is spawned and after the spawn.

me.serbob.asteroidapi.Behaviour;

import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

/**
 * Represents an interface for handling fake player spawning events.
 */
public interface FakePlayerSpawn {
    // ... (implementation details)
}

FakePlayerTick

Handles individual fake player tick events. Developers can implement custom actions on each server tick for individual fake players.

me.serbob.asteroidapi.Behaviour;

import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

/**
 * Handles individual fake player tick events.
 */
public interface FakePlayerTick {
    // ... (implementation details)
}

Getting AsteroidAPI

To integrate AsteroidAPI into your project, add the following Maven or Gradle dependency:

Maven

Repository

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Dependency

<dependency>
    <groupId>com.github.SerbanHiro</groupId>
    <artifactId>AsteroidAPI</artifactId>
    <version>Tag</version>
</dependency>

Gradle

Repository

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

Dependency

dependencies {
    implementation 'com.github.SerbanHiro:AsteroidAPI:Tag'
}
PreviousCross-Server Player Count (Proxies using Redis)NextUsage

Last updated 1 year ago

Or you can also check our jitpack:

🚀
https://jitpack.io/#SerbanHiro/AsteroidAPI