@@ -177,7 +177,7 @@ To launch the server, you may either:
|
||||
* If you already have Maven installed, simply run the command "mvn clean install" to create the jar file.
|
||||
* IntelliJ also comes with built-in Maven support. Open a new terminal window inside IntelliJ, type "mvn clean install" (your command should now be marked green), then Ctrl+Enter to build the jar file.
|
||||
2. Launch the jar file
|
||||
* Double click on "launch.bat" (need to have Java 16 installed)
|
||||
* Double click on "launch.bat" (need to have Java 17 installed)
|
||||
|
||||
#### Run as containers with Docker
|
||||
1. Start Docker
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
@title Cosmic
|
||||
java -Xmx2048m -Dwz-path= -jar target\Cosmic.jar
|
||||
java -Xmx2048m -Dwz-path=wz -jar target\Cosmic.jar
|
||||
pause
|
||||
@@ -10,7 +10,7 @@ import tools.exceptions.IdTypeNotSupportedException;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -76,7 +76,7 @@ public class IdCommand extends Command {
|
||||
throw new IdTypeNotSupportedException();
|
||||
}
|
||||
itemMap.put(type, new HashMap<>());
|
||||
try (BufferedReader reader = Files.newBufferedReader(Paths.get(handbookDirectory.get(type)))) {
|
||||
try (BufferedReader reader = Files.newBufferedReader(Path.of(handbookDirectory.get(type)))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
String[] row = line.split(" - ", 2);
|
||||
|
||||
@@ -38,7 +38,7 @@ import tools.HexTool;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Properties;
|
||||
|
||||
public class PeCommand extends Command {
|
||||
@@ -52,7 +52,7 @@ public class PeCommand extends Command {
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
String packet = "";
|
||||
try (BufferedReader br = Files.newBufferedReader(Paths.get("pe.txt"))) {
|
||||
try (BufferedReader br = Files.newBufferedReader(Path.of("pe.txt"))) {
|
||||
Properties packetProps = new Properties();
|
||||
packetProps.load(br);
|
||||
packet = packetProps.getProperty("pe");
|
||||
|
||||
@@ -6,7 +6,7 @@ import constants.string.CharsetConstants;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public class YamlConfig {
|
||||
|
||||
private static YamlConfig loadConfig() {
|
||||
try {
|
||||
YamlReader reader = new YamlReader(Files.newBufferedReader(Paths.get(CONFIG_FILE_NAME), CharsetConstants.CHARSET));
|
||||
YamlReader reader = new YamlReader(Files.newBufferedReader(Path.of(CONFIG_FILE_NAME), CharsetConstants.CHARSET));
|
||||
YamlConfig config = reader.read(YamlConfig.class);
|
||||
reader.close();
|
||||
return config;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class CharsetConstants {
|
||||
|
||||
private static String loadCharsetFromConfig() {
|
||||
try {
|
||||
YamlReader reader = new YamlReader(Files.newBufferedReader(Paths.get(YamlConfig.CONFIG_FILE_NAME), StandardCharsets.US_ASCII));
|
||||
YamlReader reader = new YamlReader(Files.newBufferedReader(Path.of(YamlConfig.CONFIG_FILE_NAME), StandardCharsets.US_ASCII));
|
||||
reader.getConfig().readConfig.setIgnoreUnknownProperties(true);
|
||||
StrippedYamlConfig charsetConfig = reader.read(StrippedYamlConfig.class);
|
||||
reader.close();
|
||||
|
||||
@@ -49,7 +49,6 @@ import java.io.IOException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
@@ -437,7 +436,7 @@ public final class Channel {
|
||||
|
||||
private static String[] getEvents() {
|
||||
List<String> events = new ArrayList<>();
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get("scripts/event"))) {
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Path.of("scripts/event"))) {
|
||||
for (Path path : stream) {
|
||||
String fileName = path.getFileName().toString();
|
||||
events.add(fileName.substring(0, fileName.length() - 3));
|
||||
|
||||
@@ -2,7 +2,6 @@ package provider.wz;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public enum WZFiles {
|
||||
QUEST("Quest"),
|
||||
@@ -28,7 +27,7 @@ public enum WZFiles {
|
||||
}
|
||||
|
||||
public Path getFile() {
|
||||
return Paths.get(DIRECTORY).resolve(fileName);
|
||||
return Path.of(DIRECTORY, fileName);
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
@@ -38,7 +37,7 @@ public enum WZFiles {
|
||||
private static String getWzDirectory() {
|
||||
// Either provide a custom directory path through the "wz-path" property when launching the .jar, or don't provide one to use the default "wz" directory
|
||||
String propertyPath = System.getProperty("wz-path");
|
||||
if (propertyPath != null && Files.isDirectory(Paths.get(propertyPath))) {
|
||||
if (propertyPath != null && Files.isDirectory(Path.of(propertyPath))) {
|
||||
return propertyPath;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
*/
|
||||
package provider.wz;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import provider.Data;
|
||||
import provider.DataDirectoryEntry;
|
||||
import provider.DataProvider;
|
||||
@@ -32,9 +34,6 @@ import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class XMLWZFile implements DataProvider {
|
||||
private static final Logger log = LoggerFactory.getLogger(DataProvider.class);
|
||||
private final Path root;
|
||||
@@ -60,7 +59,7 @@ public class XMLWZFile implements DataProvider {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.warn("Can not open file/directory at " + lroot);
|
||||
log.warn("Can not open file/directory at " + lroot.toAbsolutePath().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +68,7 @@ public class XMLWZFile implements DataProvider {
|
||||
Path dataFile = root.resolve(path + ".xml");
|
||||
Path imageDataDir = root.resolve(path);
|
||||
if (!Files.exists(dataFile)) {
|
||||
return null;// bitches
|
||||
return null;
|
||||
}
|
||||
final XMLDomMapleData domMapleData;
|
||||
try (FileInputStream fis = new FileInputStream(dataFile.toString())) {
|
||||
|
||||
@@ -28,12 +28,10 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.script.*;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* @author Matze
|
||||
@@ -47,7 +45,7 @@ public abstract class AbstractScriptManager {
|
||||
}
|
||||
|
||||
protected ScriptEngine getInvocableScriptEngine(String path) {
|
||||
Path scriptFile = Paths.get("scripts").resolve(path);
|
||||
Path scriptFile = Path.of("scripts", path);
|
||||
if (!Files.exists(scriptFile)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import java.io.IOException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -189,7 +188,7 @@ public class SkillbookInformationProvider {
|
||||
}
|
||||
|
||||
private static void listFiles(String directoryName, ArrayList<Path> files) {
|
||||
Path directory = Paths.get(directoryName);
|
||||
Path directory = Path.of(directoryName);
|
||||
|
||||
// get all the files from a directory
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory)) {
|
||||
|
||||
@@ -2,11 +2,13 @@ package tools.mapletools;
|
||||
|
||||
import provider.wz.WZFiles;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
@@ -23,7 +25,7 @@ import java.time.Instant;
|
||||
public class DojoUpdate {
|
||||
private static final Path INPUT_DIRECTORY = WZFiles.MAP.getFile().resolve("Map").resolve("Map9");
|
||||
private static final Path OUTPUT_DIRECTORY = ToolConstants.getOutputFile("dojo-maps");
|
||||
private static final Path WORKING_DIRECTORY = Paths.get("").toAbsolutePath();
|
||||
private static final Path WORKING_DIRECTORY = Path.of("").toAbsolutePath();
|
||||
private static final int DOJO_MIN_MAP_ID = 925_020_100;
|
||||
private static final int DOJO_MAX_MAP_ID = 925_033_804;
|
||||
private static final int INITIAL_STRING_LENGTH = 250;
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.io.PrintWriter;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -41,7 +40,7 @@ public class ReactorDropFetcher {
|
||||
}
|
||||
|
||||
private static void removeScriptedReactorids(String directoryName) {
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(directoryName))) {
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Path.of(directoryName))) {
|
||||
for (Path path : stream) {
|
||||
if (Files.isRegularFile(path)) {
|
||||
reactors.remove(getReactorIdFromFilename(path.getFileName().toString()));
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package tools.mapletools;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
class ToolConstants {
|
||||
static final Path INPUT_DIRECTORY = Paths.get("tools/input");
|
||||
static final Path OUTPUT_DIRECTORY = Paths.get("tools/output");
|
||||
static final Path INPUT_DIRECTORY = Path.of("tools/input");
|
||||
static final Path OUTPUT_DIRECTORY = Path.of("tools/output");
|
||||
static final String SCRIPTS_PATH = "scripts";
|
||||
static final String HANDBOOK_PATH = "handbook";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user