Phoenix Store
Webstore
Plugins
Plugins
  • 🔌Phoenix Plugins
  • Plugins
    • 📦Phoenix Crates
      • 💎Features
      • 🛑Commands & Permissions
      • 🔍Placeholders
      • 💐Crate Engine Mode
        • 🌻Vanilla Block
        • 🌺Vanilla Model
        • 🌹Model Engine
      • 📦Add a Crate
        • 🖌️Edit Crate
        • 🔑Add a Key
        • 💥Misc Options
        • 🔓Extra Options
      • 🎉Animations
        • 🧍‍♂️Idle Animations
        • 🎇Opening Animations
        • 🎁Premade Animations
      • 🏆Rewards
        • 🎁Random
        • 📬Selective
        • 📦Add Rewards
          • ✏️Edit Reward
          • 🎟️Reward Chance
          • 🗃️Alternative Reward
      • 🎲Reroll
      • 🎯Milestones
      • 🔎Log the Actions
      • 🎑Customize Menus
      • 🚢Migration
      • 📁Main Configuration
      • 📂Crate Configuration File
      • 🤖Action Types
      • ⁉️Questions & Answers
        • ⁉️Does the plugin support bedrock versions?
        • ❓Why my crates can only be open by OP Players?
        • ❓Why my custom models are not being displayed correctly?
        • ❓Why my custom model from model engine keep flickering?
        • ❓Why my furtnite models are being destroyed when clicked?
        • ❓Why when using the chat from the editor there are color to the value?
        • ❔How do i check the animations of my custom model?
        • ❔How can i create a CSGO crate?
        • ❔How do i remove the amount of the item won from the Hologram?
        • ❔How can i create a reward where the player doesn't receive a Physical Item?
        • 🤔What is the difference between "Your Chance" and "Percentage" in the preview?
      • 🛠️GeyserMC (Bedrock)
      • 🗺️Plugin's RoadMap
      • 🌐API
        • 🔧Custom Animations
    • 🏠Phoenix Lobby
      • 💎Features
      • 🛑Commands & Permissions
      • 🔍Placeholders
      • ⛓️Integrate with Proxy
      • 🌎Integrate with Worlds
      • 🧍‍♀️Create NPCs
      • ⚙️NPC Engine
        • 🪽Flying Head
        • 🪁Huge Item
        • 🧑‍🤝‍🧑Citizens
        • 🐖Model Engine
      • 🏠Lobby
        • 🪄Items
      • 🔔Announcements
      • 🗨️Join Actions
      • 📁Main Configuration
      • 🤖Action Types
      • ⁉️Questions & Answers
        • ❓Why my compass is teleporting me?
        • ❓Why proxy command is not working on Velocity?
        • ❓Why my npcs keep disappearing?
        • ❔How to make Essentials overwrite /spawn command?
    • 🎣Phoenix Duels
      • 💎Features
      • 🛑Commands & Permissions
      • 🔍Placeholders
      • 🗺️Create a Map
        • 🔨Create an arena
        • 🎨Customize the Arena
        • 🖌️Edit the Arena
        • 🌀Duplicate an Arena
        • ☘️Arena Regeneration
      • 🎮Add a Mode
        • 🏹Create a Kit
        • ⚽Match Settings
        • 📋Scoreboard
      • 🕐Start a Match
      • 🥇Betting
      • 📖Statistics
      • 📐Player Settings
      • 🎑Customize Menus
      • 🗃️Configuration Files
        • 📁Main Configuration
        • 📁Map Configuration
        • 📁Mode Configuration
      • 🤖Action Types
      • ⚙️Settings
      • ⁉️Questions & Answers
        • ❓Why Regeneration causes lag to my server
        • ❓Why does the scoreboard stays the same even when i edit it?
        • ❔How can I use a void world for my arenas?
        • ❔How can i remove the kit items from being displayed in the menu?
        • 🤔What is the difference between Battle Region and the Universal Region?
    • ⚔️Phoenix Practice
      • 💎Features
      • 🛑Commands & Permissions
      • 🔎Placeholders
      • 🗺️Create a Map
        • 🔨Create an arena
        • 🎨Customize the Arena
        • 🖌️Edit the Arena
        • 🌀Duplicate an Arena
        • ☘️Arena Regeneration
      • 🎮Add a Mode
        • 🏹Create a Kit
        • ⚽Match Settings
        • 📋Scoreboard
      • 🌎Integrate with Worlds
      • 🕐Start a Match
      • 🥳Party
      • 🥇Elo
      • 🏠Lobby
        • 🪄Items
      • ✏️Create Custom Kits
        • 🎨Edit Kit Category
        • 🪁Add Items
        • 💺Configure Slots
      • 🖌️Kit Editor
      • 📖Statistics
      • 📐Player Settings
      • 🎑Customize Menus
      • 🗃️Configuration Files
        • 📁Main Configuration
        • 📁Map Configuration
        • 📁Mode Configuration
      • 🤖Action Types
      • ⚙️Settings
      • ⁉️Questions & Answers
        • ❓Why Regeneration causes lag to my server
        • ❓Why does the scoreboard stays the same even when i edit it?
        • ❔How can I use a void world for my arenas?
        • ❔How can i make npcs queue?
        • ❔How do i allow only Ranked mode?
        • ❔How can i remove the kit items from being displayed in the menu?
        • 🤔What is the difference between Battle Region and the Universal Region?
  • Others
    • 🤖API Usage
      • 🆕Custom Addons
  • Add-ons
    • 🎃Halloween Crate Animations
    • 🎅Christmas Crate Animations
Powered by GitBook
On this page
  • Player Class
  • Location Class
  • Block Class
  • ItemStack Class
  • Entity Class
  • LivingEntity Class
  • World Class

Was this helpful?

  1. Others
  2. Scripting Language

Common Classes

Player Class

The Player class represents a player in the game and provides various methods for interaction.

  • Get Player’s Name:

    player_name = player.name
  • Send a Message:

    player.send_message("Hello, {{player.name}}!")
  • Get Player’s Location:

    player_location = player.location
  • Set Player’s Health:

    player.health = 20  // Set health to full
  • Give Experience:

    player.give_experience(100)  // Add 100 experience points

Location Class

The Location class represents a point in the game world, including coordinates and the world itself.

  • Get Coordinates:

    x = location.x
    y = location.y
    z = location.z
  • Set Coordinates:

    location.x = 100
    location.y += 10  // Move up by 10 blocks
    location.z = -50
  • Get World of Location:

    world = location.world

Block Class

The Block class represents a block in the game world.

  • Get Block Type:

    block_type = block.type
  • Set Block Type:

    block.type = :DIAMOND_BLOCK  // Change the block to a diamond block
  • Break a Block:

    block.break_naturally()  // Break the block

ItemStack Class

The ItemStack class represents an item in the player's inventory.

  • Create a New ItemStack: (Soon!)

    stone_item = ItemStack(:STONE, 1)  // Create a stone item stack of size 1
  • Get Item Type:

    item_type = item_stack.type
  • Set Amount of Item:

    item_stack.amount = 10  // Set the amount to 10

Entity Class

The Entity class represents any entity in the game, such as players, mobs, and items.

  • Get Entity Type:

    entity_type = entity.type
  • Remove an Entity:

    entity.remove()  // Remove the entity from the world
  • Get Entity Location:

    entity_location = entity.location

LivingEntity Class

The LivingEntity class extends the Entity class and represents all living creatures in the game, such as players and mobs. It includes additional methods specific to living entities. (Players are also living entities)

  • Get Health:

    health = living_entity.health
  • Set Health:

    living_entity.health = 15  // Set health to 15
  • Get Max Health:

    max_health = living_entity.max_health
  • Add Potion Effect:

    living_entity.add_potion_effect(:SPEED, 60, 1)  // Apply Speed effect for 60 seconds
  • Remove Potion Effect:

    living_entity.remove_potion_effect(:SLOWNESS)  // Remove the Slowness effect

World Class

The World class represents a game world, including its properties and methods.

  • Get All Players in the World:

    players_in_world = world.players
  • Spawn an Entity:

    world.spawn_entity(location, :ZOMBIE)  // Spawn a zombie at a specific location
  • Set the Time of Day:

    world.time = 1000  // Set the time to day

These methods provide a solid starting point for interacting with various elements within your game. As you explore the Spigot API further, you’ll discover even more methods and capabilities, enabling you to create dynamic and engaging scripts.

Last updated 6 months ago

Was this helpful?