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

Was this helpful?

  1. Others
  2. Scripting Language

Conditions

In our scripting language, conditions provide a way to filter and refine the behavior of your triggers. While triggers initiate a set of actions based on specific events, conditions allow you to define additional criteria that must be met for those actions to execute.

For example, suppose you want to create a script that sends a message to the player every second, but only if the player is sneaking and in creative mode. By combining the onTick trigger with conditions, you can ensure that the message is only sent under those specific circumstances.

sneak-message:
  trigger: "onTick:20"  # This will activate every second
  conditions:
    - 'player.sneaking?'  # Check if the player is sneaking
    - 'player.gamemode == :CREATIVE'  # Check if the player is in creative mode
  actions:
    - 'player.send_message("You are sneaking in creative mode!")'

This can help you create more tailored interactions and avoid unnecessary actions when certain criteria are not met. Conditions give you the flexibility to design complex behaviors in your scripts, enhancing the overall functionality and responsiveness of your game.

You can think of conditions as "if statements" that determine whether the actions associated with a trigger should be carried out, making your scripts more dynamic and engaging.

What is Considered a Condition?

In our scripting language, a condition is anything that evaluates to a Boolean value—either true or false. This could be a variable or a function that checks a certain state or property. If the result of the condition is true, the actions tied to the trigger will be executed. If the result is false, the actions will be skipped.

For example, the Spigot API provides many methods that return Boolean values. A common one is player.sneaking?, which checks if a player is sneaking. This function returns true if the player is sneaking and false if not.

Here's another example:

# This script sends a message if the player is flying and has less than 5 hearts

flying-low-health:
  trigger: "onTick:20"  # Activates every second
  conditions:
    - 'player.flying?'  # Checks if the player is flying
    - 'player.health < 5'  # Checks if the player has less than 5 health points
  actions:
    - 'player.send_message("You are flying and have low health!")'

Last updated 6 months ago

Was this helpful?