Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added admintools_create function #74

Merged
merged 3 commits into from Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions SkyBlock/SKYBLOCK.SK/Commands.sk
Expand Up @@ -97,6 +97,15 @@ command /islandadmin [<text>] [<text>] [<text>] [<text>] [<text>]:
if arg-2 is "invite":
admintools_invite(player,arg-3,arg-4)

#
# > Argument: "create"
# > Invites a player for the owner of the island
# > Actions:
# > This argument calls the admintools_create function, which creates a new island at the location
# > of the player, if available.
if arg-2 is "create":
admintools_create(player)

#
# > If no argument has been used, tell the player what is possible:
else:
Expand Down
51 changes: 50 additions & 1 deletion SkyBlock/SKYBLOCK.SK/Functions/admintools.sk
Expand Up @@ -79,7 +79,9 @@ function admintools_deleteisland(p:player,arg3:text,arg4:text):
# > If there is a leader set to this island, create a promt if it should be really deleted
if {SB::island::%{_loc::1}%_%{_loc::2}%_%{_loc::3}%::leader} is set:
set {_a} to {SB::lang::isadmin::suretodeleteisofp::%{_adminlang}%}
replace all "<player>" with "%{_player}%" in {_a}
#
# > Replace the player placeholder with the player.
replace all "<player>" with "%{_arg3}%" in {_a}
set {_prefix} to "%{_prefix}% %{_a}%"
set {_msg} to "%{SB::lang::isadmin::yes::%{_adminlang}%}%"
tellrawmsg1({_p},{_prefix},{_msg},"/islandadmin island delete %{SB::island::%{_loc::1}%_%{_loc::2}%_%{_loc::3}%::leader} parsed as offline player% deleteok")
Expand Down Expand Up @@ -393,3 +395,50 @@ function admintools_invite(p:player,arg3:text,arg4:text):
message "%{_prefix}% %{_a}%" to {_p}
else:
message "%{_prefix}% %{SB::lang::nois::%{_adminlang}%}%" to {_p}
#
# > Function: admintools_create
# > Arguments:
# > <player>player
# > Actions:
# > Creates a island with no leader at the position of the player paremeter.
function admintools_create(p:player):
#
# > Set local variables which are needed for messages later.
set {_uuid} to uuid of {_p}
set {_lang} to {SK::lang::%{_uuid}%}
set {_prefix} to {SB::lang::prefix::%{_adminlang}%}
#
# > Get the current bedrock
set {_bedrock} to searchbedrock({_p})
#
# > If there is already a bedrock, stop here and print error.
if block at {_bedrock} is bedrock:
message "%{_prefix}% %{SB::lang::at::isalreadyset::%{_lang}%}%" to {_p}
stop
#
# > Set the island center to bedrock.
set block at {_bedrock} to bedrock
#
# > Get local variables of the coordinates of the bedrock to set the new variables.
set {_x} to x-coord of {_bedrock}
set {_y} to y-coord of {_bedrock}
set {_z} to z-coord of {_bedrock}
#
# > If a leader is already set to the coordinates, check if it is empty.
if {SB::island::%{_x}%_%{_y}%_%{_z}%::leader} is set:
if {SB::island::%{_x}%_%{_y}%_%{_z}%::leader} is not "" or "---":
#
# > If there is already a owner set for this island/bedrock, stop here and print error.
message "%{_prefix}% %{SB::lang::at::isalreadyset::%{_lang}%}%" to {_p}
stop
else:
#
# > There is nobody set to this island, create a new one with a empty leader.
set {SB::island::%{_x}%_%{_y}%_%{_z}%::leader} to "---"
set {SB::island::%{_x}%_%{_y}%_%{_z}%::level} to 1
set {SB::island::%{_x}%_%{_y}%_%{_z}%::exp} to 0
set {SB::island::%{_x}%_%{_y}%_%{_z}%::created} to now
set {SB::islvl::%{_x}%_%{_y}%_%{_z}%} to 0
#
# > Print success message.
message "%{_prefix}% %{SB::lang::at::isnowset::%{_lang}%}%" to {_p}
5 changes: 5 additions & 0 deletions SkyBlock/lang/de.sk
Expand Up @@ -206,6 +206,11 @@ on script load:
set {SB::lang::nonether::%{_lang}%} to "%{_s1}%Die Hölle ist nicht zugänglich."
set {SB::lang::isdeleteqestion::%{_lang}%} to "%{_s1}%Bist du sicher? %{_p1}%Klicke Hier%{_s1}%"

#
# > Admintools:
set {SB::lang::at::isalreadyset::%{_lang}%} to "%{_s1}%There is already a bedrock or a island set. Kick everyone first and remove the bedrock, then create the new island."
set {SB::lang::at::isnowset::%{_lang}%} to "%{_s1}%The island is now set, add a island leader with /isadmin island addmember <new leader>."

#
# > Flags
#
Expand Down