diff --git a/.gitignore b/.gitignore index 13b1daee..ac7c0d2e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ 2006Scape Client/bin/ *.prefs *.classpath + +# Ignore any json files in the server root (should only be config files, the sample file should still be updated) +2006Scape Server/*.json diff --git a/2006Scape Server/ServerConfig.Sample.json b/2006Scape Server/ServerConfig.Sample.json new file mode 100644 index 00000000..019ddbb7 --- /dev/null +++ b/2006Scape Server/ServerConfig.Sample.json @@ -0,0 +1,20 @@ +{ + "server_name": "2006Scape", + "website_link": "https://2006Scape.org", + "server_debug": false, + "file_server": true, + "world_id": 1, + "members_only": false, + "tutorial_island_enabled": false, + "party_room_enabled": true, + "clues_enabled": true, + "admin_can_trade": false, + "admin_can_sell": false, + "respawn_x": 3222, + "respawn_y": 3218, + "save_timer": 120, + "timeout": 60, + "item_requirements": true, + "xp_rate": 1.0, + "max_players": 200 +} \ No newline at end of file diff --git a/2006Scape file_server/cache/.scape-settings.dat b/2006Scape Server/data/cache/.scape-settings.dat similarity index 100% rename from 2006Scape file_server/cache/.scape-settings.dat rename to 2006Scape Server/data/cache/.scape-settings.dat diff --git a/2006Scape file_server/cache/main_file_cache.dat b/2006Scape Server/data/cache/main_file_cache.dat similarity index 100% rename from 2006Scape file_server/cache/main_file_cache.dat rename to 2006Scape Server/data/cache/main_file_cache.dat diff --git a/2006Scape file_server/cache/main_file_cache.idx0 b/2006Scape Server/data/cache/main_file_cache.idx0 similarity index 100% rename from 2006Scape file_server/cache/main_file_cache.idx0 rename to 2006Scape Server/data/cache/main_file_cache.idx0 diff --git a/2006Scape file_server/cache/main_file_cache.idx1 b/2006Scape Server/data/cache/main_file_cache.idx1 similarity index 100% rename from 2006Scape file_server/cache/main_file_cache.idx1 rename to 2006Scape Server/data/cache/main_file_cache.idx1 diff --git a/2006Scape file_server/cache/main_file_cache.idx2 b/2006Scape Server/data/cache/main_file_cache.idx2 similarity index 100% rename from 2006Scape file_server/cache/main_file_cache.idx2 rename to 2006Scape Server/data/cache/main_file_cache.idx2 diff --git a/2006Scape file_server/cache/main_file_cache.idx3 b/2006Scape Server/data/cache/main_file_cache.idx3 similarity index 100% rename from 2006Scape file_server/cache/main_file_cache.idx3 rename to 2006Scape Server/data/cache/main_file_cache.idx3 diff --git a/2006Scape file_server/cache/main_file_cache.idx4 b/2006Scape Server/data/cache/main_file_cache.idx4 similarity index 100% rename from 2006Scape file_server/cache/main_file_cache.idx4 rename to 2006Scape Server/data/cache/main_file_cache.idx4 diff --git a/2006Scape Server/pom.xml b/2006Scape Server/pom.xml index 4268c345..a68b0c01 100644 --- a/2006Scape Server/pom.xml +++ b/2006Scape Server/pom.xml @@ -160,6 +160,12 @@ google-collections 1.0 + + io.netty + netty + 3.6.6.Final + compile + diff --git a/2006Scape Server/src/main/java/com/rs2/ConfigLoader.java b/2006Scape Server/src/main/java/com/rs2/ConfigLoader.java new file mode 100644 index 00000000..c3248f90 --- /dev/null +++ b/2006Scape Server/src/main/java/com/rs2/ConfigLoader.java @@ -0,0 +1,97 @@ +package com.rs2; + +import com.rs2.integrations.PlayersOnlineWebsite; +import com.rs2.integrations.RegisteredAccsWebsite; +import com.rs2.integrations.discord.JavaCord; +import org.json.JSONObject; + +import java.io.*; +import java.util.stream.Collectors; + +public class ConfigLoader { + + public static void loadSettings(String config) throws IOException { + BufferedReader br = new BufferedReader(new FileReader(config)); + String out = br.lines().collect(Collectors.joining("\n")); + JSONObject obj = new JSONObject(out); + + if(obj.has("server_name")) + GameConstants.SERVER_NAME = obj.getString("server_name"); + if(obj.has("website_link")) + GameConstants.WEBSITE_LINK = obj.getString("website_link"); + if(obj.has("debug")) + GameConstants.SERVER_DEBUG = obj.getBoolean("debug"); + if(obj.has("file_server")) + GameConstants.FILE_SERVER = obj.getBoolean("file_server"); + if(obj.has("world_id")) + GameConstants.WORLD = obj.getInt("world_id"); + if(obj.has("members_only")) + GameConstants.MEMBERS_ONLY = obj.getBoolean("members_only"); + if(obj.has("tutorial_island_enabled")) + GameConstants.TUTORIAL_ISLAND = obj.getBoolean("tutorial_island_enabled"); + if(obj.has("party_room_enabled")) + GameConstants.PARTY_ROOM_DISABLED = !obj.getBoolean("party_room_enabled"); + if(obj.has("clues_enabled")) + GameConstants.CLUES_ENABLED = obj.getBoolean("clues_enabled"); + if(obj.has("admin_can_trade")) + GameConstants.ADMIN_CAN_TRADE = obj.getBoolean("admin_can_trade"); + if(obj.has("admin_can_drop_items")) + GameConstants.ADMIN_DROP_ITEMS = obj.getBoolean("admin_can_drop_items"); + if(obj.has("admin_can_sell")) + GameConstants.ADMIN_CAN_SELL_ITEMS = obj.getBoolean("admin_can_sell"); + if(obj.has("respawn_x")) + GameConstants.RESPAWN_X = obj.getInt("respawn_x"); + if(obj.has("respawn_y")) + GameConstants.RESPAWN_Y = obj.getInt("respawn_y"); + if(obj.has("save_timer")) + GameConstants.SAVE_TIMER = obj.getInt("save_timer"); + if(obj.has("timeout")) + GameConstants.TIMEOUT = obj.getInt("timeout"); + if(obj.has("item_requirements")) + GameConstants.ITEM_REQUIREMENTS = obj.getBoolean("item_requirements"); + if(obj.has("xp_rate")) + GameConstants.XP_RATE = obj.getDouble("xp_rate"); + if(obj.has("max_players")) + GameConstants.MAX_PLAYERS = obj.getInt("max_players"); + } + + private static void initialize() { + JSONObject main = new JSONObject(); + main + .put("bot-token", "") + .put("websitepass", "") + .put("erssecret", ""); + try { + BufferedWriter br = new BufferedWriter(new FileWriter("data/secrets.json")); + br.write(main.toString()); + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void loadSecrets() throws IOException { + if (!new File("data/Secrets.json").exists()) { + initialize(); + System.out.println("Please open \"data/secrets.json\" file and enter your discord token bot there!"); + System.out.println("Please open \"data/secrets.json\" file and enter your Website Password there!"); + + } else { + BufferedReader br = new BufferedReader(new FileReader("data/secrets.json")); + String out = br.lines().collect(Collectors.joining("\n")); + JSONObject obj = new JSONObject(out); + + /* + * Sets External Services Vars + */ + if(obj.has("bot-token")) + JavaCord.token = obj.getString("bot-token"); + if(obj.has("websitepass")) + PlayersOnlineWebsite.password = obj.getString("websitepass"); + RegisteredAccsWebsite.password = obj.getString("websitepass"); + if(obj.has("erssecret")) + GameEngine.ersSecret = obj.getString("erssecret"); + + } + } +} diff --git a/2006Scape Server/src/main/java/com/rs2/GameConstants.java b/2006Scape Server/src/main/java/com/rs2/GameConstants.java index 5c749c97..bf79476d 100644 --- a/2006Scape Server/src/main/java/com/rs2/GameConstants.java +++ b/2006Scape Server/src/main/java/com/rs2/GameConstants.java @@ -2,43 +2,60 @@ package com.rs2; public class GameConstants { - public final static boolean SERVER_DEBUG = false; + /** + * The Variables Below Can Be Also Changed On Server Startup By Using The ConfigLoader + * + * SERVER_NAME Sets The Name The Server Will Use + * WEBSITE_LINK Defines The Server Website Links + * WORLD Sets The Servers World ID + * MAX_PLAYERS Sets The Maximum Amount Of Players Allow To Be Logged In At Once + * TIMEOUT Sets The Amount Of Time Before A Player Timeouts From A Bad Connection + * SAVE_TIMER Sets In Seconds How Often The Server Shouls Auto-Save All Characters + * RESPAWN_X Sets The X Coordinate That You Will Respawn At After Death + * RESPAWN_Y Sets The Y Coordinate That You Will Respawn At After Death + * FILE_SERVER Sets Whether The FileServer Should Run With The Server + * SERVER_DEBUG Sets Whether The Server Should Start In Debug Mode + * MEMBERS_ONLY Sets Whether The World Is Members Only + * TUTORIAL_ISLAND Sets Enables/Disables Tutorial Island For Players On First Login + * PARTY_ROOM_DISABLED Enables/Disables The Party Room Should Be Disabled + * CLUES_ENABLED Enables/Disables Clue Scrolls + * ITEM_REQUIREMENTS Enables/Disables Item Requirements for All Players + * ADMIN_CAN_TRADE Defines Whether Admins Can Trade + * ADMIN_DROP_ITEMS Defines Whether Admins Can Drop Items + * ADMIN_CAN_SELL_ITEMS Defines Whether Admins Can Sell Items + * XP_RATE Sets The XP Rate Multiplier For All Players/Skills + */ + public static String SERVER_NAME = "2006Scape", WEBSITE_LINK = "https://2006Scape.org"; + public static int WORLD = 1, MAX_PLAYERS = 200, TIMEOUT = 60, SAVE_TIMER = 120, + RESPAWN_X = 3222, RESPAWN_Y = 3218; + public static boolean FILE_SERVER = true, SERVER_DEBUG = false, MEMBERS_ONLY = false, TUTORIAL_ISLAND = false, + PARTY_ROOM_DISABLED = false, CLUES_ENABLED = true, ITEM_REQUIREMENTS = true, + ADMIN_CAN_TRADE = false, ADMIN_DROP_ITEMS = false, ADMIN_CAN_SELL_ITEMS = false; + public static double XP_RATE = 1; - public final static String SERVER_NAME = "2006Scape", SERVER_VERSION = "Server Stage v " + GameConstants.TEST_VERSION + "."; - - public final static String WEBSITE_LINK = "https://2006Scape.org"; + + /** + * The Variables Below Should Only Be Changed If You Understand What You Are Doing + */ + + public final static String SERVER_VERSION = "Server Stage v " + GameConstants.TEST_VERSION + "."; public final static boolean WEBSITE_TOTAL_CHARACTERS_INTEGRATION = false; public final static double TEST_VERSION = 2.3; public final static int ITEM_LIMIT = 15000, MAXITEM_AMOUNT = Integer.MAX_VALUE, CLIENT_VERSION = 999999, - WORLD = 1, IPS_ALLOWED = 250, CONNECTION_DELAY = 100, - MESSAGE_DELAY = 6000, MAX_PLAYERS = 200, REQ_AMOUNT = 150; + IPS_ALLOWED = 250, CONNECTION_DELAY = 100, + MESSAGE_DELAY = 6000, REQ_AMOUNT = 150; - public final static boolean SOUND = true, - GUILDS = true, - PARTY_ROOM_DISABLED = false, + public final static boolean sendServerPackets = false, SOUND = true, GUILDS = true, PRINT_OBJECT_ID = false, EXPERIMENTS = false; public static int[] SIDEBARS = { 2423, 3917, 638, 3213, 1644, 5608, 1151, 18128, 5065, 5715, 2449, 904, 147, 962 }; - - public static boolean TUTORIAL_ISLAND = false, - MEMBERS_ONLY = false, sendServerPackets = false, - CLUES_ENABLED = true; public final static int[] FUN_WEAPONS = { 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2471, 2473, 2474, 2475, 2476, 2477 }; // fun weapons for dueling - public static boolean ADMIN_CAN_TRADE = false; // can admins trade? - - public final static boolean ADMIN_DROP_ITEMS = false; - - public final static boolean ADMIN_CAN_SELL_ITEMS = false; - - public final static int RESPAWN_X = 3222; // when dead respawn here - - public final static int RESPAWN_Y = 3218; public final static int DUELING_RESPAWN_X = 3362; @@ -46,16 +63,10 @@ public class GameConstants { public final static int NO_TELEPORT_WILD_LEVEL = 20; - public final static boolean ITEM_REQUIREMENTS = true; - public final static int CASTLE_WARS_X = 2439; public final static int CASTLE_WARS_Y = 3087; - public static double XP_RATE = 1; - - public final static int SAVE_TIMER = 120; // save every x seconds - public final static int NPC_RANDOM_WALK_DISTANCE = 5; public final static int NPC_FOLLOW_DISTANCE = 10; @@ -69,8 +80,6 @@ public class GameConstants { "skorge", "tortured soul", "undead chicken", "undead cow", "undead one", "undead troll", "zombie", "zombie rat", "zogre" }; - public final static int TIMEOUT = 60; - public final static int CYCLE_TIME = 600; public final static int BUFFER_SIZE = 10000; diff --git a/2006Scape Server/src/main/java/com/rs2/GameEngine.java b/2006Scape Server/src/main/java/com/rs2/GameEngine.java index 21b3e1f2..8a2d4c0a 100644 --- a/2006Scape Server/src/main/java/com/rs2/GameEngine.java +++ b/2006Scape Server/src/main/java/com/rs2/GameEngine.java @@ -35,7 +35,6 @@ import com.rs2.game.players.PlayerSave; import com.rs2.game.shops.ShopHandler; import com.rs2.integrations.PlayersOnlineWebsite; import com.rs2.integrations.RegisteredAccsWebsite; -import com.rs2.integrations.SettingsLoader; import com.rs2.integrations.discord.DiscordActivity; import com.rs2.integrations.discord.JavaCord; import com.rs2.net.ConnectionHandler; @@ -49,6 +48,7 @@ import com.rs2.world.ObjectHandler; import com.rs2.world.ObjectManager; import com.rs2.world.clip.ObjectDefinition; import com.rs2.world.clip.RegionFactory; +import org.apollo.jagcached.FileServer; /** * Server.java @@ -141,6 +141,24 @@ public class GameEngine { public static void main(java.lang.String[] args) throws NullPointerException, IOException { + for (int i = 0; i < args.length; i++) { + if (args[i].startsWith("-") && (i + 1) < args.length && !args[i + 1].startsWith("-")) { + switch(args[i]) { + case "-c": + case "-config": + try { + //TODO Load A Default Config File When Arg Not Used + System.out.println("Loading External Config.."); + ConfigLoader.loadSettings(args[++i]); + System.out.println("Loaded Config File " + args[i]); + } catch (IOException e) { + System.out.println("Config File Not Found"); + } + break; + } + } + } + System.out.println("Starting game engine.."); if (GameConstants.SERVER_DEBUG) { System.out.println("@@@@ DEBUG MODE IS ENABLED @@@@"); @@ -163,12 +181,24 @@ public class GameEngine { /** * Starting Up Server */ - System.out.println("Launching " + GameConstants.SERVER_NAME + "..."); + System.out.println("Launching " + GameConstants.SERVER_NAME + " World: " + GameConstants.WORLD + "..."); + + /** + * Starts The File Server If Enabled In GameConstants + */ + if(GameConstants.FILE_SERVER) { + FileServer fs = new FileServer(); + try { + fs.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } /** * Start Integration Services **/ - SettingsLoader.loadSettings(); + ConfigLoader.loadSecrets(); JavaCord.init(); /** diff --git a/2006Scape Server/src/main/java/com/rs2/integrations/PlayersOnlineWebsite.java b/2006Scape Server/src/main/java/com/rs2/integrations/PlayersOnlineWebsite.java index 78caf181..5e34806d 100644 --- a/2006Scape Server/src/main/java/com/rs2/integrations/PlayersOnlineWebsite.java +++ b/2006Scape Server/src/main/java/com/rs2/integrations/PlayersOnlineWebsite.java @@ -8,7 +8,7 @@ import com.rs2.game.players.PlayerHandler; public class PlayersOnlineWebsite { - static String password; + public static String password; private static boolean hasntwared = true; private static void setWebsitePlayersOnline(int amount) throws IOException { diff --git a/2006Scape Server/src/main/java/com/rs2/integrations/RegisteredAccsWebsite.java b/2006Scape Server/src/main/java/com/rs2/integrations/RegisteredAccsWebsite.java index 6290be7e..14efc934 100644 --- a/2006Scape Server/src/main/java/com/rs2/integrations/RegisteredAccsWebsite.java +++ b/2006Scape Server/src/main/java/com/rs2/integrations/RegisteredAccsWebsite.java @@ -7,7 +7,7 @@ import java.net.URL; import com.rs2.GameConstants; public class RegisteredAccsWebsite { - static String password; + public static String password; private static boolean hasntwarned = true; private static void setAccountsRegistered(int amount) throws IOException { diff --git a/2006Scape Server/src/main/java/com/rs2/integrations/SettingsLoader.java b/2006Scape Server/src/main/java/com/rs2/integrations/SettingsLoader.java deleted file mode 100644 index ed3b2621..00000000 --- a/2006Scape Server/src/main/java/com/rs2/integrations/SettingsLoader.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.rs2.integrations; - -import org.json.JSONObject; - -import com.rs2.GameEngine; -import com.rs2.integrations.discord.JavaCord; - -import java.io.*; -import java.util.stream.Collectors; - -public class SettingsLoader { - private static void initialize() { - JSONObject main = new JSONObject(); - main - .put("bot-token", "") - .put("websitepass", "") - .put("erssecret", ""); - try { - BufferedWriter br = new BufferedWriter(new FileWriter("data/secrets.json")); - br.write(main.toString()); - br.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public static void loadSettings() throws IOException { - if (!new File("data/secrets.json").exists()) { - initialize(); - System.out.println("Please open \"data/secrets.json\" file and enter your discord token bot there!"); - System.out.println("Please open \"data/secrets.json\" file and enter your Website Password there!"); - - } else { - BufferedReader br = new BufferedReader(new FileReader("data/secrets.json")); - String out = br.lines().collect(Collectors.joining("\n")); - JSONObject obj = new JSONObject(out); - - JavaCord.token = obj.getString("bot-token"); - PlayersOnlineWebsite.password = obj.getString("websitepass"); - RegisteredAccsWebsite.password = obj.getString("websitepass"); - GameEngine.ersSecret = obj.getString("erssecret"); - - } - } -} diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/Constants.java b/2006Scape Server/src/main/java/org/apollo/jagcached/Constants.java similarity index 85% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/Constants.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/Constants.java index dd3e8643..d517f6e3 100644 --- a/2006Scape file_server/src/main/java/org/apollo/jagcached/Constants.java +++ b/2006Scape Server/src/main/java/org/apollo/jagcached/Constants.java @@ -14,7 +14,7 @@ public final class Constants { /** * The directory of the file system. */ - public static final String FILE_SYSTEM_DIR = "./cache/"; + public static final String FILE_SYSTEM_DIR = "./data/cache/"; /** * Default private constructor to prevent instantiation. diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/FileServer.java b/2006Scape Server/src/main/java/org/apollo/jagcached/FileServer.java similarity index 88% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/FileServer.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/FileServer.java index 7a07732c..df330ff4 100644 --- a/2006Scape file_server/src/main/java/org/apollo/jagcached/FileServer.java +++ b/2006Scape Server/src/main/java/org/apollo/jagcached/FileServer.java @@ -69,14 +69,15 @@ public final class FileServer { * @throws Exception if an error occurs. */ public void start() throws Exception { - if (!new File("cache").exists()) + if (!new File(Constants.FILE_SYSTEM_DIR).exists()) { + System.out.println("Working Directory = " + System.getProperty("user.dir")); System.out.println("************************************"); System.out.println("************************************"); System.out.println("************************************"); - System.out.println("WARNING: I could not find the /cache folder. You are LIKELY running this in the wrong directory!"); - System.out.println("In IntelliJ, fix it by clicking \"FileServer\" > Edit Configurations at the top of your screen"); - System.out.println("Then changing the \"Working Directory\" to be in \"2006Scape/2006Scape file_server\", instead of just \"2006Scape\""); + System.out.println("WARNING: I could not find the data/cache folder. You are LIKELY running this in the wrong directory!"); + System.out.println("In IntelliJ, fix it by clicking \"GameEngine\" > Edit Configurations at the top of your screen"); + System.out.println("Then changing the \"Working Directory\" to be in \"2006Scape/2006Scape Server\", instead of just \"2006Scape\""); System.out.println("************************************"); System.out.println("************************************"); System.out.println("************************************"); diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/ChannelRequest.java b/2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/ChannelRequest.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/ChannelRequest.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/ChannelRequest.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/HttpRequestWorker.java b/2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/HttpRequestWorker.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/HttpRequestWorker.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/HttpRequestWorker.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/JagGrabRequestWorker.java b/2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/JagGrabRequestWorker.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/JagGrabRequestWorker.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/JagGrabRequestWorker.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/OnDemandRequestWorker.java b/2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/OnDemandRequestWorker.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/OnDemandRequestWorker.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/OnDemandRequestWorker.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/RequestDispatcher.java b/2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/RequestDispatcher.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/RequestDispatcher.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/RequestDispatcher.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/RequestWorker.java b/2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/RequestWorker.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/RequestWorker.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/RequestWorker.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/RequestWorkerPool.java b/2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/RequestWorkerPool.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/dispatch/RequestWorkerPool.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/dispatch/RequestWorkerPool.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/fs/FileDescriptor.java b/2006Scape Server/src/main/java/org/apollo/jagcached/fs/FileDescriptor.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/fs/FileDescriptor.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/fs/FileDescriptor.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/fs/FileSystemConstants.java b/2006Scape Server/src/main/java/org/apollo/jagcached/fs/FileSystemConstants.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/fs/FileSystemConstants.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/fs/FileSystemConstants.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/fs/Index.java b/2006Scape Server/src/main/java/org/apollo/jagcached/fs/Index.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/fs/Index.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/fs/Index.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/fs/IndexedFileSystem.java b/2006Scape Server/src/main/java/org/apollo/jagcached/fs/IndexedFileSystem.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/fs/IndexedFileSystem.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/fs/IndexedFileSystem.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/FileServerHandler.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/FileServerHandler.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/FileServerHandler.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/FileServerHandler.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/HttpPipelineFactory.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/HttpPipelineFactory.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/HttpPipelineFactory.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/HttpPipelineFactory.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/JagGrabPipelineFactory.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/JagGrabPipelineFactory.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/JagGrabPipelineFactory.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/JagGrabPipelineFactory.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/NetworkConstants.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/NetworkConstants.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/NetworkConstants.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/NetworkConstants.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/OnDemandPipelineFactory.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/OnDemandPipelineFactory.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/OnDemandPipelineFactory.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/OnDemandPipelineFactory.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabRequest.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabRequest.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabRequest.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabRequest.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabRequestDecoder.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabRequestDecoder.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabRequestDecoder.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabRequestDecoder.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabResponse.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabResponse.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabResponse.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabResponse.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabResponseEncoder.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabResponseEncoder.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabResponseEncoder.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/jaggrab/JagGrabResponseEncoder.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandRequest.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandRequest.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandRequest.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandRequest.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandRequestDecoder.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandRequestDecoder.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandRequestDecoder.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandRequestDecoder.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandResponse.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandResponse.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandResponse.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandResponse.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandResponseEncoder.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandResponseEncoder.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandResponseEncoder.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/ondemand/OnDemandResponseEncoder.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/service/ServiceRequest.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/service/ServiceRequest.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/service/ServiceRequest.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/service/ServiceRequest.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/service/ServiceRequestDecoder.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/service/ServiceRequestDecoder.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/service/ServiceRequestDecoder.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/service/ServiceRequestDecoder.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/service/ServiceResponse.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/service/ServiceResponse.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/service/ServiceResponse.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/service/ServiceResponse.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/net/service/ServiceResponseEncoder.java b/2006Scape Server/src/main/java/org/apollo/jagcached/net/service/ServiceResponseEncoder.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/net/service/ServiceResponseEncoder.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/net/service/ServiceResponseEncoder.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/resource/CombinedResourceProvider.java b/2006Scape Server/src/main/java/org/apollo/jagcached/resource/CombinedResourceProvider.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/resource/CombinedResourceProvider.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/resource/CombinedResourceProvider.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/resource/HypertextResourceProvider.java b/2006Scape Server/src/main/java/org/apollo/jagcached/resource/HypertextResourceProvider.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/resource/HypertextResourceProvider.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/resource/HypertextResourceProvider.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/resource/ResourceProvider.java b/2006Scape Server/src/main/java/org/apollo/jagcached/resource/ResourceProvider.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/resource/ResourceProvider.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/resource/ResourceProvider.java diff --git a/2006Scape file_server/src/main/java/org/apollo/jagcached/resource/VirtualResourceProvider.java b/2006Scape Server/src/main/java/org/apollo/jagcached/resource/VirtualResourceProvider.java similarity index 100% rename from 2006Scape file_server/src/main/java/org/apollo/jagcached/resource/VirtualResourceProvider.java rename to 2006Scape Server/src/main/java/org/apollo/jagcached/resource/VirtualResourceProvider.java diff --git a/2006Scape file_server/.gitignore b/2006Scape file_server/.gitignore deleted file mode 100644 index f030fb16..00000000 --- a/2006Scape file_server/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/bin/ -*.iml -/target/ -file_server-1.0-jar-with-dependencies.jar \ No newline at end of file diff --git a/2006Scape file_server/libs/javac++.jar b/2006Scape file_server/libs/javac++.jar deleted file mode 100644 index 46f53b7f..00000000 Binary files a/2006Scape file_server/libs/javac++.jar and /dev/null differ diff --git a/2006Scape file_server/libs/netty-3.6.6.Final.jar b/2006Scape file_server/libs/netty-3.6.6.Final.jar deleted file mode 100644 index 35cb0730..00000000 Binary files a/2006Scape file_server/libs/netty-3.6.6.Final.jar and /dev/null differ diff --git a/2006Scape file_server/libs/xpp3-1.1.4c.jar b/2006Scape file_server/libs/xpp3-1.1.4c.jar deleted file mode 100644 index 451ac82a..00000000 Binary files a/2006Scape file_server/libs/xpp3-1.1.4c.jar and /dev/null differ diff --git a/2006Scape file_server/pom.xml b/2006Scape file_server/pom.xml deleted file mode 100644 index c610f128..00000000 --- a/2006Scape file_server/pom.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - 2006Scape - com.rs2 - 1.0 - - - 4.0.0 - file_server - 1.0 - jar - - - - libs-local - libs - file://${project.basedir}/libs - - - - - - - org.apache.commons - commons-lang3 - 3.1 - - - - org.apache.mina - mina-core - 1.1.7 - - - - mysql - mysql-connector-java - 8.0.16 - - - - io.netty - netty - 3.6.6.Final - - - - org.slf4j - slf4j-api - 1.5.8 - - - - org.slf4j - slf4j-nop - 1.5.8 - test - - - - com.thoughtworks.xstream - xstream - 1.4.17 - - - javac - javac - 1.0 - system - ${project.basedir}/libs/javac++.jar - - - org.xmlpull.v1 - xpp3 - 1.1.4c - system - ${project.basedir}/libs/xpp3-1.1.4c.jar - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - maven-assembly-plugin - - - - org.apollo.jagcached.FileServer - - - - jar-with-dependencies - - - - - make-assembly - package - - single - - - - - - - diff --git a/2006Scape file_server/runFileServer.sh b/2006Scape file_server/runFileServer.sh deleted file mode 100755 index 10cfa0d5..00000000 --- a/2006Scape file_server/runFileServer.sh +++ /dev/null @@ -1,6 +0,0 @@ -echo This is meant to be run by the live server admin! You probably don\'t want to do this! -for i in {0..50} -do - cp target/file_server-1.0-jar-with-dependencies.jar ./fserver.jar - java -jar fserver.jar -done diff --git a/README.md b/README.md index 6f470bad..3af8db86 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ ## How to Play -### Client (non-bottable download): https://github.com/2006-Scape/2006Scape/releases/ -### Parabot client (recommended): https://www.parabot.org/community/ +### Client/Launcher Download: https://2006Scape.org/ ### Rune-Server project thread: [Project thread](https://www.rune-server.ee/runescape-development/rs2-server/projects/686444-2006rebotted-remake-server-will-allow-supply-creatable-bots.html) # Installation + Running (Developers) @@ -14,17 +13,16 @@ 2. Hit File > Project Settings > Set SDK to Java 8 (Download [Java 8 SDK](https://adoptopenjdk.net/?variant=openjdk8) if you don't have one already) -2. Navigate to `2006Scape file_server` > `src` > `main` > `java` > `org.apollo.jagcached`, right click FileServer and hit Run [Image](https://i.imgur.com/tsg9q1Z.png) - 3. Navigate to `2006Scape Server` > `src` > `main` > `java` > `com.rs2`, right click GameEngine and hit Run [Image](https://i.imgur.com/HHooeVu.png) -4. Navigate to `2006Scape Client` > `src` > `main` > `java`, right click Client and hit Run [Image](https://i.imgur.com/gSmqGLn.png) + [(You Can Also Run The Server With The -c/-config Argument)](https://wiki.2006scape.org/books/getting-setup/page/server-arguments) +5. Navigate to `2006Scape Client` > `src` > `main` > `java`, right click Client and hit Run [Image](https://i.imgur.com/gSmqGLn.png) *Advanced* To compile any module from the command line, run `mvn clean install` -## Using Parabot with your local server: +## Using Parabot with your local server: (OUTDATED) - **1:** Download the latest `localhost_2006Scape.jar` from [here](https://github.com/2006-Scape/2006Scape/releases) (or, if testing server changes, compile it yourself like [this](https://i.imgur.com/uDrF0gl.png)) - **2:** Download the latest `Provider-version.jar` file from [here](http://v3.bdn.parabot.org/api/bot/download/default-provider?nightly=false) - **3:** Create a file called `localhost.json` in `{user}\Documents\Parabot\servers` @@ -55,7 +53,6 @@ java -jar Client-2.8.1.jar -login username password -loadlocal -v -clearcache - `2006Scape Server` contains all the server code; mark `src` as the Sources directory - `2006Scape Client` contains all the client code; likewise mark `src` - If more than 2 arguments are passed in (can be anything), the client runs locally -- `2006Scape file_server` contains the file server code that is *required* to be running before a client can connect to a server. It must be running locally before a client can connect. `src` is the Sources directory ## Building from command line diff --git a/docker-compose.yml b/docker-compose.yml index 4b6c578d..12babfff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,26 +10,14 @@ services: working_dir: /usr/src/2006scape restart: "no" - rsps-2006scape-file-server: - image: openjdk:8-alpine - container_name: rsps-2006scape-file-server - command: ["java", "-jar", "target/file_server-1.0-jar-with-dependencies.jar"] - volumes: - - ./2006Scape file_server:/usr/src/fileserver - working_dir: /usr/src/fileserver - ports: - - 8080:8080 # web panel - - 43595-43596:43595-43596 # File Server - restart: unless-stopped - rsps-2006scape-server: image: openjdk:8-alpine container_name: rsps-2006scape-server - command: ["java", "-jar", "target/server-1.0-jar-with-dependencies.jar"] + command: ["java", "-jar", "target/server-1.0-jar-with-dependencies.jar", "-c", "ServerConfig.json"] volumes: - ./2006Scape Server:/usr/src/server working_dir: /usr/src/server - ports: + ports: # You will need to open other ports if your world ID is not 1 (43597 for world 2) - 43594:43594 # Server - - 43594:43594/udp # Server + - 43595-43596:43595-43596 # File Server restart: unless-stopped diff --git a/pom.xml b/pom.xml index 4c34d42d..801afa0b 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,6 @@ 2006Scape Client - 2006Scape file_server 2006Scape Server