mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 00:31:51 +00:00
Fix X11 Error On Headless Servers With GUI Disabled (#573)
This commit is contained in:
@@ -112,7 +112,7 @@ public class GameEngine {
|
||||
public static Trawler trawler = new Trawler();
|
||||
private final static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
private final static Lock lock = new ReentrantLock();
|
||||
public static ControlPanel panel = new ControlPanel();
|
||||
public static ControlPanel panel;
|
||||
|
||||
static {
|
||||
shutdownServer = false;
|
||||
@@ -209,6 +209,8 @@ public class GameEngine {
|
||||
* Makes Visible Control Panel If Enabled
|
||||
*/
|
||||
if(GameConstants.GUI_ENABLED) {
|
||||
ControlPanel panel = new ControlPanel();
|
||||
panel.initComponents();
|
||||
panel.setVisible(true);
|
||||
System.out.println("Control Panel Enabled.");
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ import com.rs2.game.npcs.NpcHandler;
|
||||
import com.rs2.game.npcs.impl.Pets;
|
||||
import com.rs2.game.objects.ObjectsActions;
|
||||
import com.rs2.game.shops.ShopAssistant;
|
||||
import com.rs2.gui.ControlPanel;
|
||||
import com.rs2.net.Packet;
|
||||
import com.rs2.net.Packet.Type;
|
||||
import com.rs2.net.PacketSender;
|
||||
@@ -559,7 +560,8 @@ public abstract class Player {
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
GameEngine.panel.removeEntity(playerName);
|
||||
if(GameConstants.GUI_ENABLED)
|
||||
ControlPanel.removeEntity(playerName);
|
||||
if (getCannon().hasCannon()) {
|
||||
getCannon().removeObject(cannonX, cannonY);
|
||||
for(int i = 0; i < GameEngine.cannonsX.length; i++) {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ControlPanel extends JFrame {
|
||||
public JButton EMPTY_BANK;
|
||||
public JButton EMPTY_INVENTORY;
|
||||
public JList ENTITY_LIST;
|
||||
public DefaultListModel LIST_MODEL;
|
||||
public static DefaultListModel LIST_MODEL;
|
||||
public DefaultListModel LIST_NPCS;
|
||||
public JMenuItem EXIT_ITEM;
|
||||
public JMenu FILE_MENU;
|
||||
@@ -96,15 +96,14 @@ public class ControlPanel extends JFrame {
|
||||
public JScrollPane jScrollPane4;
|
||||
private PanelSettings settings = null;
|
||||
public ControlPanel() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public void addEntity(String name) {
|
||||
this.LIST_MODEL.addElement(name);
|
||||
public static void addEntity(String name) {
|
||||
LIST_MODEL.addElement(name);
|
||||
}
|
||||
|
||||
public void removeEntity(String name) {
|
||||
this.LIST_MODEL.removeElement(name);
|
||||
public static void removeEntity(String name) {
|
||||
LIST_MODEL.removeElement(name);
|
||||
}
|
||||
|
||||
public PanelSettings settings() {
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.rs2.game.items.impl.LightSources;
|
||||
import com.rs2.game.players.Client;
|
||||
import com.rs2.game.players.Player;
|
||||
import com.rs2.game.players.PlayerHandler;
|
||||
import com.rs2.gui.ControlPanel;
|
||||
import com.rs2.util.Misc;
|
||||
import com.rs2.world.Boundary;
|
||||
import com.rs2.world.clip.Region;
|
||||
@@ -73,7 +74,9 @@ public class PacketSender {
|
||||
}
|
||||
|
||||
public PacketSender loginPlayer() {
|
||||
GameEngine.panel.addEntity(player.playerName);
|
||||
if (GameConstants.GUI_ENABLED) {
|
||||
ControlPanel.addEntity(player.playerName);
|
||||
}
|
||||
player.getPlayerAssistant().loginScreen();
|
||||
if (Connection.isNamedBanned(player.playerName)) {
|
||||
player.logout();
|
||||
|
||||
Reference in New Issue
Block a user