Mechanics - bedwarshurts/AlchemistMMExtension GitHub Wiki
BookGUIMechanic
This mechanic allows you to open a BookGUI for a player.
[!NOTE] Requires an entity targeter that returns a player
[!TIP] Supports Mythic Placeholders, Adventure and PAPI
[!WARNING] Doesn't support Math
Arguments
- contents - Contents of the BookGUI
- title - Title of the book item
- author - Author of the book item
Example
- bookgui{contents="Hello";title="welcome to the server";author="server owner"}
EvaluateMechanic
Evaluates a math or boolean expression and returns the result in the <scope.var.expression_result> variable
[!NOTE] Requires an entity targeter, the entity is which to parse the papi placeholders for, if a no player entity is returned the skill will cast and parse the placeholders for the "null" player.
[!TIP] Supports Math, Mythic Placeholders and PAPI
Arguments
- expression - The expression to evaluate
- scope - The scope of the variable result
Example
- evaluate{expression=2+3+4<2+99 || 4*4^2>99 } @NearestPlayer{r=10} ~onSpawn
- msg{m="expr is false"} @trigger ~onInteract ?variableEquals{var=caster.expression_result;val=0.0}
- msg{m="expr is true"} @trigger ~onInteract ?variableEquals{var=caster.expression_result;val=1.0}
- msg{m="var = <caster.var.expression_result>"} @trigger ~onInteract
HideChatMechanic
This mechanic hides all the chat messages for a specific player for a duration
[!NOTE] Requires an entity targeter, if that targeter doesn't return a player the mechanic will not cast
[!TIP] Supports Mythic Placeholders, Adventure and PAPI
[!TIP] If the player has the permission alchemist.bypasshiddenchat they will still be able to see chat messages
[!CAUTION] This will not persist across server restarts
Arguments
- duration - how long to keep the chat hidden for, in ticks
Example
- hidechat{duration=200}
MirrorPlayerSkinMechanic
This mechanic replaces the mob's disguise with the skin that the player looking at it is wearing. In case of multiple players, the mob will have a different skin disguise for each player
[!NOTE] Requires no targeter
[!WARNING] Requires LibsDisguises
Example
- mirrorplayerskin
OpenChestMechanic
This mechanic sends a packet mimicking a player opening a chest to the player's client, thus the chest appears to be open as if another player was opening it.
[!NOTE] Requires a location targeter
[!WARNING] Requires ProtocolLib
Arguments
- action - Whether to open or close the chest, can only be "open" or "close"
- audience - An entity targeter that returns the players to send the packet for
Example
- openchest{action="open";audience=@pir{r=100}}
PrimedTntMechanic
Spawns a PrimedTnT
[!NOTE] Requires a location targeter
Arguments
- break - boolean, if the primed tnt should break blocks
- damage - boolean, if the primed tnt should deal damage to nearby entities
- fuse - how long should the primedtnt's fuse last for, in ticks
Example
- primedtnt{break=false;fuse=80;damage=true}
SetWorldBorderMechanic
Sets a world border for a player, the center of the border is the origin of this skill
[!NOTE] Requires an entity targeter that returns a player
[!TIP] The arguments radius, time, damageAmount, damageBuffer, warningTicks, warningDistance support Mythic Placeholders
Arguments
- radius - The radius of the border
- cancelOnQuit - boolean, if the border should disappear
- remove - boolean, if true this will remove the existing world border
- time - The time the border will last for, in ticks
- damageAmount - The amount of damage the border will deal if outside of it
- damageBuffer - The amount of blocks a player may safely be outside the border before taking damage.
- warningTicks - The warning time that causes the screen to be tinted red when a contracting border will reach the player within the specified time.
- warningDistance - The warning distance that causes the screen to be tinted red when the player is within the specified number of blocks from the border.
Example
- setworldborder{r=5;coq=false;time=20}
SlerpRotateMechanic
Interpolates a display's rotation.
[!NOTE] Requires no targeter but the CASTER HAS TO BE A DISPLAY ENTITY
[!TIP] All arguments except "mode" support Mythic Placeholders
Arguments
- x - Rotation on the X axis in degrees
- y - Rotation on the Y axis in degrees
- z - Rotation on the Z axis in degrees
- time - Time to complete the rotation, in ticks
- loops - How many times to loop the rotation
- mode - SET or ADD
Example
- slerprotate{x=90;y=90;z=90;mode=add;ticks=200;loops=1}
StringBuilderMechanic
This uses reflection in order to allow you to invoke java's StringBuilder methods to manipulate mythic String variables, this is a mechanic for advanced users.
[!NOTE] Requires no targeter
[!WARNING] This uses reflection thus the operations may be performance heavy
Arguments
- string - Supports Mythic Variables, the String variable to manipulate
- var - The variable to place the result of the operation
- action - The method(s) to invoke, split by "." This is an ordered operation.
Example
- stringbuilder{string=Hello;var=greeting;action=append(java.lang.String World!),reverse()}
The example will place the text "!dlroWolleH" in the skill scoped <skill.var.greeting> variable
RingShapeMechanic
Spawns particles in a way that they form a ring
[!NOTE] Requires a location or entity targeter
[!TIP] All arguments except "MatchRotation", "Particle" and "Skill" support Mythic Placeholders
Arguments
- particle - The particle type to spawn
- radius - The radius of the ring
- count - The amount of particles to spawn
- dirMultiplier - What to multiply the direction of its axis with, each loop iteration
- variance - The "randomness" of the particles
- speed - The speed of the particles
- skill - The mythic skill to cast at each particle location
- interval - Each loop iteration spawns X particles, how long to wait between loops, in miliseconds
- direction - The direction of the particles in each axis, split by "," ex:
dir=x,y,z
- audience - The audience of the mechanic, the players that are able to see the particles
- dirOverride - Unlike direction which works differently for every single particle, this sets a direction for the entire ring, 3 arguments just like direction
- rotation - The rotation of the ring, 3 arguments just like direction
- rotMultiplier - What to multiply the rotation with each loop iteration, 3 arguments just like dir
- density - how many particles to spawn each loop iteration
- matchRotation - if the ring should match the caster's rotation, this turns the rotation argument into an offset
Example
- ringshape{particle=END_ROD;radius=0.1 5;shift=0;variance=0.4;amount=3;speed=random(1.25, 1.25 + <skill.var.itr> / 15);interval=9;direction=1,1,1; dirOverride=<skill.var.x>,<skill.var.y>,<skill.var.z>;rotation=<random.float.0to360>,<random.float.0to360>,<random.float.0to360>}
SphereShapeMechanic
Spawns particles in a way that they form a sphere
[!NOTE] Requires a location or entity targeter
[!TIP] All arguments except "Particle" and "Skill" support Mythic Placeholders
Arguments
- particle - The particle type to spawn
- radius - The radius of the ring
- count - The amount of particles to spawn
- dirMultiplier - What to multiply the direction of its axis with, each loop iteration
- variance - The "randomness" of the particles
- speed - The speed of the particles
- skill - The mythic skill to cast at each particle location
- interval - Each loop iteration spawns X particles, how long to wait between loops, in miliseconds
- direction - The direction of the particles in each axis, split by "," ex:
dir=x,y,z
- audience - The audience of the mechanic, the players that are able to see the particles
- dirOverride - Unlike direction which works differently for every single particle, this sets a direction for the entire ring, 3 arguments just like direction
Example
- sphereshape{particle=SQUID_INK;count=5;dirMultiplier=1.02;direction=<skill.var.d>,0.1,<skill.var.d>;speed=0.2;radius=0.25;variance=0.1;interval=1}
SetMMOCooldownMechanic
Sets a player's MythicLib (MMOCore) skill on cooldown
[!NOTE] Requires an entity targeter that returns a player
[!TIP] Supports Mythic Placeholders
[!WARNING] Requires MMOCore and MythicLib
Arguments
- ability - The mythiclib internal name of the ability
- cooldown - The cooldown in ticks
Example
- setmmocooldown{ability=BLINK;cooldown=200}
WhileLoopMechanic
Loops through a skill sequence and executes it till the condition specified is no longer true
[!NOTE] Requires no targeter
[!TIP] The condition argument supports Mythic Placeholders, boolean and math expressions
Arguments
- condition - The condition to check for each loop iteration
- skill - The skill to execute
- interval - The delay between each loop in miliseconds
- onStart - The skill to execute at the start of the loop
- onEnd - The skill to execute when the loop ends
Example
`- while{condition=<target.var.y> > 50 || <target.var.y> < -50;skill=[ - msg{m="You are out of the arena bounds} @targetedtarget ];interval=1000;onEnd=[ - msg{m="You are back inside the arena" @targetedtarget} ]};
BreakMechanic
Stops a while loop regardless of the condition result
[!NOTE] Requires no targeter
[!CAUTION] This only works inside a skill casted by the WhileLoopMechanic
Example
- break
ForEachMechanic
Executes a skill for each target returned by a targeter.
[!NOTE] Requires an entity or location targeeter
Arguments
- skill - The skill to execute
- interval - The delay between each loop in miliseconds
Example
- foreach{skill=[ - sphereshape ]} @pir{r=100}
HotbarSnapshotMechanic
Saves and replaces a player's hotbar for a duration
[!NOTE] Requires an entity targeter that returns a player
[!TIP] Mythic Items and MMOItems items are supported, you can also manipulate the meta of your own vanilla items:
For a mythic item use:mythic:item_name
For a MMOItems item use:mmoitem:item_category:item_name
For a vanilla item use:material[name=item_name,lore=lore1\nlore2,item_model=namespace:key,enchants=fire_aspect:2|sharpness:5,skill=SomeMythicSkill]
[!CAUTION] The player's hotbar is saved in base64 format in Mythic String variables. Thus upon server restart the hotbar will be restored from there.
Arguments
- items - The items to replace the hotbar with
- duration - How long to wait before restoring the hotbar, in ticks
Example
- hotbarsnapshot{items=mythic:someitem;duration=200}
RestoreHotbarMechanic
Restores a player's hotbar early despite the specified duration not having ended, this only works on players affected by HotbarSnapshotMechanic
[!NOTE] Requires an entity targeter that returns a player
Example
- restorehotbar
RandomizeHotbarMechanic
Randomizes a player's hotbar
[!NOTE] Requires an entity targeter that returns a player
Example
- randomizehotbar
ChestGUIMechanic
Creates and opens a chest gui for a player
[!NOTE] Requires an entity targeter that returns a player
[!TIP] Mythic Items and MMOItems items are supported, you can also manipulate the meta of your own vanilla items:
For a mythic item use:mythic:item_name
For a MMOItems item use:mmoitem:item_category:item_name
For a vanilla item use:material[name=item_name,lore=lore1\nlore2,item_model=namespace:key,enchants=fire_aspect:2|sharpness:5,skill=SomeMythicSkill]
[!TIP] All item lores and names support Adventure, PAPI and Mythic Variables
Arguments
- title - The title of the GUI
- size - The size of the gui, must be a multiplicative of 9
- contents - The contents of the gui
Example
- chestgui{contents=mythic:someitem[slot=5];title=My Fav GUI;size=9}
CancelPlayerDeathMechanic
Puts an Aura to a player. The aura on death revives the player, sets his hp to the hp % defined in the argument and casts a mythic skill.
[!NOTE] Requires an entity targeter that returns a player
[!TIP] The skill casted onDeath will use the same metadata as the original skill with the only exception being that the trigger is the entity that died
[!TIP] This Mechanic applies an Aura and thus inherits all Mythic Aura's arguments. Using -1 as the duration makes the aura last forever.
Arguments (in addition to Mythic Aura arguments):
- healthPercentage - The hp % to restore the entity at
- skill - The skill to cast on death
Example
- cancelplayerdeath{skill=someskill;healthPercentage=100}
OnSignalMechanic
Puts an Aura to a player. The aura activated when the player entity receives a mythic signal that matches the one given in the argument.
[!NOTE] Requires an entity targeter that returns a player
[!TIP] The skill casted onSignal will use the same metadata as the original skill with the only exception being that the trigger is the entity that received the signal
[!TIP] This Mechanic applies an Aura and thus inherits all Mythic Aura's arguments. Using -1 as the duration makes the aura last forever.
Arguments (in addition to Mythic Aura arguments):
- signal - The signal to receive
- skill - The skill to cast on death
Example
- onsignal{skill=someskill;signal=ritofixgame}
EventSubscribeMechanic
Puts an Aura to a player. The aura casts a skill when the specified event(extends org.bukkit.event.Event) is called. This uses reflection and is only recommended for advanced users.
[!NOTE] Requires an entity targeter
[!TIP] The skill casted when the event is fired will use the same metadata as the original skill with the only exception being that the trigger is the entity that triggered the event
[!TIP] This Mechanic applies an Aura and thus inherits all Mythic Aura's arguments. Using -1 as the duration makes the aura last forever.
[!TIP] The skill scoped variable <skill.var.lastCallTime> returns the time in miliseconds that the event was last called.
[!TIP] Using
- cancelevent
inside the skill casted when the event is fired will cancel the event as long as it provides the setCancelled method.
[!WARNING] This uses reflection and although the reflection results are cached operations may be performance heavy
Arguments (in addition to Mythic Aura arguments):
- class - The full class name of the Event
- skill - The skill to cast when the event is fired
- priority - Bukkit's event priority, acceptable values are LOWEST LOW NORMAL HIGH HIGHEST MONITOR
- triggerMethod - The method that returns the entity that triggered the event, this is required and different for each event
- requirePlayer - boolean, If the event shouldnt be registered for non-player entities no matter what the targeter returns
Example
events:subscribe{name=event2;class=org.bukkit.event.block.BlockBreakEvent;skill=TestSkill;trigger=getPlayer();duration=-1}
InvokeMethodMechanic
Invokes an event method, this can only be used inside the EventSubscribeMechanic mechanic. This uses reflection. This mechanic is only recommended for advanced users
[!NOTE] Requires no targeter
[!WARNING] Must be used inside a skill that gets casted using the EventSubscribeMechanic
[!TIP] If the invoked method returns a value, its .toString will be placed inside the skill scoped <skill.var.fullMethodName> variable
[!TIP] Nested calls are supported
[!WARNING] This uses reflection and although the reflection results are cached operations may be performance heavy
Arguments (in addition to Mythic Aura arguments):
- methods - The methods to invoke
Example
events:invokemethod{methods=getBlock().getBlockPower(),setDropItems(boolean.class false),getBlock().getType()}
In the above example 2 variables will be made. First the <skill.var.getBlock().getBlockPower()>
which will return the redstone power the block has and <skill.var.getBlock().getType()>
which will return the type of the block. the method BlockBreakEvent#setDropItems returns void so nothing will be returned from there and thus no variable will be made