Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on load:
- set {gs.setting.first.block} to false
- set {gs.setting.second.block} to false
- set {gs.setting.ground} to false
- if {gs.blacklist.every.region} is not set:
- set {gs.blacklist.every.region} to false
- if {gs.creationmethod} is not set:
- set {gs.creationmethod} to "setblock"
- command /gravestones <text="help"> [<text>]:
- permission: skript.gravestones
- aliases: /gs
- trigger:
- if arg-1 is "help":
- if arg-2 is "methods":
- message "<cyan> Setblock using relative coords to set blocks around." to player
- message "<grey>Grave will look like 2 podzol blocks at ground level, double-" to player
- message "<grey>chest underneath, and cobble fence with player head above it." to player
- message "<cyan>Use this, if you like my design, and don't want to set up stuff." to player
- message "" to player
- message "<grey> Clone is using vanilla /clone command." to player
- message "<cyan>You need to build a tomb, and define it using /gs setgrave." to player
- message "<grey>This method will detect chests in your tomb and store drops in." to player
- message "<cyan>Chests can be placed separately, not necessarily as double." to player
- message "<light red>If you place 2< chests though, unfit drop will be dropped near!" to player
- message "<cyan>If there is a skull(397:3), it will be replaced with victim's." to player
- message "<grey>You need to place your structure somewhere at spawn(most-" to player
- message "<grey>likely underground), because it won't work w/ unloaded chunks." to player
- message "" to player
- message "<cyan> Schematic method should work with PirateSK and WorldEdit." to player
- message "<grey>But, it seems PirateSK doesn't work with Skript 2.2, so I can't" to player
- message "<grey>test it, so it's disabled. <light red>Sorry<grey>." to player
- stop
- if arg-2 is "masks":
- message "<cyan> In masked mode, your tomb will be copied ignoring air." to player
- message "<grey>In replace mode vice versa." to player
- message "<cyan>For example: your tomb is a hollow box with chest in the middle." to player
- message "<grey>Your player suffocated somewhere deep undergound." to player
- message "<cyan>With masked mode tomb will be filled with stone and other blocks." to player
- message "<grey>But with replace mode it will be placed as is - hollow." to player
- stop
- else:
- message " <cyan>/gs help <grey>will show this page." to player
- message "<cyan>/gs method <clone/setblock/<black>schematic<cyan>> <grey>will set gravestone creation method." to player
- message "<cyan>/gs help methods <grey>will show more info about creation methods." to player
- message "<cyan>/gs setgrave <grey>will start selection of gravestone structure. Type again to cancel.<light red>*" to player
- message "<cyan>/gs setmask <masked/replace> <grey>will set mask mode.<light red>*" to player
- message "<cyan>/gs help masks <grey>will show more info about masks for /clone command.<light red>*" to player
- message "<cyan>/gs protect <region name> <grey>will add region to blacklist. Type in '<cyan> <every> <grey>' as region name to enable blacklisting for all regions. Regions, where player can't build are protected by default. Set this only if you want to protect regions from permitted administrators or donators." to player
- message "<cyan>/gs unprotect <region name> <grey>will remove region from blacklist. Type in '<cyan> <every> <grey>' as region name to disable blacklisting for all regions. (This will not affect regions you added manually)" to player
- # message "<cyan>/gs protectlist <grey>will show every protected region."
- message "<cyan>/gs info <grey>will show your config information." to player
- message " <light red>*Those commands are only for <grey>clone <light red>creation method." to player
- if arg-1 is "method":
- if arg-2 is "clone":
- set {gs.creationmethod} to "clone"
- if {gs.clone.maskmode} is not set:
- set {gs.clone.maskmode} to "masked"
- message " <grey>Creation method has been set to <cyan>%{gs.creationmethod}%<grey>." to player
- message "<grey>This method has additional options, look at <cyan>/gs info<grey>." to player
- stop
- if arg-2 is "setblock":
- set {gs.creationmethod} to "setblock"
- message " <grey>Creation method has been set to <cyan>%{gs.creationmethod}%<grey>." to player
- stop
- if arg-2 is "schematic":
- # set {gs.creationmethod} to "schematic"
- # message " <grey>Creation method has been set to <cyan>%{gs.creationmethod}%<grey>." to player
- message " <light red>This method is currenly under construction, sorry." to player
- stop
- else:
- message " <grey>You need to specify method to set it." to player
- message "<grey>It can be either <cyan>clone<grey>, <cyan>setblock<grey> or <cyan>schematic<grey>." to player
- message "<grey>Current is: <cyan>%{gs.creationmethod}%<grey>." to player
- stop
- if arg-1 is "setgrave":
- if {gs.creationmethod} is "clone":
- if {gs.setting.first.block} and {gs.setting.second.block} and {gs.setting.ground} is false:
- set {gs.setting.first.block} to true
- message "<grey>Break a block to select <cyan>first <grey>coordinate." to player
- else:
- set {gs.setting.first.block} and {gs.setting.second.block} and {gs.setting.ground} to false
- message "<light red>You canceled coordinates setting. Coordinates may be invalid, if you canceled in the middle of the process, check /gs info to be sure." to player
- else:
- message "<light red>This command only works with <grey>clone <light red>creation method selected." to player
- if arg-1 is "setmask":
- if {gs.creationmethod} is "clone":
- if arg-2 is "masked":
- set {gs.clone.maskmode} to "masked"
- message " <grey>Mask mode has been set to <cyan>%{gs.clone.maskmode}%<grey>." to player
- stop
- if arg-2 is "replace":
- set {gs.clone.maskmode} to "replace"
- message " <grey>Mask has been set to <cyan>%{gs.clone.maskmode}%<grey>." to player
- stop
- else:
- message " <grey>You need to specify mode to set it." to player
- message "<grey>It can be either <cyan>masked<grey> or <cyan>replace<grey>." to player
- message "<grey>Current is: <cyan>%{gs.clone.maskmode}%<grey>." to player
- else:
- message "<light red>This command only works with <grey>clone <light red>creation method selected." to player
- if arg-1 is "protect":
- if arg-2 is "<every>":
- set {gs.blacklist.every.region} to true
- message " <grey>Protection for every region is <cyan>enabled." to player
- stop
- if arg-2 is not set:
- message " <grey>You need to specify a region. Use <cyan>/gs <grey>for help." to player
- stop
- else:
- add arg-2 to {gs.blacklist.regions.list::*}
- message " <grey>Added <cyan>%arg-2% <grey>to protected regions list." to player
- if arg-1 is "unprotect":
- if arg-2 is "<every>":
- set {gs.blacklist.every.region} to false
- message " <grey>Protection for every region is <cyan>disabled." to player
- stop
- if arg-2 is not set:
- message " <grey>You need to specify a region. Use <cyan>/gs <grey>for help." to player
- stop
- else:
- remove arg-2 from {gs.blacklist.regions.list::*}
- message " <grey>Removed <cyan>%arg-2% <grey>from protected regions list." to player
- # if arg-1 is "protectlist":
- # message " <cyan>Protected regions: <grey>%{gs.blacklist.regions.list::*}%." to player
- if arg-1 is "info":
- if {gs.creationmethod} is "setblock":
- message " <grey>Current creation method is <cyan>%{gs.creationmethod}%<grey>." to player
- if {gs.blacklist.every.region} is true:
- message "<grey>Every region is currently protected from grave creation." to player
- else:
- message "<cyan>Protected regions: <grey>%{gs.blacklist.regions.list::*}%." to player
- else:
- message " <grey>Current creation method is <cyan>%{gs.creationmethod}%<grey>." to player
- message "<grey>Current clone mask mode is <cyan>%{gs.clone.maskmode}%<grey>." to player
- message "<grey>Current gravestone cloning structure coordinates:" to player
- message "<cyan>%x-coord of {gs.clone.first.loc}% %y-coord of {gs.clone.first.loc}% %z-coord of {gs.clone.first.loc}% <grey>TO <cyan>%x-coord of {gs.clone.second.loc}% %y-coord of {gs.clone.second.loc}% %z-coord of {gs.clone.second.loc}%<grey>." to player
- message "<grey>Current ground offset is <cyan>%{gs.clone.structure.groundoffset}%<grey>." to player
- message "<grey>Current structure dimensions: <cyan>%{gs.absolute.width}%<grey> on X, <cyan>%{gs.absolute.height}%<grey> on Y and <cyan>%{gs.absolute.depth}%<grey> on Z." to player
- if {gs.blacklist.every.region} is true:
- message "<grey>Every region is currently protected from grave creation." to player
- else:
- message "<cyan>Protected regions: <grey>%{gs.blacklist.regions.list::*}%." to player
- on block break:
- if {gs.setting.ground} is true:
- cancel event
- message "<grey>Ground set. Calculating things..." to player
- #Calculating ground offset
- if y-coord of {gs.clone.first.loc} <= y-coord of {gs.clone.second.loc}:
- set {gs.clone.structure.groundoffset} to y-coord of {gs.clone.first.loc} - y-coord of event-block
- set {gs.absolute.height} to y-coord of {gs.clone.second.loc} - y-coord of {gs.clone.first.loc} + 1
- if y-coord of {gs.clone.first.loc} > y-coord of {gs.clone.second.loc}:
- set {gs.clone.structure.groundoffset} to y-coord of {gs.clone.second.loc} - y-coord of event-block
- set {gs.absolute.height} to y-coord of {gs.clone.first.loc} - y-coord of {gs.clone.second.loc} + 1
- #Making coordinates absolute to calculate structure size
- if x-coord of {gs.clone.first.loc} < 0:
- set {_absolute.x1} to x-coord of {gs.clone.first.loc} * -1
- if z-coord of {gs.clone.first.loc} < 0:
- set {_absolute.z1} to z-coord of {gs.clone.first.loc} * -1
- if x-coord of {gs.clone.second.loc} < 0:
- set {_absolute.x2} to x-coord of {gs.clone.second.loc} * -1
- if z-coord of {gs.clone.second.loc} < 0:
- set {_absolute.z2} to z-coord of {gs.clone.second.loc} * -1
- #Calculating structure size
- set {gs.absolute.width} to {_absolute.x1} - {_absolute.x2}
- set {gs.absolute.depth} to {_absolute.z1} - {_absolute.z2}
- if {gs.absolute.width} < 0:
- set {gs.absolute.width} to {gs.absolute.width} * -1
- if {gs.absolute.depth} < 0:
- set {gs.absolute.depth} to {gs.absolute.depth} * -1
- set {gs.absolute.width} to {gs.absolute.width} + 1
- set {gs.absolute.depth} to {gs.absolute.depth} + 1
- #End of calculations
- message "<cyan>Done." to player
- set {gs.setting.ground} to false
- if {gs.setting.second.block} is true:
- cancel event
- message "<grey>Second coordinate set" to player
- message "<grey>Region selected, now break any block where <cyan>ground level <grey>should be when gravestone is placed." to player
- message "<grey>For example, if you want your tomb to be a single chest on the ground, break block under chest." to player
- set {gs.clone.second.loc} to location of event-block
- set {gs.setting.second.block} to false
- set {gs.setting.ground} to true
- if {gs.setting.first.block} is true:
- cancel event
- message "<grey>First coordinate set" to player
- message "<grey>Break a block to select <cyan>second <grey>coordinate." to player
- set {gs.clone.first.loc} to location of event-block
- set {gs.setting.first.block} to false
- set {gs.setting.second.block} to true
- on death of a player:
- #Delete previous grave if exists, and reset some variables
- set {_canbuild.%player%} to true
- delete {gs.items.%player%::*}
- delete {gs.location.%player%}
- #Calculate ground coordinate
- set {gs.location.%player%} to location of player
- while block at {gs.location.%player%} is air or stationary water or flowing water:
- set {gs.location.%player%} to location 1 meter below {gs.location.%player%}
- #If there is no ground, don't set Y:
- if y-coord of block at {gs.location.%player%} is 0:
- set y-coord of {gs.location.%player%} to -1
- message "Grave can't be created in void" to player
- stop
- #Vanilla clone command gravestone creation method
- #Check if player can build at grave location
- if {gs.creationmethod} is "clone":
- add block at location rounded {gs.absolute.depth}/2 meters north and rounded {gs.absolute.width}/2 meters west and rounded {gs.absolute.height}/2 meters above {gs.location.%player%} to {_canbuildat.%player%::*}
- add block at location rounded {gs.absolute.depth}/2 meters north and rounded {gs.absolute.width}/2 meters east and rounded {gs.absolute.height}/2 meters above {gs.location.%player%} to {_canbuildat.%player%::*}
- add block at location rounded {gs.absolute.depth}/2 meters south and rounded {gs.absolute.width}/2 meters west and rounded {gs.absolute.height}/2 meters above {gs.location.%player%} to {_canbuildat.%player%::*}
- add block at location rounded {gs.absolute.depth}/2 meters south and rounded {gs.absolute.width}/2 meters east and rounded {gs.absolute.height}/2 meters above {gs.location.%player%} to {_canbuildat.%player%::*}
- add block at location rounded {gs.absolute.depth}/2 meters north and rounded {gs.absolute.width}/2 meters west and rounded {gs.absolute.height}/2 meters below {gs.location.%player%} to {_canbuildat.%player%::*}
- add block at location rounded {gs.absolute.depth}/2 meters north and rounded {gs.absolute.width}/2 meters east and rounded {gs.absolute.height}/2 meters below {gs.location.%player%} to {_canbuildat.%player%::*}
- add block at location rounded {gs.absolute.depth}/2 meters south and rounded {gs.absolute.width}/2 meters west and rounded {gs.absolute.height}/2 meters below {gs.location.%player%} to {_canbuildat.%player%::*}
- add block at location rounded {gs.absolute.depth}/2 meters south and rounded {gs.absolute.width}/2 meters east and rounded {gs.absolute.height}/2 meters below {gs.location.%player%} to {_canbuildat.%player%::*}
- if player cannot build at {_canbuildat.%player%::*}:
- set {_canbuild.%player%} to false
- if "%region at {_canbuildat.%player%::*}%" is not "<none>":
- if {gs.blacklist.every.region} is true:
- set {_canbuild.%player%} to false
- if "%region at {_canbuildat.%player%::*}%" contains {gs.blacklist.regions.list::*}:
- set {_canbuild.%player%} to false
- if {_canbuild.%player%} is true:
- #Start making grave
- add drops to {gs.items.%player%::*}
- if {gs.clone.first.loc} and {gs.clone.second.loc} and {gs.clone.structure.groundoffset} is set:
- execute console command "/clone %x-coord of {gs.clone.first.loc}% %y-coord of {gs.clone.first.loc}% %z-coord of {gs.clone.first.loc}% %x-coord of {gs.clone.second.loc}% %y-coord of {gs.clone.second.loc}% %z-coord of {gs.clone.second.loc}% %x-coord of {gs.location.%player%} - rounded down {gs.absolute.width}/2% %y-coord of {gs.location.%player%} + {gs.clone.structure.groundoffset}% %z-coord of {gs.location.%player%} - rounded down {gs.absolute.depth}/2% %{gs.clone.maskmode}%"
- loop blocks within {_canbuildat.%player%::1} to {_canbuildat.%player%::8}:
- if loop-block is a chest:
- add location of loop-blocks to {_chest.loc.%player%::*}
- # if {_chest.loc.%player%::2} is set:
- # exit loop
- if loop-block is a mob head block:
- set {_skull.loc.%player%} to location of loop-block
- execute console command "/blockdata %x-coord of {_skull.loc.%player%}% %y-coord of {_skull.loc.%player%}% %z-coord of {_skull.loc.%player%}% {SkullType:3,ExtraType:%player%}"
- execute console command "/setblock %x coord of {_chest.loc.%player%::1}% %y coord of {_chest.loc.%player%::1}% %z coord of {_chest.loc.%player%::1}% chest 0 replace {CustomName:Loot of %player%}"
- execute console command "/setblock %x coord of {_chest.loc.%player%::2}% %y coord of {_chest.loc.%player%::2}% %z coord of {_chest.loc.%player%::2}% chest 0 replace {CustomName:Loot of %player%}"
- #Adding drops to found chests
- if {_chest.loc.%player%::1} is set:
- loop 40 times:
- set {_loop.counter.%player%} to loop-number + 1
- if block at {_chest.loc.%player%::1} has enough space for {gs.items.%player%::%loop-number%}:
- add {gs.items.%player%::%loop-number%} to block at {_chest.loc.%player%::1}
- else:
- if {_chest.loc.%player%::2} is set:
- add {gs.items.%player%::%loop-number%} to block at {_chest.loc.%player%::2}
- else:
- drop {gs.items.%player%::%loop-number%} at location 5 meters above {_chest.loc.%player%::1}
- clear drops
- else:
- stop
- clear {gs.items.%player%::*}
- else:
- message "<light red>Don't know what to clone, coordinates not set." to player
- #Setblock gravestone creation method
- if {gs.creationmethod} is "setblock":
- add block at location north and 2 meters above {gs.location.%player%} to {_canbuildat.%player%::*}
- add block at location below {gs.location.%player%} to {_canbuildat.%player%::*}
- if player cannot build at {_canbuildat.%player%::*}:
- set {_canbuild.%player%} to false
- broadcast "cant' build here"
- if "%region at {_canbuildat.%player%::*}%" is not "<none>":
- if {gs.blacklist.every.region} is true:
- set {_canbuild.%player%} to false
- broadcast "there is a region near your death location, can't create grave"
- if "%region at {_canbuildat.%player%::*}%" contains {gs.blacklist.regions.list::*}:
- set {_canbuild.%player%} to false
- broadcast "blacklisted region found, can't create grave"
- if {_canbuild.%player%} is true:
- broadcast "digging grave here"
- #Start making grave
- add drops to {gs.items.%player%::*}
- set block at {gs.location.%player%} to dirt:2
- set block 1 meter north of {gs.location.%player%} to dirt:2
- set block at location 1 meter north and above {gs.location.%player%} to cobblestone wall
- execute console command "/setblock %x-coord of {gs.location.%player%}% %y-coord of {gs.location.%player%} +2% %z-coord of {gs.location.%player%} -1% skull 1 keep {SkullType:3,ExtraType:%player%,Rot:8}"
- execute console command "/fill %x-coord of {gs.location.%player%}% %y-coord of {gs.location.%player%} -1% %z-coord of {gs.location.%player%}% %x-coord of {gs.location.%player%}% %y-coord of {gs.location.%player%} -1% %z-coord of {gs.location.%player%} -1% chest 0 replace {CustomName:Loot of %player%}"
- #Adding drops to created chest
- loop blocks within {_canbuildat.%player%::1} to {_canbuildat.%player%::2}:
- if loop-block is a chest:
- if inventory name of loop-block is "Loot of %player%":
- add {gs.items.%player%::*} to loop-block
- clear drops
- stop loop
- clear {gs.items.%player%::*}
- #Schematic gravestone creation method
- # if {gs.creationmethod} is "schematic":
- # paste schematic "gravestone" at event-location
- # do stuff
- # clear {gs.items.%player%::*}
- #Help player destroy setblock grave
- on break of dirt:2:
- if block above event-block is cobblestone wall:
- if block 2 blocks above event-block is head:
- if block below event-block is a chest:
- execute console command "/setblock %x coordinate of event-block% %y coordinate of event-block +1% %z coordinate of event-block% air 0"
- execute console command "/setblock %x coordinate of event-block% %y coordinate of event-block +2% %z coordinate of event-block% air 0 destroy"
- on break of a head:
- if block below event-block is cobblestone wall:
- if block 2 blocks below event-block is dirt:2:
- if block 3 blocks below event-block is a chest:
- execute console command "/setblock %x coordinate of event-block% %y coordinate of event-block -1% %z coordinate of event-block% air 0"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement