Skip to content

Latest commit

 

History

History
195 lines (164 loc) · 6.7 KB

File metadata and controls

195 lines (164 loc) · 6.7 KB

HytaleLoader Documentation

Welcome to HytaleLoader - a powerful plugin loader and API wrapper for Hytale servers!

Quick Links

Key Features

📦 Player API (fr.hytale.loader.api.Player)

Simplified wrapper for player management:

Player player = event.getPlayer();

// Identity
String name = player.getName();
UUID uuid = player.getUUID();

// Messaging
player.sendMessage("Hello!");

// Location & Teleportation
Location loc = player.getLocation();
player.teleport(new Location(loc.getWorld(), 100, 64, 200));

// Inventory
Inventory inv = player.getInventory();

// Permissions
boolean hasPermission = player.hasPermission("myplugin.admin");

// Stats
float health = player.getHealth();
player.setHealth(20.0f);

🌍 Location & World API

// Get player location
Location loc = player.getLocation();
double x = loc.getX();
double y = loc.getY();
double z = loc.getZ();
World world = loc.getWorld();

// Create and teleport
Location spawn = new Location(world, 0, 100, 0, 0, 0);
player.teleport(spawn);

// Distance calculations
double distance = loc1.distance(loc2);

📦 Item & Inventory API

// Get player inventory
InventoryPlayer inv = new InventoryPlayer(player);

// Get items
List<Item> items = inv.getItems();
Item item = inv.getItem(slot);

// Modify inventory
inv.addItem(item);
inv.clear(); // Note: May cause issues during join event

🎪 Event System

public class MyPlugin extends SimplePlugin {
    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        player.sendMessage("Welcome " + player.getName() + "!");
    }
    
    @EventHandler
    public void onBlockBreak(BreakBlockEvent event) {
        // Handle block break
        event.setCancelled(true); // Cancel the event
    }
}

⚔️ Command System

@Command(name = "tp", description = "Teleport command")
public void teleportCommand(CommandContext context) {
    context.sendMessage("Teleporting...");
}

Available Events

Player Events

  • PlayerJoinEvent - When a player joins
  • PlayerQuitEvent - When a player leaves
  • PlayerChatEvent - When a player sends a chat message
  • PlayerDamageEvent - When a player takes damage
  • PlayerCraftEvent - When a player crafts (deprecated)
  • PlayerMouseButtonEvent - When a player clicked (left or right click)
  • PlayerMouseMotionEvent - When a player moved the mouse

ECS Block Events

  • BreakBlockEvent - When a block is broken
  • PlaceBlockEvent - When a block is placed
  • UseBlockEvent - When a block is used/interacted with
  • DamageBlockEvent - When a block takes damage

ECS Other Events

  • DropItemEvent - When an item is dropped
  • DiscoverZoneEvent - When a zone is discovered
  • CraftRecipeEvent - When a recipe is crafted
  • SwitchActiveSlotEvent - When switching elements in inventory

Project Structure

HL/
├── HytaleLoader/              # Core library
│   ├── src/main/java/fr/hytale/loader/
│   │   ├── api/               # Public API
│   │   │   ├── inventory/     # Inventory classes
│   │   │   ├── ui/            # UI classes
│   │   │   ├── Block.java     # Block wrapper
│   │   │   ├── ChatColor.java # Chat color enums
│   │   │   ├── Entity.java    # Entity wrapper
│   │   │   ├── GameMode.java  # GameMode enum
│   │   │   ├── Item.java      # Item wrapper
│   │   │   ├── Location.java  # Location wrapper
│   │   │   ├── Player.java    # Player wrapper
│   │   │   ├── Server.java    # Server wrapper
│   │   │   ├── SoundCategory.java # Sound categories
│   │   │   ├── Time.java      # Time wrapper
│   │   │   ├── WeatherType.java # Weather types
│   │   │   └── World.java     # World wrapper
│   │   ├── command/           # Command system
│   │   │   ├── Arg.java           # Argument annotation
│   │   │   ├── Command.java       # Command annotation
│   │   │   ├── CommandScanner.java# Command scanner
│   │   │   ├── CommandUtils.java  # Command utilities
│   │   │   └── SimpleCommand.java # Command base
│   │   ├── config/            # Configuration system
│   │   ├── datastorage/       # Data storage
│   │   │   ├── MySQLClient.java   # MySQL client
│   │   │   └── RedisClient.java   # Redis client
│   │   ├── event/             # Event system
│   │   ├── internal/          # Internal dispatchers
│   │   ├── permission/        # Permission system
│   │   │   ├── Permission.java        # Permission object
│   │   │   └── PermissionManager.java # Permission storage
│   │   ├── plugin/            # Plugin base classes
│   │   ├── scheduler/         # Task scheduling
│   │   │   ├── Scheduler.java     # Scheduler implementation
│   │   │   └── ScheduledTask.java # Task wrapper
│   │   └── utils/             # Utilities
└── TestMod/                   # Example mod

Installation

Add HytaleLoader as a dependency in your pom.xml:

<dependency>
    <groupId>fr.hytale.loader</groupId>
    <artifactId>HytaleLoader</artifactId>
    <version>1.0.5</version>
    <scope>provided</scope>
</dependency>

Support & Contributing

For issues, questions, or contributions, please visit the GitHub repository.