mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 13:06:02 +01:00
Commands can be sent from the console (WIP, needs improvements)
This commit is contained in:
parent
657913faeb
commit
21b8c16886
@ -15,6 +15,7 @@ import java.util.logging.Logger;
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
|||||||
}
|
}
|
||||||
public CraftServer server;
|
public CraftServer server;
|
||||||
public OptionSet options;
|
public OptionSet options;
|
||||||
|
public ConsoleCommandSender console = new ConsoleCommandSender();
|
||||||
|
|
||||||
private boolean d() throws UnknownHostException {
|
private boolean d() throws UnknownHostException {
|
||||||
// CraftBukkit end -- added throws UnknownHostException
|
// CraftBukkit end -- added throws UnknownHostException
|
||||||
@ -299,6 +301,12 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
|||||||
ICommandListener icommandlistener = servercommand.b;
|
ICommandListener icommandlistener = servercommand.b;
|
||||||
String s1 = icommandlistener.c();
|
String s1 = icommandlistener.c();
|
||||||
|
|
||||||
|
// Craftbukkit start
|
||||||
|
if (server.dispatchCommand(console, s)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Craftbukkit end
|
||||||
|
|
||||||
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
|
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
|
||||||
if (s.toLowerCase().startsWith("list")) {
|
if (s.toLowerCase().startsWith("list")) {
|
||||||
icommandlistener.b("Connected players: " + this.f.c());
|
icommandlistener.b("Connected players: " + this.f.c());
|
||||||
|
@ -581,7 +581,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
private void c(String s) {
|
private void c(String s) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftPlayer player = getPlayer();
|
CraftPlayer player = getPlayer();
|
||||||
boolean targetPluginFound = server.dispatchCommand(player, s);
|
boolean targetPluginFound = server.dispatchCommand(player, s.substring(1));
|
||||||
if (targetPluginFound) {
|
if (targetPluginFound) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user