I have a gens skript which is working perfectly fine and everything is good, the only problem is, is that it uses too much ram and I can't start my server because of it. Can anyone tell how I can make it take less ram? Thank you. The skript is probably not professional because I am just a beginner at skripting. Please tell me if I can make it take less ram and if so how. This is code:
Code:
command /wheatgen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player hay block named "&eWheat Gen"
command /pumpkingen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player pumpkin named "&6Pumpkin Gen"
command /coalgen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player coal block named "&8Coal Gen"
command /irongen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player iron block named "&fIron Gen"
command /goldgen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player gold block named "&6Gold Gen"
command /lapisgen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player lapis block named "&9Lapis Gen"
command /redstonegen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player redstone block named "&cRedstone Gen"
command /diamondgen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player diamond block named "&bDiamond Gen"
command /emeraldgen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player emerald block named "&2Emerald Gen"
command /obsidiangen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player obsidian named "&8Obsidian Gen"
command /gencapreset [<player>]:
permission: op
permission message: "&4You can't execute this command!"
trigger:
if arg-1 is set:
if arg-1 is a player:
send "&bYou have reset %arg-1% &bgenacp" to player
set {gens::%arg-1's uuid%} to 0
command /gens <player>:
trigger:
if arg-1 is set:
send "&b%arg-1% &bplaced %{gens::%arg-1's uuid%}% &bgens!" to player
else:
send "&bYou have placed %{gens::%player's uuid%}% &bgens!" to player
on place of hay block:
if name of player's held item contains "&eWheat Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed a wheat gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on hay block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke a wheat gen!" to player
give player hay block named "&eWheat Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on hay block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else if player's balance >= 500:
wait 10 ticks
set event-block to pumpkin
send action bar "&bYou upgraded a gen!" to player
else:
send action bar "&bYou need %500 - player's balance%&a$ &bmore to upgrade the gen" to player
on place of pumpkin:
if name of player's held item contains "&6Pumpkin Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed a pumpkin gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on pumpkin:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke a pumpkin gen!" to player
give player pumpkin named "&6Pumpkin Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on pumpkin:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
wait 10 ticks
set event-block to coal block
send action bar "&bYou upgraded a gen!" to player
on place of coal block:
if name of player's held item contains "&8Coal Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed a coal gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on coal block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke a coal gen!" to player
give player coal block named "&8Coal Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on coal block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
wait 10 ticks
set event-block to iron block
send action bar "&bYou upgraded a gen!" to player
on place of iron block:
if name of player's held item contains "&fIron Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed an iron gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on iron block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke an iron gen!" to player
give player iron block named "&fIron Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on iron block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
wait 10 ticks
set event-block to gold block
send action bar "&bYou upgraded a gen!" to player
on place of gold block:
if name of player's held item contains "&6Gold Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed a gold gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on gold block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke a gold gen!" to player
give player gold block named "&6Gold Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on gold block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
wait 10 ticks
set event-block to lapis block
send action bar "&bYou upgraded a gen!" to player
on place of lapis block:
if name of player's held item contains "&9Lapis Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed a lapis gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on lapis block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke a lapis gen!" to player
give player lapis block named "&9Lapis Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on lapis block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
wait 10 ticks
set event-block to redstone block
send action bar "&bYou upgraded a gen!" to player
on place of redstone block:
if name of player's held item contains "&cRedstone Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed a redstone gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on redstone block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke a redstone gen!" to player
give player redstone block named "&cRedstone Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on redstone block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
wait 10 ticks
set event-block to diamond block
send action bar "&bYou upgraded a gen!" to player
on place of diamond block:
if name of player's held item contains "&bDiamond Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed a diamond gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on diamond block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke a diamond gen!" to player
give player diamond block named "&bDiamond Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on diamond block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
wait 10 ticks
set event-block to emerald block
send action bar "&bYou upgraded a gen!" to player
on place of emerald block:
if name of player's held item contains "&2Emerald Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed an emerald gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on emerald block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke an emerald gen!" to player
give player emerald block named "&2Emerald Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on emerald block:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
wait 10 ticks
set event-block to obsidian
send action bar "&bYou upgraded a gen!" to player
on place of obsidian:
if name of player's held item contains "&8Obsidian Gen":
if {gens::%player's uuid%} < 10:
set {%event-block%.owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed an obsidian gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on obsidian:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke an obsidian gen!" to player
give player Obsidian block named "&8Obsidian Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on obsidian:
Loop all players:
if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
if player is sneaking:
if {%event-block%.owner} is set:
if {%event-block%.owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
send action bar "&bThere are no gen upgrades." to player
every 3 seconds:
Loop all players:
Loop all blocks in radius 30 of loop-player:
if loop-block is hay block:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 wheat at block above loop-value-2
if loop-block is pumpkin:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 pumpkin at block above loop-value-2
if loop-block is coal block:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 coal at block above loop-value-2
if loop-block is iron block:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 iron ingot at block above loop-value-2
if loop-block is gold block:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 gold ingot at block above loop-value-2
if loop-block is lapis block:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 lapis at block above loop-value-2
if loop-block is redstone block:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 redstone at block above loop-value-2
if loop-block is diamond block:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 diamond at block above loop-value-2
if loop-block is emerald block:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 emerald at block above loop-value-2
if loop-block is obsidian:
if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
drop 1 nether star at block above loop-value-2
Last edited: