Pre-created commands. (Or just take them as a more examples)
.
DailyBonus :
dailybonus: command: /dailybonus type: RUN_COMMAND runcmd: - "$Script$%if%$todaydate!=$PlayerData%DailyBonus%" - "$text$&0[&6Daily&eBonus&0]&b Hello $player! Here, your daily reward!" - "$text$&0[&6Daily&eBonus&0]&b Received &a1 DIAMOND!" - "%PlayerOptions%addItem: DIAMOND:1" - "$Script$%PlayerData%DailyBonus=$todaydate" - "$text$&0[&6Daily&eBonus&0]&b Come back tomorrow!" - "$Script$%else%" - "$text$&0[&6Daily&eBonus&0]&b That's enough for today! Come back tomorrow!"
Custom Lottery :
lottery_example: command: /lottery_example type: RUN_COMMAND runcmd: - '%PlayerOptions%playSound: BLOCK_LEVER_CLICK:1.0F:1' - '$text$&6Welcome to &eMyCommand &6Lottery!' - '$delay$' - '$text$&b+------------------------------------' - '$text$&b| &2Prize of today :' - '$text$&b| &aCOBBLESTONE, BREAD, APPLE, GOLD_INGOT or DIAMOND! ' - '$text$&b+------------------------------------' - '$text$&ePlease wait for the results!' - '$delay$$delay$$delay$' - '$delay$$text$&0[$random_colorLottery&0] &65...' - '%PlayerOptions%playSound: BLOCK_LEVER_CLICK:1.0F:1' - '$delay$$text$&0[$random_colorLottery&0] &64...' - '%PlayerOptions%playSound: BLOCK_LEVER_CLICK:1.0F:1' - '$delay$$text$&0[$random_colorLottery&0] &63...' - '%PlayerOptions%playSound: BLOCK_LEVER_CLICK:1.0F:1' - '$delay$$text$&0[$random_colorLottery&0] &62...' - '%PlayerOptions%playSound: BLOCK_LEVER_CLICK:1.0F:1' - '$delay$$text$&0[$random_colorLottery&0] &61...' - '%PlayerOptions%playSound: BLOCK_LEVER_CLICK:1.0F:1' - '$delay$' - '%PlayerOptions%playSound: ENTITY_EXPERIENCE_ORB_PICKUP:1.0F:1' - '$Script$%PlayerData%lotteryprize=$GetRandomStringFromList%COBBLESTONE;DIAMOND;GOLD_INGOT;BREAD;APPLE%' - '$Script$%PlayerData%amount_lotteryprize=$randomnumber%3%' - '$delay$' - '$text$&b+------------------------------------' - '$text$&b| &6Congratulation! You won : &e $PlayerData%amount_lotteryprize% $PlayerData%lotteryprize%! ' - '$text$&b+------------------------------------' - '%PlayerOptions%addItem: $PlayerData%lotteryprize%:$PlayerData%amount_lotteryprize%' delaytimer: 1 cooldown: 600
Custom sethome and home
sethome: command: /sethome type: RUN_COMMAND runcmd: - $Script$%PlayerData%home.x=$locX - $Script$%PlayerData%home.y=$locY - $Script$%PlayerData%home.z=$locZ - $text$Home successfully created cost: 0 permission-required: false home: command: /home type: RUN_CONSOLE runcmd: - /tp $player $PlayerData%home.x% $PlayerData%home.y% $PlayerData%home.z% cost: 0 permission-required: false
Custom /top command
go_to_the_top: command: /top type: RUN_CONSOLE runcmd: - /tp $player $locX $loc_highestY $locZ
Check if a player is online (.contains) example.
is_online_check: command: /isonline type: RUN_COMMAND runcmd: - "$Script$%if%$ponline.contains=$arg1" - "$text$&aYes. The player $arg1 is online" - "$Script$%else%" - "$text$&cCan't find the player $arg1" require_all_arguments: true error-message: "&cUsage : /isonline playername"
Coin command(s) Example :
coin_pay_cmd: command: /coins pay type: RUN_CONSOLE runcmd: - $text$&b+-- MyCommand Coin System --+ - $Script$%if%$arg2<=$PlayerData%coins% - /mycmd-playerdata add $arg1 coins $arg2 - /mycmd-playerdata remove $player coins $arg2 - $text_to_specific_player%$arg1%$player sended you $arg2 coins! - $text$&aTransaction Done. - '$text$&aNew balance : $PlayerData%coins%' - $Script$%else% - $text$&cNot enough coins for do this transaction error-message: '&cUsage : /coins pay <player_name> <amount>' require_all_arguments: true coin_main_cmd: command: /coins type: TEXT runcmd: - "&b+-- MyCommand Coin System --+" - "&aCurrent balance :&e $PlayerData%coins%" - "&aSend coin to another player with /coins pay <player_name> <amount>"
Another "Credits" command(s) example :
'addcredits': command: /addcredits type: RUN_COMMAND runcmd: - '$Script$%PlayerDataFor%$arg1%Credits+$arg2' - "$text$New $arg1 balance : $PlayerDataFor%$arg1%Credits% Credits" required_args: 2 error-message: "Usage : /addcredits <player> <amount>" 'removecredits': command: /removecredits type: RUN_COMMAND runcmd: - '$Script$%PlayerDataFor%$arg1%Credits-$arg2' - "$text$New $arg1 balance : $PlayerDataFor%$arg1%Credits% Credits" required_args: 2 error-message: "Usage : /removecredits <player> <amount>" 'viewcredits': command: /viewcredits type: RUN_COMMAND runcmd: - "$Script$%if%$PlayerDataFor%$arg1%Credits%!=NoData" - "$text$$arg1 have $PlayerDataFor%$arg1%Credits% Credits" - "$Script$%else%" - "$text$This player don't have any account..." required_args: 1 permission-required: false error-message: "Usage : /viewcredits <player>"
Custom Kit example :
kit_test: command: /mycmdkit type: RUN_COMMAND runcmd: - '%PlayerOptions%clearInventory' - '%PlayerOptions%setHelmet: IRON_HELMET:1:0:DAMAGE_ALL;1;FIRE_ASPECT;1:&aMega Helmet:&bLine 1;Line 2;$random_colorLine 3' - '%PlayerOptions%setChestplate: IRON_CHESTPLATE:1:0::Mega Chestplate:Super' - '%PlayerOptions%setLeggings: IRON_LEGGINGS:1' - '%PlayerOptions%setBoots: IRON_BOOTS:1' - '%PlayerOptions%setItemInOffHand: SHIELD:1' - '%PlayerOptions%addItem: STONE_SWORD:1:0:DAMAGE_ALL;1;FIRE_ASPECT;1:&aMega Sword:&bLine1;Line 2;$random_colorLine 3' - '%PlayerOptions%setHeldItemSlot:0'
String (Text) Lenght Check
argstest:
command: /test
type: RUN_COMMAND
runcmd:
- "$Script$%if%$multiargs.string.length>0"
- "$text$ Do something if the command args are more than 0"
- "$Script$%else%"
- "$text$ Show Command Help Here"
Checking if the inventory is empty :
$Script$%if%$hasemptyinventory==true or $Script$%if%$inventorysize==0
Checking if the inventory is full:
$Script$%if%$inventorysize==41 (Full Inventory)
Here is a script I use to toggle night vision on and off for a player. I thought it might be a good example for people looking for a toggling command.
night_vision_toggle:
command: /nv
type: RUN_CONSOLE
runcmd:
- "$Script$%if%$PlayerData%nightvision%==off<or>$PlayerData%nightvision%==NoData"
- "effect give $player night_vision 99999 254 true"
- "$Script$%PlayerData%nightvision=on"
- "$Script$%else%"
- "$Script$%PlayerData%nightvision=off"
- "effect clear $player night_vision"
permission-required: true
permission-node: mycommand.cmd.nv
register: true