forked from GeyserMC/Geyser
Only allow console to shut down Geyser with a command
This commit is contained in:
parent
c290e7a7fd
commit
1670c77672
4 changed files with 15 additions and 0 deletions
|
@ -108,4 +108,9 @@ public class GeyserLogger extends SimpleTerminalConsole implements IGeyserLogger
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
info(message);
|
info(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isConsole() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,6 @@ public interface CommandSender {
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendMessage(String message);
|
void sendMessage(String message);
|
||||||
|
|
||||||
|
boolean isConsole();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,9 @@ public class StopCommand extends GeyserCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if (!sender.isConsole())
|
||||||
|
return;
|
||||||
|
|
||||||
connector.shutdown();
|
connector.shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,6 +324,11 @@ public class GeyserSession implements CommandSender {
|
||||||
upstream.sendPacket(textPacket);
|
upstream.sendPacket(textPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isConsole() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void sendForm(FormWindow window, int id) {
|
public void sendForm(FormWindow window, int id) {
|
||||||
windowCache.showWindow(window, id);
|
windowCache.showWindow(window, id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue