forked from 2009Scape/Server
Make shutdown work properly + add TICK modifier
This commit is contained in:
parent
7cd02df358
commit
4ef73827cf
24 changed files with 21 additions and 18 deletions
|
|
@ -4,6 +4,7 @@ import org.runite.Configurations;
|
|||
import org.runite.GameLaunch;
|
||||
import org.runite.GameSetting;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.applet.Applet;
|
||||
import java.applet.AppletContext;
|
||||
import java.awt.*;
|
||||
|
|
@ -244,7 +245,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
|
|||
if(!this.aBoolean1) {
|
||||
this.aBoolean1 = true;
|
||||
System.out.println("error_game_" + var1);
|
||||
|
||||
JOptionPane.showMessageDialog(frame, "Error: " + var1 + (var1.contains("js5connect") ? ". The game is likely down." : "") + "\nCheck Discord (Red Bracket#8151) or Github (https://github.com/dginovker/RS-2009/releases) for a potential solution.");
|
||||
try {
|
||||
if(var2 != -48) {
|
||||
aClass94_4 = (RSString)null;
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -22,6 +22,11 @@ import java.util.Scanner;
|
|||
*/
|
||||
public final class Management {
|
||||
|
||||
/**
|
||||
* If the shutdown hook is active.
|
||||
*/
|
||||
public static boolean active = true;
|
||||
|
||||
/**
|
||||
* The commands.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.keldagrim.classloader;
|
||||
|
||||
import org.keldagrim.Management;
|
||||
import org.keldagrim.ServerConstants;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -52,7 +53,7 @@ public class ClassLoadServer extends Thread {
|
|||
public void run() {
|
||||
resetResourceCache();
|
||||
// System.out.println("Listening on port " + PORT + "...");
|
||||
while (true) {
|
||||
while (Management.active) {
|
||||
Socket clientSocket = null;
|
||||
try {
|
||||
clientSocket = serverSocket.accept();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package org.keldagrim.net;
|
||||
|
||||
import org.keldagrim.Management;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.channels.SelectionKey;
|
||||
|
|
@ -86,7 +88,7 @@ public final class NioReactor implements Runnable {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
while (running) {
|
||||
while (running && Management.active) {
|
||||
try {
|
||||
selector.select();
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package org.keldagrim.system;
|
||||
|
||||
|
||||
import org.keldagrim.Management;
|
||||
|
||||
/**
|
||||
* The shutdown sequence used for safely turning off the Management server.
|
||||
* @author Emperor
|
||||
|
|
@ -8,14 +10,9 @@ package org.keldagrim.system;
|
|||
*/
|
||||
public final class ShutdownSequence extends Thread {
|
||||
|
||||
/**
|
||||
* If the shutdown hook is active.
|
||||
*/
|
||||
private static boolean active = true;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (active) {
|
||||
if (Management.active) {
|
||||
shutdown();
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +22,6 @@ public final class ShutdownSequence extends Thread {
|
|||
*/
|
||||
public static void shutdown() {
|
||||
System.out.println("Management server successfully shut down!");
|
||||
active = false;
|
||||
System.exit(0);
|
||||
Management.active = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,6 @@ public final class SystemTermination {
|
|||
}
|
||||
}
|
||||
SystemLogger.log("[SystemTerminator] Server successfully terminated!");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -79,8 +79,9 @@ public final class MajorUpdateWorker implements Runnable {
|
|||
*/
|
||||
private void sleep() throws InterruptedException {
|
||||
// How many ticks off we are
|
||||
final int TICK_SPEED = (int) (600 / 1); //Allows you to make server ticks faster than normal
|
||||
StatisticsTab.reportPerformance((int) (System.currentTimeMillis() - start));
|
||||
long duration = 600 - ((System.currentTimeMillis() - start) % 600);
|
||||
long duration = TICK_SPEED - ((System.currentTimeMillis() - start) % TICK_SPEED);
|
||||
if (duration > 0) {
|
||||
Thread.sleep(duration);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ public class TutorialCompletionDialogue extends DialoguePlugin {
|
|||
stage++;
|
||||
break;
|
||||
case 531:
|
||||
npc("A standard Ironman does not receieve items or", "assistance from other players. They cannot trade, stake,", "receieve PK loot, scavenge dropped items, nor player", "certain minigames.");
|
||||
npc("A standard Ironman does not receive items or", "assistance from other players. They cannot trade, stake,", "receieve PK loot, scavenge dropped items, nor player", "certain minigames.");
|
||||
stage++;
|
||||
break;
|
||||
case 532:
|
||||
|
|
@ -216,9 +216,7 @@ public class TutorialCompletionDialogue extends DialoguePlugin {
|
|||
break;
|
||||
case 1200:
|
||||
npc("Keep in mind: our server has more content than any other", "server ever released. There's hundreds of hours of", "exciting and flawless gameplay awaiting you, "+player.getUsername()+".", "Enjoy your time playing "+GameWorld.getName()+"!");
|
||||
stage = 520;
|
||||
break;
|
||||
case 520:
|
||||
stage = 7; //HOW DO WE CLOSE THIS DIALOGUE
|
||||
player.removeAttribute("tut-island");
|
||||
player.getConfigManager().set(1021, 0);
|
||||
player.getProperties().setTeleportLocation(new Location(3233, 3230));
|
||||
|
|
@ -233,7 +231,6 @@ public class TutorialCompletionDialogue extends DialoguePlugin {
|
|||
player.getBank().add(new Item(121, 15), new Item(115, 15), new Item(133, 15), new Item(373, 50), new Item(2289, 25), new Item(7056, 25));
|
||||
player.unlock();
|
||||
TutorialSession.getExtension(player).setStage(TutorialSession.MAX_STAGE + 1);
|
||||
stage = 7;
|
||||
if (player.getIronmanManager().isIronman() && player.getSettings().isAcceptAid()) {
|
||||
player.getSettings().toggleAcceptAid();
|
||||
}
|
||||
|
|
@ -248,6 +245,7 @@ public class TutorialCompletionDialogue extends DialoguePlugin {
|
|||
player.removeAttribute("tut-island:hi_slot");
|
||||
HintIconManager.removeHintIcon(player, slot);
|
||||
HintIconManager.registerHintIcon(player, Repository.findNPC(Location.create(3168, 3481, 0)));
|
||||
end();
|
||||
break;
|
||||
case 7:
|
||||
end();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue