I just made a vanilla Minecraft 1.10.2 server and I want the server to send a personalized message every 30 minutes and if possible also clear all dropped items. Thank you.
-
I dont really know what to try– Cobalt05Commented Nov 7, 2016 at 22:07
-
6Well, in general, you'll get better a better response if you show some effort on your part rather than simply asking for someone to do it for you, from what I've seen.– VemonusCommented Nov 7, 2016 at 22:09
-
I tried doing the help command but they didn't give me any info– Cobalt05Commented Nov 7, 2016 at 22:10
-
1vanilla using the minecraft website– Cobalt05Commented Nov 9, 2016 at 1:37
-
1also its 1.10.2– Cobalt05Commented Nov 9, 2016 at 1:37
2 Answers
First, make an objective:
/scoreboard objectives add time dummy
Then, on an always active repeat command block, have the following command:
/scoreboard players add Timer time 1
On a chain command block coming out of it:
/scoreboard players test Timer time 36000
The 36000 is the result of 20 (ticks) * 60 (seconds) * 30 (minutes)
Next, have a conditional chain command block running out of that command block:
/tellraw @a {"text":"whatever you want"}
And another conditional chain for the item clear:
/kill @e[type=Item]
Lastly, the time score must be reset with a conditional chain command block:
/scoreboard players reset Timer time
I wrote a script that does exactly this as one of its functions.
https://github.com/Veritas83/Minecraft.SNAPSHOT.Commands.Mod
Here is the relevant code I used to do what you're asking. You can disable all functions of the script and just use this function in the config :)
In config, make sure useautoclear
is True
For 30min timer set, autoclearint
to 1800.
Adjust the rest of the config to your needs. Setting your own MOTD and command line to start your server.
##
#Timed Functions
##
if useautosave == True and ((currtime - lasttimesave) > autosaveint):
lasttimesave = time.time()
autosave = "save-all\n"
print "[" + get24hrtime() + "] [Script thread/EXEC]: " + autosave,
p.stdin.write(autosave)
autosave = 'tellraw @a {"text":"World saved. Autosave by ' + ver + '","color":"yellow"}\n'
print "[" + get24hrtime() + "] [Script thread/EXEC]: " + autosave,
p.stdin.write(autosave)
if useautoclear == True and ((currtime - lasttimeclear) > (autoclearint-60)):
if clearwarn60 == False:
if ((currtime - lasttimeclear) > (autoclearint-60)):
autoclear = 'tellraw @a {"text":"Clearing Items in 1 minute!","color":"aqua"}\n'
clearwarn60 = True
print "[" + get24hrtime() + "] [Script thread/EXEC]: " + autoclear,
p.stdin.write(autoclear)
if clearwarn10 == False:
if ((currtime - lasttimeclear) > (autoclearint-10)):
autoclear = 'tellraw @a {"text":"Clearing items in 10 seconds!","color":"aqua"}\n'
clearwarn10 = True
print "[" + get24hrtime() + "] [Script thread/EXEC]: " + autoclear,
p.stdin.write(autoclear)
if useautoclear == True and ((currtime - lasttimeclear) > autoclearint):
lasttimeclear = time.time()
autoclear = "kill @e[type=Item]\n"
print "[" + get24hrtime() + "] [Script thread/EXEC]: " + autoclear,
p.stdin.write(autoclear)
autoclear = 'tellraw @a {"text":"Items cleared. Autoclear by ' + ver + '","color":"aqua"}\nlist\n'
p.stdin.write(autoclear)
clearwarn60 = False
clearwarn10 = False