mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-10 14:26:45 +00:00
Simplify project structure (wip), run tsc during compilation
This commit is contained in:
parent
cd9e555e86
commit
304c063887
10
.gitattributes
vendored
10
.gitattributes
vendored
@ -1,5 +1,5 @@
|
||||
Server/src/main/resources/static/css/bootstrap4-neon-glow.min linguist-vendored
|
||||
Server/src/main/resources/static/css/bootstrap-grid.min linguist-vendored
|
||||
Server/src/main/resources/static/css/bootstrap-reboot.min linguist-vendored
|
||||
Server/src/main/resources/static/js/* linguist-vendored
|
||||
Server/src/main/resources/static/js/ace/* linguist-vendored
|
||||
src/main/resources/static/css/bootstrap4-neon-glow.min linguist-vendored
|
||||
src/main/resources/static/css/bootstrap-grid.min linguist-vendored
|
||||
src/main/resources/static/css/bootstrap-reboot.min linguist-vendored
|
||||
src/main/resources/static/js/* linguist-vendored
|
||||
src/main/resources/static/js/ace/* linguist-vendored
|
||||
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,8 +1,4 @@
|
||||
|
||||
plugins/Plugin NPC.jar
|
||||
plugins/Plugin Misc HW.jar
|
||||
plugins/Plant.jar
|
||||
plugins/Cubot.jar
|
||||
.idea/*
|
||||
mar.log
|
||||
mar.log.lck
|
||||
@ -13,10 +9,10 @@ plugins/*.jar
|
||||
save.json
|
||||
Server/Server.iml
|
||||
target/*
|
||||
Server/Server.iml
|
||||
Server/src/main/java/META-INF/MANIFEST.MF
|
||||
src/main/java/META-INF/MANIFEST.MF
|
||||
src/main/resources/static/js/mar.js
|
||||
.settings
|
||||
.project
|
||||
.classpath
|
||||
# VSCode Workspace
|
||||
.vscode/
|
||||
.vscode/
|
||||
|
@ -8,12 +8,7 @@ Here small unordered list of guidelines to read before creating a pull request
|
||||
- Use java <= 1.8 features
|
||||
- Please follow [Google's Java style guide](https://google.github.io/styleguide/javaguide.html)
|
||||
- Constants (e.g. the energy cost of an in-game action) should be loaded from config.properties
|
||||
- The project is separated into multiple modules, the `Server` module and its plugins. Plugins should
|
||||
not depend on another plugin to compile or to run.
|
||||
(e.g. NPC plugin shouldn't import `net.simon987.biomassplugin` )
|
||||
- Use `Logmanager.LOGGER` to log messages to the console. Use `.fine()` for debugging messages and `.info()` for
|
||||
- Use `Logmanager.LOGGER` to log messages to the console. Use `.fine()` for debugging messages and `.info()` for
|
||||
info for more important messages
|
||||
that are not too frequently used.
|
||||
- Do not submit a pull request for a new feature that has not been approved
|
||||
by [simon987](https://github.com/simon987) in an Issue beforehand
|
||||
- Please state what tests have been performed in the pull request
|
||||
|
@ -3,4 +3,4 @@ COPY /. /app/
|
||||
WORKDIR /app
|
||||
RUN mvn package
|
||||
WORKDIR /app/target
|
||||
CMD ["java", "-jar", "/app/target/server-1.4a.jar"]
|
||||
CMD ["java", "-jar", "/app/target/server-1.6a.jar"]
|
||||
|
@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
<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$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="Server" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-sync:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sparkjava:spark-core:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-webapp:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-xml:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-server:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-client:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-servlet:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sparkjava:spark-template-velocity:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server_root</artifactId>
|
||||
<version>1.4a</version>
|
||||
</parent>
|
||||
|
||||
<groupId>net.simon987.plugincubot</groupId>
|
||||
<artifactId>plugin-cubot</artifactId>
|
||||
<version>1.4a</version>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>1.4a</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -1,44 +0,0 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import net.simon987.cubotplugin.event.*;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.objects.GameRegistry;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.plugin.ServerPlugin;
|
||||
|
||||
public class CubotPlugin extends ServerPlugin {
|
||||
|
||||
|
||||
@Override
|
||||
public void init(GameServer gameServer) {
|
||||
listeners.add(new CpuInitialisationListener());
|
||||
listeners.add(new UserCreationListener());
|
||||
//Debug commands
|
||||
listeners.add(new ChargeShieldCommandListener());
|
||||
listeners.add(new SetInventoryPosition());
|
||||
listeners.add(new PutItemCommandListener());
|
||||
listeners.add(new PopItemCommandListener());
|
||||
//Leaderboard
|
||||
listeners.add(new DeathListener());
|
||||
listeners.add(new WalkListener());
|
||||
|
||||
GameRegistry registry = gameServer.getRegistry();
|
||||
|
||||
registry.registerGameObject(Cubot.class);
|
||||
|
||||
registry.registerHardware(CubotLeg.class);
|
||||
registry.registerHardware(CubotLaser.class);
|
||||
registry.registerHardware(CubotLidar.class);
|
||||
registry.registerHardware(CubotDrill.class);
|
||||
registry.registerHardware(CubotInventory.class);
|
||||
registry.registerHardware(CubotKeyboard.class);
|
||||
registry.registerHardware(CubotHologram.class);
|
||||
registry.registerHardware(CubotBattery.class);
|
||||
registry.registerHardware(CubotFloppyDrive.class);
|
||||
registry.registerHardware(CubotComPort.class);
|
||||
registry.registerHardware(CubotShield.class);
|
||||
registry.registerHardware(CubotCore.class);
|
||||
|
||||
LogManager.LOGGER.info("(Cubot Plugin) Initialised Cubot plugin");
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
classpath=net.simon987.cubotplugin.CubotPlugin
|
||||
name=Cubot Plugin
|
||||
version=1.0
|
@ -1,12 +0,0 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class CubotTest {
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<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$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="Server" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-sync:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sparkjava:spark-core:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-webapp:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-xml:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-server:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-client:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-servlet:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sparkjava:spark-template-velocity:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server_root</artifactId>
|
||||
<version>1.4a</version>
|
||||
</parent>
|
||||
|
||||
<groupId>net.simon987.pluginmischw</groupId>
|
||||
<artifactId>plugin-misc-hw</artifactId>
|
||||
<version>1.4a</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>1.4a</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,26 +0,0 @@
|
||||
package net.simon987.mischwplugin;
|
||||
|
||||
import net.simon987.mischwplugin.event.CpuInitialisationListener;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.objects.GameRegistry;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.plugin.ServerPlugin;
|
||||
|
||||
/**
|
||||
* Plugin that adds miscellaneous hardware to the game
|
||||
*/
|
||||
public class MiscHWPlugin extends ServerPlugin {
|
||||
|
||||
|
||||
@Override
|
||||
public void init(GameServer gameServer) {
|
||||
listeners.add(new CpuInitialisationListener());
|
||||
|
||||
GameRegistry registry = gameServer.getRegistry();
|
||||
|
||||
registry.registerHardware(RandomNumberGenerator.class);
|
||||
registry.registerHardware(Clock.class);
|
||||
|
||||
LogManager.LOGGER.info("(Mist HW Plugin) Initialised Misc Hardware Plugin");
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
classpath=net.simon987.mischwplugin.MiscHWPlugin
|
||||
name=Misc HW Plugin
|
||||
version=1.0
|
@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<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$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="module" module-name="Server" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-sync:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sparkjava:spark-core:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-webapp:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-xml:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-server:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-client:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-servlet:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sparkjava:spark-template-velocity:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server_root</artifactId>
|
||||
<version>1.4a</version>
|
||||
</parent>
|
||||
|
||||
<groupId>net.simon987.pluginnpc</groupId>
|
||||
<artifactId>plugin-npc</artifactId>
|
||||
<version>1.4a</version>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>1.4a</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,93 +0,0 @@
|
||||
package net.simon987.npcplugin;
|
||||
|
||||
import net.simon987.npcplugin.event.CpuInitialisationListener;
|
||||
import net.simon987.npcplugin.event.VaultCompleteListener;
|
||||
import net.simon987.npcplugin.event.VaultWorldUpdateListener;
|
||||
import net.simon987.npcplugin.event.WorldCreationListener;
|
||||
import net.simon987.npcplugin.world.TileVaultFloor;
|
||||
import net.simon987.npcplugin.world.TileVaultWall;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.IServerConfiguration;
|
||||
import net.simon987.server.game.objects.GameRegistry;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.plugin.ServerPlugin;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class NpcPlugin extends ServerPlugin {
|
||||
|
||||
public static Map<String, Settlement> settlementMap;
|
||||
|
||||
public static Document DEFAULT_HACKED_NPC;
|
||||
|
||||
@Override
|
||||
public void init(GameServer gameServer) {
|
||||
|
||||
IServerConfiguration configuration = gameServer.getConfig();
|
||||
GameRegistry registry = gameServer.getRegistry();
|
||||
|
||||
listeners.add(new WorldCreationListener(configuration.getInt("settlement_spawn_rate")));
|
||||
listeners.add(new CpuInitialisationListener());
|
||||
listeners.add(new VaultWorldUpdateListener(configuration));
|
||||
listeners.add(new VaultCompleteListener());
|
||||
|
||||
registry.registerGameObject(HarvesterNPC.class);
|
||||
registry.registerGameObject(Factory.class);
|
||||
registry.registerGameObject(RadioTower.class);
|
||||
registry.registerGameObject(VaultDoor.class);
|
||||
registry.registerGameObject(Obstacle.class);
|
||||
registry.registerGameObject(ElectricBox.class);
|
||||
registry.registerGameObject(Portal.class);
|
||||
registry.registerGameObject(VaultExitPortal.class);
|
||||
registry.registerGameObject(HackedNPC.class);
|
||||
|
||||
registry.registerHardware(RadioReceiverHardware.class);
|
||||
registry.registerHardware(NpcBattery.class);
|
||||
registry.registerHardware(NpcInventory.class);
|
||||
|
||||
registry.registerTile(TileVaultFloor.ID, TileVaultFloor.class);
|
||||
registry.registerTile(TileVaultWall.ID, TileVaultWall.class);
|
||||
|
||||
settlementMap = new ConcurrentHashMap<>();
|
||||
|
||||
LogManager.LOGGER.fine("(NPC Plugin) Loading default HackedNPC settings from" +
|
||||
" defaultHackedCubotHardware.json");
|
||||
InputStream is = getClass().getClassLoader().getResourceAsStream("defaultHackedCubotHardware.json");
|
||||
Scanner scanner = new Scanner(is).useDelimiter("\\A");
|
||||
String json = scanner.next();
|
||||
DEFAULT_HACKED_NPC = Document.parse(json);
|
||||
|
||||
LogManager.LOGGER.info("(NPC Plugin) Initialised NPC plugin");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document mongoSerialise() {
|
||||
Document document = super.mongoSerialise();
|
||||
|
||||
Document settlements = new Document();
|
||||
for (String world : settlementMap.keySet()) {
|
||||
settlements.put(world, settlementMap.get(world).mongoSerialise());
|
||||
}
|
||||
|
||||
document.put("settlement_map", settlements);
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Document document) {
|
||||
super.load(document);
|
||||
|
||||
Document settlements = (Document) document.get("settlement_map");
|
||||
|
||||
for (String world : settlements.keySet()) {
|
||||
settlementMap.put(world, new Settlement((Document) settlements.get(world)));
|
||||
}
|
||||
|
||||
LogManager.LOGGER.fine(String.format("(%s) Loaded %d settlements", name, settlementMap.size()));
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
classpath=net.simon987.npcplugin.NpcPlugin
|
||||
name=NPC Plugin
|
||||
version=1.1
|
||||
depend=Cubot Plugin
|
@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<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$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="module" module-name="Server" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-sync:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sparkjava:spark-core:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-webapp:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-xml:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-server:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-client:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-servlet:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.12.v20180830" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sparkjava:spark-template-velocity:2.7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server_root</artifactId>
|
||||
<version>1.4a</version>
|
||||
</parent>
|
||||
|
||||
<groupId>net.simon987.pluginplant</groupId>
|
||||
<artifactId>plugin-biomassBlob</artifactId>
|
||||
<version>1.4a</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>1.4a</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,31 +0,0 @@
|
||||
package net.simon987.biomassplugin;
|
||||
|
||||
import net.simon987.biomassplugin.event.ObjectDeathListener;
|
||||
import net.simon987.biomassplugin.event.WorldCreationListener;
|
||||
import net.simon987.biomassplugin.event.WorldUpdateListener;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.IServerConfiguration;
|
||||
import net.simon987.server.game.objects.GameRegistry;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.plugin.ServerPlugin;
|
||||
|
||||
|
||||
public class BiomassPlugin extends ServerPlugin {
|
||||
|
||||
|
||||
@Override
|
||||
public void init(GameServer gameServer) {
|
||||
|
||||
IServerConfiguration config = gameServer.getConfig();
|
||||
GameRegistry registry = gameServer.getRegistry();
|
||||
|
||||
listeners.add(new WorldCreationListener());
|
||||
listeners.add(new WorldUpdateListener(config));
|
||||
listeners.add(new ObjectDeathListener(config));
|
||||
|
||||
registry.registerGameObject(BiomassBlob.class);
|
||||
registry.registerItem(ItemBiomass.ID, ItemBiomass.class);
|
||||
|
||||
LogManager.LOGGER.info("(BiomassPlugin) Initialised Biomass plugin");
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
classpath=net.simon987.biomassplugin.BiomassPlugin
|
||||
name=Biomass Plugin
|
||||
version=1.0
|
||||
depend=NPC Plugin
|
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server_root</artifactId>
|
||||
<version>1.4a</version>
|
||||
</parent>
|
||||
|
||||
<groupId>net.simon987.pluginradioactivecloud</groupId>
|
||||
<artifactId>plugin-radioactiveCloud</artifactId>
|
||||
<version>1.4a</version>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>1.4a</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,14 +0,0 @@
|
||||
package net.simon987.pluginradioactivecloud;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.plugin.ServerPlugin;
|
||||
|
||||
public class RadioactiveCloudPlugin extends ServerPlugin {
|
||||
|
||||
@Override
|
||||
public void init(GameServer gameServer) {
|
||||
|
||||
LogManager.LOGGER.info("(Radioactive cloud Plugin) Initialised Radioactive cloud plugin.");
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
classpath=net.simon987.pluginradioactivecloud.RadioactiveCloudPlugin
|
||||
name=Radioactive cloud Plugin
|
||||
version=1.4
|
18
README.md
18
README.md
@ -44,7 +44,7 @@ mvn package
|
||||
|
||||
# Run
|
||||
cd target
|
||||
java -jar server-1.4a.jar
|
||||
java -jar muchassemblyrequired-*.jar
|
||||
```
|
||||
|
||||
## Windows (tested on Windows 10)
|
||||
@ -75,7 +75,7 @@ mongod
|
||||
```batch
|
||||
:: Runs the MAR server
|
||||
cd Much-Assembly-Required\target
|
||||
java -jar server-1.4a.jar
|
||||
java -jar muchassemblyrequired-*.jar
|
||||
```
|
||||
|
||||
## macOS (tested on Sierra 10.12.6)
|
||||
@ -136,7 +136,7 @@ If you do not wish to use the default data directory (/data/db), follow the step
|
||||
|
||||
# Run
|
||||
cd target
|
||||
java -jar server-1.4a.jar
|
||||
java -jar muchassemblyrequired-*.jar
|
||||
```
|
||||
|
||||
## Docker
|
||||
@ -155,18 +155,6 @@ application's directory:
|
||||
Make sure to change `mongo_address` in `config.properties` to `mongodb`.
|
||||
|
||||
|
||||
## Vagrant
|
||||
### Requirements
|
||||
1. [Vagrant](https://www.vagrantup.com/downloads.html)
|
||||
2. [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
|
||||
|
||||
### Installation
|
||||
|
||||
When vagrant is installed, you can build and start this application by running the following
|
||||
command inside this application's directory:
|
||||
|
||||
`vagrant up`
|
||||
|
||||
# Running
|
||||
|
||||
Once the server is running, you should be able to connect to `http://localhost:4567` with your browser
|
||||
|
142
Server/pom.xml
142
Server/pom.xml
@ -1,142 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<build>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-resources</id>
|
||||
<!-- here the phase you need -->
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>../target/</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>../Server/src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<version>3.6.2</version>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<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>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<outputDirectory>../target</outputDirectory>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>net.simon987.server.Main</mainClass>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>libs/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<configuration>
|
||||
<forkMode>never</forkMode>
|
||||
<workingDirectory>./src/main/resources</workingDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>1.4a</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>mongodb-driver-sync</artifactId>
|
||||
<version>3.9.1</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-core -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
<version>5.1.11.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sparkjava</groupId>
|
||||
<artifactId>spark-core</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sparkjava</groupId>
|
||||
<artifactId>spark-template-velocity</artifactId>
|
||||
<version>2.7.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<!-- explicitly set build encoding so not altered by build platform defaults -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@ -1,43 +0,0 @@
|
||||
package net.simon987.server.event;
|
||||
|
||||
import net.simon987.server.plugin.PluginManager;
|
||||
import net.simon987.server.plugin.ServerPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class GameEventDispatcher {
|
||||
|
||||
private PluginManager pluginManager;
|
||||
|
||||
private ArrayList<GameEventListener> listeners;
|
||||
|
||||
public GameEventDispatcher(PluginManager pluginManager) {
|
||||
this.pluginManager = pluginManager;
|
||||
listeners = new ArrayList<>(5);
|
||||
}
|
||||
|
||||
public void dispatch(GameEvent event) {
|
||||
|
||||
//Dispatch to 'local' listeners
|
||||
for (GameEventListener listener : listeners) {
|
||||
if (event.getClass().equals(listener.getListenedEventType())) {
|
||||
listener.handle(event);
|
||||
}
|
||||
}
|
||||
|
||||
//Dispatch to plugins
|
||||
for (ServerPlugin plugin : pluginManager.getPlugins()) {
|
||||
for (GameEventListener listener : plugin.getListeners()) {
|
||||
if (event.getClass().equals(listener.getListenedEventType())) {
|
||||
listener.handle(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<GameEventListener> getListeners() {
|
||||
return listeners;
|
||||
}
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
package net.simon987.server.plugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public class PluginManager {
|
||||
|
||||
private ArrayList<ServerPlugin> loadedPlugins;
|
||||
private ArrayList<ServerPlugin> toLoadPlugins;
|
||||
|
||||
private GameServer gameServer;
|
||||
|
||||
public PluginManager(GameServer gameServer) {
|
||||
this.gameServer = gameServer;
|
||||
this.toLoadPlugins = new ArrayList<>(10);
|
||||
this.loadedPlugins = new ArrayList<>(10);
|
||||
}
|
||||
|
||||
private ServerPlugin load(File pluginFile) {
|
||||
|
||||
LogManager.LOGGER.info("Loading plugin file " + pluginFile.getName());
|
||||
|
||||
ZipFile zipFile = null;
|
||||
try {
|
||||
//Get the plugin config file from the archive
|
||||
zipFile = new ZipFile(pluginFile);
|
||||
|
||||
ZipEntry configEntry = zipFile.getEntry("plugin.properties");
|
||||
|
||||
if (configEntry != null) {
|
||||
|
||||
InputStream stream = zipFile.getInputStream(configEntry);
|
||||
Properties pluginConfig = new Properties();
|
||||
pluginConfig.load(stream);
|
||||
|
||||
ClassLoader loader = URLClassLoader.newInstance(new URL[]{pluginFile.toURI().toURL()});
|
||||
Class<?> aClass = Class.forName(pluginConfig.getProperty("classpath"), true, loader);
|
||||
Class<? extends ServerPlugin> pluginClass = aClass.asSubclass(ServerPlugin.class);
|
||||
Constructor<? extends ServerPlugin> constructor = pluginClass.getConstructor();
|
||||
|
||||
ServerPlugin plugin = constructor.newInstance();
|
||||
plugin.setName(pluginConfig.getProperty("name"));
|
||||
plugin.setVersion(pluginConfig.getProperty("version"));
|
||||
|
||||
String dependStr = pluginConfig.getProperty("depend");
|
||||
if (dependStr != null) {
|
||||
for (String dep : dependStr.split(",")) {
|
||||
plugin.dependencies.add(dep.trim());
|
||||
}
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
} else {
|
||||
LogManager.LOGGER.severe("Couldn't find plugin.properties in " + pluginFile.getName());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} finally {
|
||||
try {
|
||||
if (zipFile != null) {
|
||||
zipFile.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all plugins in plugins folder, if it doesn't exist, create it
|
||||
*
|
||||
* @return true if all the plugins could be loaded
|
||||
*/
|
||||
public boolean loadInFolder(String dir) {
|
||||
|
||||
File pluginDir = new File(dir);
|
||||
File[] pluginDirListing = pluginDir.listFiles();
|
||||
|
||||
if (pluginDirListing == null) {
|
||||
if (!pluginDir.mkdir()) {
|
||||
LogManager.LOGGER.severe("Couldn't create plugin directory");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
for (File pluginFile : pluginDirListing) {
|
||||
if (pluginFile.getName().endsWith(".jar")) {
|
||||
toLoadPlugins.add(load(pluginFile));
|
||||
}
|
||||
}
|
||||
|
||||
while (toLoadPlugins.size() > 0) {
|
||||
|
||||
ServerPlugin plugin = toLoadPlugins.get(0);
|
||||
|
||||
if (!initWithDependencies(plugin)) {
|
||||
LogManager.LOGGER.severe("Plugin " + plugin.name + " has unmet dependencies: " +
|
||||
Arrays.toString(plugin.dependencies.toArray()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
toLoadPlugins.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean initWithDependencies(ServerPlugin plugin) {
|
||||
|
||||
for (String depName : plugin.dependencies) {
|
||||
|
||||
if (!isLoaded(depName)) {
|
||||
ServerPlugin dep = getPluginByName(depName, toLoadPlugins);
|
||||
|
||||
if (dep != null) {
|
||||
initWithDependencies(dep);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initPlugin(plugin);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static ServerPlugin getPluginByName(String name, List<ServerPlugin> plugins) {
|
||||
|
||||
for (ServerPlugin p : plugins) {
|
||||
if (p.name.equals(name)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ServerPlugin getPluginByName(String name) {
|
||||
return PluginManager.getPluginByName(name, loadedPlugins);
|
||||
}
|
||||
|
||||
private boolean isLoaded(String name) {
|
||||
return getPluginByName(name, loadedPlugins) != null;
|
||||
}
|
||||
|
||||
private void initPlugin(ServerPlugin plugin) {
|
||||
|
||||
toLoadPlugins.remove(plugin);
|
||||
loadedPlugins.add(plugin);
|
||||
plugin.init(gameServer);
|
||||
}
|
||||
|
||||
public ArrayList<ServerPlugin> getPlugins() {
|
||||
return loadedPlugins;
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package net.simon987.server.plugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.io.MongoSerializable;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ServerPlugin implements MongoSerializable {
|
||||
|
||||
/**
|
||||
* Name of the plugin
|
||||
*/
|
||||
protected String name;
|
||||
|
||||
/**
|
||||
* Version of the plugin
|
||||
*/
|
||||
protected String version;
|
||||
|
||||
/**
|
||||
* List of event listeners
|
||||
*/
|
||||
protected List<GameEventListener> listeners = new ArrayList<>(5);
|
||||
|
||||
protected List<String> dependencies = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Called when the plugin is loaded
|
||||
*/
|
||||
public abstract void init(GameServer gameServer);
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public List<GameEventListener> getListeners() {
|
||||
return listeners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document mongoSerialise() {
|
||||
Document document = new Document();
|
||||
|
||||
document.put("version", version);
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
public void load(Document document) {
|
||||
|
||||
LogManager.LOGGER.fine(String.format("(%s) Loading from database", name));
|
||||
if (!version.equals(document.getString("version"))) {
|
||||
LogManager.LOGGER.warning(String.format("(%s) Version mismatch with database!" +
|
||||
" This could cause problems. %s!=%s", name, version, document.getString("version")));
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
package net.simon987.server.assembly;
|
||||
|
||||
public class CPUTest {
|
||||
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package net.simon987.server.assembly.instruction;
|
||||
|
||||
public class CallInstructionTest {
|
||||
|
||||
|
||||
|
||||
}
|
5
Vagrantfile
vendored
5
Vagrantfile
vendored
@ -1,5 +0,0 @@
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.vm.provision :shell, path: "bootstrap.sh"
|
||||
config.vm.network "forwarded_port", guest: 4567, host: 4567
|
||||
end
|
13
bootstrap.sh
13
bootstrap.sh
@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# This file is ran during vagrant provision
|
||||
add-apt-repository ppa:webupd8team/java
|
||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
|
||||
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.6 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.6.list
|
||||
apt-get update
|
||||
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
|
||||
apt-get install -y git maven oracle-java8-installer mongodb-org-server
|
||||
cd /vagrant/
|
||||
mvn clean
|
||||
mvn install
|
||||
cd target
|
||||
java -jar server-1.4a.jar
|
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server_root</artifactId>
|
||||
<version>1.4a</version>
|
||||
</parent>
|
||||
|
||||
<groupId>net.simon987.plugincontruction</groupId>
|
||||
<artifactId>plugin-construction</artifactId>
|
||||
<version>1.4a</version>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>1.4a</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,24 +0,0 @@
|
||||
package net.simon987.constructionplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.objects.GameRegistry;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.plugin.ServerPlugin;
|
||||
|
||||
public class ConstructionPlugin extends ServerPlugin {
|
||||
|
||||
@Override
|
||||
public void init(GameServer gameServer) {
|
||||
|
||||
BluePrintUtil.setSecretKey(gameServer.getSecretKey());
|
||||
GameRegistry gameRegistry = gameServer.getRegistry();
|
||||
|
||||
gameRegistry.registerItem(ItemBluePrint.ID, ItemBluePrint.class);
|
||||
gameRegistry.registerGameObject(Obstacle.class);
|
||||
gameRegistry.registerGameObject(ConstructionSite.class);
|
||||
|
||||
BluePrintRegistry.INSTANCE.registerBluePrint(ObstacleBlueprint.class);
|
||||
|
||||
LogManager.LOGGER.info("(Construction Plugin) Initialized construction plugin");
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
classpath=net.simon987.constructionplugin.ConstructionPlugin
|
||||
name=Construction Plugin
|
||||
version=1.0
|
138
pom.xml
138
pom.xml
@ -4,13 +4,30 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>net.simon987.server</groupId>
|
||||
<artifactId>server_root</artifactId>
|
||||
<version>1.4a</version>
|
||||
<packaging>pom</packaging>
|
||||
<groupId>net.simon987.mar</groupId>
|
||||
<artifactId>muchassemblyrequired</artifactId>
|
||||
<version>1.6a</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<executable>tsc</executable>
|
||||
<workingDirectory>./src/main/typescript/</workingDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<version>3.6.2</version>
|
||||
@ -20,36 +37,119 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-resources</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>./target/</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>./src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</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>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<outputDirectory>../target/plugins</outputDirectory>
|
||||
<outputDirectory>./target</outputDirectory>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addClasspath>false</addClasspath>
|
||||
<mainClass>net.simon987.server.Main</mainClass>
|
||||
<mainClass>net.simon987.mar.server.Main</mainClass>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>libs/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<configuration>
|
||||
<forkMode>never</forkMode>
|
||||
<workingDirectory>./src/main/resources</workingDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<modules>
|
||||
<module>Server</module>
|
||||
<module>Plugin Plant</module>
|
||||
<module>Plugin NPC</module>
|
||||
<module>Plugin Misc HW</module>
|
||||
<module>Plugin Cubot</module>
|
||||
<module>Plugin Radioactive Cloud</module>
|
||||
<module>plugin-contruction</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>mongodb-driver-sync</artifactId>
|
||||
<version>3.9.1</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-core -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
<version>5.1.11.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sparkjava</groupId>
|
||||
<artifactId>spark-core</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sparkjava</groupId>
|
||||
<artifactId>spark-template-velocity</artifactId>
|
||||
<version>2.7.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<!-- explicitly set build encoding so not altered by build platform defaults -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.simon987.biomassplugin;
|
||||
package net.simon987.mar.biomass;
|
||||
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.server.game.objects.InventoryHolder;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import net.simon987.mar.server.game.objects.InventoryHolder;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,9 +1,8 @@
|
||||
package net.simon987.biomassplugin;
|
||||
package net.simon987.mar.biomass;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.server.game.objects.Rechargeable;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
public class ItemBiomass extends Item {
|
||||
@ -27,9 +26,7 @@ public class ItemBiomass extends Item {
|
||||
|
||||
@Override
|
||||
public void clear(ControllableUnit unit) {
|
||||
if (unit instanceof Rechargeable) {
|
||||
((Rechargeable) unit).storeEnergy(energy);
|
||||
}
|
||||
unit.storeEnergy(energy);
|
||||
}
|
||||
|
||||
@Override
|
@ -1,8 +1,8 @@
|
||||
package net.simon987.biomassplugin;
|
||||
package net.simon987.mar.biomass;
|
||||
|
||||
import net.simon987.server.game.world.TileMap;
|
||||
import net.simon987.server.game.world.TilePlain;
|
||||
import net.simon987.server.game.world.World;
|
||||
import net.simon987.mar.server.game.world.TileMap;
|
||||
import net.simon987.mar.server.game.world.TilePlain;
|
||||
import net.simon987.mar.server.game.world.World;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import java.awt.*;
|
@ -1,12 +1,12 @@
|
||||
package net.simon987.biomassplugin.event;
|
||||
package net.simon987.mar.biomass.event;
|
||||
|
||||
import net.simon987.biomassplugin.BiomassBlob;
|
||||
import net.simon987.server.IServerConfiguration;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.event.ObjectDeathEvent;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.server.game.world.World;
|
||||
import net.simon987.mar.biomass.BiomassBlob;
|
||||
import net.simon987.mar.server.IServerConfiguration;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.event.ObjectDeathEvent;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import net.simon987.mar.server.game.world.World;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
/**
|
||||
@ -14,7 +14,7 @@ import org.bson.types.ObjectId;
|
||||
*/
|
||||
public class ObjectDeathListener implements GameEventListener {
|
||||
|
||||
private int biomassDropCount;
|
||||
private final int biomassDropCount;
|
||||
|
||||
public ObjectDeathListener(IServerConfiguration config) {
|
||||
biomassDropCount = config.getInt("harvester_biomass_drop_count");
|
||||
@ -28,9 +28,9 @@ public class ObjectDeathListener implements GameEventListener {
|
||||
@Override
|
||||
public void handle(GameEvent event) {
|
||||
|
||||
if (event.getSource().getClass().getCanonicalName().equals("net.simon987.npcplugin.HarvesterNPC")) {
|
||||
if (event.getSource().getClass().getCanonicalName().equals("net.simon987.mar.npcplugin.HarvesterNPC")) {
|
||||
//An HarvesterNPC ObjectDeathEvent is received
|
||||
GameObject dyingHarvesterNPC = (GameObject)event.getSource();
|
||||
GameObject dyingHarvesterNPC = (GameObject) event.getSource();
|
||||
|
||||
//Don't spawn biomass on World border
|
||||
if (dyingHarvesterNPC.getX() != 0 && dyingHarvesterNPC.getX() != dyingHarvesterNPC.getWorld().getWorldSize() - 1 &&
|
@ -1,11 +1,11 @@
|
||||
package net.simon987.biomassplugin.event;
|
||||
package net.simon987.mar.biomass.event;
|
||||
|
||||
import net.simon987.biomassplugin.BiomassBlob;
|
||||
import net.simon987.biomassplugin.WorldUtils;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.event.WorldGenerationEvent;
|
||||
import net.simon987.mar.biomass.BiomassBlob;
|
||||
import net.simon987.mar.biomass.WorldUtils;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.event.WorldGenerationEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.simon987.biomassplugin.event;
|
||||
package net.simon987.mar.biomass.event;
|
||||
|
||||
import net.simon987.biomassplugin.BiomassBlob;
|
||||
import net.simon987.biomassplugin.WorldUtils;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.IServerConfiguration;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.event.WorldUpdateEvent;
|
||||
import net.simon987.server.game.world.World;
|
||||
import net.simon987.mar.biomass.BiomassBlob;
|
||||
import net.simon987.mar.biomass.WorldUtils;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.IServerConfiguration;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.event.WorldUpdateEvent;
|
||||
import net.simon987.mar.server.game.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -15,7 +15,7 @@ import java.util.HashMap;
|
||||
|
||||
public class WorldUpdateListener implements GameEventListener {
|
||||
|
||||
private HashMap<World, Long> worldWaitMap = new HashMap<>(200);
|
||||
private final HashMap<World, Long> worldWaitMap = new HashMap<>(200);
|
||||
|
||||
private static int minBlobCount;
|
||||
private static int maxBlobCount;
|
||||
@ -72,4 +72,4 @@ public class WorldUpdateListener implements GameEventListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.constructionplugin;
|
||||
package net.simon987.mar.construction;
|
||||
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.server.game.objects.InventoryHolder;
|
||||
import net.simon987.server.io.JSONSerializable;
|
||||
import net.simon987.server.io.MongoSerializable;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import net.simon987.mar.server.game.objects.InventoryHolder;
|
||||
import net.simon987.mar.server.io.JSONSerializable;
|
||||
import net.simon987.mar.server.io.MongoSerializable;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.simon987.constructionplugin;
|
||||
package net.simon987.mar.construction;
|
||||
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.mar.server.logging.LogManager;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@ -11,8 +11,8 @@ public class BluePrintRegistry {
|
||||
|
||||
public static final BluePrintRegistry INSTANCE = new BluePrintRegistry();
|
||||
|
||||
private Map<String, Class<? extends BluePrint>> blueprints;
|
||||
private Map<String, String> digitizedBlueprints;
|
||||
private final Map<String, Class<? extends BluePrint>> blueprints;
|
||||
private final Map<String, String> digitizedBlueprints;
|
||||
|
||||
private BluePrintRegistry() {
|
||||
blueprints = new HashMap<>();
|
@ -1,4 +1,4 @@
|
||||
package net.simon987.constructionplugin;
|
||||
package net.simon987.mar.construction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
@ -0,0 +1,12 @@
|
||||
package net.simon987.mar.construction;
|
||||
|
||||
import net.simon987.mar.server.GameServer;
|
||||
|
||||
public class ConstructionPlugin {
|
||||
|
||||
public void init(GameServer gameServer) {
|
||||
// TODO
|
||||
BluePrintUtil.setSecretKey(gameServer.getSecretKey());
|
||||
BluePrintRegistry.INSTANCE.registerBluePrint(ObstacleBlueprint.class);
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.constructionplugin;
|
||||
package net.simon987.mar.construction;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.objects.InventoryHolder;
|
||||
import net.simon987.server.game.objects.Structure;
|
||||
import net.simon987.server.game.objects.Updatable;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.objects.InventoryHolder;
|
||||
import net.simon987.mar.server.game.objects.Structure;
|
||||
import net.simon987.mar.server.game.objects.Updatable;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@ -14,7 +14,7 @@ public class ConstructionSite extends Structure implements Updatable, InventoryH
|
||||
public static final int LIFETIME = GameServer.INSTANCE.getConfig().getInt("construction_site_ttl");
|
||||
|
||||
private int age;
|
||||
private BluePrint bluePrint;
|
||||
private final BluePrint bluePrint;
|
||||
|
||||
public ConstructionSite(BluePrint bluePrint) {
|
||||
super(1, 1);
|
@ -1,7 +1,7 @@
|
||||
package net.simon987.constructionplugin;
|
||||
package net.simon987.mar.construction;
|
||||
|
||||
import net.simon987.server.assembly.Memory;
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.mar.server.assembly.Memory;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.simon987.constructionplugin;
|
||||
package net.simon987.mar.construction;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.objects.Attackable;
|
||||
import net.simon987.server.game.objects.Structure;
|
||||
import net.simon987.server.game.objects.Updatable;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.game.objects.Attackable;
|
||||
import net.simon987.mar.server.game.objects.Structure;
|
||||
import net.simon987.mar.server.game.objects.Updatable;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.simon987.constructionplugin;
|
||||
package net.simon987.mar.construction;
|
||||
|
||||
import net.simon987.server.game.item.ItemIron;
|
||||
import net.simon987.mar.server.game.item.ItemIron;
|
||||
import org.bson.Document;
|
||||
|
||||
public class ObstacleBlueprint extends BluePrint {
|
@ -1,19 +1,19 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.cubotplugin.event.CubotWalkEvent;
|
||||
import net.simon987.cubotplugin.event.DeathEvent;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.IServerConfiguration;
|
||||
import net.simon987.server.assembly.CPU;
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Memory;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.assembly.exception.CancelledException;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.item.ItemVoid;
|
||||
import net.simon987.server.game.objects.*;
|
||||
import net.simon987.server.user.User;
|
||||
import net.simon987.mar.cubot.event.CubotWalkEvent;
|
||||
import net.simon987.mar.cubot.event.DeathEvent;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.IServerConfiguration;
|
||||
import net.simon987.mar.server.assembly.CPU;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Memory;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.assembly.exception.CancelledException;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.item.ItemVoid;
|
||||
import net.simon987.mar.server.game.objects.*;
|
||||
import net.simon987.mar.server.user.User;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@ -74,7 +74,7 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Me
|
||||
/**
|
||||
* Buffer of console messages (also called 'internal buffer') that was set during the current tick
|
||||
*/
|
||||
private ArrayList<char[]> consoleMessagesBuffer = new ArrayList<>(CONSOLE_BUFFER_MAX_SIZE);
|
||||
private final ArrayList<char[]> consoleMessagesBuffer = new ArrayList<>(CONSOLE_BUFFER_MAX_SIZE);
|
||||
/**
|
||||
* Buffer of console messages (also called 'internal buffer') at the end of the last tick
|
||||
*/
|
||||
@ -101,8 +101,8 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Me
|
||||
/**
|
||||
* List of attached hardware, 'modules'
|
||||
*/
|
||||
private Map<Integer, HardwareModule> hardwareAddresses = new HashMap<>();
|
||||
private Map<Class<? extends HardwareModule>, Integer> hardwareModules = new HashMap<>();
|
||||
private final Map<Integer, HardwareModule> hardwareAddresses = new HashMap<>();
|
||||
private final Map<Class<? extends HardwareModule>, Integer> hardwareModules = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Cubot's brain box
|
||||
@ -395,7 +395,7 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Me
|
||||
|
||||
/**
|
||||
* Damages shield by amount.
|
||||
*
|
||||
*
|
||||
* Return damage that broke through the shield.
|
||||
*/
|
||||
public int damageShield(int amount) {
|
@ -1,9 +1,9 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.server.game.objects.MessageReceiver;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import net.simon987.mar.server.game.objects.MessageReceiver;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.awt.*;
|
||||
@ -39,7 +39,7 @@ public class CubotComPort extends HardwareModule {
|
||||
if (a == COMPORT_BUFFER_CLEAR) {
|
||||
|
||||
unit.getConsoleMessagesBuffer().clear();
|
||||
|
||||
|
||||
} else if (a == COMPORT_CONSOLE_CLEAR) {
|
||||
|
||||
if (unit instanceof Cubot) {
|
@ -1,8 +1,8 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotCore extends HardwareModule {
|
@ -1,11 +1,11 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.objects.Action;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.server.game.world.Tile;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.objects.Action;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.game.world.Tile;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotDrill extends HardwareModule {
|
@ -1,7 +1,7 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotFloppyDrive extends CubotHardwareModule {
|
||||
@ -17,7 +17,7 @@ public class CubotFloppyDrive extends CubotHardwareModule {
|
||||
private static final int FLOPPY_READ_SECTOR = 2;
|
||||
private static final int FLOPPY_WRITE_SECTOR = 3;
|
||||
|
||||
private FloppyDisk floppyDisk;
|
||||
private final FloppyDisk floppyDisk;
|
||||
|
||||
public CubotFloppyDrive(Cubot cubot) {
|
||||
super(cubot);
|
@ -1,7 +1,7 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
public abstract class CubotHardwareModule extends HardwareModule {
|
@ -1,8 +1,8 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -25,7 +25,7 @@ public class CubotInventory extends HardwareModule {
|
||||
private static final int INV_SCAN = 3;
|
||||
|
||||
private int inventorySize = 4; //TODO: load from config
|
||||
private Map<Integer, Item> inventory;
|
||||
private final Map<Integer, Item> inventory;
|
||||
private int position = 0;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotKeyboard extends CubotHardwareModule {
|
@ -1,9 +1,9 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.*;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.*;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.awt.*;
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.Action;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.server.game.objects.Direction;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.Action;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.game.objects.Direction;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotLeg extends HardwareModule {
|
@ -1,11 +1,11 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Memory;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.server.game.pathfinding.Node;
|
||||
import net.simon987.server.game.pathfinding.Pathfinder;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Memory;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.game.pathfinding.Node;
|
||||
import net.simon987.mar.server.game.pathfinding.Pathfinder;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -125,7 +125,7 @@ public class CubotLidar extends HardwareModule {
|
||||
getCpu().getRegisterSet().getRegister("X").setValue(unit.getWorld().getX());
|
||||
getCpu().getRegisterSet().getRegister("Y").setValue(unit.getWorld().getY());
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotShield extends CubotHardwareModule {
|
||||
@ -41,4 +41,4 @@ public class CubotShield extends CubotHardwareModule {
|
||||
getCpu().getRegisterSet().getRegister("B").setValue(shield);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
/**
|
||||
* Status of a Cubot (Special buff or debuff)
|
@ -1,8 +1,8 @@
|
||||
package net.simon987.cubotplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
|
||||
import net.simon987.server.assembly.Memory;
|
||||
import net.simon987.server.io.MongoSerializable;
|
||||
import net.simon987.mar.server.assembly.Memory;
|
||||
import net.simon987.mar.server.io.MongoSerializable;
|
||||
import org.bson.Document;
|
||||
|
||||
/**
|
||||
@ -15,7 +15,7 @@ public class FloppyDisk implements MongoSerializable {
|
||||
/**
|
||||
* Contents of the disk
|
||||
*/
|
||||
private Memory memory;
|
||||
private final Memory memory;
|
||||
|
||||
/**
|
||||
* Current location of the read/write head.
|
@ -1,11 +1,11 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.cubotplugin.Cubot;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.event.DebugCommandEvent;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.mar.cubot.Cubot;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.event.DebugCommandEvent;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
|
||||
/**
|
||||
* Debug command to add shield points to a Cubot
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.cubotplugin.*;
|
||||
import net.simon987.server.assembly.CPU;
|
||||
import net.simon987.server.event.CpuInitialisationEvent;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.mar.cubot.*;
|
||||
import net.simon987.mar.server.assembly.CPU;
|
||||
import net.simon987.mar.server.event.CpuInitialisationEvent;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
|
||||
public class CpuInitialisationListener implements GameEventListener {
|
||||
@Override
|
@ -1,17 +1,17 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
|
||||
import net.simon987.cubotplugin.Cubot;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
|
||||
public class CubotWalkEvent extends GameEvent {
|
||||
|
||||
public CubotWalkEvent(Cubot cubot) {
|
||||
setSource(cubot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cubot getSource() {
|
||||
return (Cubot) super.getSource();
|
||||
}
|
||||
|
||||
}
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.mar.cubot.Cubot;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
|
||||
public class CubotWalkEvent extends GameEvent {
|
||||
|
||||
public CubotWalkEvent(Cubot cubot) {
|
||||
setSource(cubot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cubot getSource() {
|
||||
return (Cubot) super.getSource();
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
|
||||
public class DeathEvent extends GameEvent {
|
||||
|
||||
public DeathEvent(GameObject object) {
|
||||
setSource(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameObject getSource() {
|
||||
return (GameObject) super.getSource();
|
||||
}
|
||||
}
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
|
||||
public class DeathEvent extends GameEvent {
|
||||
|
||||
public DeathEvent(GameObject object) {
|
||||
setSource(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameObject getSource() {
|
||||
return (GameObject) super.getSource();
|
||||
}
|
||||
}
|
@ -1,23 +1,23 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
|
||||
public class DeathListener implements GameEventListener {
|
||||
|
||||
@Override
|
||||
public Class getListenedEventType() {
|
||||
return DeathEvent.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(GameEvent event) {
|
||||
DeathEvent DeathEvent = (DeathEvent) event;
|
||||
GameObject object = DeathEvent.getSource();
|
||||
if (object instanceof ControllableUnit) {
|
||||
((ControllableUnit) object).getParent().getStats().incrementStat("death", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
|
||||
public class DeathListener implements GameEventListener {
|
||||
|
||||
@Override
|
||||
public Class getListenedEventType() {
|
||||
return DeathEvent.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(GameEvent event) {
|
||||
DeathEvent DeathEvent = (DeathEvent) event;
|
||||
GameObject object = DeathEvent.getSource();
|
||||
if (object instanceof ControllableUnit) {
|
||||
((ControllableUnit) object).getParent().getStats().incrementStat("death", 1);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.cubotplugin.Cubot;
|
||||
import net.simon987.cubotplugin.CubotInventory;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.event.DebugCommandEvent;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.mar.cubot.Cubot;
|
||||
import net.simon987.mar.cubot.CubotInventory;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.event.DebugCommandEvent;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
|
||||
public class PopItemCommandListener implements GameEventListener {
|
||||
|
||||
@ -40,4 +40,4 @@ public class PopItemCommandListener implements GameEventListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.cubotplugin.Cubot;
|
||||
import net.simon987.cubotplugin.CubotInventory;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.event.DebugCommandEvent;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.mar.cubot.Cubot;
|
||||
import net.simon987.mar.cubot.CubotInventory;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.event.DebugCommandEvent;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import org.bson.Document;
|
||||
|
||||
public class PutItemCommandListener implements GameEventListener {
|
@ -1,12 +1,12 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.cubotplugin.Cubot;
|
||||
import net.simon987.cubotplugin.CubotInventory;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.event.DebugCommandEvent;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.mar.cubot.Cubot;
|
||||
import net.simon987.mar.cubot.CubotInventory;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.event.DebugCommandEvent;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
|
||||
public class SetInventoryPosition implements GameEventListener {
|
||||
|
@ -1,18 +1,18 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.cubotplugin.Cubot;
|
||||
import net.simon987.cubotplugin.CubotStatus;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.IServerConfiguration;
|
||||
import net.simon987.server.assembly.Assembler;
|
||||
import net.simon987.server.assembly.AssemblyResult;
|
||||
import net.simon987.server.assembly.CPU;
|
||||
import net.simon987.server.assembly.exception.CancelledException;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.event.UserCreationEvent;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.user.User;
|
||||
import net.simon987.mar.cubot.Cubot;
|
||||
import net.simon987.mar.cubot.CubotStatus;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.IServerConfiguration;
|
||||
import net.simon987.mar.server.assembly.Assembler;
|
||||
import net.simon987.mar.server.assembly.AssemblyResult;
|
||||
import net.simon987.mar.server.assembly.CPU;
|
||||
import net.simon987.mar.server.assembly.exception.CancelledException;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.event.UserCreationEvent;
|
||||
import net.simon987.mar.server.logging.LogManager;
|
||||
import net.simon987.mar.server.user.User;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import java.awt.*;
|
||||
@ -78,6 +78,6 @@ public class UserCreationListener implements GameEventListener {
|
||||
cubot.setMaxHp(config.getInt("cubot_max_hp"));
|
||||
cubot.setMaxShield(config.getInt("cubot_max_shield"));
|
||||
|
||||
LogManager.LOGGER.fine("(Plugin) Handled User creation event (Cubot Plugin)");
|
||||
LogManager.LOGGER.fine("Handled User creation event");
|
||||
}
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
package net.simon987.cubotplugin.event;
|
||||
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
|
||||
public class WalkListener implements GameEventListener {
|
||||
|
||||
@Override
|
||||
public Class getListenedEventType() {
|
||||
return CubotWalkEvent.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(GameEvent event) {
|
||||
CubotWalkEvent walkEvent = (CubotWalkEvent) event;
|
||||
walkEvent.getSource().getParent().getStats().incrementStat("walkDistance", 1);
|
||||
}
|
||||
}
|
||||
package net.simon987.mar.cubot.event;
|
||||
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
|
||||
public class WalkListener implements GameEventListener {
|
||||
|
||||
@Override
|
||||
public Class getListenedEventType() {
|
||||
return CubotWalkEvent.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(GameEvent event) {
|
||||
CubotWalkEvent walkEvent = (CubotWalkEvent) event;
|
||||
walkEvent.getSource().getParent().getStats().incrementStat("walkDistance", 1);
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.mischwplugin;
|
||||
package net.simon987.mar.mischwplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.assembly.Util;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.assembly.Util;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
/**
|
@ -1,8 +1,8 @@
|
||||
package net.simon987.mischwplugin;
|
||||
package net.simon987.mar.mischwplugin;
|
||||
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.util.Random;
|
||||
@ -16,7 +16,7 @@ public class RandomNumberGenerator extends HardwareModule {
|
||||
|
||||
public static final char DEFAULT_ADDRESS = 0x0007;
|
||||
|
||||
private Random random;
|
||||
private final Random random;
|
||||
|
||||
public RandomNumberGenerator() {
|
||||
random = new Random();
|
@ -1,12 +1,12 @@
|
||||
package net.simon987.mischwplugin.event;
|
||||
package net.simon987.mar.mischwplugin.event;
|
||||
|
||||
import net.simon987.mischwplugin.Clock;
|
||||
import net.simon987.mischwplugin.RandomNumberGenerator;
|
||||
import net.simon987.server.assembly.CPU;
|
||||
import net.simon987.server.event.CpuInitialisationEvent;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.game.objects.HardwareHost;
|
||||
import net.simon987.mar.mischwplugin.Clock;
|
||||
import net.simon987.mar.mischwplugin.RandomNumberGenerator;
|
||||
import net.simon987.mar.server.assembly.CPU;
|
||||
import net.simon987.mar.server.event.CpuInitialisationEvent;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.game.objects.HardwareHost;
|
||||
|
||||
public class CpuInitialisationListener implements GameEventListener {
|
||||
|
||||
@ -19,7 +19,7 @@ public class CpuInitialisationListener implements GameEventListener {
|
||||
public void handle(GameEvent event) {
|
||||
|
||||
CPU cpu = (CPU) event.getSource();
|
||||
HardwareHost cubot = (HardwareHost) ((CpuInitialisationEvent) event).getUnit();
|
||||
HardwareHost cubot = ((CpuInitialisationEvent) event).getUnit();
|
||||
cpu.setHardwareHost(cubot);
|
||||
|
||||
RandomNumberGenerator rngHW = new RandomNumberGenerator();
|
||||
@ -30,4 +30,4 @@ public class CpuInitialisationListener implements GameEventListener {
|
||||
cpu.getHardwareHost().attachHardware(rngHW, RandomNumberGenerator.DEFAULT_ADDRESS);
|
||||
cpu.getHardwareHost().attachHardware(clock, Clock.DEFAULT_ADDRESS);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.Util;
|
||||
import net.simon987.server.game.objects.Attackable;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.server.game.objects.Rechargeable;
|
||||
import net.simon987.server.game.objects.Updatable;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.Util;
|
||||
import net.simon987.mar.server.game.objects.Attackable;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import net.simon987.mar.server.game.objects.Rechargeable;
|
||||
import net.simon987.mar.server.game.objects.Updatable;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@ -37,7 +37,7 @@ public class ElectricBox extends GameObject implements Updatable, Attackable {
|
||||
/**
|
||||
* List of nearby objects. Is updated every tick
|
||||
*/
|
||||
private ArrayList<Attackable> nearObjects = new ArrayList<>();
|
||||
private final ArrayList<Attackable> nearObjects = new ArrayList<>();
|
||||
|
||||
public ElectricBox() {
|
||||
hp = maxHp;
|
@ -1,7 +1,7 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.objects.Action;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.game.objects.Action;
|
||||
|
||||
public class ExecuteCpuTask extends NPCTask {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.objects.MessageReceiver;
|
||||
import net.simon987.server.game.objects.Structure;
|
||||
import net.simon987.server.game.objects.Updatable;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.game.objects.MessageReceiver;
|
||||
import net.simon987.mar.server.game.objects.Structure;
|
||||
import net.simon987.mar.server.game.objects.Updatable;
|
||||
import org.bson.Document;
|
||||
import org.bson.types.ObjectId;
|
||||
|
@ -1,15 +1,15 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.*;
|
||||
import net.simon987.server.event.ObjectDeathEvent;
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.item.ItemVoid;
|
||||
import net.simon987.server.game.objects.Action;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.server.game.objects.Direction;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.user.User;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.*;
|
||||
import net.simon987.mar.server.event.ObjectDeathEvent;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.item.ItemVoid;
|
||||
import net.simon987.mar.server.game.objects.Action;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.game.objects.Direction;
|
||||
import net.simon987.mar.server.logging.LogManager;
|
||||
import net.simon987.mar.server.user.User;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@ -23,16 +23,16 @@ public class HackedNPC extends NonPlayerCharacter implements ControllableUnit {
|
||||
private static final int MEM_SIZE = GameServer.INSTANCE.getConfig().getInt("hacked_npc_mem_size");
|
||||
private static final boolean DIE_ON_NO_ENERGY = GameServer.INSTANCE.getConfig().getInt("hacked_npc_die_on_no_energy") != 0;
|
||||
|
||||
private CPU cpu;
|
||||
private final CPU cpu;
|
||||
/**
|
||||
* List of attached hardware, 'modules'
|
||||
*/
|
||||
private Map<Integer, HardwareModule> hardwareAddresses = new HashMap<>();
|
||||
private Map<Class<? extends HardwareModule>, Integer> hardwareModules = new HashMap<>();
|
||||
private final Map<Integer, HardwareModule> hardwareAddresses = new HashMap<>();
|
||||
private final Map<Class<? extends HardwareModule>, Integer> hardwareModules = new HashMap<>();
|
||||
|
||||
private Action currentAction = Action.IDLE;
|
||||
private Action lastAction = Action.IDLE;
|
||||
private ArrayList<char[]> consoleMessagesBuffer = new ArrayList<>(30); //todo load from conf
|
||||
private final List<char[]> consoleMessagesBuffer = new ArrayList<>(30); //todo load from conf
|
||||
private ArrayList<char[]> lastConsoleMessagesBuffer = new ArrayList<>(30);
|
||||
|
||||
HackedNPC(char[] program) {
|
@ -1,11 +1,11 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
|
||||
import net.simon987.server.assembly.Util;
|
||||
import net.simon987.server.game.objects.Direction;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.server.game.objects.InventoryHolder;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.mar.server.assembly.Util;
|
||||
import net.simon987.mar.server.game.objects.Direction;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import net.simon987.mar.server.game.objects.InventoryHolder;
|
||||
import net.simon987.mar.server.logging.LogManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
@ -15,7 +15,7 @@ import java.util.Random;
|
||||
*/
|
||||
public class HarvestTask extends NPCTask {
|
||||
|
||||
private Random random;
|
||||
private final Random random;
|
||||
|
||||
/**
|
||||
* Number of ticks to wait before continuing
|
||||
@ -45,7 +45,7 @@ public class HarvestTask extends NPCTask {
|
||||
|
||||
if (pause == 0) {
|
||||
//Get biomass
|
||||
ArrayList<GameObject> biomass = npc.getWorld().findGameObjects("net.simon987.biomassplugin.BiomassBlob");
|
||||
ArrayList<GameObject> biomass = npc.getWorld().findGameObjects("net.simon987.mar.biomassplugin.BiomassBlob");
|
||||
|
||||
//Get closest one
|
||||
int minDist = Integer.MAX_VALUE;
|
@ -1,8 +1,8 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.event.ObjectDeathEvent;
|
||||
import net.simon987.server.game.objects.Direction;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.event.ObjectDeathEvent;
|
||||
import net.simon987.mar.server.game.objects.Direction;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
|
||||
public abstract class NPCTask {
|
@ -1,11 +1,11 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.Util;
|
||||
import net.simon987.server.game.objects.*;
|
||||
import net.simon987.server.game.pathfinding.Node;
|
||||
import net.simon987.server.game.pathfinding.Pathfinder;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.Util;
|
||||
import net.simon987.mar.server.game.objects.*;
|
||||
import net.simon987.mar.server.game.pathfinding.Node;
|
||||
import net.simon987.mar.server.game.pathfinding.Pathfinder;
|
||||
import net.simon987.mar.server.logging.LogManager;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.util.ArrayList;
|
@ -1,9 +1,9 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.item.Item;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.game.item.Item;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
|
||||
@ -106,4 +106,4 @@ public class NpcInventory extends HardwareModule {
|
||||
public String toString() {
|
||||
return String.format("{NpcInventory [%s]}", item);
|
||||
}
|
||||
}
|
||||
}
|
27
src/main/java/net/simon987/mar/npcplugin/NpcPlugin.java
Normal file
27
src/main/java/net/simon987/mar/npcplugin/NpcPlugin.java
Normal file
@ -0,0 +1,27 @@
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class NpcPlugin {
|
||||
|
||||
public static Map<String, Settlement> settlementMap;
|
||||
|
||||
public static Document DEFAULT_HACKED_NPC;
|
||||
|
||||
public void init(GameServer gameServer) {
|
||||
// TODO: save this in GameUniverse.store
|
||||
settlementMap = new ConcurrentHashMap<>();
|
||||
|
||||
// TODO: load from file relpath
|
||||
InputStream is = getClass().getClassLoader().getResourceAsStream("defaultHackedCubotHardware.json");
|
||||
Scanner scanner = new Scanner(is).useDelimiter("\\A");
|
||||
String json = scanner.next();
|
||||
DEFAULT_HACKED_NPC = Document.parse(json);
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.game.objects.Attackable;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.mar.server.game.objects.Attackable;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.objects.Enterable;
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.server.game.objects.Structure;
|
||||
import net.simon987.server.game.objects.Updatable;
|
||||
import net.simon987.server.game.world.Location;
|
||||
import net.simon987.server.game.world.World;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.game.objects.Enterable;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import net.simon987.mar.server.game.objects.Structure;
|
||||
import net.simon987.mar.server.game.objects.Updatable;
|
||||
import net.simon987.mar.server.game.world.Location;
|
||||
import net.simon987.mar.server.game.world.World;
|
||||
import org.bson.Document;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.assembly.HardwareModule;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.assembly.Util;
|
||||
import net.simon987.server.game.objects.Action;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
||||
import net.simon987.mar.server.assembly.Util;
|
||||
import net.simon987.mar.server.game.objects.Action;
|
||||
import net.simon987.mar.server.game.objects.ControllableUnit;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -18,7 +18,7 @@ public class RadioReceiverHardware extends HardwareModule {
|
||||
|
||||
public static final int DEFAULT_ADDRESS = 0xC;
|
||||
|
||||
private ControllableUnit cubot;
|
||||
private final ControllableUnit cubot;
|
||||
|
||||
public RadioReceiverHardware(ControllableUnit cubot) {
|
||||
this.cubot = cubot;
|
@ -1,9 +1,9 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.objects.MessageReceiver;
|
||||
import net.simon987.server.game.objects.Structure;
|
||||
import net.simon987.server.game.objects.Updatable;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.game.objects.MessageReceiver;
|
||||
import net.simon987.mar.server.game.objects.Structure;
|
||||
import net.simon987.mar.server.game.objects.Updatable;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
@ -34,7 +34,7 @@ public class RadioTower extends Structure implements MessageReceiver, Updatable
|
||||
/**
|
||||
* Messages from the current tick
|
||||
*/
|
||||
private ArrayList<char[]> messages = new ArrayList<>(4);
|
||||
private final ArrayList<char[]> messages = new ArrayList<>(4);
|
||||
|
||||
/**
|
||||
* Messages from the last tick
|
@ -1,10 +1,10 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.world.TilePlain;
|
||||
import net.simon987.server.game.world.World;
|
||||
import net.simon987.server.game.world.WorldGenerationException;
|
||||
import net.simon987.server.io.MongoSerializable;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.game.world.TilePlain;
|
||||
import net.simon987.mar.server.game.world.World;
|
||||
import net.simon987.mar.server.game.world.WorldGenerationException;
|
||||
import net.simon987.mar.server.io.MongoSerializable;
|
||||
import org.bson.Document;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
@ -17,12 +17,12 @@ public class Settlement implements MongoSerializable {
|
||||
private Factory factory = null;
|
||||
private RadioTower radioTower = null;
|
||||
private VaultDoor vaultDoor = null;
|
||||
private World world;
|
||||
private DifficultyLevel difficultyLevel;
|
||||
private final World world;
|
||||
private final DifficultyLevel difficultyLevel;
|
||||
|
||||
private List<NonPlayerCharacter> npcs = new ArrayList<>();
|
||||
private final List<NonPlayerCharacter> npcs = new ArrayList<>();
|
||||
|
||||
private char[] password;
|
||||
private final char[] password;
|
||||
|
||||
public Settlement(Document document) {
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.npcplugin.world.TileVaultFloor;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.IServerConfiguration;
|
||||
import net.simon987.server.game.objects.Direction;
|
||||
import net.simon987.server.game.world.Location;
|
||||
import net.simon987.server.game.world.World;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.mar.npcplugin.world.TileVaultFloor;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.IServerConfiguration;
|
||||
import net.simon987.mar.server.game.objects.Direction;
|
||||
import net.simon987.mar.server.game.world.Location;
|
||||
import net.simon987.mar.server.game.world.World;
|
||||
import net.simon987.mar.server.logging.LogManager;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import java.awt.*;
|
||||
@ -20,7 +20,7 @@ public class VaultDimension {
|
||||
/**
|
||||
* Name of the dimension
|
||||
*/
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
private World homeWorld;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.game.objects.*;
|
||||
import net.simon987.server.game.world.World;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.game.objects.*;
|
||||
import net.simon987.mar.server.game.world.World;
|
||||
import net.simon987.mar.server.logging.LogManager;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -26,7 +26,7 @@ public class VaultDoor extends Structure implements MessageReceiver, Enterable,
|
||||
/**
|
||||
* Number of ticks to remain the door open
|
||||
*/
|
||||
private int OPEN_TIME = GameServer.INSTANCE.getConfig().getInt("vault_door_open_time");
|
||||
private final int OPEN_TIME = GameServer.INSTANCE.getConfig().getInt("vault_door_open_time");
|
||||
|
||||
private int openedTimer = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.simon987.npcplugin;
|
||||
package net.simon987.mar.npcplugin;
|
||||
|
||||
import net.simon987.server.game.objects.GameObject;
|
||||
import net.simon987.server.game.world.Location;
|
||||
import net.simon987.mar.server.game.objects.GameObject;
|
||||
import net.simon987.mar.server.game.world.Location;
|
||||
import org.bson.Document;
|
||||
|
||||
/**
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user