Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################## Mine Creation Automation
- # DEPENDENCY 1: This is a script that works with CommandHelper (CH) in the config.txt
- # ### You will have to add many CH permissions to your staff and users for this to work
- # ### The console will tell you which perm is currently preventing the function from working.
- # DEPENDENCY 2: MineReset Lite
- # DEPENDENCY 3: *Optional* Command Signs - lets you use /payResetMine,/payClearBedrock on a sign
- #
- # *Tabs are ok to use with CommandHelper, its a great plugin for casual programmers
- # This script is open source, made by Bobb Shields of Team[GLOKK]
- # Fill out the application at http://teamglokk.enjin.com/recruitment to get white-listed.
- #
- ###########
- ### This allows an OP with WorldEdit and WorldGuard to build a bedrock wall around a future mine
- ### It is overloaded so you can just build a box with /prepareMine
- ### Or you can call the next function by providing a $name for a default quality 'A' mine.
- ### You may further specify a $quality of {A,B,C,D1,D2}
- ### A is the worst, then B, C, and the D's stand for Donor 1 and 2
- #
- # This will create a MineResetLite mine of whatever name you give it. It will also
- # create a WorldGuard region in the heart of the mine so that permissions can be
- # restricted (add your own custom commands below) but also for /payClearMine which
- # clears out the blocks (including bedrock) from the mines for a high price. This is needed
- # due to the fillMode Setting of MRL that when true, only resets the air blocks.
- ##### The donor Qualities do not contain bedrock!
- #
- # No Command Helper perms used because the scripted commands already require them
- /prepareMine [$name='none'] [$quality='A']= >>>
- run ('/region remove '.$name)
- run ('//pos1')
- run ('//pos2') #current position is the block your feet are in
- run ('//shift 2 me') #so the user isn't pushed out of the way
- run ('//expand 40 me')
- run ('//expand 40 r')
- run ('//shift 1 d')
- run ('//set bedrock') #floor
- run ('//shift 22 u')
- run ('//set bedrock') #ceiling
- run ('//shift 1 d')
- run ('//expand 20 d')
- run ('//outset 1')
- run ('//walls bedrock') #walls
- run ('//inset 1')
- run ('/region define '.$name )
- run ('//pos1')
- run ('//pos2')
- run ('//shift 1 me')
- run ('//expand 1 r')
- run ('//shift 1 d')
- run ('//set glass')
- run ('//shift 1 d')
- run ('//set glowstone')
- run ('//shift 1 d')
- run ('//set bedrock')
- run ('//shift 3 u')
- run ('//expand 2 u')
- run ('//set 0') # Make the doorway
- run ('//pos1')
- run ('//pos2')
- run ('//shift 2 me')
- run ('//expand 40 me')
- run ('//expand 40 r')
- run ('//expand 20 u')
- run ('//set 0')
- # Future update: make the two signs and clear a gangway at the entrance
- #run ('' #Region permissions could go here #)
- if ( equals($name,'none'),
- msg ('You may now run the /createMine command to complete the mine')
- ,
- call_alias(/createMine $name $quality)
- )
- <<<
- ### Overload it for more user-friendly /mine
- /mine = /mrl
- /mine $ = /mrl $
- ### This creates the percentages in the mines
- /createMine $name [$quality='A'] = >>>
- # Delete the existing mine first. Allows mine percentages to be updated in the same
- # that they were created
- run ('/mrl erase '.$name)
- ## This is a SELECT statement with CASES. Its syntax is based soley on commas
- # To make a new group, Copy { 'A', TO THE , BEFORE THE 'B', } then change A to whatever label
- # To adjust the percentages, go to the appropriate Quality then look for the right label
- switch ( $quality,
- 'A',
- assign(@b,.3)
- assign(@e,.2)
- assign(@d,.2)
- assign(@l,.4)
- assign(@g,.5)
- assign(@gl,.5)
- assign(@c,1)
- assign(@w,1.5)
- assign(@r,3)
- assign(@gr,6)
- assign(@i,7)
- assign(@f,7)
- assign(@s,10)
- assign(@a,15)
- assign(@dt,15)
- assign(@st,31.8)
- assign(@o,.1)
- ,
- 'B',
- assign(@b,.2)
- assign(@e,.3)
- assign(@d,.3)
- assign(@l,.3)
- assign(@g,.6)
- assign(@gl,1)
- assign(@c,3)
- assign(@w,1)
- assign(@r,3)
- assign(@gr,5)
- assign(@i,9)
- assign(@f,8)
- assign(@s,7)
- assign(@a,10)
- assign(@dt,10)
- assign(@st,39.8)
- assign(@o,1)
- ,
- 'C',
- assign(@b,.1)
- assign(@e,.4)
- assign(@d,.4)
- assign(@l,.2)
- assign(@g,.7)
- assign(@gl,2.5)
- assign(@c,5)
- assign(@w,.5)
- assign(@r,5)
- assign(@gr,4)
- assign(@i,11)
- assign(@f,9)
- assign(@s,5)
- assign(@a,5)
- assign(@dt,5)
- assign(@st,43.7)
- assign(@o,2)
- ,
- 'D1',
- assign(@b,.0)
- assign(@e,.4)
- assign(@d,.4)
- assign(@l,.2)
- assign(@g,.7)
- assign(@gl,2.5)
- assign(@c,5)
- assign(@w,.5)
- assign(@r,6)
- assign(@gr,3)
- assign(@i,12)
- assign(@f,10)
- assign(@s,7)
- assign(@a,3)
- assign(@dt,4)
- assign(@st,39.5)
- assign(@o,3)
- ,
- 'D2',
- assign(@b,0)
- assign(@e,.5)
- assign(@d,.5)
- assign(@l,.1)
- assign(@g,1)
- assign(@gl,4)
- assign(@c,8)
- assign(@w,.1)
- assign(@r,7)
- assign(@gr,3)
- assign(@i,13)
- assign(@f,11)
- assign(@s,8)
- assign(@a,1)
- assign(@dt,3)
- assign(@st,35.3)
- assign(@o,4)
- )
- # Make the mine and assign the percentages. This is the real
- # reason these were scripted- to make everything consistent!
- run ('/mrl create '.$name )
- run ('/mrl set '.$name.' bedrock '.@b.'%')
- run ('/mrl set '.$name.' emerald_ore '.@e.'%')
- run ('/mrl set '.$name.' diamond_ore '.@d.'%')
- run ('/mrl set '.$name.' lava '.@l.'%')
- run ('/mrl set '.$name.' gold_ore '.@g.'%')
- run ('/mrl set '.$name.' glowstone '.@gl.'%')
- run ('/mrl set '.$name.' clay '.@c.'%')
- run ('/mrl set '.$name.' water '.@w.'%')
- run ('/mrl set '.$name.' redstone_ore '.@r.'%')
- run ('/mrl set '.$name.' gravel '.@gr.'%')
- run ('/mrl set '.$name.' iron_ore '.@i.'%')
- run ('/mrl set '.$name.' coal_ore '.@f.'%')
- run ('/mrl set '.$name.' sand '.@s.'%')
- run ('/mrl set '.$name.' air '.@a.'%')
- run ('/mrl set '.$name.' dirt '.@dt.'%')
- run ('/mrl set '.$name.' stone '.@st.'%')
- run ('/mrl set '.$name.' obsidian '.@o.'%')
- run ('/mrl flag '.$name.' resetDelay 10080') # Weekly resets (in minutes)
- run ('/mrl flag '.$name.' resetWarnings 1440,360,180,60,30,10,1') #Saying the mine will reset
- run ('/mrl flag '.$name.' fillMode true') # True means only air will be replaced on reset
- # Let everyone know the mine has been installed, its fair game from here
- broadcast ( player().' has installed a mine named '.$name)
- run ('/mrl reset '.$name.'')
- # How we got around the lack of signs with MRL is by making these two custom commands
- # that take payment from the users to run some OP commands to reset the mine, and
- # to //set 0 the region where the mine is- to clear accumulating bedrock
- msg ('Remember to place a sign then do ')
- msg ('/cmds 1 /payMineReset '.$name.' 10,000' )
- msg ('and then click the Reset Sign, and then do')
- msg ('/cmds 1 /payClearMine '.$name. ' 50,000' )
- msg ('and then click the Clear Sign')
- # And thank the staffer who installed the mine
- msg ('Mine '.$name.' has been created. Thank you, '.player().'!')
- <<<
- #### Confirmation of /yes or /no for payment commands
- /yes = >>>
- assign(@key, concat('confirmation.', player()))
- store_value ( @key, 't') # Persistent value
- msg ( 'Confirmation received! Try again' )
- <<<
- /no = >>>
- msg ('Maybe next time.')
- <<<
- # The user pays $cost to reset the mine $name
- # Designed to be attached to a Command Sign. Just do:
- # /cmds 1 /payMineReset CityMine_A 20000
- # then click the sign
- /payMineReset [$name='none'] [$cost='10000'] = >>>
- if( equals($name,'none'), die ('You have not specified a mine.') )
- # Confirmation system of /yes or /no
- assign(@key,concat('confirmation.',player() ) )
- if ( equals (get_value(@key), 't') ,
- clear_value(@key)
- ,
- msg ( 'This will cost you $'.$cost.'. Are you sure you want to continue?' )
- msg ( 'Type /yes or /no to confirm' )
- die()
- )
- #Retain the account balance
- assign(@bal,acc_balance(player() ) )
- #### Logic and actions
- if(gte(@bal,$cost), # If they have enough money
- acc_subtract(player(),$cost) # take their money
- runas(~op,'/mrl reset '.$name.'') # Reset the mine
- , #Else
- die ('You did not have enough Gidrins to reset the mine '.$name.'.')
- )
- <<<
- # The same idea as /payMineReset
- # /cmds 1 /payMineReset CityMine_A 30000
- # then click the sign
- /payClearMine [$name='none'] [$cost='50000'] = >>>
- if( equals($name,'none'), die ('You have not specified a mine.') )
- assign(@key,concat('confirmation.',player() ) )
- if ( equals (get_value(@key), 't') ,
- clear_value(@key)
- ,
- msg ( 'This will cost you $'.$cost.'. Are you sure you want to continue?' )
- msg ( 'Type /yes or /no to confirm' )
- die() )
- #Retain the accountt balance
- assign(@bal,acc_balance(player() ) )
- #### Logic and actions
- if(gte(@bal,$cost),
- acc_subtract(player(),$cost)
- runas(~op,'/region select '.$name)
- runas(~op,'//set 0')
- , #Else
- die ('You did not have enough Gidrins to reset the mine '.$name.'.')
- )
- <<<
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement