Only allow console to shut down Geyser with a command

This commit is contained in:
RednedEpic 2020-03-04 20:44:42 -06:00
parent c290e7a7fd
commit 1670c77672
4 changed files with 15 additions and 0 deletions

View file

@ -108,4 +108,9 @@ public class GeyserLogger extends SimpleTerminalConsole implements IGeyserLogger
public void sendMessage(String message) {
info(message);
}
@Override
public boolean isConsole() {
return true;
}
}

View file

@ -11,4 +11,6 @@ public interface CommandSender {
}
void sendMessage(String message);
boolean isConsole();
}

View file

@ -44,6 +44,9 @@ public class StopCommand extends GeyserCommand {
@Override
public void execute(CommandSender sender, String[] args) {
if (!sender.isConsole())
return;
connector.shutdown();
}
}

View file

@ -324,6 +324,11 @@ public class GeyserSession implements CommandSender {
upstream.sendPacket(textPacket);
}
@Override
public boolean isConsole() {
return false;
}
public void sendForm(FormWindow window, int id) {
windowCache.showWindow(window, id);
}