Skip to content

Commit e918f6a

Browse files
committed
/websandbox tp without user takes to web spawn
1 parent 9960a19 commit e918f6a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ If not given, WebSandboxMC's embedded version of NetCraft will be served up inst
8080

8181
* `/websandbox`: show help
8282
* `/websandbox list [verbose]`: list all web users connected
83-
* `/websandbox tp <user>`: teleport to given web username
83+
* `/websandbox tp [<user>]`: teleport to given web username, or web spawn location
8484
* `/websandbox kick <user>`: disconnect given web username
8585

8686
## Compatibility

src/main/java/io/github/satoshinm/WebSandboxMC/bukkit/WsCommand.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
5151
return true;
5252
} else if (subcommand.equals("tp")) {
5353
if (split.length < 2) {
54-
sender.sendMessage("Usage: /websandbox tp <user>");
54+
Location spawnLocation = webSocketServerThread.blockBridge.spawnLocation;
55+
if (sender instanceof Player) {
56+
Player player = (Player) sender;
57+
player.sendMessage("Taking you to web spawn location, " + spawnLocation);
58+
player.teleport(spawnLocation);
59+
} else {
60+
sender.sendMessage("Web spawn location is "+spawnLocation);
61+
}
5562
return true;
5663
}
5764
String name = split[1];
@@ -99,7 +106,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
99106
return true;
100107
} else { // help
101108
sender.sendMessage("/websandbox list [verbose] -- list all web users connected");
102-
sender.sendMessage("/websandbox tp <user> -- teleport to given web username");
109+
sender.sendMessage("/websandbox tp [<user>] -- teleport to given web username, or web spawn location");
103110
sender.sendMessage("/websandbox kick <user> -- disconnect given web username");
104111
// TODO: reload, reconfig commands
105112
}

0 commit comments

Comments
 (0)