### Server Start Event Source: https://ajneb97.gitbook.io/conditionalevents/event-types/other-events Triggered when the server starts and the ConditionalEvents plugin is enabled. Ideal for one-time setup actions or enabling specific events on startup. ```yaml example: type: server_start actions: default: - "console_command: ce enable event1" ``` -------------------------------- ### DiscordSRV Embed Action Example Source: https://ajneb97.gitbook.io/conditionalevents/actions/plugin-actions This example demonstrates sending a DiscordSRV embed message when a player uses the '/plugins' command. It requires DiscordSRV to be installed and configured. The embed includes player-specific information and a custom color. ```yaml example: type: player_command conditions: - "%main_command% equalsIgnoreCase /plugins" actions: default: - "discordsrv_embed: channel:admin;author_name:Suspicious Activity!;author_avatar:%player%;title:%player% used a forbidden command.;footer: This user has played on the server for: %statistic_time_played%.;description:Command used: %command%;color:255,0,0" ``` -------------------------------- ### Full Example: Private Message System Source: https://ajneb97.gitbook.io/conditionalevents/actions/to-actions This example demonstrates a private message system using 'to_player' to send messages between players. It includes command parsing, player online checks, and error handling. ```yaml example: type: player_command conditions: - "%main_command% == /message" - "%args_length% < 2 execute error1" - "%parseother_{arg_1}_{player_online}% == no execute error2" actions: default: - "cancel_event: true" - "message: &d[PM] &8[&eYou &7-> &e%arg_1%&8]&7: &f%args_substring_2-99%" - "to_player: %arg_1%: message: &d[PM] &8[&e%player% -> &eYou&8]&7: &f%args_substring_2-99%" error1: - "cancel_event: true" - "message: &cYou must use &7/message " error2: - "cancel_event: true" - "message: &cThat player is not online." ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://ajneb97.gitbook.io/conditionalevents/config-tutorial Perform an HTTP GET request with the 'ask' query parameter to dynamically query documentation. Use this for specific questions, clarifications, or to retrieve related documentation sections not explicitly present on the current page. ```http GET https://ajneb97.gitbook.io/conditionalevents/config-tutorial.md?ask= ``` -------------------------------- ### Item Pickup Event Example Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Fires when a player picks up an item. This example cancels the event if the player is in the 'minigames' world. ```yaml example: type: item_pickup conditions: - '%player_world% == minigames' actions: default: - "cancel_event: true" ``` -------------------------------- ### Agent Instructions: Querying Documentation Source: https://ajneb97.gitbook.io/conditionalevents/config.yml Use the provided GET request format to query the documentation dynamically with a specific question. ```http GET https://ajneb97.gitbook.io/conditionalevents/config.yml.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://ajneb97.gitbook.io/conditionalevents/addons To get more information not present on the current page, make an HTTP GET request to the page URL with the 'ask' query parameter. The question should be specific and self-contained. The response will include a direct answer and relevant excerpts. ```http GET https://ajneb97.gitbook.io/conditionalevents/addons.md?ask= ``` -------------------------------- ### Item Drop Event Example Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Fires when a player drops an item. This example cancels the event if the player is in the 'minigames' world. ```yaml example: type: item_drop conditions: - '%player_world% == minigames' actions: default: - "cancel_event: true" ``` -------------------------------- ### Full Example: Conditional Messaging Source: https://ajneb97.gitbook.io/conditionalevents/actions/to-actions This example shows how to use 'to_condition' to send a message only to players possessing a specific permission. It requires defining a condition group in the server's configuration. ```yaml Config: to_condition_groups: group1: - "%player_has_permission_conditionalevents.somepermission% == yes" test: type: player_command conditions: - "%command% == /test" actions: default: - "cancel_event: true" - "to_condition: group1: message: &7Hello to people with permissions." ``` -------------------------------- ### Query Documentation with GET Request Source: https://ajneb97.gitbook.io/conditionalevents/how-to-start Perform an HTTP GET request to the current page URL, appending the 'ask' query parameter with your natural language question. Use this to retrieve specific information, clarifications, or related documentation sections. ```HTTP GET https://ajneb97.gitbook.io/conditionalevents/how-to-start.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://ajneb97.gitbook.io/conditionalevents/actions/to-actions Perform an HTTP GET request to the current page URL, appending the 'ask' query parameter with your natural language question. The response will include a direct answer and relevant excerpts. ```http GET https://ajneb97.gitbook.io/conditionalevents/actions/to-actions.md?ask= ``` -------------------------------- ### Query Documentation with 'ask' Parameter Source: https://ajneb97.gitbook.io/conditionalevents/event-types To get additional information not directly on the page, perform an HTTP GET request with the 'ask' query parameter. The question should be specific and in natural language. ```http GET https://ajneb97.gitbook.io/conditionalevents/event-types.md?ask= ``` -------------------------------- ### Perform HTTP GET Request with 'ask' Parameter Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Use this method to query the documentation dynamically when information is not explicitly present. The question should be specific and self-contained. ```http GET https://ajneb97.gitbook.io/conditionalevents/event-types/item-events.md?ask= ``` -------------------------------- ### Item Select Event Example Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Triggered when a player selects or deselects an item in their hotbar. This example displays an action bar message when a specific sword is selected. ```yaml example: type: item_select conditions: - '%item% == DIAMOND_SWORD' - '%item_name% == Super Diamond Sword' - '%select_type% == SELECT' actions: default: - "actionbar: &6Equipping your Super Diamond Sword;60" ``` -------------------------------- ### Query Documentation Dynamically Source: https://ajneb97.gitbook.io/conditionalevents/videos Perform an HTTP GET request to query the documentation dynamically. Use the 'ask' query parameter with a specific, self-contained question in natural language. The response will include a direct answer and relevant excerpts. ```http GET https://ajneb97.gitbook.io/conditionalevents/videos.md?ask= ``` -------------------------------- ### Item Craft Event Example Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Called when a player is about to craft an item. This example prevents the crafting of writable books. ```yaml example: type: item_craft conditions: - "%item% == WRITABLE_BOOK" actions: default: - "message: &cYou can't craft writable books!" - "cancel_event: true" ``` -------------------------------- ### Item Interact Event Example Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Triggered when a player clicks on an item. This example cancels the event and sends a message if the item is redstone. ```yaml example: type: item_interact conditions: - '%item% == REDSTONE' actions: default: - 'cancel_event: true' - "message: &cYou can't use redstone." ``` -------------------------------- ### Query API Documentation Source: https://ajneb97.gitbook.io/conditionalevents/api Perform an HTTP GET request to query the documentation dynamically. Use the 'ask' query parameter with a specific, natural language question. The response includes a direct answer and relevant excerpts. ```http GET https://ajneb97.gitbook.io/conditionalevents/api.md?ask= ``` -------------------------------- ### Player Armor Equip/Unequip Configuration Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events Set up conditions for when a player equips or unequips armor. This example cancels the event if the player lacks permission for a specific item. ```yaml example: type: player_armor conditions: - '%armor_type% == HELMET' - '%equip_type% == EQUIP' - '%item_name% == Super Diamond Helmet' - '%player_has_permission_items.super_diamond_helmet% == false' actions: default: - 'cancel_event: true' - "message: &cYou don't have permissions to equip that item!" ``` -------------------------------- ### Block Place Event Configuration Source: https://ajneb97.gitbook.io/conditionalevents/event-types/block-events Restrict block placement in a specific world. This example prevents players from placing any blocks in the 'spawn' world and notifies them with a message and a sound. ```yaml example: type: block_place conditions: - '%block_world% == spawn' actions: default: - 'cancel_event: true' - "message: &cYou can''t place blocks on this world." - 'playsound: BLOCK_NOTE_BLOCK_PLING;10;0.1' ``` -------------------------------- ### Item Move Event Example Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Triggered when a player attempts to move an item within their inventory. This example prevents moving items in an anvil inventory. ```yaml example: type: item_move conditions: - "%inventory_type% == ANVIL" actions: default: - "message: &cNope!" - "cancel_event: true" ``` -------------------------------- ### Nesting Variables for Block Below Player Source: https://ajneb97.gitbook.io/conditionalevents/global-variables This example demonstrates retrieving the block beneath the player by nesting multiple PlaceholderAPI expansions and ConditionalEvents variables. ```yaml %block_at_{player_x}_{math_0:0_{player_y}-1}_{player_z}_{player_world}% ``` -------------------------------- ### Custom Event Configuration Example Source: https://ajneb97.gitbook.io/conditionalevents/custom-events This configuration defines a custom event that triggers when a player places a turret. It captures the world name and cancels the event if the turret is placed in the 'spawn' world. ```yaml example1: type: custom custom_event_data: event: dt.ajneb97.api.TurretPlaceEvent player_variable: getPlayer() variables_to_capture: - '%turret_world%;getLocation().getWorld().getName()' conditions: - '%turret_world% equals spawn' actions: default: - 'cancel_event: true' - "message: &cYou can''t place turrets on this world." ``` -------------------------------- ### Execute Actions with Combined 'AND' Condition Source: https://ajneb97.gitbook.io/conditionalevents/conditions Combine 'and' conditions with the 'execute' option to create more specific action triggers. This example requires both a specific rank and player level. ```yaml example: type: player_join conditions: - '%vault_rank% equals admin execute actions1' - '%vault_rank% equals vip and %player_level% > 20 execute actions2' actions: default: [] actions1: - 'to_all: message: &4&lADMIN &c%player% &ejoined the game.' actions2: - 'to_all: message: &b&lVIP &a%player% &ejoined the game.' ``` -------------------------------- ### Player Bed Enter Event Configuration Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events Configure actions when a player attempts to enter a bed. This example prevents sleeping in a specific world. ```yaml example: type: player_bed_enter conditions: - "%result% == OK" - "%player_world% == spawn" actions: default: - "cancel_event: true" - "message: &cYou can't sleep on this world." ``` -------------------------------- ### Item Consume Event Example Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Called when a player consumes an item, such as eating food. This example grants a potion effect if the item is a golden apple and a random condition is met. ```yaml example: type: item_consume conditions: - '%item% == GOLDEN_APPLE' - '%random_1_10% >= 8' actions: default: - "give_potion_effect: INCREASE_DAMAGE;120;1;false" ``` -------------------------------- ### Item Enchant Event Example Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Called when a player enchants an item. This example prevents enchanting swords with the Durability enchantment. ```yaml example: type: item_enchant conditions: - "%item% contains _SWORD" - "%enchantment_list% contains DURABILITY" actions: default: - "cancel_event: true" - "message: &cYou can't enchant swords with durability!" ``` -------------------------------- ### Comparing Two Variables Source: https://ajneb97.gitbook.io/conditionalevents/conditions Compare two variables directly. This example checks if the item name does not contain the player name. ```yaml conditions: - '%item_name% !contains %player_name%' ``` -------------------------------- ### Item Repair Event Example Source: https://ajneb97.gitbook.io/conditionalevents/event-types/item-events Fires when a player repairs an item. This example prevents renaming a netherite sword to 'Super Sword'. Note: Requires Minecraft 1.13+. ```yaml example: type: item_repair conditions: - "%item% == NETHERITE_SWORD" - "%rename_text% == Super Sword" actions: default: - "cancel_event: true" - "message: &cYou can't rename a netherite sword to that name!" ``` -------------------------------- ### Nesting Variables for Player IP Lookup Source: https://ajneb97.gitbook.io/conditionalevents/global-variables This example shows how to use nested variables to retrieve a player's IP address by referencing another player's name as an argument. Requires the OtherPlayer expansion. ```yaml # Gets the IP of another player by command. # Remember to download the OtherPlayer expansion using # /papi ecloud download OtherPlayer example2: type: player_command conditions: - "%command% == /ip or %command% startsWith /ip " - "%player_has_permission_conditionalevents.admin% == no execute error1" - "%args_length% < 1 execute error2" actions: default: - "cancel_event: true" - "message: &7IP of &a%arg_1% &7is: %otherplayer_ip_{arg_1}%" error1: - "cancel_event: true" - "message: &cYou don't have permissions." error2: - "cancel_event: true" - "message: &cYou must use /ip " ``` -------------------------------- ### Access 'to' Variable in 'to_all' Action Source: https://ajneb97.gitbook.io/conditionalevents/global-variables When using 'to_all' or 'to_range' actions, 'to:' prefix allows accessing variables from the player receiving the action. This example sends a personalized welcome message. ```yaml example: type: call actions: default: - "console_message: &7Sending a welcome message to all players" - "to_all: message: &eHello &c%to:player%, &ewelcome to the server!" ``` -------------------------------- ### Block Interact Event Configuration Source: https://ajneb97.gitbook.io/conditionalevents/event-types/block-events Configure actions to be performed when a player interacts with a specific block. This example triggers a message and a console command when a player right-clicks a stone button at coordinates (20, 60, 20) in the 'lobby' world. ```yaml example: type: block_interact conditions: - '%block_x% == 20' - '%block_y% == 60' - '%block_z% == 20' - '%block_world% == lobby' - '%block% == STONE_BUTTON' - '%action_type% == RIGHT_CLICK' actions: default: - "message: &aYou''ve received $500!" - "console_command: eco give %player% 500" ``` -------------------------------- ### Access 'to' Variable in 'to_range' Action Source: https://ajneb97.gitbook.io/conditionalevents/global-variables This example demonstrates using '%to:player%' within a 'to_range' action to send a message to players within a specified radius, including the sender's message. ```yaml example2: type: player_command conditions: - "%main_command% == /hello" actions: default: - "cancel_event: true" - "to_range: 10;false: message: &6%player% says: &7Hello %to:player%!" ``` -------------------------------- ### Cancel Fishing on Animals Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events This example prevents players from catching animals with a fishing rod. It checks if the fishing state is 'CAUGHT_ENTITY' and the caught type is 'COW' or 'PIG'. ```yaml example: type: player_fish conditions: - "%state% == CAUGHT_ENTITY" - "%caught_type% == COW or %caught_type% == PIG" actions: default: - "cancel_event: true" - "message: &cYou can't use a fishing rod on animals!" ``` -------------------------------- ### Access Target Player Variables in Player Attack Event Source: https://ajneb97.gitbook.io/conditionalevents/global-variables Use 'target:' prefix to access variables from the victim in events like player_attack. This example sends a message and applies a potion effect to the target. ```yaml example: type: player_attack conditions: - '%victim% equals PLAYER' - '%item% equals DIAMOND_SWORD' - '%item_name% equals Poison Sword' actions: default: - 'message: &aApplying poison to: &e%target:player%' - 'to_target: give_potion_effect: POISON;120;1' - 'to_target: message: &cYou were poisoned by &e%player%&c!' ``` -------------------------------- ### Nesting Variables for World Time Source: https://ajneb97.gitbook.io/conditionalevents/global-variables Combine ConditionalEvents variables with PlaceholderAPI expansions to create dynamic values. This example retrieves the current world time using nested variables. ```yaml # Checks the time of the world you are in. # Remember to download the Player expansion using # /papi ecloud download Player example: type: player_command conditions: - "%command% == /world-time" actions: default: - "cancel_event: true" - "message: Time in your current world: %world_time_{player_world}%" ``` -------------------------------- ### Custom Help Command Functionality Source: https://ajneb97.gitbook.io/conditionalevents/actions/event-actions Implements the core functionality for a custom /help command. It handles different arguments to display specific help messages or trigger further actions. ```yaml custom_help_command: type: player_command conditions: - "%main_command% == /help" - "%arg_1% == commands execute help_commands" - "%arg_1% == economy execute help_economy" - "%arg_1% == worlds execute help_worlds" actions: default: - "cancel_event: true" - "message: &cYou must use: &7/help " help_commands: - "cancel_event: true" - "message: &fThis is the help page for &a&lCOMMANDS" help_economy: - "cancel_event: true" - "message: &fThis is the help page for &a&lECONOMY" help_worlds: - "cancel_event: true" - "call_event: custom_help_command_worlds_argument;%selected_world%=%arg_2%" ``` -------------------------------- ### Disable Villager Trading Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events This example disables villager trading by cancelling the inventory open event when the inventory type is 'MERCHANT'. ```yaml example: type: player_open_inventory conditions: - "%inventory_type% == MERCHANT" actions: default: - "message: &cVillager trading is disabled." - "cancel_event: true" ``` -------------------------------- ### Register Commands for Tab Completion Source: https://ajneb97.gitbook.io/conditionalevents/config.yml List commands here to enable them in tab completion. Remember to omit the leading '/'. Server restart is required after changes. ```yaml register_commands: - "hello" ``` -------------------------------- ### Player Run Toggle Event Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events Fires when a player starts or stops running. Similar to the sneak event, this cannot be cancelled with 'cancel_event'. ```yaml example: type: player_run conditions: - "%is_running% == true execute actions1" actions: actions1: - "message: &eRunning" default: - "message: &eStopped running" ``` -------------------------------- ### Player Sneak Toggle Event Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events Called when a player starts or stops sneaking. This event cannot be cancelled using the 'cancel_event' action. ```yaml example: type: player_sneak conditions: - "%is_sneaking% == true execute actions1" actions: actions1: - "message: &eSneaking" default: - "message: &eCancelling sneak" ``` -------------------------------- ### Call Event Execution Flow Source: https://ajneb97.gitbook.io/conditionalevents/event-types/other-events Demonstrates how a player command event can trigger another event ('example2') using the 'call_event' action. The 'example2' event, of type 'call', will then execute its actions. ```yaml example: type: player_command conditions: - "%main_command% == /test" actions: default: - "cancel_event: true" - "message: This is a test message from event 'example'" - "call_event: example2" example2: type: call actions: default: - "message: This message will be sent only when event 'example2' is called" ``` -------------------------------- ### Player Regain Health Event Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events Triggered when a player's health regenerates. This example shows how to cancel the event if the reason is 'SATIATED'. ```yaml example: type: player_regain_health conditions: - "%reason% == SATIATED" actions: default: - 'cancel_event: true' ``` -------------------------------- ### Execute Console Command Source: https://ajneb97.gitbook.io/conditionalevents/actions Executes a specified command from the server console. ```yaml console_command: eco give %player% 5000 ``` -------------------------------- ### Player Command Conditions with Math Formulas Source: https://ajneb97.gitbook.io/conditionalevents/conditions Enable math formulas in conditions for player commands to create complex checks, such as comparing statistics. Ensure 'allow_math_formulas_in_conditions: true' is set. ```yaml example4: type: player_command allow_math_formulas_in_conditions: true conditions: - '%command% equals /test-kills' - '%statistic_player_kills% >= %statistic_deaths%*2 execute actions1' actions: actions1: - 'message: &aYou have a lot of kills, congrats!' - 'cancel_event: true' default: - 'message: &cYou need to have AT LEAST 2 times more kills than deaths' - 'message: &cto use this command. Currently these are your stats:' - 'message: &7Kills: &6%statistic_player_kills%' - 'message: &7Deaths: &6%statistic_deaths%' - 'cancel_event: true' ``` -------------------------------- ### Give Basic Item Source: https://ajneb97.gitbook.io/conditionalevents/actions Gives a specified amount of an item to the player with a custom name. Ensure the item ID is valid. ```yaml give_item: id:IRON_HELMET;amount:1;name:&6Basic Helmet ``` -------------------------------- ### Player Join Event Configuration Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events Configure a message to be displayed when a player joins the server. This event does not support cancellation. ```yaml example: type: player_join actions: default: - 'message: &eWelcome %player% to the server.' ``` -------------------------------- ### Basic Event Configuration Source: https://ajneb97.gitbook.io/conditionalevents/how-to-start Defines a new event named 'event1' with the 'block_break' type. This is the foundational structure for any event. ```yaml Events: event1: type: block_break ``` -------------------------------- ### Player Damage Event Configuration Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events Configure actions to be taken when a player takes damage. Use '%cause%' to specify the damage source. ```yaml example: type: player_damage conditions: - '%cause% == DROWNING' actions: default: - 'cancel_event: true' ``` -------------------------------- ### Defining the Player Variable Method Source: https://ajneb97.gitbook.io/conditionalevents/custom-events This configuration specifies the method used to retrieve the player associated with the event. For most Bukkit/Spigot events, 'getPlayer()' is used. Remove this option if the event does not involve a player. ```yaml player_variable: "getPlayer()" ``` -------------------------------- ### Execute Action for Players in a World Source: https://ajneb97.gitbook.io/conditionalevents/actions/to-actions Use 'to_world' to execute an action for all players currently in a specified world. You can use a fixed world name or a dynamic placeholder like '%player_world%'. ```yaml - 'to_world: spawn: message: &6This message is sended to all players in the SPAWN world.' ``` ```yaml - 'to_world: %player_world%: message: &6Hello to this world!' ``` -------------------------------- ### Basic Player Attack Conditions Source: https://ajneb97.gitbook.io/conditionalevents/conditions Use multiple lines for 'and' conditions. Each line must be true for the event to trigger. ```yaml conditions: - '%victim% == PLAYER' - '%item% == DIAMOND_SWORD' - '%item_name% == Super Sword' ``` -------------------------------- ### Execute Action for All Players Source: https://ajneb97.gitbook.io/conditionalevents/actions/to-actions Use 'to_all' to execute an action for every player on the server. This is useful for broadcasting messages or applying global effects. ```yaml - 'to_all: message: &a%player% just leveled up!' ``` ```yaml - 'to_all: message: &7Hello &a%to:player% &7your level is &a%to:player_level%&7!' ``` -------------------------------- ### Call Event with Variable Passing Source: https://ajneb97.gitbook.io/conditionalevents/event-types/other-events Shows how to pass variables from one event to another using the 'call_event' action. The called event ('example2') can then use these passed variables in its conditions. ```yaml example: type: player_command conditions: - "%main_command% == /test" actions: default: - "cancel_event: true" - "message: This is a test message from event 'example'" - "call_event: example2;%example_variable%=Something" example2: type: call conditions: - "%example_variable% == Something" actions: default: - "message: This message will be sent only when event 'example2' is called" ``` -------------------------------- ### Simplified Event Using Parameters Source: https://ajneb97.gitbook.io/conditionalevents/conditions This refactored event configuration utilizes parameters to pass dynamic error messages to a single 'error_action' group. This reduces redundancy and makes the configuration more maintainable. ```yaml vip_rank: type: player_command conditions: - "%main_command% == /vip" - "%player_has_permission_conditionalevents.admin% != yes execute error_action{%error_message%=&cYou don't have permissions}" - "%args_length% < 1 execute error_action{%error_message%=&cYou must use &7/vip }" actions: default: - "cancel_event: true" - "player_command: lp user %arg_1% parent set vip" error_action: - "cancel_event: true" - "centered_message: &c&m &r &c&lERROR! &c&m " - "centered_message: " - "centered_message: %error_message%" - "centered_message: " - "centered_message: &c&m " - "playsound: BLOCK_NOTE_BLOCK_PLING;10;0.1" ``` -------------------------------- ### Execute Actions Based on Rank Source: https://ajneb97.gitbook.io/conditionalevents/conditions Define different action sets ('actions1', 'actions2') to execute based on specific conditions. If no 'execute' condition is met, 'default' actions run. ```yaml example: type: player_join conditions: - '%vault_rank% equals admin execute actions1' - '%vault_rank% equals vip execute actions2' actions: default: - 'to_all: message: &a%player% &ejoined the game.' actions1: - 'to_all: message: &4&lADMIN &c%player% &ejoined the game.' actions2: - 'to_all: message: &b&lVIP &a%player% &ejoined the game.' ``` -------------------------------- ### Custom Help Command Worlds Argument Handler Source: https://ajneb97.gitbook.io/conditionalevents/actions/event-actions Handles the second argument for the '/help worlds' command. It checks the provided world name and displays a specific message for each valid world. ```yaml custom_help_command_worlds_argument: type: call conditions: - "%selected_world% == overworld execute world_overworld" - "%selected_world% == nether execute world_nether" - "%selected_world% == plots execute world_plots" actions: default: - "message: &cYou must use: &7/help worlds " world_overworld: - "message: &fThis is the help page for &a&lWORLD &8- &e&lOVERWORLD" world_nether: - "message: &fThis is the help page for &a&lWORLD &8- &c&lNETHER" world_plots: - "message: &fThis is the help page for &a&lWORLD &8- &b&lPLOTS" ``` -------------------------------- ### Comparing Variables with Math Formulas Source: https://ajneb97.gitbook.io/conditionalevents/conditions Use math formulas for conditions. Ensure `allow_math_formulas_in_conditions: true` is set in your event configuration. ```yaml conditions: - '%statistic_player_kills% >= %statistic_deaths%*2' ``` ```yaml conditions: - '%player_x% == (%player_z%*3)-1000' ``` -------------------------------- ### Event with Condition Source: https://ajneb97.gitbook.io/conditionalevents/how-to-start Adds a condition to 'event1' to check if the player's current world is 'spawn'. Requires PlaceholderAPI and the 'Player' expansion. ```yaml Events: event1: type: block_break conditions: - "%player_world% == spawn" ``` -------------------------------- ### Custom Player Command with Arguments Source: https://ajneb97.gitbook.io/conditionalevents Creates a custom command to check another player's level, with argument validation and error handling for offline players or incorrect usage. ```yaml example8: type: player_command conditions: - "%main_command% == /checklevel" - "%args_length% < 1 execute error1" - "%parseother_{arg_1}_{player_online}% == no execute error2" actions: default: - "cancel_event: true" - "message: &aLevel of &e%arg_1% &ais: &e%otherplayer_level_{arg_1}%" error1: - "cancel_event: true" - "message: &cYou must use &7/checklevel " error2: - "cancel_event: true" - "message: &cThat player is not online." ``` -------------------------------- ### Custom Help Command Tab Completion Source: https://ajneb97.gitbook.io/conditionalevents/actions/event-actions Configures tab completion for a custom /help command. It checks the command and arguments to provide relevant suggestions. ```yaml custom_help_command_tab: type: player_tab_complete conditions: - "%main_command% == /help" - "%args_length% == 1 execute show_arguments_1" - "%args_length% == 2 and %arg_1% == worlds execute show_worlds_arguments" actions: show_arguments_1: - "tab_complete: clear" - "tab_complete: set;commands,economy,worlds" show_worlds_arguments: - "tab_complete: set;overworld,nether,plots" ``` -------------------------------- ### Play Sound Source: https://ajneb97.gitbook.io/conditionalevents/actions Plays a sound to the player with specified volume and pitch. Optionally plays at a specific location. Supports different sound lists for 1.8. ```yaml playsound: BLOCK_NOTE_BLOCK_PLING;10;0.1 ``` ```yaml # Playsound on location playsound: BLOCK_NOTE_BLOCK_PLING;10;2;100,60,-127,world ``` -------------------------------- ### Send Player to Server Source: https://ajneb97.gitbook.io/conditionalevents/actions Redirects the player to a specified BungeeCord server. ```yaml send_to_server: lobby ``` -------------------------------- ### Execute Player Command Source: https://ajneb97.gitbook.io/conditionalevents/actions Executes a specified command as if the player typed it in chat. ```yaml player_command: warp survival ``` -------------------------------- ### Send Title and Subtitle Source: https://ajneb97.gitbook.io/conditionalevents/actions Displays a title and subtitle to the player with customizable fade-in, stay, and fade-out durations in ticks. Use 'none' for either title or subtitle if only one is desired. ```yaml title: 20;40;20;&6This is a title;none ``` -------------------------------- ### Execute Player Command as OP Source: https://ajneb97.gitbook.io/conditionalevents/actions Executes a specified command from the player with operator privileges. Use with caution. ```yaml player_command_as_op: help ``` -------------------------------- ### Execute Action Based on Conditions Source: https://ajneb97.gitbook.io/conditionalevents/actions/to-actions Use 'to_condition' to execute actions only for players who meet predefined conditions defined in 'to_condition_groups' within the configuration. ```yaml to_condition: group1: message: &7This message will be received by anyone who accomplish the condition ``` -------------------------------- ### Play Resource Pack Sound Source: https://ajneb97.gitbook.io/conditionalevents/actions Plays a custom sound from a resource pack to the player. The format is identical to the `playsound` action. ```yaml playsound_resource_pack: my_custom_sound;10;1 ``` ```yaml # Playsound on location playsound_resource_pack: my_custom_sound;10;2;100,60,-127,world ``` -------------------------------- ### Player Leave Event Configuration Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events Configure a message to be broadcast to all players when a player leaves the server. This event cannot be cancelled. ```yaml example: type: player_leave actions: default: - 'to_all: message: &e%player% left the server.' ``` -------------------------------- ### Execute Action for Event Target Source: https://ajneb97.gitbook.io/conditionalevents/actions/to-actions Use 'to_target' for specific events like player_attack, player_kill, entity_interact, and player_fish to execute actions on the event's target. This can target both players and living entities. ```yaml - 'to_target: give_potion_effect: POISON;120;1' ``` ```yaml - 'to_target: message: &cYou were poisoned by &e%player%&c!' ``` -------------------------------- ### Original Event with Separate Error Actions Source: https://ajneb97.gitbook.io/conditionalevents/conditions This event configuration uses separate action groups for different error messages, leading to code duplication. It checks for the '/vip' command and handles permission errors and incorrect usage errors distinctly. ```yaml # This event will check when a player uses the /vip command # and set the specified player to the vip rank. # An error will show when the player doesn't have permissions. Another # error will show when the player doesn't use arguments. vip_rank: type: player_command conditions: - "%main_command% == /vip" - "%player_has_permission_conditionalevents.admin% != yes execute error_action1" - "%args_length% < 1 execute error_action2" actions: default: - "cancel_event: true" - "player_command: lp user %arg_1% parent set vip" error_action1: - "cancel_event: true" - "centered_message: &c&m &r &c&lERROR! &c&m " - "centered_message: " - "centered_message: &cYou don't have permissions" - "centered_message: " - "centered_message: &c&m " - "playsound: BLOCK_NOTE_BLOCK_PLING;10;0.1" error_action2: - "cancel_event: true" - "centered_message: &c&m &r &c&lERROR! &c&m " - "centered_message: " - "centered_message: &cYou must use &7/vip " - "centered_message: " - "centered_message: &c&m " - "playsound: BLOCK_NOTE_BLOCK_PLING;10;0.1" ``` -------------------------------- ### Creating a Custom Action Source: https://ajneb97.gitbook.io/conditionalevents/api Learn how to extend the ConditionalEvents API by creating your own custom actions. This involves extending the ConditionalEventsAction class, defining a constructor, and implementing the execute method. ```APIDOC ## Creating a Custom Action ### Description Allows users to create custom and unique ConditionalEvents actions that can be added to their events. ### Steps 1. **Create a class** that extends `ConditionalEventsAction`. 2. **Define a constructor** that calls the super constructor with a unique action name. 3. **Override the `execute` method** to implement the custom action logic. ### Example: ChangeWeatherAction ```java public class ChangeWeatherAction extends ConditionalEventsAction { public ChangeWeatherAction() { super("change_weather"); } @Override public void execute(Player player, String actionLine, Event minecraftEvent) { // Format: change_weather: ; // weather: SUN,STORM,THUNDER String[] sep = actionLine.split(";"); World world = Bukkit.getWorld(sep[0]); switch(sep[1]){ case "SUN": world.setStorm(false); world.setThundering(false); break; case "STORM": world.setStorm(true); break; case "THUNDER": world.setThundering(true); break; } } } ``` ### Parameters for `execute` method: - **Player player**: The player involved in the event. Can be null. - **String actionLine**: The content following the action name in the event configuration. - **Event minecraftEvent**: The Minecraft/Spigot event that triggered the action. ``` -------------------------------- ### Repetitive Server Event Configuration Source: https://ajneb97.gitbook.io/conditionalevents/event-types/other-events Configure a repetitive server event to trigger at a specific interval defined in ticks. This event type is not player-specific and cannot use player variables or actions. ```yaml example: type: repetitive_server repetitive_time: 1200 actions: default: - 'to_all: message: &7There are &a%server_online% &7players on the server.' ``` -------------------------------- ### Item Management Command Source: https://ajneb97.gitbook.io/conditionalevents/commands-and-permissions Save or remove items from a config file for later use in actions like 'give_item', 'drop_item', or 'set_item'. PlaceholderAPI variables are supported. ```minecraft-commands /ce item ``` -------------------------------- ### Player Pre-Join Event Configuration Source: https://ajneb97.gitbook.io/conditionalevents/event-types/player-events Prevent players from joining based on conditions like name or IP. Use the `prevent_join` action to block access. This event does not provide player-specific data and cannot be cancelled with `cancel_event`. ```yaml example: type: player_pre_join conditions: - "%name% == Ajneb" - "%ip% != 192.168.0.1" actions: default: - "console_message: &8[&c&lALERT&8] &7A user with IP &e%ip% &7tried to join the server using and administrator account." - "prevent_join: &c&lERROR!\n&7You can't access this account with that IP." ``` -------------------------------- ### Event with Actions Source: https://ajneb97.gitbook.io/conditionalevents/how-to-start Configures 'event1' to cancel the block break event and send a message to the player if the condition is met. Uses 'cancel_event' and 'message' actions. ```yaml Events: event1: type: block_break conditions: - "%player_world% == spawn" actions: default: - "cancel_event: true" - "message: &cYou can't break blocks on this world!" ``` -------------------------------- ### Define Event Type Source: https://ajneb97.gitbook.io/conditionalevents/config-tutorial Specifies the type of event to detect. Refer to the Event Types documentation for a full list. ```yaml type: block_interact ``` -------------------------------- ### Set Block with Data Source: https://ajneb97.gitbook.io/conditionalevents/actions Places a block at a location, optionally including block data to define specific states like facing direction or age. Useful for regenerating blocks. ```yaml set_block: location:%block_x%,%block_y%,%block_z%,%block_world%;id:%block%;block_data:%block_data% ``` -------------------------------- ### ProtocolLib Receive Message Event Source: https://ajneb97.gitbook.io/conditionalevents/event-types/plugin-events Triggered when a player receives a chat message. Use this to intercept and potentially cancel messages. Requires the ProtocolLib plugin. ```yaml example: type: protocollib_receive_message conditions: - "%normal_message% contains &cWelcome to the server." actions: default: - "cancel_event: true" ``` -------------------------------- ### Call Event Command Source: https://ajneb97.gitbook.io/conditionalevents/commands-and-permissions Execute a 'call' event with optional variables and player targeting. Use 'silent:true' to suppress feedback messages. ```minecraft-commands /ce call (optional)%variable1%=;%variableN%= (optional)player: (optional) silent:true ``` ```minecraft-commands /ce call event1 ``` ```minecraft-commands /ce call event1 %test_variable%=25 ``` ```minecraft-commands /ce call event1 player:Ajneb ``` ```minecraft-commands /ce call event1 silent:true ``` -------------------------------- ### Call Event with Variables Source: https://ajneb97.gitbook.io/conditionalevents/actions Executes another event, passing custom variables. This is useful for triggering chained events or passing data between them. ```yaml example: type: player_command conditions: - "%main_command% == /test" actions: default: - "cancel_event: true" - "message: This is a test message from event 'example'" - "call_event: example2;%example_variable%=Something" example2: type: call conditions: - "%example_variable% == Something" actions: default: - "message: This message will be sent only when event 'example2' is called" ``` -------------------------------- ### Define Event Actions Source: https://ajneb97.gitbook.io/conditionalevents/config-tutorial Actions to execute when event conditions are met. Supports cancelling the event, sending messages, and playing sounds. ```yaml actions: default: - "cancel_event: true" - "message: &cYou can't break blocks on this world." - "playsound: BLOCK_NOTE_BLOCK_PLING;10;0.1" ``` -------------------------------- ### Configure Plugin Settings in config.yml Source: https://ajneb97.gitbook.io/conditionalevents/config.yml Modify these settings to control plugin behavior such as update notifications, data saving frequency, and debug output. ```yaml Config: # Whether the plugin should send notifications on join to OP # players if an update is found update_notification: true # This option defines the time (in minutes) to automatically save player data. data_save_time: 5 # When enabled, data of players that join the server will be maintained in memory # until the server restarts, meaning resets of data will be possible to do # if the player has disconnected. retain_player_data_until_restart: true # Whether actions should appear when using /ce debug command. debug_actions: true # Enable it to use the new variable replacement method for ConditionalEvents. # It adds the possibility to replace/parse variables that have multiple # levels of more variables inside. For example # %block_at_{player_x}_{math_0:0_{player_y}-1}_{player_z}_{player_world}%. experimental: variable_replacement: false # Enables or disables the %item_meta% variable. For big servers the storage of # this value can cause lag, so my recommendation is to disable this option. item_meta_variable_enabled: false # If you are using ConditionalEvents to create commands with the usage of # player_command events, you can register those commands here, so they appear # on the tab completion. Just remember to ignore the "/". # IMPORTANT: # If you make changes to this option you must restart your server. register_commands: - "hello" # Defines if every message/text in the plugin should use the MiniMessage format. # Only works on Paper 1.19.4+. use_minimessage: false # This option works ONLY for to_condition actions. # Here you can define condition groups following the same format as usual. to_condition_groups: group1: - "%player_has_permission_conditionalevents.somepermission% == yes" ``` -------------------------------- ### Summon Entity Source: https://ajneb97.gitbook.io/conditionalevents/actions Spawns a specified entity at a given location with optional custom properties like name, health, amount, scale, and equipment. ```yaml summon: location:0,68,0,spawn;entity:SHEEP ``` ```yaml summon: location:0,68,0,spawn;entity:SKELETON;custom_name:&cShadow Warrior;health:80 ``` ```yaml summon: location:%player_x%,%player_y%,%player_z%,%player_world%;entity:ZOMBIE;custom_name:&4Aberration;equipment:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDJhMmFlNzQ5ZDAzYWU1Y2U3MmJjMmEyNmQyZTJhNThjZDVmMmU0MGM4ODMxODRiZjk2YzZhMjcwMDc4MmQyNiJ9fX0=,IRON_CHESTPLATE,none,none;amount:4 ``` ```yaml summon: location:0,90,0,world;entity:ZOMBIE;equipment:none,saved_item:orange_chestplate,none,none;amount:1 ``` ```yaml summon: location:%player_x%,%player_y%,%player_z%,%player_world%;entity:ZOMBIE;equipment:none,IRON_CHESTPLATE,none,none;hand_equipment:IRON_SWORD,SHIELD ``` -------------------------------- ### Send Mini Message Source: https://ajneb97.gitbook.io/conditionalevents/actions Sends a message using the Mini Message format. This action is redundant if `use_minimessage` is enabled in the config, in which case the `message` action should be used instead. Only works on Paper 1.19.4+. ```yaml mini_message: Welcome to the SERVER! ``` -------------------------------- ### Execute Action within a Radius Source: https://ajneb97.gitbook.io/conditionalevents/actions/to-actions Use 'to_range' to execute actions for players within a specified block radius. You can choose to include the player triggering the event and other entities. ```yaml - 'to_range: 10;true: message: &6This message is sended to all players in a radius of 10 blocks!' ``` ```yaml - 'to_range: 10;false: message: &6%player% says: &7Hello %to:player%&7!' ``` ```yaml - 'to_range: 5;false;true: damage; 10' ``` -------------------------------- ### Allow Math Formulas in Conditions Source: https://ajneb97.gitbook.io/conditionalevents/config-tutorial Enables the use of mathematical formulas and comparisons within event conditions, allowing for more complex logic. ```yaml allow_math_formulas_in_conditions: true conditions: - '%command% equals /test-kills' - '%statistic_player_kills% >= %statistic_deaths%*2' ```