5

Is there any way to run a command automatically when a player joins the server? I need to do this without the use of a Bukkit plugin. I think it's possible with MCP but I want to know how!

  • 1
    Place a pressure plate on the spawn point? – Ben Dec 21 '14 at 14:59
  • @Ben If he doesn't use Bukkit then there is no on-join point. The spawn point is used only if the player dies. – Andrew Dec 21 '14 at 19:04
5

First, create a scoreboard objective of type "stat.leaveGame":

/scoreboard objectives add quits stat.leaveGame

Next, make any kind of clock and attach two command blocks to it:

enter image description here

In the block that is activated first, put this command:

/execute @a[score_quits_min=1] ~ ~ ~ <COMMAND TO RUN>

And in the block that is activated second, put this command:

/scoreboard players set @a[score_quits_min=1] quits 0

The command you put in the place of <COMMAND TO RUN> will now run every time a player rejoins the game.

1

the previous answer is good if you want it to give players the item every time they join... (i see an exploit if its a good item)

If you only wnat it to give the item the first time they join try:

-in chat:

/scoreboard objectives add joined dummy

-in Command blocks on a fill clock:

/scoreboard players add @a joined 0

.

/execute @a[score_joined=0] ~ ~ ~ [command you want to run]

in a command block powered by a comparator signal from the execute command

/scoreboard players set @a[score_joined=0] joined 1

this will do it the first time they join only

  • Or you can do this as an .mcfunction – Manchineel Oct 5 '17 at 17:17
-4

If you want to make it run a command when YOU join, use liteloader and the mod called macros mod, found at LiteLoader Website
Unfortunately i do not think there is a way to do this without bukkit (if you want the command to be run whenever ANYONE joins

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.