Minecraft

How to disable TNT explosions on your MC Server.

Submitted by Microsoft-Word, , Thread ID: 100277

Thread Closed
29-08-2018, 06:05 AM
#1
I currently run a Minecraft server for my friends and I to play on and one of them decided to blow up my house. Now originally I was pretty mad but I forgave them and chose to implement this cool code to prevent TNT explosions.

Code:
summon FallingSand ~ ~1 ~ {Block:stone,Time:1,Passengers:[{id:FallingSand,Block:redstone_block,Time:1,Passengers:[{id:FallingSand,Block:activator_rail,Time:1,Passengers:[{id:MinecartCommandBlock,Command:gamerule commandBlockOutput false},{id:MinecartCommandBlock,Command:fill ~2 ~-3 ~-1 ~7 ~ ~1 stained_hardened_clay 9 hollow},{id:MinecartCommandBlock,Command:fill ~2 ~-2 ~-1 ~7 ~-1 ~1 stained_glass 10 0 stained_hardened_clay},{id:MinecartCommandBlock,Command:"/tellraw @p [\"\",{\"text\":\"Command Made By\",\"bold\":true,\"color\":\"yellow\"},{\"text\":\" \"},{\"text\":\"[\",\"color\":\"dark_blue\"},{\"text\":\"HydroFist_XG\",\"color\":\"green\"},{\"text\":\"]\",\"color\":\"dark_blue\"}]"},{id:MinecartCommandBlock,Command:"/tellraw @a [\"\",{\"text\":\"NB\",\"bold\":true,\"color\":\"dark_red\"},{\"text\":\": I just convert this to one command\\n The Creator is \\\"\",\"color\":\"green\"},{\"text\":\"Nviel\",\"bold\":true,\"italic\":true,\"underlined\":true,\"color\":\"gold\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.youtube.com/channel/UC_muyYFziJjZbJjXlmE8_4A\"}},{\"text\":\"\\\", checkout his channel! \\n \",\"color\":\"green\"}]Styled text only (Minecraft JSON Format)"},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~ wall_sign 4 0 {Text1:"{\\\"text\\\":\\\"-=-=-=-\\\",\\\"color\\\":\\\"blue\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"/scoreboard objectives remove TNTDisable\\\"}}",Text2:"{\\\"text\\\":\\\"Click Here\\\",\\\"color\\\":\\\"dark_red\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"particle largeexplode ~ ~ ~ 4 1 2 1 50\\\"},\\\"italic\\\":true,\\\"bold\\\":true}",Text3:"{\\\"text\\\":\\\"To Remove\\\",\\\"color\\\":\\\"dark_red\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"/playsound minecraft:entity.generic.explode voice @p ~ ~ ~\\\"},\\\"italic\\\":true,\\\"bold\\\":true}",Text4:"{\\\"text\\\":\\\"-=-=-=-\\\",\\\"color\\\":\\\"blue\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"fill ~ ~-1 ~-1 ~6 ~2 ~1 air\\\"}}"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-1 ~ wall_sign 4 0 {Text1:"{\\\"text\\\":\\\"-=-=-=-\\\",\\\"color\\\":\\\"dark_red\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"/tellraw @p [\\\\\\\"\\\\\\\",{\\\\\\\"text\\\\\\\":\\\\\\\"Command Made By\\\\\\\",\\\\\\\"bold\\\\\\\":true,\\\\\\\"color\\\\\\\":\\\\\\\"yellow\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\" \\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"[\\\\\\\",\\\\\\\"color\\\\\\\":\\\\\\\"dark_blue\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"HydroFist_XG\\\\\\\",\\\\\\\"color\\\\\\\":\\\\\\\"green\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"]\\\\\\\",\\\\\\\"color\\\\\\\":\\\\\\\"dark_blue\\\\\\\"}] INIT:/tellraw @a [\\\\\\\"\\\\\\\",{\\\\\\\"text\\\\\\\":\\\\\\\"NB\\\\\\\",\\\\\\\"bold\\\\\\\":true,\\\\\\\"color\\\\\\\":\\\\\\\"dark_red\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\": I just convert this to one command\\\\\\\\n The Creator is \\\\\\\\\\\\\\\"\\\\\\\",\\\\\\\"color\\\\\\\":\\\\\\\"green\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"Nviel\\\\\\\",\\\\\\\"bold\\\\\\\":true,\\\\\\\"italic\\\\\\\":true,\\\\\\\"underlined\\\\\\\":true,\\\\\\\"color\\\\\\\":\\\\\\\"gold\\\\\\\",\\\\\\\"clickEvent\\\\\\\":{\\\\\\\"action\\\\\\\":\\\\\\\"open_url\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"https://www.youtube.com/channel/UC_muyYFziJjZbJjXlmE8_4A\\\\\\\"}},{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\\\\\\\\\", checkout his channel! \\\\\\\\n \\\\\\\",\\\\\\\"color\\\\\\\":\\\\\\\"green\\\\\\\"}]Styled text only (Minecraft JSON Format)\\\"}}",Text2:"{\\\"text\\\":\\\"Click Here\\\",\\\"color\\\":\\\"green\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"/tellraw @a [\\\\\\\"\\\\\\\",{\\\\\\\"text\\\\\\\":\\\\\\\"NB\\\\\\\",\\\\\\\"bold\\\\\\\":true,\\\\\\\"color\\\\\\\":\\\\\\\"dark_red\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\": I just convert this to one command\\\\\\\\n The Creator is \\\\\\\\\\\\\\\"\\\\\\\",\\\\\\\"color\\\\\\\":\\\\\\\"green\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"Nviel\\\\\\\",\\\\\\\"bold\\\\\\\":true,\\\\\\\"italic\\\\\\\":true,\\\\\\\"underlined\\\\\\\":true,\\\\\\\"color\\\\\\\":\\\\\\\"gold\\\\\\\",\\\\\\\"clickEvent\\\\\\\":{\\\\\\\"action\\\\\\\":\\\\\\\"open_url\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"https://www.youtube.com/channel/UC_muyYFziJjZbJjXlmE8_4A\\\\\\\"}},{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\\\\\\\\\", checkout his channel! \\\\\\\\n \\\\\\\",\\\\\\\"color\\\\\\\":\\\\\\\"green\\\\\\\"}]Styled text only (Minecraft JSON Format)\\\"},\\\"italic\\\":true,\\\"bold\\\":true}",Text3:"{\\\"text\\\":\\\"For Credits\\\",\\\"color\\\":\\\"green\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"/playsound minecraft:entity.experience_orb.touch voice @p ~ ~ ~\\\"},\\\"italic\\\":true,\\\"bold\\\":true}",Text4:"{\\\"text\\\":\\\"-=-=-=-\\\",\\\"color\\\":\\\"dark_red\\\"}"}},{id:MinecartCommandBlock,Command:fill ~3 ~-2 ~ ~6 ~-1 ~ chain_command_block 5},{id:MinecartCommandBlock,Command:setblock ~3 ~-1 ~ chain_command_block 1},{id:MinecartCommandBlock,Command:fill ~6 ~-1 ~ ~4 ~-1 ~ chain_command_block 4},{id:MinecartCommandBlock,Command:setblock ~6 ~-2 ~ chain_command_block 1},{id:MinecartCommandBlock,Command:setblock ~3 ~-2 ~ repeating_command_block 5},{id:MinecartCommandBlock,Command:blockdata ~3 ~-1 ~ {auto:1,Command:/kill @e[score_TNTDisable_min=79]}},{id:MinecartCommandBlock,Command:blockdata ~4 ~-1 ~ {auto:1,Command:/execute @e[score_TNTDisable_min=79] ~ ~ ~ /particle largeexplode ~ ~ ~ 1 1 1 0.6 5}},{id:MinecartCommandBlock,Command:blockdata ~5 ~-1 ~ {auto:1,Command:/execute @e[score_TNTDisable_min=79] ~ ~ ~ /particle largeexplode ~ ~ ~ 1 1 1 0.6 5}},{id:MinecartCommandBlock,Command:blockdata ~6 ~-1 ~ {auto:1,Command:/execute @e[score_TNTDisable_min=79] ~ ~ ~ /particle explode ~ ~ ~ 1 1 1 0.6 100}},{id:MinecartCommandBlock,Command:blockdata ~6 ~-2 ~ {auto:1,Command:"/execute @e[score_TNTDisable_min=79] ~ ~ ~ summon Creeper ~ ~ ~ {Fuse:0,CustomName:\\\"TNT\\\",NoGravity:1b,FallFlying:1b,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:1,Duration:200000,ShowParticles:0b}]}"}},{id:MinecartCommandBlock,Command:blockdata ~5 ~-2 ~ {auto:1,Command:/scoreboard players add @e[type=PrimedTnt] TNTDisable 1}},{id:MinecartCommandBlock,Command:blockdata ~4 ~-2 ~ {auto:1,Command:/gamerule mobGriefing false}},{id:MinecartCommandBlock,Command:blockdata ~3 ~-2 ~ {auto:1,Command:/scoreboard objectives add TNTDisable dummy}},{id:MinecartCommandBlock,Command:setblock ~ ~ ~1 command_block 0 0 {Command:fill ~ ~-3 ~-1 ~ ~ ~ air}},{id:MinecartCommandBlock,Command:setblock ~ ~-1 ~1 redstone_block},{id:MinecartCommandBlock,Command:kill @e[type=MinecartCommandBlock,r=1]}]}]}]}

There is a gamerule named
Quote: commandBlockOutput



It will need to be set to false to prevent the command blocks from spamming your chatbox.

Hope this helps!

Users browsing this thread: 4 Guest(s)