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!

RE: How to disable TNT explosions on your MC Server.

29-08-2018, 08:15 PM
#2
Do these work on bukkit/spigots, I assume it's one of those 1 command block creation stuff

RE: How to disable TNT explosions on your MC Server.

OP
30-08-2018, 01:36 AM
#3
29-08-2018, 08:15 PM
ZalmonDudeDude Wrote:
Do these work on bukkit/spigots, I assume it's one of those 1 command block creation stuff

It should work on them but its untested. I have this running on my vanilla server. It is a 1 commands block thing though.

RE: How to disable TNT explosions on your MC Server.

__kubisek__
Newbie
Level:
0
Reputation:
0
Posts:
14
Likes:
0
Credits:
9
12-10-2018, 04:08 PM
#4
Try looking for some bukkit plugins on their site.

RE: How to disable TNT explosions on your MC Server.

JAN261202
Newbie
Level:
0
Reputation:
0
Posts:
17
Likes:
0
Credits:
12
12-10-2018, 06:44 PM
#5
You can install EssentialsX plugin and disable tnt destruction in config file.

RE: How to disable TNT explosions on your MC Server.

VannaKarenina
Junior Member
Level:
0
Reputation:
0
Posts:
83
Likes:
0
Credits:
6
13-10-2018, 12:57 PM
#6
It can be disabled either by plug-in or in the server settings

RE: How to disable TNT explosions on your MC Server.

Acerlamoiness
Novice
Level:
0
Reputation:
0
Posts:
29
Likes:
1
Credits:
0
15-10-2018, 03:18 PM
#7
Thank man .

RE: How to disable TNT explosions on your MC Server.

johnsmith2
Novice
Level:
0
Reputation:
0
Posts:
33
Likes:
0
Credits:
4
16-10-2018, 09:57 AM
#8
Nice to know ! thanks man but why so much code for that

RE: How to disable TNT explosions on your MC Server.

OpCemiyeti2
Novice
Level:
0
Reputation:
2
Posts:
30
Likes:
1
Credits:
0
26-10-2018, 11:48 PM
#9
You can correct this problem by changing the game rules. "/gamerule"

RE: How to disable TNT explosions on your MC Server.

29-10-2018, 08:51 PM
#10
Well if you are running bukkit or spigot you can go ahead and disable it using the useful plugin essentials in the config settings. Or you can just make a javascript that runs in the background of the server and removes all blocks matching the entity id of TNT.

Users browsing this thread: 1 Guest(s)