mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-12 22:38:54 +00:00
Maven and file access
- Server config file is now accessed through the class loader - Maven outputs server.jar, moves dependencys to adjacent /libs, and plugins to adjacent /plugins
This commit is contained in:
@@ -6,9 +6,6 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${parent.project.basedir}/ServerTarget" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ServerTarget" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>/</directory>
|
||||
<directory>../Server/src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>../config.properties</include>
|
||||
<include>config.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
@@ -30,6 +30,23 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>../target/libs</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@@ -38,6 +55,8 @@
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>net.simon987.server.Main</mainClass>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>libs/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
||||
@@ -40,7 +40,7 @@ public class GameServer implements Runnable {
|
||||
|
||||
public GameServer() {
|
||||
|
||||
this.config = new ServerConfiguration(new File("config.properties"));
|
||||
this.config = new ServerConfiguration("config.properties");
|
||||
|
||||
gameUniverse = new GameUniverse(config);
|
||||
pluginManager = new PluginManager();
|
||||
|
||||
@@ -12,8 +12,7 @@ public class Main {
|
||||
|
||||
|
||||
LogManager.initialize();
|
||||
ServerConfiguration config = new ServerConfiguration(new File("config.properties"));
|
||||
|
||||
ServerConfiguration config = new ServerConfiguration("config.properties");
|
||||
//Load
|
||||
GameServer.INSTANCE.getGameUniverse().load(new File("save.json"));
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.simon987.server.logging.LogManager;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
@@ -18,11 +19,11 @@ public class ServerConfiguration {
|
||||
*/
|
||||
private Properties properties;
|
||||
|
||||
public ServerConfiguration(File file) {
|
||||
public ServerConfiguration(String file) {
|
||||
try {
|
||||
properties = new Properties();
|
||||
|
||||
properties.load(new FileInputStream(file));
|
||||
InputStream is = ServerConfiguration.class.getClassLoader().getResourceAsStream("config.properties");
|
||||
properties.load(is);
|
||||
|
||||
} catch (IOException e) {
|
||||
LogManager.LOGGER.severe("Problem loading server configuration: " + e.getMessage());
|
||||
|
||||
78
Server/src/main/resources/config.properties
Normal file
78
Server/src/main/resources/config.properties
Normal file
@@ -0,0 +1,78 @@
|
||||
# MySQL username
|
||||
mysql_user=mar
|
||||
# MySQL password/
|
||||
mysql_pass=mar
|
||||
# MySQL address
|
||||
mysql_url=jdbc:mysql://localhost:3306/mar?useSSL=false
|
||||
# File management
|
||||
save_interval=5
|
||||
clean_interval=10
|
||||
history_size=10
|
||||
# Web server port
|
||||
webSocket_port=8887
|
||||
webSocket_host=0.0.0.0
|
||||
|
||||
use_secure_webSocket=0
|
||||
cert_path=certificates
|
||||
# ----------------------------------------------
|
||||
|
||||
# Length of a tick in ms
|
||||
tick_length=1000
|
||||
# Default offset of the origin (starting point of code execution) in words
|
||||
org_offset=512
|
||||
# Address of the stack bottom
|
||||
stack_bottom=65536
|
||||
# Size of the memory in words
|
||||
memory_size=65536
|
||||
# Initial location of new user's controlled unit
|
||||
new_user_worldX = 32767
|
||||
new_user_worldY = 32767
|
||||
# Default user code
|
||||
new_user_code=; Welcome to Much Assembly required!\n\
|
||||
; You will find useful information on the game here: https://github.com/simon987/Much-Assembly-Required/wiki\n\
|
||||
.text\n\
|
||||
\t; Write code here\n\
|
||||
\tbrk
|
||||
# Default held item
|
||||
new_user_item=0
|
||||
# ----------------------------------------------
|
||||
# Biomass units for each blob
|
||||
biomass_yield=2
|
||||
# Minimum biomass blob count for the WorldGenerator
|
||||
minBiomassCount=3
|
||||
minBiomassRespawnCount=2
|
||||
# Maximum biomass blob count for the WorldGenerator
|
||||
maxBiomassCount=10
|
||||
maxBiomassRespawnCount=6
|
||||
# Maximum energy of the battery hardware in kJ
|
||||
battery_max_energy=60000
|
||||
# Time for biomass respawn in ticks
|
||||
biomassRespawnTime=64
|
||||
# Respawn timer will start when biomass count is below this number
|
||||
biomassRespawnThreshold=1
|
||||
# NPC lifetime in ticks
|
||||
npc_lifetime=1024
|
||||
# Maximum travel distance from the Factory in Worlds
|
||||
npc_max_factory_distance=3
|
||||
# Maximum NPC per Factory
|
||||
factory_max_npc_count=16
|
||||
# ----------------------------------------------
|
||||
# Minimum center point count for the WorldGenerator
|
||||
wg_centerPointCountMin=5
|
||||
# Maximum center point count for the WorldGenerator
|
||||
wg_centerPointCountMax=15
|
||||
# Wall/Plain tile ratio for the WorldGenerator
|
||||
wg_wallPlainRatio=4
|
||||
# Minimum iron tiles count for the WorldGenerator
|
||||
wg_minIronCount=0
|
||||
# Minimum iron tile count for the WorldGenerator
|
||||
wg_maxIronCount=2
|
||||
# Minimum copper tile count for the WorldGenerator
|
||||
wg_minCopperCount=0
|
||||
# Maximum copper tile count for the WorldGenerator
|
||||
wg_maxCopperCount=2
|
||||
|
||||
|
||||
# ----------------------------------------------
|
||||
# Maximum execution time of user code in ms
|
||||
user_timeout=100
|
||||
Reference in New Issue
Block a user