Jump to content
  • 0
Sign in to follow this  
Divine-X

RS2HD, GUI Doesn't launch

Question

I don't know what's wrong, my GUI is fine, I know I've set up the launch code correctly, but it's just not running when I run the server.

[code]package com.rs2hd;

import com.rs2hd.model.Player;
import com.rs2hd.model.World;

/**
*
* [MENTION=52317]auth[/MENTION]or Divine-X
*
*/ [MENTION=19271]supp[/MENTION]ressWarnings("serial")
public class DivineFramework extends javax.swing.JFrame
{

/**
* Class Constructor
*/
public DivineFramework()
{
initComponents();
setSize(450, 300);
setResizable(false);
}

private void initComponents()
{
jTabbedPane = new javax.swing.JTabbedPane(1);
contentPane = new javax.swing.JLayeredPane();
sendMessageButton = new javax.swing.JButton();
announceMentJTF = new javax.swing.JTextField();
messageJTF = new javax.swing.JTextField();

setDefaultCloseOperation(EXIT_ON_CLOSE);
setTitle("Divine Framework");

this.contentPane = new javax.swing.JLayeredPane();
this.contentPane.setBorder(new javax.swing.border.EmptyBorder(5, 5, 5, 5));
setContentPane(this.contentPane);

jPanel1 = new javax.swing.JPanel();
jPanel1.setBounds(0, 0, 450, 300);
this.contentPane.add(jPanel1);

jPanel1.setLayout(new java.awt.BorderLayout(0, 0));
jPanel1.add(jTabbedPane);

jPanel1 = new javax.swing.JPanel();
jTabbedPane.addTab("Main", null, jPanel1, null);
jPanel1.add(sendMessageButton);
jPanel1.add(announceMentJTF);
jPanel1.add(messageJTF);
jPanel1.setLayout(null);

/**
* Text field
*/
announceMentJTF.setText("[Announcement]");
announceMentJTF.setFont(new java.awt.Font("Rockwell", 1, 12));
announceMentJTF.setBounds(65, 10, 300, 25);

messageJTF.setText("Message");
messageJTF.setFont(new java.awt.Font("Rockwell", 1, 12));
messageJTF.setBounds(65, 40, 300, 25);

/**
* Button Handling
*/
sendMessageButton.setText("Send Message");
sendMessageButton.setBounds(145, 70, 130, 25);
sendMessageButton.setFont(new java.awt.Font("Rockwell", 1, 12));
sendMessageButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
sendMessageButtonActionPerformed(evt);
}
});

}

/**
* Button Effects
* [MENTION=75098]Para[/MENTION]m evt
*/
protected void sendMessageButtonActionPerformed(java.awt.event.ActionEvent evt)
{
String preText = announceMentJTF.getText();
String yellText = messageJTF.getText();
for (Player p : World.getInstance().getPlayerList()) {
p.getActionSender().sendMessage((new StringBuilder()).append(preText).append(": ").append(yellText).toString());
}
}

/**
* [MENTION=75098]Para[/MENTION]m args the command line arguments
*/
public static void main(String args[])
{
try
{
javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch(Throwable e)
{
e.printStackTrace();
}
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
new DivineFramework().setVisible(true);
}
});
}


//Declared variables do not modify
private javax.swing.JTabbedPane jTabbedPane;
private javax.swing.JLayeredPane contentPane;
private javax.swing.JButton sendMessageButton;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField messageJTF;
private javax.swing.JTextField announceMentJTF;
//End of variable declarations

}][/code]

[code]package com.rs2hd;

import java.io.File;
[COLOR="#FF0000"]import com.rs2hd.DivineFramework;[/COLOR]
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.rs2hd.content.LoadPrices;
import com.rs2hd.content.ShopHandler;
import com.rs2hd.content.Shops;
import com.rs2hd.content.minigames.BHWorld;
import com.rs2hd.content.skills.combat.NpcVsPlayer;
import com.rs2hd.content.skills.fishing.FishSpotLive;
import com.rs2hd.content.skills.mining.RockLive;
import com.rs2hd.content.skills.prayer.Prayer;
import com.rs2hd.content.skills.summoning.Summon;
import com.rs2hd.content.skills.thief.StallLive;
import com.rs2hd.content.skills.woodcutting.TreeLive;
import com.rs2hd.content.ClanChat.ClanMain;
import com.rs2hd.content.ClanChat.SaveChats;
//import com.rs2hd.content.grandexchange.*;
import com.rs2hd.content.LoadEquips;
import com.rs2hd.io.MapDataLoader;
import com.rs2hd.io.MapDataPacker;
import com.rs2hd.io.XStreamPlayerLoader;
import com.rs2hd.model.ItemDefinition;
import com.rs2hd.model.NPCDefinition;
import com.rs2hd.model.World;
import com.rs2hd.model.clipInfo;
import com.rs2hd.model.NoclipHandler;
import com.rs2hd.packethandler.PacketHandlers;
import com.rs2hd.util.BanUser;
import com.rs2hd.util.Censor;
import com.rs2hd.util.MuteUser;
import com.rs2hd.util.AddTile;
import com.rs2hd.util.Scripts;
import com.rs2hd.content.*;
import com.rs2hd.model.NPC;
import com.rs2hd.util.PathFinder.*;
import com.rs2hd.util.pathfinding.*;
import com.rs2hd.util.log.Logger;
import com.rs2hd.util.WorldList;
import com.rs2hd.util.AutoSaveEvent;
import com.rs2hd.tools.*;
/**
* A varek has called it before, the 'central motor' of the game.
*
* That means it handles periodic updating and packet handling/creation.
*
* [MENTION=52317]auth[/MENTION]or Graham
*
*/
public class GameEngine {
public static ClanMain ClanMain = new ClanMain();
private static SaveChats save;
public static boolean DarkCoreOn = false;
/**
* Logger instance.
*/
private Logger logger = Logger.getInstance();

/**
* Running flag.
*/
private boolean isRunning;
/**
* Poison
*/
public static Poison poison = new Poison();
/**
* This makes you wish that Java supported typedefs.
*/
private Map<Integer, int[]> mapData;

/**
* Our worker thread.
*/
private WorkerThread workerThread;

/**
* Handles player some classes by Dragonkk
*/
public static LoadEquips equip = new LoadEquips();
public static FishSpotLive FishSpotLive = new FishSpotLive(); //rocks
public static StallLive StallLive = new StallLive(); //stalls
public static RockLive RockLive = new RockLive(); //rocks
public static TreeLive TreeLive = new TreeLive(); //trees
public static MuteUser mute = new MuteUser(); //loads muted users
public static AddTile AddTile = new AddTile(); //loads muted users
public static BanUser ban = new BanUser(); //loads banned users
public static Censor Censor = new Censor(); //load bad words
public static LoadPrices prices = new LoadPrices(); //prices
public static Shops shops = new Shops(); //load shops stuff
public static ShopHandler shopHandler = new ShopHandler(); //shops configs
public static NpcVsPlayer nvp = new NpcVsPlayer(); //nvp
public static Prayer prayer = new Prayer(); //pray not needed to be here
public static Summon summon = new Summon(); //not needed soon wil remove
public static BHWorld BH = new BHWorld(); //bh
//public static clipInfo clipInfo = new clipInfo(); //bh
public static NoclipHandler clipInfo = new NoclipHandler(); //bh
/**
* Thread group.
*/
public ThreadGroup threads = new ThreadGroup("Project Skux");

/**
* Creates other things vital to the game logic, like the world class.
* @throws Exception
*/
public GameEngine() throws Exception {
/*
* We are running.
*/
isRunning = true;
/*
* Check if mapdata packed file exists, if not, then we pack it.
*/
File packedFile = new File("data/mapdata/packed.dat");
if(!packedFile.exists()) {
MapDataPacker.pack("data/mapdata/unpacked/", "data/mapdata/packed.dat");
}
packedFile = new File("data/clip/packed.dat");
//ItemXmlToBinary.main(null);
/*
* Actually load the mapdata.
*/
mapData = new HashMap<Integer, int[]>();
MapDataLoader.load(mapData);
/*
* Load handlers.
*/
PacketHandlers.loadHandlers();
/*
* Load item definitions.
*/
logger.info("Loading item definitions...");
ItemDefinition.load();
logger.info("Loading npc definitions...");
NPCDefinition.load();
setSave(new SaveChats());
setSave(null);
logger.info("Setting up world...");
World.getInstance().setEngine(this);
logger.info("Loading world list data...");
WorldList worldList = new WorldList();
worldList.load();
//GUI Start
[COLOR="#FF0000"] logger.info("Launching GUI...");
initComponents = new DivineFramework();[/COLOR]
//GUI End
logger.info("Launching worker thread...");
workerThread = new WorkerThread(new XStreamPlayerLoader());
newThread("WorkerThread", workerThread);
Scripts.init();
}
public void newThread(String name, Runnable r) {
try {
new Thread(threads, r, name).start();
} catch(Exception e) {
}
}

[COLOR="#FF0000"]public static DivineFramework initComponents = null;[/COLOR]


/**
* Handle a major update.
*/
public void majorUpdate() {
try {
World.getInstance().majorUpdate();
} catch(Exception e) {
}
}

/**
* Handle a minor update.
*/
public void minorUpdate() {
try {
//mn.Restarter();
//World.getInstance().minorUpdate();
} catch(Exception e) {
}
}
/**
* Called every tick.
*/
public void tick() {
try {

World.getInstance().tick();
} catch(Exception e) {
}
}

/**
* Gets the is running flag.
* @return
*/
public boolean isRunning() {
return isRunning;
}

/**
* Sets the is running flag.
* [MENTION=75098]Para[/MENTION]m isRunning
*/
public void setIsRunning(boolean isRunning) {
try {
this.isRunning = isRunning;
} catch(Exception e) {
}
}

/**
* Gets the worker thread.
* @return
*/
public WorkerThread getWorkerThread() {
return workerThread;
}

/**
* Stops threads, saves games, etc.
*/
public void cleanup() {
try {
threads.interrupt();
} catch(Exception e) {
}
}

public int[] getMapData(int region) {
return mapData.get(region);
}
public static void setSave(SaveChats save) {
GameEngine.save = save;
}

public static SaveChats getSave() {
return save;
}

}
[/code]

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
lol maybe if you actually set it to visible it would work :)

Share this post


Link to post
Share on other sites
  • 0
[quote name='Steve']lol maybe if you actually set it to visible it would work :)[/QUOTE]

Oh yeah! Lmfao, thanks! XD

I went to sleep on this and woke up remembering but I couldn't remember it fully! Like it was on the tip of tongue :P. Well thanks Steve!

Share this post


Link to post
Share on other sites
Sign in to follow this  

×