Skip to content

Instantly share code, notes, and snippets.

@FlashyReese
Last active July 5, 2022 20:22
Show Gist options
  • Save FlashyReese/d24cd9eebedce8c4b968fee30283b7c7 to your computer and use it in GitHub Desktop.
Save FlashyReese/d24cd9eebedce8c4b968fee30283b7c7 to your computer and use it in GitHub Desktop.
tpa and home commands
[
{
"commandMode": "COMMAND_CUSTOM",
"customCommand": {
"parent": "sethome",
"children": [
{
"child": "name",
"type": "argument",
"argumentType": "minecraft:word",
"suggestionProvider": {
"suggestionMode": "DATABASE_STARTS_WITH",
"suggestion": "$executor_name().home.suggestions"
},
"actions": [
{
"command": "commandaliases database put $executor_name().home.suggestions.{{name}} {{name}}",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put $executor_name().home.{{name}}.dimension $get_dimension($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put $executor_name().home.{{name}}.x $get_block_pos_x($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put $executor_name().home.{{name}}.y $get_block_pos_y($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put $executor_name().home.{{name}}.z $get_block_pos_z($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put $executor_name().home.{{name}}.yaw $get_yaw($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put $executor_name().home.{{name}}.pitch $get_pitch($executor_name())",
"commandType": "SERVER",
"successfulMessage": "$executor_name() [{{name}}] home has been set in [$get_dimension($executor_name())] with coordinates of $get_block_pos_x($executor_name()) $get_block_pos_y($executor_name()) $get_block_pos_z($executor_name())"
}
]
}
],
"actions": [
{
"command": "sethome main",
"commandType": "CLIENT"
}
]
}
},
{
"commandMode": "COMMAND_CUSTOM",
"customCommand": {
"parent": "delhome",
"children": [
{
"child": "name",
"type": "argument",
"argumentType": "minecraft:word",
"suggestionProvider": {
"suggestionMode": "DATABASE_STARTS_WITH",
"suggestion": "$executor_name().home.suggestions"
},
"actions": [
{
"command": "commandaliases database contains $executor_name().home.suggestions.{{name}}",
"commandType": "SERVER",
"unsuccessfulMessage": "$executor_name() [{{name}}] home does not exist!",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().home.suggestions.{{name}}",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().home.{{name}}.dimension",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().home.{{name}}.x",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().home.{{name}}.y",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().home.{{name}}.z",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().home.{{name}}.yaw",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().home.{{name}}.pitch",
"commandType": "SERVER",
"successfulMessage": "$executor_name() [{{name}}] home has been deleted!"
}
]
}
],
"actions": [
{
"command": "delhome main",
"commandType": "CLIENT"
}
]
}
},
{
"commandMode": "COMMAND_CUSTOM",
"customCommand": {
"parent": "home",
"children": [
{
"child": "name",
"type": "argument",
"argumentType": "minecraft:word",
"suggestionProvider": {
"suggestionMode": "DATABASE_STARTS_WITH",
"suggestion": "$executor_name().home.suggestions"
},
"actions": [
{
"command": "commandaliases database contains $executor_name().home.suggestions.{{name}}",
"commandType": "SERVER",
"unsuccessfulMessage": "$executor_name() [{{name}}] home has not been set!",
"requireSuccess": true
},
{
"command": "execute in $get_database_value($executor_name().home.{{name}}.dimension) run tp $executor_name() $get_database_value($executor_name().home.{{name}}.x) $get_database_value($executor_name().home.{{name}}.y) $get_database_value($executor_name().home.{{name}}.z) $get_database_value($executor_name().home.{{name}}.yaw) $get_database_value($executor_name().home.{{name}}.pitch)",
"commandType": "SERVER",
"successfulMessage": "Teleporting to $executor_name() [{{name}}] home!"
}
]
}
],
"actions": [
{
"command": "home main",
"commandType": "CLIENT"
}
]
}
},
{
"commandMode": "COMMAND_CUSTOM",
"customCommand": {
"parent": "tpa",
"children": [
{
"child": "player",
"type": "argument",
"argumentType": "minecraft:player",
"actions": [
{
"command": "commandaliases compute equals {{player}} $executor_name()",
"commandType": "SERVER",
"unsuccessfulActions": [
{
"command": "commandaliases database contains {{player}}.tpa.last_player",
"commandType": "SERVER",
"unsuccessfulActions": [
{
"command": "commandaliases database put {{player}}.tpa.last_player $executor_name()",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "tellraw {{player}} \"$executor_name() has requested to teleport to you. Type /tpaccept to accept this request. This request will expire in 60 seconds.\"",
"commandType": "SERVER",
"requireSuccess": true,
"successfulMessage": "You have requested to teleport to {{player}}."
},
{
"sleep": "60000"
},
{
"command": "commandaliases database contains {{player}}.tpa.last_player",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete {{player}}.tpa.last_player",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "tellraw {{player}} \"The request has expired.\"",
"commandType": "SERVER",
"successfulMessage": "The request to {{player}} has expired."
}
],
"requireSuccess": true,
"successfulMessage": "{{name}} has a pending request! Please wait..."
}
],
"successfulMessage": "You can not request to teleport to yourself!"
}
]
}
]
}
},
{
"commandMode": "COMMAND_CUSTOM",
"customCommand": {
"parent": "tpahere",
"children": [
{
"child": "player",
"type": "argument",
"argumentType": "minecraft:player",
"actions": [
{
"command": "commandaliases compute equals {{player}} $executor_name()",
"commandType": "SERVER",
"unsuccessfulActions": [
{
"command": "commandaliases database contains {{player}}.tpahere.last_player",
"commandType": "SERVER",
"unsuccessfulActions": [
{
"command": "commandaliases database put {{player}}.tpahere.last_player $executor_name()",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put {{player}}.tpahere.dimension $get_dimension($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put {{player}}.tpahere.x $get_block_pos_x($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put {{player}}.tpahere.y $get_block_pos_y($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put {{player}}.tpahere.z $get_block_pos_z($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put {{player}}.tpahere.yaw $get_yaw($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database put {{player}}.tpahere.pitch $get_pitch($executor_name())",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "tellraw {{player}} \"$executor_name() has requested you to teleport to them. Type /tpaccept to accept this request. This request will expire in 60 seconds.\"",
"commandType": "SERVER",
"requireSuccess": true,
"successfulMessage": "You have requested to teleport to {{player}}."
},
{
"sleep": "60000"
},
{
"command": "commandaliases database contains {{player}}.tpahere.last_player",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete {{player}}.tpahere.last_player",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete {{player}}.tpahere.dimension",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete {{player}}.tpahere.x",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete {{player}}.tpahere.y",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete {{player}}.tpahere.z",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete {{player}}.tpahere.yaw",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete {{player}}.tpahere.pitch",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "tellraw {{player}} \"The request has expired.\"",
"commandType": "SERVER",
"successfulMessage": "The request to {{player}} has expired."
}
],
"requireSuccess": true,
"successfulMessage": "{{name}} has a pending request! Please wait..."
}
],
"successfulMessage": "You can not request to teleport to yourself!"
}
]
}
]
}
},
{
"commandMode": "COMMAND_CUSTOM",
"customCommand": {
"parent": "tpaccept",
"actions": [
{
"command": "commandaliases database contains $executor_name().tpa.last_player",
"commandType": "SERVER",
"unsuccessfulActions": [
{
"command": "commandaliases database contains $executor_name().tpahere.last_player",
"commandType": "SERVER",
"unsuccessfulMessage": "You have no pending teleport request!",
"requireSuccess": true
},
{
"command": "execute in $get_database_value($executor_name().tpahere.dimension) run tp $executor_name() $get_database_value($executor_name().tpahere.x) $get_database_value($executor_name().tpahere.y) $get_database_value($executor_name().tpahere.z) $get_database_value($executor_name().tpahere.yaw) $get_database_value($executor_name().tpahere.pitch)",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "tellraw $get_database_value($executor_name().tpahere.last_player) \"$executor_name() is teleporting to the requested location...\"",
"commandType": "SERVER",
"requireSuccess": true,
"successfulMessage": "You are being teleported to the requested location by $get_database_value($executor_name().tpahere.last_player)."
},
{
"command": "commandaliases database delete $executor_name().tpahere.last_player",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().tpahere.dimension",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().tpahere.x",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().tpahere.y",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().tpahere.z",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().tpahere.yaw",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "commandaliases database delete $executor_name().tpahere.pitch",
"commandType": "SERVER"
}
],
"requireSuccess": true
},
{
"command": "tp $get_database_value($executor_name().tpa.last_player) $executor_name()",
"commandType": "SERVER",
"requireSuccess": true
},
{
"command": "tellraw $get_database_value($executor_name().tpa.last_player) \"Teleporting to $executor_name()...\"",
"commandType": "SERVER",
"requireSuccess": true,
"successfulMessage": "Teleporting $get_database_value($executor_name().tpa.last_player) to you..."
},
{
"command": "commandaliases database delete $executor_name().tpa.last_player",
"commandType": "SERVER"
}
]
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment