Merge remote-tracking branch 'origin' into 021214renderer

Conflicts:
	src/net/mosstest/scripting/MossScriptEnv.java
master
Aaron Chan 2014-04-13 19:19:16 -04:00
commit fc95712e17
55 changed files with 4906 additions and 4911 deletions

6
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "data"]
path = data
url = https://github.com/mosstest/mosstest-game-default.git
[submodule "data"]
path = data
url = https://github.com/mosstest/mosstest-game-default.git

View File

@ -1,37 +1,37 @@
<assembly>
<id>exe</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory></outputDirectory>
<outputFileNameMapping>${artifactId}-${version}${dashClassifier?}-client.${extension}
</outputFileNameMapping>
<unpack>true</unpack>
<scope>runtime</scope>
<includes>
<include>commons-lang:commons-lang</include>
<include>org.apache.commons:commons-lang3</include>
<include>commons-collections:commons-collections</include>
<include>org.fusesource.leveldbjni:leveldbjni</include>
<include>org.lwjgl.lwjgl:lwjgl</include>
<include>net.java.jinput:jinput</include>
<include>jme3:jme3-desktop</include>
<include>jme3:jme3-lwjgl</include>
<include>jme3:jme3-lwjgl-natives</include>
<include>jme3:jme3-lwjgl-niftygui</include>
<include>jme3:niftygui</include>
<include>commons-cli:commons-cli</include>
<include>commons-configuration:commons-configuration</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>target/classes/</directory>
<outputDirectory></outputDirectory>
</fileSet>
</fileSets>
<assembly>
<id>exe</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory></outputDirectory>
<outputFileNameMapping>${artifactId}-${version}${dashClassifier?}-client.${extension}
</outputFileNameMapping>
<unpack>true</unpack>
<scope>runtime</scope>
<includes>
<include>commons-lang:commons-lang</include>
<include>org.apache.commons:commons-lang3</include>
<include>commons-collections:commons-collections</include>
<include>org.fusesource.leveldbjni:leveldbjni</include>
<include>org.lwjgl.lwjgl:lwjgl</include>
<include>net.java.jinput:jinput</include>
<include>jme3:jme3-desktop</include>
<include>jme3:jme3-lwjgl</include>
<include>jme3:jme3-lwjgl-natives</include>
<include>jme3:jme3-lwjgl-niftygui</include>
<include>jme3:niftygui</include>
<include>commons-cli:commons-cli</include>
<include>commons-configuration:commons-configuration</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>target/classes/</directory>
<outputDirectory></outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@ -1,38 +1,38 @@
<assembly>
<id>serverexe</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory></outputDirectory>
<outputFileNameMapping>${artifactId}-${version}${dashClassifier?}-server.${extension}
</outputFileNameMapping>
<unpack>true</unpack>
<scope>runtime</scope>
<includes>
<include>commons-lang:commons-lang</include>
<include>org.apache.commons:commons-lang3</include>
<include>commons-collections:commons-collections</include>
<include>org.fusesource.leveldbjni:leveldbjni</include>
<include>commons-cli:commons-cli</include>
<include>commons-configuration:commons-configuration</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>target/classes/net/mosstest/servercore</directory>
<outputDirectory>net/mosstest/servercore</outputDirectory>
</fileSet>
<fileSet>
<directory>target/classes/net/mosstest/scripting</directory>
<outputDirectory>net/mosstest/scripting</outputDirectory>
</fileSet>
<fileSet>
<directory>target/classes/net/mosstest/sandbox</directory>
<outputDirectory>net/mosstest/sandbox</outputDirectory>
</fileSet>
</fileSets>
<assembly>
<id>serverexe</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory></outputDirectory>
<outputFileNameMapping>${artifactId}-${version}${dashClassifier?}-server.${extension}
</outputFileNameMapping>
<unpack>true</unpack>
<scope>runtime</scope>
<includes>
<include>commons-lang:commons-lang</include>
<include>org.apache.commons:commons-lang3</include>
<include>commons-collections:commons-collections</include>
<include>org.fusesource.leveldbjni:leveldbjni</include>
<include>commons-cli:commons-cli</include>
<include>commons-configuration:commons-configuration</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>target/classes/net/mosstest/servercore</directory>
<outputDirectory>net/mosstest/servercore</outputDirectory>
</fileSet>
<fileSet>
<directory>target/classes/net/mosstest/scripting</directory>
<outputDirectory>net/mosstest/scripting</outputDirectory>
</fileSet>
<fileSet>
<directory>target/classes/net/mosstest/sandbox</directory>
<outputDirectory>net/mosstest/sandbox</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@ -1,7 +1,7 @@
cd ..
mkdir -p translate/servercore
mkdir -p translate/scripting
mkdir -p translate/launcher
msgcat -P src/net/mosstest/servercore/messages.properties -o translate/servercore/servercore.pot
msgcat -P src/net/mosstest/scripting/messages.properties -o translate/scripting/scripting.pot
msgcat -P src/net/mosstest/launcher/messages.properties -o translate/launcher/launcher.pot
cd ..
mkdir -p translate/servercore
mkdir -p translate/scripting
mkdir -p translate/launcher
msgcat -P src/net/mosstest/servercore/messages.properties -o translate/servercore/servercore.pot
msgcat -P src/net/mosstest/scripting/messages.properties -o translate/scripting/scripting.pot
msgcat -P src/net/mosstest/launcher/messages.properties -o translate/launcher/launcher.pot

View File

@ -1,2 +1,2 @@
20:04:00 <LandrushServer> <fuinur> lag is caused by minetest being very stupid. change 1 node - full 16x16x16 mapblock must be send. and blinky/mesecon/klots of other stuff is actually replacing nodes. also these changes are atacking on server. use drill in 10 places in 1 mapblock - server will send and confirm at least 10 updates to mapblock and inventory - which is idiotic. instead iyt should check that previous update is not sent yet and skip all in middle - sending on
19:59:04 <LandrushServer> <fuinur> textures on server are small already. and liong time is caused by server sending them one-by-one, each needing confirmation. do smaller texture data will stiull need lots of control traffic. this is minetest fault (unless i am very wrong)
20:04:00 <LandrushServer> <fuinur> lag is caused by minetest being very stupid. change 1 node - full 16x16x16 mapblock must be send. and blinky/mesecon/klots of other stuff is actually replacing nodes. also these changes are atacking on server. use drill in 10 places in 1 mapblock - server will send and confirm at least 10 updates to mapblock and inventory - which is idiotic. instead iyt should check that previous update is not sent yet and skip all in middle - sending on
19:59:04 <LandrushServer> <fuinur> textures on server are small already. and liong time is caused by server sending them one-by-one, each needing confirmation. do smaller texture data will stiull need lots of control traffic. this is minetest fault (unless i am very wrong)

672
pom.xml
View File

@ -1,336 +1,336 @@
<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>
<groupId>mosstest</groupId>
<artifactId>mosstest</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>Mosstest</name>
<description>Open-source voxel engine with some extra features</description>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>moss-forums</id>
<url>http://forum-mosstest.rhcloud.com/repository/</url>
</repository>
</repositories>
<build>
<testSourceDirectory>tests</testSourceDirectory>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.1.7</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<prefix>git</prefix>
<dateFormat>yyyy.MM.dd '@' HH:mm:ss z</dateFormat>
<verbose>true</verbose>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<skipPoms>true</skipPoms>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>src/git.properties</generateGitPropertiesFilename>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<gitDescribe>
<skip>false</skip>
<always>false</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
<forceLongFormat>false</forceLongFormat>
</gitDescribe>
</configuration>
</plugin>
<!-- END OF GIT COMMIT ID PLUGIN CONFIGURATION -->
<!-- <plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>clientbuild</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>buildcfg/assembly-client.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>net.mosstest.launcher.GUIClientsideLauncher</mainClass>
</manifest>
</archive>
</configuration>
</execution>
<execution>
<id>serverbuild</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>buildcfg/assembly-server.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>net.mosstest.launcher.ServerMain</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<!-- signed jars -->
<excludes>
<exclude>bouncycastle:bcprov-jdk15</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<!-- Main class -->
<mainClass>net.mosstest.servercore.MossWorld</mainClass>
</transformer>
<!-- Use resource transformers to prevent file overwrites -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>properties.properties</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>applicationContext.xml</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/cxf/cxf.extension</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/cxf/bus-extensions.xml</resource>
</transformer>
</transformers>
</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>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>-->
</plugins>
</build>
<url>https://github.com/mosstest/mosstest</url>
<issueManagement>
<system>Launchpad</system>
<url>https://bugs.launchpad.net/mosstest</url>
</issueManagement>
<ciManagement>
<system>Travis-CI</system>
</ciManagement>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>net.java.jinput</groupId>
<artifactId>jinput</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-desktop</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-lwjgl</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-lwjgl-natives</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-lwjgl-niftygui</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>niftygui</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>15.0</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
<version>1.7R2</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-core</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.fusesource.leveldbjni</groupId>
<artifactId>leveldbjni-all</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>parent</artifactId>
<version>2.9.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>lwjgl-workaround</artifactId>
<version>9.5.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</project>
<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>
<groupId>mosstest</groupId>
<artifactId>mosstest</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>Mosstest</name>
<description>Open-source voxel engine with some extra features</description>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>moss-forums</id>
<url>http://forum-mosstest.rhcloud.com/repository/</url>
</repository>
</repositories>
<build>
<testSourceDirectory>tests</testSourceDirectory>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.1.7</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<prefix>git</prefix>
<dateFormat>yyyy.MM.dd '@' HH:mm:ss z</dateFormat>
<verbose>true</verbose>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<skipPoms>true</skipPoms>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>src/git.properties</generateGitPropertiesFilename>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<gitDescribe>
<skip>false</skip>
<always>false</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
<forceLongFormat>false</forceLongFormat>
</gitDescribe>
</configuration>
</plugin>
<!-- END OF GIT COMMIT ID PLUGIN CONFIGURATION -->
<!-- <plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>clientbuild</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>buildcfg/assembly-client.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>net.mosstest.launcher.GUIClientsideLauncher</mainClass>
</manifest>
</archive>
</configuration>
</execution>
<execution>
<id>serverbuild</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>buildcfg/assembly-server.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>net.mosstest.launcher.ServerMain</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<!-- signed jars -->
<excludes>
<exclude>bouncycastle:bcprov-jdk15</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<!-- Main class -->
<mainClass>net.mosstest.servercore.MossWorld</mainClass>
</transformer>
<!-- Use resource transformers to prevent file overwrites -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>properties.properties</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>applicationContext.xml</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/cxf/cxf.extension</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/cxf/bus-extensions.xml</resource>
</transformer>
</transformers>
</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>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>-->
</plugins>
</build>
<url>https://github.com/mosstest/mosstest</url>
<issueManagement>
<system>Launchpad</system>
<url>https://bugs.launchpad.net/mosstest</url>
</issueManagement>
<ciManagement>
<system>Travis-CI</system>
</ciManagement>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>net.java.jinput</groupId>
<artifactId>jinput</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-desktop</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-lwjgl</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-lwjgl-natives</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-lwjgl-niftygui</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>niftygui</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>15.0</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
<version>1.7R2</version>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>jme3-core</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.fusesource.leveldbjni</groupId>
<artifactId>leveldbjni-all</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>parent</artifactId>
<version>2.9.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>jme3</groupId>
<artifactId>lwjgl-workaround</artifactId>
<version>9.5.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</project>

View File

@ -1,14 +1,14 @@
# Root logger option
log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=mosslog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %r %-5p %c{1} - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Root logger option
log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=mosslog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %r %-5p %c{1} - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %r %-5p %c{1} - %m%n

View File

@ -1,201 +1,201 @@
package net.mosstest.launcher;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
// TODO: Auto-generated Javadoc
/**
* The Class GUIBugReportDialog.
*/
public class GUIBugReportDialog extends JDialog {
/**
* The content panel.
*/
private final JPanel contentPanel = new JPanel();
/**
* The reporter name.
*/
private JTextField reporterName;
/**
* The email.
*/
private JTextField email;
/**
* The problem summary.
*/
private JTextField problemSummary;
/**
* The chckbx include technical information.
*/
private JCheckBox chckbxIncludeTechnicalInformation;
/**
* The lbl name.
*/
private JLabel lblName;
/**
* Launch the application.
*
* @param args the arguments
*/
public static void main(String[] args) {
GUIBugReportDialog dialog = new GUIBugReportDialog("test traceback");
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
}
/**
* Create the dialog.
*
* @param traceback the traceback
*/
public GUIBugReportDialog(String traceback) {
setModal(true);
setModalityType(ModalityType.APPLICATION_MODAL);
setMinimumSize(new Dimension(640, 480));
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
setTitle(Messages.getString("GUIBugReportDialog.DLG_BUG_TITLE")); //$NON-NLS-1$
setBounds(100, 100, 640, 480);
getContentPane().setLayout(new BorderLayout());
contentPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
{
JPanel namePanel = new JPanel();
namePanel.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(namePanel);
namePanel.setLayout(new BorderLayout(0, 0));
{
lblName = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_NAME")); //$NON-NLS-1$
namePanel.add(lblName, BorderLayout.WEST);
lblName.setHorizontalTextPosition(SwingConstants.LEFT);
lblName.setHorizontalAlignment(SwingConstants.LEFT);
lblName.setAlignmentY(Component.TOP_ALIGNMENT);
}
lblName.setLabelFor(reporterName);
{
this.reporterName = new JTextField();
namePanel.add(reporterName, BorderLayout.CENTER);
reporterName.setMaximumSize(new Dimension(2147483647, 20));
reporterName.setAlignmentY(Component.TOP_ALIGNMENT);
this.reporterName.setColumns(10);
}
}
{
JPanel emailPanel = new JPanel();
emailPanel.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(emailPanel);
emailPanel.setLayout(new BorderLayout(0, 0));
{
JLabel lblEmailoptional = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_EMAIL")); //$NON-NLS-1$
emailPanel.add(lblEmailoptional, BorderLayout.WEST);
}
{
this.email = new JTextField();
emailPanel.add(email, BorderLayout.CENTER);
email.setMaximumSize(new Dimension(2147483647, 20));
this.email.setColumns(10);
}
}
{
JPanel summaryPnl = new JPanel();
summaryPnl.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(summaryPnl);
summaryPnl.setLayout(new BorderLayout(0, 0));
{
JLabel lblProblemDescription = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_SUMMARY")); //$NON-NLS-1$
summaryPnl.add(lblProblemDescription, BorderLayout.WEST);
}
{
this.problemSummary = new JTextField();
summaryPnl.add(problemSummary, BorderLayout.CENTER);
this.problemSummary.setColumns(10);
}
}
{
JPanel descPanel = new JPanel();
descPanel.setMinimumSize(new Dimension(80, 150));
contentPanel.add(descPanel);
descPanel.setLayout(new BorderLayout(0, 0));
{
JLabel lblDetailedProblemDescription = new JLabel(
Messages.getString("GUIBugReportDialog.DLG_BUG_DESC")); //$NON-NLS-1$
lblDetailedProblemDescription.setVerticalAlignment(SwingConstants.TOP);
descPanel.add(lblDetailedProblemDescription, BorderLayout.WEST);
}
{
JScrollPane scrollPane = new JScrollPane();
descPanel.add(scrollPane, BorderLayout.CENTER);
{
JTextArea txtLongDesc = new JTextArea();
scrollPane.setViewportView(txtLongDesc);
txtLongDesc.setWrapStyleWord(true);
txtLongDesc.setLineWrap(true);
txtLongDesc
.setText(Messages.getString("GUIBugReportDialog.DLG_BUG_DESC_DEFAULT")); //$NON-NLS-1$
}
}
}
{
JPanel techInfoPanel = new JPanel();
contentPanel.add(techInfoPanel);
techInfoPanel.setLayout(new BorderLayout(0, 0));
{
chckbxIncludeTechnicalInformation = new JCheckBox(
Messages.getString("GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO")); //$NON-NLS-1$
techInfoPanel.add(chckbxIncludeTechnicalInformation, BorderLayout.WEST);
chckbxIncludeTechnicalInformation.setLocation(new Point(2, 0));
chckbxIncludeTechnicalInformation.setVerticalAlignment(SwingConstants.TOP);
chckbxIncludeTechnicalInformation.setHorizontalTextPosition(SwingConstants.LEFT);
chckbxIncludeTechnicalInformation.setAlignmentX(Component.CENTER_ALIGNMENT);
chckbxIncludeTechnicalInformation.setHorizontalAlignment(SwingConstants.LEFT);
}
{
JScrollPane scrollPane = new JScrollPane();
techInfoPanel.add(scrollPane, BorderLayout.CENTER);
{
JTextArea textArea = new JTextArea();
scrollPane.setViewportView(textArea);
textArea.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
textArea.setBackground(new Color(204, 204, 204));
textArea.setEditable(false);
textArea.setWrapStyleWord(true);
textArea.setLineWrap(true);
textArea.setText(Messages.getString("GUIBugReportDialog.NOTICE_INFO_INCLUDED") + traceback); //$NON-NLS-1$
}
}
}
{
JPanel buttonPane = new JPanel();
getContentPane().add(buttonPane, BorderLayout.SOUTH);
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
{
JProgressBar progressBar = new JProgressBar();
buttonPane.add(progressBar);
}
{
JButton okButton = new JButton(Messages.getString("GUIBugReportDialog.DLG_SUBMIT")); //$NON-NLS-1$
buttonPane.add(okButton);
okButton.setActionCommand(Messages.getString("GUIBugReportDialog.DLG_OK")); //$NON-NLS-1$
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton(Messages.getString("GUIBugReportDialog.DLG_CXL")); //$NON-NLS-1$
buttonPane.add(cancelButton);
cancelButton.setActionCommand(Messages.getString("GUIBugReportDialog.DLG_CXL")); //$NON-NLS-1$
}
}
}
}
package net.mosstest.launcher;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
// TODO: Auto-generated Javadoc
/**
* The Class GUIBugReportDialog.
*/
public class GUIBugReportDialog extends JDialog {
/**
* The content panel.
*/
private final JPanel contentPanel = new JPanel();
/**
* The reporter name.
*/
private JTextField reporterName;
/**
* The email.
*/
private JTextField email;
/**
* The problem summary.
*/
private JTextField problemSummary;
/**
* The chckbx include technical information.
*/
private JCheckBox chckbxIncludeTechnicalInformation;
/**
* The lbl name.
*/
private JLabel lblName;
/**
* Launch the application.
*
* @param args the arguments
*/
public static void main(String[] args) {
GUIBugReportDialog dialog = new GUIBugReportDialog("test traceback");
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
}
/**
* Create the dialog.
*
* @param traceback the traceback
*/
public GUIBugReportDialog(String traceback) {
setModal(true);
setModalityType(ModalityType.APPLICATION_MODAL);
setMinimumSize(new Dimension(640, 480));
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
setTitle(Messages.getString("GUIBugReportDialog.DLG_BUG_TITLE")); //$NON-NLS-1$
setBounds(100, 100, 640, 480);
getContentPane().setLayout(new BorderLayout());
contentPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
{
JPanel namePanel = new JPanel();
namePanel.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(namePanel);
namePanel.setLayout(new BorderLayout(0, 0));
{
lblName = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_NAME")); //$NON-NLS-1$
namePanel.add(lblName, BorderLayout.WEST);
lblName.setHorizontalTextPosition(SwingConstants.LEFT);
lblName.setHorizontalAlignment(SwingConstants.LEFT);
lblName.setAlignmentY(Component.TOP_ALIGNMENT);
}
lblName.setLabelFor(reporterName);
{
this.reporterName = new JTextField();
namePanel.add(reporterName, BorderLayout.CENTER);
reporterName.setMaximumSize(new Dimension(2147483647, 20));
reporterName.setAlignmentY(Component.TOP_ALIGNMENT);
this.reporterName.setColumns(10);
}
}
{
JPanel emailPanel = new JPanel();
emailPanel.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(emailPanel);
emailPanel.setLayout(new BorderLayout(0, 0));
{
JLabel lblEmailoptional = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_EMAIL")); //$NON-NLS-1$
emailPanel.add(lblEmailoptional, BorderLayout.WEST);
}
{
this.email = new JTextField();
emailPanel.add(email, BorderLayout.CENTER);
email.setMaximumSize(new Dimension(2147483647, 20));
this.email.setColumns(10);
}
}
{
JPanel summaryPnl = new JPanel();
summaryPnl.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(summaryPnl);
summaryPnl.setLayout(new BorderLayout(0, 0));
{
JLabel lblProblemDescription = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_SUMMARY")); //$NON-NLS-1$
summaryPnl.add(lblProblemDescription, BorderLayout.WEST);
}
{
this.problemSummary = new JTextField();
summaryPnl.add(problemSummary, BorderLayout.CENTER);
this.problemSummary.setColumns(10);
}
}
{
JPanel descPanel = new JPanel();
descPanel.setMinimumSize(new Dimension(80, 150));
contentPanel.add(descPanel);
descPanel.setLayout(new BorderLayout(0, 0));
{
JLabel lblDetailedProblemDescription = new JLabel(
Messages.getString("GUIBugReportDialog.DLG_BUG_DESC")); //$NON-NLS-1$
lblDetailedProblemDescription.setVerticalAlignment(SwingConstants.TOP);
descPanel.add(lblDetailedProblemDescription, BorderLayout.WEST);
}
{
JScrollPane scrollPane = new JScrollPane();
descPanel.add(scrollPane, BorderLayout.CENTER);
{
JTextArea txtLongDesc = new JTextArea();
scrollPane.setViewportView(txtLongDesc);
txtLongDesc.setWrapStyleWord(true);
txtLongDesc.setLineWrap(true);
txtLongDesc
.setText(Messages.getString("GUIBugReportDialog.DLG_BUG_DESC_DEFAULT")); //$NON-NLS-1$
}
}
}
{
JPanel techInfoPanel = new JPanel();
contentPanel.add(techInfoPanel);
techInfoPanel.setLayout(new BorderLayout(0, 0));
{
chckbxIncludeTechnicalInformation = new JCheckBox(
Messages.getString("GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO")); //$NON-NLS-1$
techInfoPanel.add(chckbxIncludeTechnicalInformation, BorderLayout.WEST);
chckbxIncludeTechnicalInformation.setLocation(new Point(2, 0));
chckbxIncludeTechnicalInformation.setVerticalAlignment(SwingConstants.TOP);
chckbxIncludeTechnicalInformation.setHorizontalTextPosition(SwingConstants.LEFT);
chckbxIncludeTechnicalInformation.setAlignmentX(Component.CENTER_ALIGNMENT);
chckbxIncludeTechnicalInformation.setHorizontalAlignment(SwingConstants.LEFT);
}
{
JScrollPane scrollPane = new JScrollPane();
techInfoPanel.add(scrollPane, BorderLayout.CENTER);
{
JTextArea textArea = new JTextArea();
scrollPane.setViewportView(textArea);
textArea.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
textArea.setBackground(new Color(204, 204, 204));
textArea.setEditable(false);
textArea.setWrapStyleWord(true);
textArea.setLineWrap(true);
textArea.setText(Messages.getString("GUIBugReportDialog.NOTICE_INFO_INCLUDED") + traceback); //$NON-NLS-1$
}
}
}
{
JPanel buttonPane = new JPanel();
getContentPane().add(buttonPane, BorderLayout.SOUTH);
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
{
JProgressBar progressBar = new JProgressBar();
buttonPane.add(progressBar);
}
{
JButton okButton = new JButton(Messages.getString("GUIBugReportDialog.DLG_SUBMIT")); //$NON-NLS-1$
buttonPane.add(okButton);
okButton.setActionCommand(Messages.getString("GUIBugReportDialog.DLG_OK")); //$NON-NLS-1$
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton(Messages.getString("GUIBugReportDialog.DLG_CXL")); //$NON-NLS-1$
buttonPane.add(cancelButton);
cancelButton.setActionCommand(Messages.getString("GUIBugReportDialog.DLG_CXL")); //$NON-NLS-1$
}
}
}
}

View File

@ -1,429 +1,429 @@
package net.mosstest.launcher;
import net.mosstest.servercore.*;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import java.awt.*;
import java.awt.Dialog.ModalityType;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
// TODO: Auto-generated Javadoc
/**
* The Class GUIClientsideLauncher.
*/
public class GUIClientsideLauncher {
/**
* The logger.
*/
static Logger logger = Logger.getLogger(GUIClientsideLauncher.class);
/**
* The mdl.
*/
private SingleplayerListTableModel mdl;
static {
System.setSecurityManager(MosstestSecurityManager.instance);
}
/**
* The Class SingleplayerListEntry.
*/
public static class SingleplayerListEntry {
/**
* The name.
*/
public String name;
/**
* The description.
*/
public String description;
/**
* The game preset.
*/
public String gamePreset;
/**
* Instantiates a new singleplayer list entry.
*
* @param name the name
* @param description the description
* @param gamePreset the game preset
*/
public SingleplayerListEntry(String name, String description,
String gamePreset) {
this.name = name;
this.description = description;
this.gamePreset = gamePreset;
}
}
/**
* The frm mosstest client launcher.
*/
private JDialog frmMosstestClientLauncher;
/**
* The table.
*/
private JTable table;
/**
* Launch the application.
*
* @param args the arguments
* @throws InvocationTargetException the invocation target exception
* @throws InterruptedException the interrupted exception
*/
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
logger.info("Mosstest client starting...");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException e1) {
logger.warn(Messages
.getString("GUIClientsideLauncher.WARN_SET_LAF")); //$NON-NLS-1$
}
EventQueue.invokeAndWait(new Runnable() {
public void run() {
ArrayList<SingleplayerListEntry> entries = new ArrayList<>();
GUIClientsideLauncher window = new GUIClientsideLauncher(
entries);
window.frmMosstestClientLauncher.setVisible(true);
}
});
}
/**
* Create the application.
*
* @param singleplayerEntries the singleplayer entries
*/
public GUIClientsideLauncher(
ArrayList<SingleplayerListEntry> singleplayerEntries) {
initialize(singleplayerEntries);
}
/**
* Initialize the contents of the frame.
*
* @param singleplayerEntries the singleplayer entries
*/
private void initialize(ArrayList<SingleplayerListEntry> singleplayerEntries) {
this.frmMosstestClientLauncher = new JDialog();
this.frmMosstestClientLauncher.setModal(true);
this.frmMosstestClientLauncher.setModalityType(ModalityType.APPLICATION_MODAL);
this.frmMosstestClientLauncher.setTitle(Messages
.getString("GUIClientsideLauncher.DLG_TITLE")); //$NON-NLS-1$
this.frmMosstestClientLauncher.setBounds(100, 100, 800, 480);
this.frmMosstestClientLauncher
.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
this.frmMosstestClientLauncher.getContentPane().add(tabbedPane,
BorderLayout.CENTER);
JPanel singleplayerTab = new JPanel();
tabbedPane
.addTab(Messages
.getString("GUIClientsideLauncher.DLG_SINGLEPLAYER"), null, singleplayerTab, null); //$NON-NLS-1$
singleplayerTab.setLayout(new BorderLayout(0, 0));
this.table = new JTable();
this.table.setFillsViewportHeight(true);
this.mdl = new SingleplayerListTableModel(singleplayerEntries);
this.table.setModel(this.mdl);
this.table.getColumnModel().getColumn(0).setPreferredWidth(90);
this.table.getColumnModel().getColumn(1).setPreferredWidth(256);
this.table.getColumnModel().getColumn(2).setPreferredWidth(104);
this.table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JPanel singleplayerControlBtns = new JPanel();
singleplayerTab.add(singleplayerControlBtns, BorderLayout.SOUTH);
singleplayerControlBtns.setLayout(new GridLayout(0, 4, 0, 0));
JButton btnPlaySingleplayer = new JButton(
Messages.getString("GUIClientsideLauncher.DLG_PLAY")); //$NON-NLS-1$
btnPlaySingleplayer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int row = GUIClientsideLauncher.this.table.getSelectedRow();
if (row < 0) {
logger.warn("An attempt was made to start gameplay without selecting a world.");
JOptionPane.showMessageDialog(
null,
Messages.getString("GUIClientsideLauncher.ERR_NO_WORLD_SELECTED"), //$NON-NLS-1$
Messages.getString("GUIClientsideLauncher.ERR_NO_WORLD_SELECTED_TITLE"), //$NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
return;
}
GUIClientsideLauncher.this.frmMosstestClientLauncher
.setVisible(false);
// below is testing code. in reality this would call a method to
// start a world and block. This should be in a try-catch block
// for the bug reporter to snatch up.
try {
MossWorld w = new MossWorld((String) GUIClientsideLauncher.this.table.getModel().getValueAt(row, 0), -16511);
} catch (MossWorldLoadException | MapDatabaseException | IOException | ConfigurationException e) {
logger.error("Uncaught exception in game code, opening bug reporter.");
String fname = MossDebugUtils.writeStracktrace(e);
logger.error("Stracktrace has been written to " + fname);
GUIBugReportDialog bg = new GUIBugReportDialog(
MossDebugUtils.getDebugInformation(e));
bg.setVisible(true);
}
GUIClientsideLauncher.this.frmMosstestClientLauncher
.setVisible(true);
}
});
singleplayerControlBtns.add(btnPlaySingleplayer);
JButton btnNewSingleplayer = new JButton(
Messages.getString("GUIClientsideLauncher.DLG_NEW")); //$NON-NLS-1$
btnNewSingleplayer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldCreationDialog dlg = new GUIWorldCreationDialog();
dlg.setVisible(true);
if (dlg.dlgResult) {
logger.debug("Got world: "
+ dlg.nameField.getText()
+ " with desc: "
+ dlg.inputDesc.getText()
+ " with game: "
+ dlg.comboBox.getItemAt(dlg.comboBox
.getSelectedIndex())); //$NON-NLS-1$
} else
logger.info("World creation cancelled");
}
});
singleplayerControlBtns.add(btnNewSingleplayer);
JButton btnSettingsSingleplayer = new JButton(
Messages.getString("GUIClientsideLauncher.DLG_SETTINGS")); //$NON-NLS-1$
singleplayerControlBtns.add(btnSettingsSingleplayer);
JButton btnDelete = new JButton(
Messages.getString("GUIClientsideLauncher.DLG_DELETE")); //$NON-NLS-1$
btnDelete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int row = GUIClientsideLauncher.this.table.getSelectedRow();
if (row < 0) {
logger.warn("An attempt was made to delete a world, but none was selected.");
JOptionPane.showMessageDialog(
null,
Messages.getString("GUIClientsideLauncher.DLG_NO_WORLD_TO_DELETE"), //$NON-NLS-1$
Messages.getString("GUIClientsideLauncher.ERR_NO_WORLD_SELECTED_TITLE"), //$NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
}
}
});
singleplayerControlBtns.add(btnDelete);
// singleplayerTab.add(this.table, BorderLayout.CENTER);
JScrollPane singleplayerScrollPane = new JScrollPane(this.table);
singleplayerScrollPane
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
singleplayerTab.add(singleplayerScrollPane, BorderLayout.CENTER);
JPanel aboutTab = new JPanel();
tabbedPane
.addTab(Messages.getString("GUIClientsideLauncher.DLG_ABOUT"), null, aboutTab, null); //$NON-NLS-1$
tabbedPane.setEnabledAt(1, true);
SpringLayout sl_aboutTab = new SpringLayout();
aboutTab.setLayout(sl_aboutTab);
JPanel communityToolsButtonPanel = new JPanel();
sl_aboutTab.putConstraint(SpringLayout.NORTH,
communityToolsButtonPanel, 405, SpringLayout.NORTH, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.WEST, communityToolsButtonPanel,
0, SpringLayout.WEST, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.EAST, communityToolsButtonPanel,
787, SpringLayout.WEST, aboutTab);
aboutTab.add(communityToolsButtonPanel);
communityToolsButtonPanel.setLayout(new GridLayout(0, 5, 0, 0));
JButton btnReportBug = new JButton(
Messages.getString("GUIClientsideLauncher.23")); //$NON-NLS-1$
btnReportBug.setEnabled(false);
communityToolsButtonPanel.add(btnReportBug);
JButton btnRequestNewFeature = new JButton(
Messages.getString("GUIClientsideLauncher.24")); //$NON-NLS-1$
btnRequestNewFeature.setEnabled(false);
communityToolsButtonPanel.add(btnRequestNewFeature);
JButton btnVisitWebsite = new JButton(
Messages.getString("GUIClientsideLauncher.25")); //$NON-NLS-1$
btnVisitWebsite.setEnabled(false);
communityToolsButtonPanel.add(btnVisitWebsite);
JButton btnGithubProject = new JButton(
Messages.getString("GUIClientsideLauncher.26")); //$NON-NLS-1$
btnGithubProject.setEnabled(false);
communityToolsButtonPanel.add(btnGithubProject);
JButton btnVisitForums = new JButton(
Messages.getString("GUIClientsideLauncher.27")); //$NON-NLS-1$
btnVisitForums.setEnabled(false);
communityToolsButtonPanel.add(btnVisitForums);
JTextArea textArea = new JTextArea();
aboutTab.add(textArea);
textArea.setText(" __ __ ____ _____ _____ _______ ______ _____ _______ \r\n"
+ " | \\/ |/ __ \\ / ____/ ____|__ __| ____|/ ____|__ __|\r\n"
+ " | \\ / | | | | (___| (___ | | | |__ | (___ | | \r\n"
+ " | |\\/| | | | |\\___ \\\\___ \\ | | | __| \\___ \\ | | \r\n"
+ " | | | | |__| |____) |___) | | | | |____ ____) | | | \r\n"
+ " |_| |_|\\____/|_____/_____/ |_| |______|_____/ |_| \r\n"
+ " \r\n"
+ " 0.0.1-initial \r\n"
+ ""
+ Messages
.getString("GUIClientsideLauncher.NOTICE_PRIMARY_AUTHORS") //$NON-NLS-1$
+ Messages
.getString("GUIClientsideLauncher.NOTICE_DEFAULT_GAME_CODE") //$NON-NLS-1$
+ Messages.getString("GUIClientsideLauncher.SYS_NEWLINE") //$NON-NLS-1$
+ Messages.getString("GUIClientsideLauncher.USES_LIBS") //$NON-NLS-1$
+ "* Apache Commons Lang\r\n"
+ "* Apache Commons Collections\r\n"
+ "* JInput\r\n"
+ "* jmonkeyengine/jme3\r\n"
+ "* niftygui\r\n"
+ "* Google Guava Collections\r\n"
+ "* Apache Commons CLI\r\n"
+ "* Apache Commons Configuration\r\n"
+ "* Mozilla Rhino\r\n"
+ "* leveldbjni\r\n"
+ "* junit4 for testing\r\n"
+ Messages.getString("GUIClientsideLauncher.SYS_NEWLINE") //$NON-NLS-1$
+ Messages.getString("GUIClientsideLauncher.NOTICE_TOOLS_USED")); //$NON-NLS-1$
textArea.setWrapStyleWord(true);
textArea.setBackground(new Color(192, 192, 192));
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);
sl_aboutTab.putConstraint(SpringLayout.NORTH, scrollPane, 0,
SpringLayout.NORTH, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.WEST, scrollPane, 0,
SpringLayout.WEST, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.SOUTH, scrollPane, 0,
SpringLayout.NORTH, communityToolsButtonPanel);
sl_aboutTab.putConstraint(SpringLayout.EAST, scrollPane, 787,
SpringLayout.WEST, aboutTab);
scrollPane
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
aboutTab.add(scrollPane);
frmMosstestClientLauncher.setVisible(true);
}
/**
* The Class SingleplayerListTableModel.
*/
class SingleplayerListTableModel extends AbstractTableModel {
/**
* The column names.
*/
private String[] columnNames = {
Messages.getString("GUIClientsideLauncher.COL_WORLD_NAME"), Messages.getString("GUIClientsideLauncher.COL_WORLD_DESC"), //$NON-NLS-1$ //$NON-NLS-2$
Messages.getString("GUIClientsideLauncher.COL_GAME_PRESET")}; //$NON-NLS-1$
/**
* The entries.
*/
private ArrayList<SingleplayerListEntry> entries = new ArrayList<>();
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getColumnCount()
*/
public int getColumnCount() {
return this.columnNames.length;
}
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getRowCount()
*/
public int getRowCount() {
return this.entries.size();
}
/* (non-Javadoc)
* @see javax.swing.table.AbstractTableModel#getColumnName(int)
*/
public String getColumnName(int col) {
return this.columnNames[col];
}
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getValueAt(int, int)
*/
public Object getValueAt(int row, int col) {
SingleplayerListEntry entry = this.entries.get(row);
switch (col) {
case 0:
return entry.name;
case 1:
return entry.description;
case 2:
return entry.gamePreset;
default:
return null;
}
}
/*
* All entries are strings *at the moment*.
*/
/* (non-Javadoc)
* @see javax.swing.table.AbstractTableModel#getColumnClass(int)
*/
public Class<?> getColumnClass(int c) {
return String.class;
}
/*
* Don't need to implement this method unless your table's editable.
*/
/* (non-Javadoc)
* @see javax.swing.table.AbstractTableModel#isCellEditable(int, int)
*/
public boolean isCellEditable(int row, int col) {
return false;
}
/**
* Instantiates a new singleplayer list table model.
*
* @param entries the entries
*/
public SingleplayerListTableModel(
ArrayList<SingleplayerListEntry> entries) {
this.entries = entries;
}
}
}
package net.mosstest.launcher;
import net.mosstest.servercore.*;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import java.awt.*;
import java.awt.Dialog.ModalityType;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
// TODO: Auto-generated Javadoc
/**
* The Class GUIClientsideLauncher.
*/
public class GUIClientsideLauncher {
/**
* The logger.
*/
static Logger logger = Logger.getLogger(GUIClientsideLauncher.class);
/**
* The mdl.
*/
private SingleplayerListTableModel mdl;
static {
System.setSecurityManager(MosstestSecurityManager.instance);
}
/**
* The Class SingleplayerListEntry.
*/
public static class SingleplayerListEntry {
/**
* The name.
*/
public String name;
/**
* The description.
*/
public String description;
/**
* The game preset.
*/
public String gamePreset;
/**
* Instantiates a new singleplayer list entry.
*
* @param name the name
* @param description the description
* @param gamePreset the game preset
*/
public SingleplayerListEntry(String name, String description,
String gamePreset) {
this.name = name;
this.description = description;
this.gamePreset = gamePreset;
}
}
/**
* The frm mosstest client launcher.
*/
private JDialog frmMosstestClientLauncher;
/**
* The table.
*/
private JTable table;
/**
* Launch the application.
*
* @param args the arguments
* @throws InvocationTargetException the invocation target exception
* @throws InterruptedException the interrupted exception
*/
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
logger.info("Mosstest client starting...");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException e1) {
logger.warn(Messages
.getString("GUIClientsideLauncher.WARN_SET_LAF")); //$NON-NLS-1$
}
EventQueue.invokeAndWait(new Runnable() {
public void run() {
ArrayList<SingleplayerListEntry> entries = new ArrayList<>();
GUIClientsideLauncher window = new GUIClientsideLauncher(
entries);
window.frmMosstestClientLauncher.setVisible(true);
}
});
}
/**
* Create the application.
*
* @param singleplayerEntries the singleplayer entries
*/
public GUIClientsideLauncher(
ArrayList<SingleplayerListEntry> singleplayerEntries) {
initialize(singleplayerEntries);
}
/**
* Initialize the contents of the frame.
*
* @param singleplayerEntries the singleplayer entries
*/
private void initialize(ArrayList<SingleplayerListEntry> singleplayerEntries) {
this.frmMosstestClientLauncher = new JDialog();
this.frmMosstestClientLauncher.setModal(true);
this.frmMosstestClientLauncher.setModalityType(ModalityType.APPLICATION_MODAL);
this.frmMosstestClientLauncher.setTitle(Messages
.getString("GUIClientsideLauncher.DLG_TITLE")); //$NON-NLS-1$
this.frmMosstestClientLauncher.setBounds(100, 100, 800, 480);
this.frmMosstestClientLauncher
.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
this.frmMosstestClientLauncher.getContentPane().add(tabbedPane,
BorderLayout.CENTER);
JPanel singleplayerTab = new JPanel();
tabbedPane
.addTab(Messages
.getString("GUIClientsideLauncher.DLG_SINGLEPLAYER"), null, singleplayerTab, null); //$NON-NLS-1$
singleplayerTab.setLayout(new BorderLayout(0, 0));
this.table = new JTable();
this.table.setFillsViewportHeight(true);
this.mdl = new SingleplayerListTableModel(singleplayerEntries);
this.table.setModel(this.mdl);
this.table.getColumnModel().getColumn(0).setPreferredWidth(90);
this.table.getColumnModel().getColumn(1).setPreferredWidth(256);
this.table.getColumnModel().getColumn(2).setPreferredWidth(104);
this.table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JPanel singleplayerControlBtns = new JPanel();
singleplayerTab.add(singleplayerControlBtns, BorderLayout.SOUTH);
singleplayerControlBtns.setLayout(new GridLayout(0, 4, 0, 0));
JButton btnPlaySingleplayer = new JButton(
Messages.getString("GUIClientsideLauncher.DLG_PLAY")); //$NON-NLS-1$
btnPlaySingleplayer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int row = GUIClientsideLauncher.this.table.getSelectedRow();
if (row < 0) {
logger.warn("An attempt was made to start gameplay without selecting a world.");
JOptionPane.showMessageDialog(
null,
Messages.getString("GUIClientsideLauncher.ERR_NO_WORLD_SELECTED"), //$NON-NLS-1$
Messages.getString("GUIClientsideLauncher.ERR_NO_WORLD_SELECTED_TITLE"), //$NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
return;
}
GUIClientsideLauncher.this.frmMosstestClientLauncher
.setVisible(false);
// below is testing code. in reality this would call a method to
// start a world and block. This should be in a try-catch block
// for the bug reporter to snatch up.
try {
MossWorld w = new MossWorld((String) GUIClientsideLauncher.this.table.getModel().getValueAt(row, 0), -16511);
} catch (MossWorldLoadException | MapDatabaseException | IOException | ConfigurationException e) {
logger.error("Uncaught exception in game code, opening bug reporter.");
String fname = MossDebugUtils.writeStracktrace(e);
logger.error("Stracktrace has been written to " + fname);
GUIBugReportDialog bg = new GUIBugReportDialog(
MossDebugUtils.getDebugInformation(e));
bg.setVisible(true);
}
GUIClientsideLauncher.this.frmMosstestClientLauncher
.setVisible(true);
}
});
singleplayerControlBtns.add(btnPlaySingleplayer);
JButton btnNewSingleplayer = new JButton(
Messages.getString("GUIClientsideLauncher.DLG_NEW")); //$NON-NLS-1$
btnNewSingleplayer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldCreationDialog dlg = new GUIWorldCreationDialog();
dlg.setVisible(true);
if (dlg.dlgResult) {
logger.debug("Got world: "
+ dlg.nameField.getText()
+ " with desc: "
+ dlg.inputDesc.getText()
+ " with game: "
+ dlg.comboBox.getItemAt(dlg.comboBox
.getSelectedIndex())); //$NON-NLS-1$
} else
logger.info("World creation cancelled");
}
});
singleplayerControlBtns.add(btnNewSingleplayer);
JButton btnSettingsSingleplayer = new JButton(
Messages.getString("GUIClientsideLauncher.DLG_SETTINGS")); //$NON-NLS-1$
singleplayerControlBtns.add(btnSettingsSingleplayer);
JButton btnDelete = new JButton(
Messages.getString("GUIClientsideLauncher.DLG_DELETE")); //$NON-NLS-1$
btnDelete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int row = GUIClientsideLauncher.this.table.getSelectedRow();
if (row < 0) {
logger.warn("An attempt was made to delete a world, but none was selected.");
JOptionPane.showMessageDialog(
null,
Messages.getString("GUIClientsideLauncher.DLG_NO_WORLD_TO_DELETE"), //$NON-NLS-1$
Messages.getString("GUIClientsideLauncher.ERR_NO_WORLD_SELECTED_TITLE"), //$NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
}
}
});
singleplayerControlBtns.add(btnDelete);
// singleplayerTab.add(this.table, BorderLayout.CENTER);
JScrollPane singleplayerScrollPane = new JScrollPane(this.table);
singleplayerScrollPane
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
singleplayerTab.add(singleplayerScrollPane, BorderLayout.CENTER);
JPanel aboutTab = new JPanel();
tabbedPane
.addTab(Messages.getString("GUIClientsideLauncher.DLG_ABOUT"), null, aboutTab, null); //$NON-NLS-1$
tabbedPane.setEnabledAt(1, true);
SpringLayout sl_aboutTab = new SpringLayout();
aboutTab.setLayout(sl_aboutTab);
JPanel communityToolsButtonPanel = new JPanel();
sl_aboutTab.putConstraint(SpringLayout.NORTH,
communityToolsButtonPanel, 405, SpringLayout.NORTH, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.WEST, communityToolsButtonPanel,
0, SpringLayout.WEST, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.EAST, communityToolsButtonPanel,
787, SpringLayout.WEST, aboutTab);
aboutTab.add(communityToolsButtonPanel);
communityToolsButtonPanel.setLayout(new GridLayout(0, 5, 0, 0));
JButton btnReportBug = new JButton(
Messages.getString("GUIClientsideLauncher.23")); //$NON-NLS-1$
btnReportBug.setEnabled(false);
communityToolsButtonPanel.add(btnReportBug);
JButton btnRequestNewFeature = new JButton(
Messages.getString("GUIClientsideLauncher.24")); //$NON-NLS-1$
btnRequestNewFeature.setEnabled(false);
communityToolsButtonPanel.add(btnRequestNewFeature);
JButton btnVisitWebsite = new JButton(
Messages.getString("GUIClientsideLauncher.25")); //$NON-NLS-1$
btnVisitWebsite.setEnabled(false);
communityToolsButtonPanel.add(btnVisitWebsite);
JButton btnGithubProject = new JButton(
Messages.getString("GUIClientsideLauncher.26")); //$NON-NLS-1$
btnGithubProject.setEnabled(false);
communityToolsButtonPanel.add(btnGithubProject);
JButton btnVisitForums = new JButton(
Messages.getString("GUIClientsideLauncher.27")); //$NON-NLS-1$
btnVisitForums.setEnabled(false);
communityToolsButtonPanel.add(btnVisitForums);
JTextArea textArea = new JTextArea();
aboutTab.add(textArea);
textArea.setText(" __ __ ____ _____ _____ _______ ______ _____ _______ \r\n"
+ " | \\/ |/ __ \\ / ____/ ____|__ __| ____|/ ____|__ __|\r\n"
+ " | \\ / | | | | (___| (___ | | | |__ | (___ | | \r\n"
+ " | |\\/| | | | |\\___ \\\\___ \\ | | | __| \\___ \\ | | \r\n"
+ " | | | | |__| |____) |___) | | | | |____ ____) | | | \r\n"
+ " |_| |_|\\____/|_____/_____/ |_| |______|_____/ |_| \r\n"
+ " \r\n"
+ " 0.0.1-initial \r\n"
+ ""
+ Messages
.getString("GUIClientsideLauncher.NOTICE_PRIMARY_AUTHORS") //$NON-NLS-1$
+ Messages
.getString("GUIClientsideLauncher.NOTICE_DEFAULT_GAME_CODE") //$NON-NLS-1$
+ Messages.getString("GUIClientsideLauncher.SYS_NEWLINE") //$NON-NLS-1$
+ Messages.getString("GUIClientsideLauncher.USES_LIBS") //$NON-NLS-1$
+ "* Apache Commons Lang\r\n"
+ "* Apache Commons Collections\r\n"
+ "* JInput\r\n"
+ "* jmonkeyengine/jme3\r\n"
+ "* niftygui\r\n"
+ "* Google Guava Collections\r\n"
+ "* Apache Commons CLI\r\n"
+ "* Apache Commons Configuration\r\n"
+ "* Mozilla Rhino\r\n"
+ "* leveldbjni\r\n"
+ "* junit4 for testing\r\n"
+ Messages.getString("GUIClientsideLauncher.SYS_NEWLINE") //$NON-NLS-1$
+ Messages.getString("GUIClientsideLauncher.NOTICE_TOOLS_USED")); //$NON-NLS-1$
textArea.setWrapStyleWord(true);
textArea.setBackground(new Color(192, 192, 192));
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);
sl_aboutTab.putConstraint(SpringLayout.NORTH, scrollPane, 0,
SpringLayout.NORTH, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.WEST, scrollPane, 0,
SpringLayout.WEST, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.SOUTH, scrollPane, 0,
SpringLayout.NORTH, communityToolsButtonPanel);
sl_aboutTab.putConstraint(SpringLayout.EAST, scrollPane, 787,
SpringLayout.WEST, aboutTab);
scrollPane
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
aboutTab.add(scrollPane);
frmMosstestClientLauncher.setVisible(true);
}
/**
* The Class SingleplayerListTableModel.
*/
class SingleplayerListTableModel extends AbstractTableModel {
/**
* The column names.
*/
private String[] columnNames = {
Messages.getString("GUIClientsideLauncher.COL_WORLD_NAME"), Messages.getString("GUIClientsideLauncher.COL_WORLD_DESC"), //$NON-NLS-1$ //$NON-NLS-2$
Messages.getString("GUIClientsideLauncher.COL_GAME_PRESET")}; //$NON-NLS-1$
/**
* The entries.
*/
private ArrayList<SingleplayerListEntry> entries = new ArrayList<>();
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getColumnCount()
*/
public int getColumnCount() {
return this.columnNames.length;
}
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getRowCount()
*/
public int getRowCount() {
return this.entries.size();
}
/* (non-Javadoc)
* @see javax.swing.table.AbstractTableModel#getColumnName(int)
*/
public String getColumnName(int col) {
return this.columnNames[col];
}
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getValueAt(int, int)
*/
public Object getValueAt(int row, int col) {
SingleplayerListEntry entry = this.entries.get(row);
switch (col) {
case 0:
return entry.name;
case 1:
return entry.description;
case 2:
return entry.gamePreset;
default:
return null;
}
}
/*
* All entries are strings *at the moment*.
*/
/* (non-Javadoc)
* @see javax.swing.table.AbstractTableModel#getColumnClass(int)
*/
public Class<?> getColumnClass(int c) {
return String.class;
}
/*
* Don't need to implement this method unless your table's editable.
*/
/* (non-Javadoc)
* @see javax.swing.table.AbstractTableModel#isCellEditable(int, int)
*/
public boolean isCellEditable(int row, int col) {
return false;
}
/**
* Instantiates a new singleplayer list table model.
*
* @param entries the entries
*/
public SingleplayerListTableModel(
ArrayList<SingleplayerListEntry> entries) {
this.entries = entries;
}
}
}

View File

@ -1,155 +1,155 @@
package net.mosstest.launcher;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import java.awt.Dialog.ModalityType;
import javax.swing.DefaultComboBoxModel;
import com.jme3.material.RenderState.TestFunction;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridLayout;
import java.awt.Dimension;
// TODO: Auto-generated Javadoc
/**
* The Class GUIWorldCreationDialog.
*/
public class GUIWorldCreationDialog extends JDialog {
/** The dlg result. */
boolean dlgResult= false;
/** The content panel. */
private final JPanel contentPanel = new JPanel();
/** The combo box. */
JComboBox<String> comboBox;
/** The input desc. */
JTextField inputDesc;
/** The name field. */
JTextField nameField;
/**
* Launch the application.
*
* @param args the arguments
*/
public static void main(String[] args) {
try {
GUIWorldCreationDialog dialog = new GUIWorldCreationDialog();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the dialog.
*/
public GUIWorldCreationDialog() {
setTitle(Messages.getString("GUIWorldCreationDialog.DLG_TITLE")); //$NON-NLS-1$
setModal(true);
setModalityType(ModalityType.APPLICATION_MODAL);
setResizable(false);
setBounds(100, 100, 450, 142);
getContentPane().setLayout(new BorderLayout());
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new GridLayout(3, 1, 0, 0));
{
JPanel namePanel = new JPanel();
namePanel.setMinimumSize(new Dimension(10, 20));
namePanel.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(namePanel);
namePanel.setLayout(new BorderLayout(0, 0));
{
JLabel lblWorldName = new JLabel(Messages.getString("GUIWorldCreationDialog.WORLD_NAME")); //$NON-NLS-1$
namePanel.add(lblWorldName, BorderLayout.WEST);
}
{
this.nameField = new JTextField();
nameField.setMaximumSize(new Dimension(2147483647, 20));
namePanel.add(nameField, BorderLayout.CENTER);
this.nameField.setColumns(10);
}
}
{
JPanel descPnl = new JPanel();
descPnl.setMinimumSize(new Dimension(10, 20));
descPnl.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(descPnl);
descPnl.setLayout(new BorderLayout(0, 0));
{
JLabel lblDescription = new JLabel(Messages.getString("GUIWorldCreationDialog.WORLD_DESC")); //$NON-NLS-1$
descPnl.add(lblDescription, BorderLayout.WEST);
}
{
this.inputDesc = new JTextField();
descPnl.add(inputDesc, BorderLayout.CENTER);
this.inputDesc.setColumns(10);
}
}
{
JPanel profPnl = new JPanel();
profPnl.setMinimumSize(new Dimension(10, 20));
profPnl.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(profPnl);
profPnl.setLayout(new BorderLayout(0, 0));
{
JLabel lblGameProfile = new JLabel(Messages.getString("GUIWorldCreationDialog.GAME_PROFILE")); //$NON-NLS-1$
profPnl.add(lblGameProfile, BorderLayout.WEST);
}
{
this.comboBox = new JComboBox<String>();
comboBox.setMaximumSize(new Dimension(32767, 23));
profPnl.add(comboBox, BorderLayout.CENTER);
}
}
{
JPanel buttonPane = new JPanel();
buttonPane.setMaximumSize(new Dimension(32767, 23));
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton(Messages.getString("GUIWorldCreationDialog.OK")); //$NON-NLS-1$
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldCreationDialog.this.dlgResult = true;
GUIWorldCreationDialog.this.dispose();
}
});
okButton.setActionCommand(Messages.getString("GUIWorldCreationDialog.OK")); //$NON-NLS-1$
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton(Messages.getString("GUIWorldCreationDialog.CXL")); //$NON-NLS-1$
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldCreationDialog.this.dlgResult = false;
GUIWorldCreationDialog.this.dispose();
}
});
cancelButton.setActionCommand(Messages.getString("GUIWorldCreationDialog.CXL")); //$NON-NLS-1$
buttonPane.add(cancelButton);
}
}
}
}
package net.mosstest.launcher;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import java.awt.Dialog.ModalityType;
import javax.swing.DefaultComboBoxModel;
import com.jme3.material.RenderState.TestFunction;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridLayout;
import java.awt.Dimension;
// TODO: Auto-generated Javadoc
/**
* The Class GUIWorldCreationDialog.
*/
public class GUIWorldCreationDialog extends JDialog {
/** The dlg result. */
boolean dlgResult= false;
/** The content panel. */
private final JPanel contentPanel = new JPanel();
/** The combo box. */
JComboBox<String> comboBox;
/** The input desc. */
JTextField inputDesc;
/** The name field. */
JTextField nameField;
/**
* Launch the application.
*
* @param args the arguments
*/
public static void main(String[] args) {
try {
GUIWorldCreationDialog dialog = new GUIWorldCreationDialog();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the dialog.
*/
public GUIWorldCreationDialog() {
setTitle(Messages.getString("GUIWorldCreationDialog.DLG_TITLE")); //$NON-NLS-1$
setModal(true);
setModalityType(ModalityType.APPLICATION_MODAL);
setResizable(false);
setBounds(100, 100, 450, 142);
getContentPane().setLayout(new BorderLayout());
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new GridLayout(3, 1, 0, 0));
{
JPanel namePanel = new JPanel();
namePanel.setMinimumSize(new Dimension(10, 20));
namePanel.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(namePanel);
namePanel.setLayout(new BorderLayout(0, 0));
{
JLabel lblWorldName = new JLabel(Messages.getString("GUIWorldCreationDialog.WORLD_NAME")); //$NON-NLS-1$
namePanel.add(lblWorldName, BorderLayout.WEST);
}
{
this.nameField = new JTextField();
nameField.setMaximumSize(new Dimension(2147483647, 20));
namePanel.add(nameField, BorderLayout.CENTER);
this.nameField.setColumns(10);
}
}
{
JPanel descPnl = new JPanel();
descPnl.setMinimumSize(new Dimension(10, 20));
descPnl.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(descPnl);
descPnl.setLayout(new BorderLayout(0, 0));
{
JLabel lblDescription = new JLabel(Messages.getString("GUIWorldCreationDialog.WORLD_DESC")); //$NON-NLS-1$
descPnl.add(lblDescription, BorderLayout.WEST);
}
{
this.inputDesc = new JTextField();
descPnl.add(inputDesc, BorderLayout.CENTER);
this.inputDesc.setColumns(10);
}
}
{
JPanel profPnl = new JPanel();
profPnl.setMinimumSize(new Dimension(10, 20));
profPnl.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(profPnl);
profPnl.setLayout(new BorderLayout(0, 0));
{
JLabel lblGameProfile = new JLabel(Messages.getString("GUIWorldCreationDialog.GAME_PROFILE")); //$NON-NLS-1$
profPnl.add(lblGameProfile, BorderLayout.WEST);
}
{
this.comboBox = new JComboBox<String>();
comboBox.setMaximumSize(new Dimension(32767, 23));
profPnl.add(comboBox, BorderLayout.CENTER);
}
}
{
JPanel buttonPane = new JPanel();
buttonPane.setMaximumSize(new Dimension(32767, 23));
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton(Messages.getString("GUIWorldCreationDialog.OK")); //$NON-NLS-1$
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldCreationDialog.this.dlgResult = true;
GUIWorldCreationDialog.this.dispose();
}
});
okButton.setActionCommand(Messages.getString("GUIWorldCreationDialog.OK")); //$NON-NLS-1$
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton(Messages.getString("GUIWorldCreationDialog.CXL")); //$NON-NLS-1$
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldCreationDialog.this.dlgResult = false;
GUIWorldCreationDialog.this.dispose();
}
});
cancelButton.setActionCommand(Messages.getString("GUIWorldCreationDialog.CXL")); //$NON-NLS-1$
buttonPane.add(cancelButton);
}
}
}
}

View File

@ -1,99 +1,99 @@
package net.mosstest.launcher;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
// TODO: Auto-generated Javadoc
/**
* The Class GUIWorldDeletionDialog.
*/
public class GUIWorldDeletionDialog extends JDialog {
/** The dlg result. */
boolean dlgResult=false;
/** The content panel. */
private final JPanel contentPanel = new JPanel();
/**
* Launch the application.
*
* @param args the arguments
*/
public static void main(String[] args) {
try {
GUIWorldDeletionDialog dialog = new GUIWorldDeletionDialog("test from main"); //$NON-NLS-1$
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the dialog.
*
* @param worldName the world name
*/
public GUIWorldDeletionDialog(String worldName) {
setTitle(Messages.getString("GUIWorldDeletionDialog.DLG_TITLE")); //$NON-NLS-1$
setModal(true);
setModalityType(ModalityType.APPLICATION_MODAL);
setResizable(false);
setBounds(100, 100, 600, 105);
getContentPane().setLayout(new BorderLayout());
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.X_AXIS));
{
JPanel panel = new JPanel();
contentPanel.add(panel);
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
{
JLabel lblAreYouSure = new JLabel(Messages.getString("GUIWorldDeletionDialog.AREYOUSURE_TEXT")+worldName+Messages.getString("GUIWorldDeletionDialog.QUESTIONMARK_CANNOT_UNDO")); //$NON-NLS-1$ //$NON-NLS-2$
panel.add(lblAreYouSure);
lblAreYouSure.setHorizontalTextPosition(SwingConstants.LEFT);
lblAreYouSure.setHorizontalAlignment(SwingConstants.LEFT);
}
}
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton btnYes = new JButton(Messages.getString("GUIWorldDeletionDialog.YES")); //$NON-NLS-1$
btnYes.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldDeletionDialog.this.dlgResult = true;
GUIWorldDeletionDialog.this.dispose();
}
});
btnYes.setActionCommand(Messages.getString("GUIWorldDeletionDialog.YES")); //$NON-NLS-1$
buttonPane.add(btnYes);
getRootPane().setDefaultButton(btnYes);
}
{
JButton cancelButton = new JButton(Messages.getString("GUIWorldDeletionDialog.NO")); //$NON-NLS-1$
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldDeletionDialog.this.dlgResult = false;
GUIWorldDeletionDialog.this.dispose();
}
});
buttonPane.add(cancelButton);
}
}
}
}
package net.mosstest.launcher;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
// TODO: Auto-generated Javadoc
/**
* The Class GUIWorldDeletionDialog.
*/
public class GUIWorldDeletionDialog extends JDialog {
/** The dlg result. */
boolean dlgResult=false;
/** The content panel. */
private final JPanel contentPanel = new JPanel();
/**
* Launch the application.
*
* @param args the arguments
*/
public static void main(String[] args) {
try {
GUIWorldDeletionDialog dialog = new GUIWorldDeletionDialog("test from main"); //$NON-NLS-1$
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the dialog.
*
* @param worldName the world name
*/
public GUIWorldDeletionDialog(String worldName) {
setTitle(Messages.getString("GUIWorldDeletionDialog.DLG_TITLE")); //$NON-NLS-1$
setModal(true);
setModalityType(ModalityType.APPLICATION_MODAL);
setResizable(false);
setBounds(100, 100, 600, 105);
getContentPane().setLayout(new BorderLayout());
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.X_AXIS));
{
JPanel panel = new JPanel();
contentPanel.add(panel);
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
{
JLabel lblAreYouSure = new JLabel(Messages.getString("GUIWorldDeletionDialog.AREYOUSURE_TEXT")+worldName+Messages.getString("GUIWorldDeletionDialog.QUESTIONMARK_CANNOT_UNDO")); //$NON-NLS-1$ //$NON-NLS-2$
panel.add(lblAreYouSure);
lblAreYouSure.setHorizontalTextPosition(SwingConstants.LEFT);
lblAreYouSure.setHorizontalAlignment(SwingConstants.LEFT);
}
}
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton btnYes = new JButton(Messages.getString("GUIWorldDeletionDialog.YES")); //$NON-NLS-1$
btnYes.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldDeletionDialog.this.dlgResult = true;
GUIWorldDeletionDialog.this.dispose();
}
});
btnYes.setActionCommand(Messages.getString("GUIWorldDeletionDialog.YES")); //$NON-NLS-1$
buttonPane.add(btnYes);
getRootPane().setDefaultButton(btnYes);
}
{
JButton cancelButton = new JButton(Messages.getString("GUIWorldDeletionDialog.NO")); //$NON-NLS-1$
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GUIWorldDeletionDialog.this.dlgResult = false;
GUIWorldDeletionDialog.this.dispose();
}
});
buttonPane.add(cancelButton);
}
}
}
}

View File

@ -1,48 +1,48 @@
package net.mosstest.launcher;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
// TODO: Auto-generated Javadoc
/**
* The Class Messages.
*/
public class Messages {
/** The Constant BUNDLE_NAME. */
private static final String BUNDLE_NAME = "net.mosstest.launcher.messages"; //$NON-NLS-1$
/** The res bundle. */
private static ResourceBundle resBundle = ResourceBundle
.getBundle(BUNDLE_NAME);
/**
* Change language.
*
* @param identifier the identifier
*/
public static void changeLanguage(String identifier) {
resBundle = ResourceBundle.getBundle(BUNDLE_NAME + "." + identifier);
}
/**
* Instantiates a new messages.
*/
private Messages() {
}
/**
* Gets the string.
*
* @param key the key
* @return the string
*/
public static String getString(String key) {
try {
return resBundle.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
}
package net.mosstest.launcher;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
// TODO: Auto-generated Javadoc
/**
* The Class Messages.
*/
public class Messages {
/** The Constant BUNDLE_NAME. */
private static final String BUNDLE_NAME = "net.mosstest.launcher.messages"; //$NON-NLS-1$
/** The res bundle. */
private static ResourceBundle resBundle = ResourceBundle
.getBundle(BUNDLE_NAME);
/**
* Change language.
*
* @param identifier the identifier
*/
public static void changeLanguage(String identifier) {
resBundle = ResourceBundle.getBundle(BUNDLE_NAME + "." + identifier);
}
/**
* Instantiates a new messages.
*/
private Messages() {
}
/**
* Gets the string.
*
* @param key the key
* @return the string
*/
public static String getString(String key) {
try {
return resBundle.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
}

View File

@ -1,14 +1,14 @@
# Root logger option
log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=mosslog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Root logger option
log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=mosslog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

View File

@ -1,46 +1,46 @@
GUIBugReportDialog.DLG_BUG_DESC=Detailed problem description:
GUIBugReportDialog.DLG_BUG_DESC_DEFAULT=Please describe your problem here, preferably including what you had done, what you expected to happen, what happened, and any other details about the world or game.\n\nPlease note that we cannot help with third-party games or mods.
GUIBugReportDialog.DLG_BUG_EMAIL=e-mail (optional):
GUIBugReportDialog.DLG_BUG_NAME=Name:
GUIBugReportDialog.DLG_BUG_SUMMARY=Problem summary:
GUIBugReportDialog.DLG_BUG_TITLE=Report a bug
GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO=Include technical information
GUIBugReportDialog.DLG_CXL=Cancel
GUIBugReportDialog.DLG_OK=OK
GUIBugReportDialog.DLG_SUBMIT=Submit
GUIBugReportDialog.NOTICE_INFO_INCLUDED=The following information will be included in the bug report if this box is checked: \n\n
GUIClientsideLauncher.23=Report a bug...
GUIClientsideLauncher.24=Request new feature...
GUIClientsideLauncher.25=Visit website
GUIClientsideLauncher.26=GitHub project
GUIClientsideLauncher.27=Visit forums
GUIClientsideLauncher.COL_GAME_PRESET=Game preset
GUIClientsideLauncher.COL_WORLD_DESC=Description
GUIClientsideLauncher.COL_WORLD_NAME=World name
GUIClientsideLauncher.DLG_ABOUT=About
GUIClientsideLauncher.DLG_DELETE=Delete...
GUIClientsideLauncher.DLG_NEW=New...
GUIClientsideLauncher.DLG_NO_WORLD_TO_DELETE=No world was selected to be deleted. Please select an existing world in the table.
GUIClientsideLauncher.DLG_PLAY=Play
GUIClientsideLauncher.DLG_SETTINGS=Settings...
GUIClientsideLauncher.DLG_SINGLEPLAYER=Singleplayer
GUIClientsideLauncher.DLG_TITLE=Mosstest Client launcher <0.0.1-initial>
GUIClientsideLauncher.ERR_NO_WORLD_SELECTED=No world was selected to be started. Please select an existing world in the table, or create a new world.
GUIClientsideLauncher.ERR_NO_WORLD_SELECTED_TITLE=No world selected
GUIClientsideLauncher.NOTICE_DEFAULT_GAME_CODE=Default game code and textures created by dolinksy296, hexafraction, et. al.\n
GUIClientsideLauncher.NOTICE_PRIMARY_AUTHORS=Made by hexafraction, thatnerd2, et al.\n
GUIClientsideLauncher.NOTICE_TOOLS_USED=Made with the help of Eclipse, Git, Maven, and countless services such as TravisCI and GitHub.\n
GUIClientsideLauncher.SYS_NEWLINE=\n
GUIClientsideLauncher.USES_LIBS=Uses the following libraries:\n
GUIClientsideLauncher.WARN_SET_LAF=Warning: The look-and-feel cannot be set to system. Using default look-and-feel.
GUIWorldCreationDialog.CXL=Cancel
GUIWorldCreationDialog.DLG_TITLE=Create new singleplayer world...
GUIWorldCreationDialog.GAME_PROFILE=Game profile:
GUIWorldCreationDialog.OK=OK
GUIWorldCreationDialog.WORLD_DESC=Description:
GUIWorldCreationDialog.WORLD_NAME=World name:
GUIWorldDeletionDialog.AREYOUSURE_TEXT=Are you sure you wish to delete the world called
GUIWorldDeletionDialog.DLG_TITLE=Delete singleplayer world...
GUIWorldDeletionDialog.NO=No
GUIWorldDeletionDialog.QUESTIONMARK_CANNOT_UNDO=? This operation cannot be undone.
GUIWorldDeletionDialog.YES=Yes
GUIBugReportDialog.DLG_BUG_DESC=Detailed problem description:
GUIBugReportDialog.DLG_BUG_DESC_DEFAULT=Please describe your problem here, preferably including what you had done, what you expected to happen, what happened, and any other details about the world or game.\n\nPlease note that we cannot help with third-party games or mods.
GUIBugReportDialog.DLG_BUG_EMAIL=e-mail (optional):
GUIBugReportDialog.DLG_BUG_NAME=Name:
GUIBugReportDialog.DLG_BUG_SUMMARY=Problem summary:
GUIBugReportDialog.DLG_BUG_TITLE=Report a bug
GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO=Include technical information
GUIBugReportDialog.DLG_CXL=Cancel
GUIBugReportDialog.DLG_OK=OK
GUIBugReportDialog.DLG_SUBMIT=Submit
GUIBugReportDialog.NOTICE_INFO_INCLUDED=The following information will be included in the bug report if this box is checked: \n\n
GUIClientsideLauncher.23=Report a bug...
GUIClientsideLauncher.24=Request new feature...
GUIClientsideLauncher.25=Visit website
GUIClientsideLauncher.26=GitHub project
GUIClientsideLauncher.27=Visit forums
GUIClientsideLauncher.COL_GAME_PRESET=Game preset
GUIClientsideLauncher.COL_WORLD_DESC=Description
GUIClientsideLauncher.COL_WORLD_NAME=World name
GUIClientsideLauncher.DLG_ABOUT=About
GUIClientsideLauncher.DLG_DELETE=Delete...
GUIClientsideLauncher.DLG_NEW=New...
GUIClientsideLauncher.DLG_NO_WORLD_TO_DELETE=No world was selected to be deleted. Please select an existing world in the table.
GUIClientsideLauncher.DLG_PLAY=Play
GUIClientsideLauncher.DLG_SETTINGS=Settings...
GUIClientsideLauncher.DLG_SINGLEPLAYER=Singleplayer
GUIClientsideLauncher.DLG_TITLE=Mosstest Client launcher <0.0.1-initial>
GUIClientsideLauncher.ERR_NO_WORLD_SELECTED=No world was selected to be started. Please select an existing world in the table, or create a new world.
GUIClientsideLauncher.ERR_NO_WORLD_SELECTED_TITLE=No world selected
GUIClientsideLauncher.NOTICE_DEFAULT_GAME_CODE=Default game code and textures created by dolinksy296, hexafraction, et. al.\n
GUIClientsideLauncher.NOTICE_PRIMARY_AUTHORS=Made by hexafraction, thatnerd2, et al.\n
GUIClientsideLauncher.NOTICE_TOOLS_USED=Made with the help of Eclipse, Git, Maven, and countless services such as TravisCI and GitHub.\n
GUIClientsideLauncher.SYS_NEWLINE=\n
GUIClientsideLauncher.USES_LIBS=Uses the following libraries:\n
GUIClientsideLauncher.WARN_SET_LAF=Warning: The look-and-feel cannot be set to system. Using default look-and-feel.
GUIWorldCreationDialog.CXL=Cancel
GUIWorldCreationDialog.DLG_TITLE=Create new singleplayer world...
GUIWorldCreationDialog.GAME_PROFILE=Game profile:
GUIWorldCreationDialog.OK=OK
GUIWorldCreationDialog.WORLD_DESC=Description:
GUIWorldCreationDialog.WORLD_NAME=World name:
GUIWorldDeletionDialog.AREYOUSURE_TEXT=Are you sure you wish to delete the world called
GUIWorldDeletionDialog.DLG_TITLE=Delete singleplayer world...
GUIWorldDeletionDialog.NO=No
GUIWorldDeletionDialog.QUESTIONMARK_CANNOT_UNDO=? This operation cannot be undone.
GUIWorldDeletionDialog.YES=Yes

View File

@ -1,14 +1,14 @@
# Root logger option
log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=mosslog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Root logger option
log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=mosslog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

View File

@ -1,94 +1,94 @@
package net.mosstest.scripting;
import net.mosstest.servercore.INodeManager;
import net.mosstest.servercore.MapGeneratorException;
// TODO: Auto-generated Javadoc
/**
* The Class FlatMapGenerator.
*/
public class FlatMapGenerator implements IMapGenerator {
public static final int CHUNK_DIMENSION = 16;
/**
* The seed.
*/
long seed;
/**
* The nm.
*/
INodeManager nm;
/* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#init(long, net.mosstest.servercore.INodeManager, java.lang.Object[])
*/
@Override
public void init(long seed, INodeManager nm, Object... params)
throws MapGeneratorException {
this.seed = seed;
this.nm = nm;
}
/* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#generateChunk(net.mosstest.scripting.Position)
*/
@Override
public MapChunk generateChunk(Position pos)
throws MapGeneratorException {
int[][][] nodes = new int[CHUNK_DIMENSION][CHUNK_DIMENSION][CHUNK_DIMENSION];
int fillNode = (pos.getZ() >= 0) ? this.nm.getNode(
"mg:air", false).getNodeId() : this.nm.getNode( //$NON-NLS-1$
"mg:ground", false).getNodeId(); //$NON-NLS-1$
for (int x = 0; x < CHUNK_DIMENSION; x++) {
for (int y = 0; y < CHUNK_DIMENSION; y++) {
for (int z = 0; z < CHUNK_DIMENSION; z++) {
nodes[x][y][z] = fillNode;
}
}
}
return new MapChunk(pos, nodes);
}
/* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#fillInChunk(int[][][], net.mosstest.scripting.Position)
*/
@Override
public void fillInChunk(int[][][] lightNodes, Position pos)
throws MapGeneratorException {
int fillNode = (pos.getZ() >= 0) ? this.nm.getNode("mg:air", //$NON-NLS-1$
false).getNodeId() : this.nm
.getNode("mg:ground", false).getNodeId(); //$NON-NLS-1$
for (int x = 0; x < CHUNK_DIMENSION; x++) {
for (int y = 0; y < CHUNK_DIMENSION; y++) {
for (int z = 0; z < CHUNK_DIMENSION; z++) {
if (lightNodes[x][y][z] == 0) {
// operation in place on passed in array as per
// contract
lightNodes[x][y][z] = fillNode;
}
}
}
}
}
/* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#registerOre(net.mosstest.scripting.MapNode, double, double, double, int, java.lang.Object[])
*/
@Override
public void registerOre(MapNode oreNode, double minDepth,
double rarity, double clumping, int seed, Object... params) {
// TODO Auto-generated method stub
}
package net.mosstest.scripting;
import net.mosstest.servercore.INodeManager;
import net.mosstest.servercore.MapGeneratorException;
// TODO: Auto-generated Javadoc
/**
* The Class FlatMapGenerator.
*/
public class FlatMapGenerator implements IMapGenerator {
public static final int CHUNK_DIMENSION = 16;
/**
* The seed.
*/
long seed;
/**
* The nm.
*/
INodeManager nm;
/* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#init(long, net.mosstest.servercore.INodeManager, java.lang.Object[])
*/
@Override
public void init(long seed, INodeManager nm, Object... params)
throws MapGeneratorException {
this.seed = seed;
this.nm = nm;
}
/* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#generateChunk(net.mosstest.scripting.Position)
*/
@Override
public MapChunk generateChunk(Position pos)
throws MapGeneratorException {
int[][][] nodes = new int[CHUNK_DIMENSION][CHUNK_DIMENSION][CHUNK_DIMENSION];
int fillNode = (pos.getZ() >= 0) ? this.nm.getNode(
"mg:air", false).getNodeId() : this.nm.getNode( //$NON-NLS-1$
"mg:ground", false).getNodeId(); //$NON-NLS-1$
for (int x = 0; x < CHUNK_DIMENSION; x++) {
for (int y = 0; y < CHUNK_DIMENSION; y++) {
for (int z = 0; z < CHUNK_DIMENSION; z++) {
nodes[x][y][z] = fillNode;
}
}
}
return new MapChunk(pos, nodes);
}
/* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#fillInChunk(int[][][], net.mosstest.scripting.Position)
*/
@Override
public void fillInChunk(int[][][] lightNodes, Position pos)
throws MapGeneratorException {
int fillNode = (pos.getZ() >= 0) ? this.nm.getNode("mg:air", //$NON-NLS-1$
false).getNodeId() : this.nm
.getNode("mg:ground", false).getNodeId(); //$NON-NLS-1$
for (int x = 0; x < CHUNK_DIMENSION; x++) {
for (int y = 0; y < CHUNK_DIMENSION; y++) {
for (int z = 0; z < CHUNK_DIMENSION; z++) {
if (lightNodes[x][y][z] == 0) {
// operation in place on passed in array as per
// contract
lightNodes[x][y][z] = fillNode;
}
}
}
}
}
/* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#registerOre(net.mosstest.scripting.MapNode, double, double, double, int, java.lang.Object[])
*/
@Override
public void registerOre(MapNode oreNode, double minDepth,
double rarity, double clumping, int seed, Object... params) {
// TODO Auto-generated method stub
}
}

View File

@ -1,66 +1,66 @@
package net.mosstest.scripting;
import net.mosstest.servercore.INodeManager;
import net.mosstest.servercore.MapGeneratorException;
// TODO: Auto-generated Javadoc
/**
* The Interface IMapGenerator.
*/
public interface IMapGenerator {
/**
* Inits the.
*
* @param seed the seed
* @param nm the nm
* @param params the params
* @throws MapGeneratorException the map generator exception
*/
void init(long seed, INodeManager nm, Object... params) throws MapGeneratorException;
/**
* Generate chunk.
*
* @param pos the pos
* @return the map chunk
* @throws MapGeneratorException the map generator exception
*/
public MapChunk generateChunk(Position pos) throws MapGeneratorException;
/**
* Fills in a chunk as an array of light nodes, where 0 values require
* filling.
*
* @param lightNodes
* A reference to the array that must be updated.
* @param pos
* The position corresponding to the chunk to be filled in.
* @throws MapGeneratorException
* Thrown in case the map generator encounters an inconsistency
* it cannot recover from.
*/
public void fillInChunk(int[][][] lightNodes, Position pos)
throws MapGeneratorException;
/**
* Register an ore for future generation of chunks. The values given here
* are hints to the map generator and need not be exact.
*
* @param oreNode The ore to generate.
* @param minDepth The minimum depth(as a positive integer number of nodes below
* sea level.
* @param rarity How rare the ore should be. Rarity 1 corresponds to virtually
* every ore-containing node, and rarity 100 would correspond to
* approximately one out of 100 nodes being this ore.
* @param clumping Defines how clumped the ore should be. Generally corresponds
* to 0=uniform and 1=most strongly clumped(solid spheres of ore
* clumps to meet rarity goal)
* @param seed the seed
* @param params Miscellaneous params for the map generator.
*/
public void registerOre(MapNode oreNode, double minDepth, double rarity,
double clumping, int seed, Object... params);
}
package net.mosstest.scripting;
import net.mosstest.servercore.INodeManager;
import net.mosstest.servercore.MapGeneratorException;
// TODO: Auto-generated Javadoc
/**
* The Interface IMapGenerator.
*/
public interface IMapGenerator {
/**
* Inits the.
*
* @param seed the seed
* @param nm the nm
* @param params the params
* @throws MapGeneratorException the map generator exception
*/
void init(long seed, INodeManager nm, Object... params) throws MapGeneratorException;
/**
* Generate chunk.
*
* @param pos the pos
* @return the map chunk
* @throws MapGeneratorException the map generator exception
*/
public MapChunk generateChunk(Position pos) throws MapGeneratorException;
/**
* Fills in a chunk as an array of light nodes, where 0 values require
* filling.
*
* @param lightNodes
* A reference to the array that must be updated.
* @param pos
* The position corresponding to the chunk to be filled in.
* @throws MapGeneratorException
* Thrown in case the map generator encounters an inconsistency
* it cannot recover from.
*/
public void fillInChunk(int[][][] lightNodes, Position pos)
throws MapGeneratorException;
/**
* Register an ore for future generation of chunks. The values given here
* are hints to the map generator and need not be exact.
*
* @param oreNode The ore to generate.
* @param minDepth The minimum depth(as a positive integer number of nodes below
* sea level.
* @param rarity How rare the ore should be. Rarity 1 corresponds to virtually
* every ore-containing node, and rarity 100 would correspond to
* approximately one out of 100 nodes being this ore.
* @param clumping Defines how clumped the ore should be. Generally corresponds
* to 0=uniform and 1=most strongly clumped(solid spheres of ore
* clumps to meet rarity goal)
* @param seed the seed
* @param params Miscellaneous params for the map generator.
*/
public void registerOre(MapNode oreNode, double minDepth, double rarity,
double clumping, int seed, Object... params);
}

View File

@ -1,224 +1,224 @@
package net.mosstest.scripting;
import net.mosstest.servercore.*;
import net.mosstest.servercore.Messages;
import org.apache.log4j.Logger;
import java.io.*;
import java.util.Arrays;
// TODO: Auto-generated Javadoc
/**
* The Class MapChunk.
*/
public class MapChunk extends AbstractMapChunk {
public static final Logger logger = Logger.getLogger(MapChunk.class);
public static final int IS_CHANGED_MASK = 16384;
public static final int UNSIGNED_IDENTITY_MASK = 0b0011111111111111;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MapChunk mapChunk = (MapChunk) o;
if (!pos.equals(mapChunk.pos)) return false;
return true;
}
@Override
public int hashCode() {
return pos.hashCode();
}
/**
* The pos.
*/
public Position pos;
/**
* The light nodes.
*/
int[][][] lightNodes = new int[CHUNK_DIMENSION][CHUNK_DIMENSION][CHUNK_DIMENSION];
boolean compressed;
static final int MAPCHUNK_SERIALIZATION_VERSION = 2;
/**
* Instantiates a new map chunk.
*
*
*
* @param light the primary data storage
* @throws IOException Signals that an I/O exception has occurred.
*/
public MapChunk(byte[] light)
throws IOException {
loadBytes_(light);
}
@Override
protected void setManager(Void manager) {
// This is a void here, ergo we can just return
return;
}
public void loadBytes_(byte[] light) throws IOException {
//Arrays.copyOf(light, light.length);
try (DataInputStream lightStreamIn = new DataInputStream(
new ByteArrayInputStream(light))) {
int flags = lightStreamIn.readUnsignedShort();
int version = lightStreamIn.readUnsignedShort();
if (version > MAPCHUNK_SERIALIZATION_VERSION)
ExceptionHandler.registerException(new MossWorldLoadException(
Messages.getString("MapChunk.BAD_SER_VER"))); //$NON-NLS-1$
byte[] posBuf = new byte[Position.SERIALIZED_LENGTH];
// side effect of reading into buffer
lightStreamIn.read(posBuf);
this.pos = new Position(posBuf);
/*
* flags short: 1=TODO
* 2=none yet 4=run-length diff compression
* (not implemented yet) 8...=reserved
*/
this.compressed = (((flags & 0x04)) != 0);
if (this.compressed) {
int cursor = 0;
// Below comment for IntelliJ Idea. This is the primary side effect of this method
//noinspection MismatchedReadAndWriteOfArray
int[] lightTmp = new int[CHUNK_DIMENSION * CHUNK_DIMENSION * CHUNK_DIMENSION];
while (lightStreamIn.available() > 0) {
int curShort = lightStreamIn.readUnsignedShort();
if ((curShort & IS_CHANGED_MASK) != 0) {
lightTmp[cursor] = curShort;
cursor++;
} else {
if ((curShort & IS_CHANGED_MASK) != 0) {
for (int i = 0; i < (curShort & UNSIGNED_IDENTITY_MASK); i++) {
lightTmp[cursor] = 0;
cursor++;
}
}
}
}
try {
MapGenerators.getDefaultMapgen().fillInChunk(this.lightNodes,
pos);
} catch (MapGeneratorException e) {
// pass, we'll deal with a bad chunk later in the pipeline
}
// throw new NotImplementedException();
} else {
for (int x = 0; x < CHUNK_DIMENSION; x++) {
for (int y = 0; y < CHUNK_DIMENSION; y++) {
for (int z = 0; z < CHUNK_DIMENSION; z++) {
this.lightNodes[x][y][z] = lightStreamIn.readShort();
}
}
}
}
}
}
private void loadHeavy(byte[] heavy) {
}
/**
* Instantiates a new map chunk.
*
* @param pos2 the pos2
* @param nodes the nodes
*/
public MapChunk(Position pos2, int[][][] nodes) {
this.pos = pos2;
this.lightNodes = Arrays.copyOf(nodes, nodes.length);
}
/**
* Gets the node id.
*
* @param x the x
* @param y the y
* @param z the z
* @return the node id
*/
@Override
public int getNodeId(byte x, byte y, byte z) {
return this.lightNodes[x][y][z];
}
/**
* Updates the chunk to set a node. The chunk is not written to the database
* or committed across the network.
*
* @param x the x
* @param y the y
* @param z the z
* @param node the node
*/
@Override
public void setNode(byte x, byte y, byte z, short node) {
this.lightNodes[x][y][z] = node;
}
@Override
public int[][][] getNodes() {
return this.lightNodes;
}
@Override
public byte[] writeLight(boolean compressed) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try (DataOutputStream dos = new DataOutputStream(bos)) {
dos.writeShort(0);
dos.writeShort(MAPCHUNK_SERIALIZATION_VERSION);
dos.write(this.pos.toBytes());
for (int[][] nodelvl : this.lightNodes) {
for (int[] nodelvl2 : nodelvl) {
for (int node : nodelvl2) {
dos.writeShort(node);
}
}
}
dos.flush();
bos.flush();
} catch (IOException e) {
// should never happen
logger.warn("IOException writing light chunk data");
}
return bos.toByteArray();
}
@Override
public void compact() {
// noop in this version. Later versions may compact.
}
@Override
public byte[] toBytes() {
return this.writeLight(true);
}
@Override
public void loadBytes(byte[] buf) throws IOException{
// delegate to internal implementation
this.loadBytes_(buf);
}
}
package net.mosstest.scripting;
import net.mosstest.servercore.*;
import net.mosstest.servercore.Messages;
import org.apache.log4j.Logger;
import java.io.*;
import java.util.Arrays;
// TODO: Auto-generated Javadoc
/**
* The Class MapChunk.
*/
public class MapChunk extends AbstractMapChunk {
public static final Logger logger = Logger.getLogger(MapChunk.class);
public static final int IS_CHANGED_MASK = 16384;
public static final int UNSIGNED_IDENTITY_MASK = 0b0011111111111111;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MapChunk mapChunk = (MapChunk) o;
if (!pos.equals(mapChunk.pos)) return false;
return true;
}
@Override
public int hashCode() {
return pos.hashCode();
}
/**
* The pos.
*/
public Position pos;
/**
* The light nodes.
*/
int[][][] lightNodes = new int[CHUNK_DIMENSION][CHUNK_DIMENSION][CHUNK_DIMENSION];
boolean compressed;
static final int MAPCHUNK_SERIALIZATION_VERSION = 2;
/**
* Instantiates a new map chunk.
*
*
*
* @param light the primary data storage
* @throws IOException Signals that an I/O exception has occurred.
*/
public MapChunk(byte[] light)
throws IOException {
loadBytes_(light);
}
@Override
protected void setManager(Void manager) {
// This is a void here, ergo we can just return
return;
}
public void loadBytes_(byte[] light) throws IOException {
//Arrays.copyOf(light, light.length);
try (DataInputStream lightStreamIn = new DataInputStream(
new ByteArrayInputStream(light))) {
int flags = lightStreamIn.readUnsignedShort();
int version = lightStreamIn.readUnsignedShort();
if (version > MAPCHUNK_SERIALIZATION_VERSION)
ExceptionHandler.registerException(new MossWorldLoadException(
Messages.getString("MapChunk.BAD_SER_VER"))); //$NON-NLS-1$
byte[] posBuf = new byte[Position.SERIALIZED_LENGTH];
// side effect of reading into buffer
lightStreamIn.read(posBuf);
this.pos = new Position(posBuf);
/*
* flags short: 1=TODO
* 2=none yet 4=run-length diff compression
* (not implemented yet) 8...=reserved
*/
this.compressed = (((flags & 0x04)) != 0);
if (this.compressed) {
int cursor = 0;
// Below comment for IntelliJ Idea. This is the primary side effect of this method
//noinspection MismatchedReadAndWriteOfArray
int[] lightTmp = new int[CHUNK_DIMENSION * CHUNK_DIMENSION * CHUNK_DIMENSION];
while (lightStreamIn.available() > 0) {
int curShort = lightStreamIn.readUnsignedShort();
if ((curShort & IS_CHANGED_MASK) != 0) {
lightTmp[cursor] = curShort;
cursor++;
} else {
if ((curShort & IS_CHANGED_MASK) != 0) {
for (int i = 0; i < (curShort & UNSIGNED_IDENTITY_MASK); i++) {
lightTmp[cursor] = 0;
cursor++;
}
}
}
}
try {
MapGenerators.getDefaultMapgen().fillInChunk(this.lightNodes,
pos);
} catch (MapGeneratorException e) {
// pass, we'll deal with a bad chunk later in the pipeline
}
// throw new NotImplementedException();
} else {
for (int x = 0; x < CHUNK_DIMENSION; x++) {
for (int y = 0; y < CHUNK_DIMENSION; y++) {
for (int z = 0; z < CHUNK_DIMENSION; z++) {
this.lightNodes[x][y][z] = lightStreamIn.readShort();
}
}
}
}
}
}
private void loadHeavy(byte[] heavy) {
}
/**
* Instantiates a new map chunk.
*
* @param pos2 the pos2
* @param nodes the nodes
*/
public MapChunk(Position pos2, int[][][] nodes) {
this.pos = pos2;
this.lightNodes = Arrays.copyOf(nodes, nodes.length);
}
/**
* Gets the node id.
*
* @param x the x
* @param y the y
* @param z the z
* @return the node id
*/
@Override
public int getNodeId(byte x, byte y, byte z) {
return this.lightNodes[x][y][z];
}
/**
* Updates the chunk to set a node. The chunk is not written to the database
* or committed across the network.
*
* @param x the x
* @param y the y
* @param z the z
* @param node the node
*/
@Override
public void setNode(byte x, byte y, byte z, short node) {
this.lightNodes[x][y][z] = node;
}
@Override
public int[][][] getNodes() {
return this.lightNodes;
}
@Override
public byte[] writeLight(boolean compressed) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try (DataOutputStream dos = new DataOutputStream(bos)) {
dos.writeShort(0);
dos.writeShort(MAPCHUNK_SERIALIZATION_VERSION);
dos.write(this.pos.toBytes());
for (int[][] nodelvl : this.lightNodes) {
for (int[] nodelvl2 : nodelvl) {
for (int node : nodelvl2) {
dos.writeShort(node);
}
}
}
dos.flush();
bos.flush();
} catch (IOException e) {
// should never happen
logger.warn("IOException writing light chunk data");
}
return bos.toByteArray();
}
@Override
public void compact() {
// noop in this version. Later versions may compact.
}
@Override
public byte[] toBytes() {
return this.writeLight(true);
}
@Override
public void loadBytes(byte[] buf) throws IOException{
// delegate to internal implementation
this.loadBytes_(buf);
}
}

View File

@ -1,46 +1,46 @@
package net.mosstest.scripting;
import net.mosstest.servercore.INodeManager;
import net.mosstest.servercore.MapGeneratorException;
// TODO: Auto-generated Javadoc
/**
* The Class MapGenerators.
*/
public class MapGenerators {
public static final int CHUNK_DIMENSION = 16;
/**
* The mg.
*/
private static volatile IMapGenerator mg;
/**
* Sets the default map generator.
*
* @param g the g
* @param nm the nm
* @param seed the seed
* @param params the params
* @throws MapGeneratorException the map generator exception
*/
public static void setDefaultMapGenerator(IMapGenerator g, INodeManager nm, long seed,
Object... params) throws MapGeneratorException {
synchronized (MapGenerators.class) {
mg = g;
mg.init(seed, nm, params);
}
}
/**
* Gets the default mapgen.
*
* @return the default mapgen
*/
public static IMapGenerator getDefaultMapgen() {
return mg;
}
}
package net.mosstest.scripting;
import net.mosstest.servercore.INodeManager;
import net.mosstest.servercore.MapGeneratorException;
// TODO: Auto-generated Javadoc
/**
* The Class MapGenerators.
*/
public class MapGenerators {
public static final int CHUNK_DIMENSION = 16;
/**
* The mg.
*/
private static volatile IMapGenerator mg;
/**
* Sets the default map generator.
*
* @param g the g
* @param nm the nm
* @param seed the seed
* @param params the params
* @throws MapGeneratorException the map generator exception
*/
public static void setDefaultMapGenerator(IMapGenerator g, INodeManager nm, long seed,
Object... params) throws MapGeneratorException {
synchronized (MapGenerators.class) {
mg = g;
mg.init(seed, nm, params);
}
}
/**
* Gets the default mapgen.
*
* @return the default mapgen
*/
public static IMapGenerator getDefaultMapgen() {
return mg;
}
}

View File

@ -1,60 +1,60 @@
package net.mosstest.scripting;
import net.mosstest.scripting.MapNode.DrawType;
// TODO: Auto-generated Javadoc
/**
* The Class MapNodeBuilder.
*/
public class MapNodeBuilder {
/** The name. */
private String name;
/** The ui name. */
private String uiName;
/** The params. */
private INodeParams params;
/** The light emission. */
private int lightEmission = 0;
/** The drop item. */
private MossItem dropItem;
/** The is buildable to. */
private boolean isBuildableTo = true;
/** The draw type. */
private DrawType drawType = DrawType.DRAW_BLOCK;
/** The box origin z. */
private float boxOriginX = 0, boxOriginY = 0, boxOriginZ = 0;
/** The length z. */
private float lengthX = 0.5f, lengthY = 0.5f, lengthZ = 0.5f;
/**
* Instantiates a new map node builder.
*
* @param name the name
* @param uiName the ui name
*/
public MapNodeBuilder(String name, String uiName) {
this.name = name;
this.uiName = uiName;
}
/**
* Params.
*
* @param params the params
* @return the map node builder
*/
public MapNodeBuilder params(INodeParams params) {
this.params = params;
return this;
}
}
package net.mosstest.scripting;
import net.mosstest.scripting.MapNode.DrawType;
// TODO: Auto-generated Javadoc
/**
* The Class MapNodeBuilder.
*/
public class MapNodeBuilder {
/** The name. */
private String name;
/** The ui name. */
private String uiName;
/** The params. */
private INodeParams params;
/** The light emission. */
private int lightEmission = 0;
/** The drop item. */
private MossItem dropItem;
/** The is buildable to. */
private boolean isBuildableTo = true;
/** The draw type. */
private DrawType drawType = DrawType.DRAW_BLOCK;
/** The box origin z. */
private float boxOriginX = 0, boxOriginY = 0, boxOriginZ = 0;
/** The length z. */
private float lengthX = 0.5f, lengthY = 0.5f, lengthZ = 0.5f;
/**
* Instantiates a new map node builder.
*
* @param name the name
* @param uiName the ui name
*/
public MapNodeBuilder(String name, String uiName) {
this.name = name;
this.uiName = uiName;
}
/**
* Params.
*
* @param params the params
* @return the map node builder
*/
public MapNodeBuilder params(INodeParams params) {
this.params = params;
return this;
}
}

View File

@ -1,47 +1,47 @@
package net.mosstest.scripting;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
// TODO: Auto-generated Javadoc
/**
* The Class Messages.
*/
public class Messages {
/** The Constant BUNDLE_NAME. */
private static final String BUNDLE_NAME = "net.mosstest.scripting.messages"; //$NON-NLS-1$
/** The res bundle. */
private static ResourceBundle resBundle = ResourceBundle
.getBundle(BUNDLE_NAME);
/**
* Change language.
*
* @param identifier the identifier
*/
public static void changeLanguage(String identifier) {
resBundle = ResourceBundle.getBundle(BUNDLE_NAME + "." + identifier);
}
/**
* Instantiates a new messages.
*/
private Messages() {
}
/**
* Gets the string.
*
* @param key the key
* @return the string
*/
public static String getString(String key) {
try {
return resBundle.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
package net.mosstest.scripting;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
// TODO: Auto-generated Javadoc
/**
* The Class Messages.
*/
public class Messages {
/** The Constant BUNDLE_NAME. */
private static final String BUNDLE_NAME = "net.mosstest.scripting.messages"; //$NON-NLS-1$
/** The res bundle. */
private static ResourceBundle resBundle = ResourceBundle
.getBundle(BUNDLE_NAME);
/**
* Change language.
*
* @param identifier the identifier
*/
public static void changeLanguage(String identifier) {
resBundle = ResourceBundle.getBundle(BUNDLE_NAME + "." + identifier);
}
/**
* Instantiates a new messages.
*/
private Messages() {
}
/**
* Gets the string.
*
* @param key the key
* @return the string
*/
public static String getString(String key) {
try {
return resBundle.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
}

View File

@ -1,68 +1,68 @@
package net.mosstest.scripting;
public class MossItemBuilder {
private String invTex;
private String wieldTex;
private double invWeight;
private MossItem.StackMode mayStack = MossItem.StackMode.STACK_UNIT;
private String displayName;
private String internalName;
public MossItemBuilder setInvTex(String invTex) {
this.invTex = invTex;
return this;
}
public MossItemBuilder setWieldTex(String wieldTex) {
this.wieldTex = wieldTex;
return this;
}
public MossItemBuilder setInvWeight(double invWeight) {
this.invWeight = invWeight;
return this;
}
public String getInvTex() {
return invTex;
}
public String getWieldTex() {
return wieldTex;
}
public double getInvWeight() {
return invWeight;
}
public MossItem.StackMode getStackMode() {
return mayStack;
}
public MossItemBuilder setStackMode(MossItem.StackMode mayStack) {
this.mayStack = mayStack;
return this;
}
public String getDisplayName() {
return displayName;
}
public String getInternalName() {
return internalName;
}
public MossItemBuilder setDisplayName(String displayName) {
this.displayName = displayName;
return this;
}
public MossItemBuilder setInternalName(String internalName) {
this.internalName = internalName;
return this;
}
public MossItem createMossItem() {
return new MossItem(invTex, wieldTex, invWeight, mayStack, displayName, internalName);
}
package net.mosstest.scripting;
public class MossItemBuilder {
private String invTex;
private String wieldTex;
private double invWeight;
private MossItem.StackMode mayStack = MossItem.StackMode.STACK_UNIT;
private String displayName;
private String internalName;
public MossItemBuilder setInvTex(String invTex) {
this.invTex = invTex;
return this;
}
public MossItemBuilder setWieldTex(String wieldTex) {
this.wieldTex = wieldTex;
return this;
}
public MossItemBuilder setInvWeight(double invWeight) {
this.invWeight = invWeight;
return this;
}
public String getInvTex() {
return invTex;
}
public String getWieldTex() {
return wieldTex;
}
public double getInvWeight() {
return invWeight;
}
public MossItem.StackMode getStackMode() {
return mayStack;
}
public MossItemBuilder setStackMode(MossItem.StackMode mayStack) {
this.mayStack = mayStack;
return this;
}
public String getDisplayName() {
return displayName;
}
public String getInternalName() {
return internalName;
}
public MossItemBuilder setDisplayName(String displayName) {
this.displayName = displayName;
return this;
}
public MossItemBuilder setInternalName(String internalName) {
this.internalName = internalName;
return this;
}
public MossItem createMossItem() {
return new MossItem(invTex, wieldTex, invWeight, mayStack, displayName, internalName);
}
}

View File

@ -1,320 +1,321 @@
package net.mosstest.scripting;
import net.mosstest.scripting.events.IMossEvent;
import net.mosstest.scripting.handlers.MossEventHandler;
import net.mosstest.scripting.handlers.MossNodeChangeHandler;
import net.mosstest.servercore.*;
import java.util.ArrayList;
import java.util.HashMap;
/**
* This class is used by scripts and script-facing portions of Mosstest. Methods
* restricted to be called from trusted Java-side shall pass a
* {@link ScriptSandboxBorderToken}. Each event fired will run in the thread
* pool. All requests via this API need not concern themselves with threading as
* everything is handled by Mosstest itself.
* <p/>
* The event handlers called are the ones defined via this class's registerOnFoo
* methods, followed by any handlers defined in an instance of NodeParams via an
* anonymous inner class, and finally with the default handler.
* <p/>
* The order in which handlers registered here are called is undefined due to
* the undefined order of scripts being loaded. Generally, this is planned to
* occur in an order based on the SHA512 hash of the script. Comments with dummy
* information may be used by the script author to attempt to set the position
* of a script in the execution order via manipulating the hash. Handlers of the
* same types within the same script are guaranteed to be called in order.
* <p/>
* An event handler may interrupt handling of the event so that no further event
* handlers nor the default are ever called, by returning the proper boolean value
*
* @author rarkenin
* @version 0.0
* @since 0.0
*/
public class MossScriptEnv {
public void registerNodeChangeHandler(MossNodeChangeHandler h) {
}
private HashMap<Class<? extends IMossEvent>, ArrayList<MossEventHandler>> eventHandlers;
private ScriptableDatabase db;
private MapCache nc;
private FuturesProcessor fp;
private INodeManager nm;
/**
* Sends a chat message to a player.
*
* @param recipient A {@link Player} object representing the recipient. A Player
* object may be constructed with
* {@link MossScriptEnv#getPlayerByName(String)}.
* @param from A player object representing the sender. A Player object may
* be constructed with
* {@link MossScriptEnv#getPlayerByName(String)}. If null a
* message is sent showing to users as having been sent by the
* server with the prefix <code>[*] Server:</code>
* @param message A string representing the message that shall be sent to the
* specified recipient.
*/
public void sendChatMessage(Player recipient, Player from, String message) {
// TODO
}
/**
* Sends a chat message to all players.
*
* @param from A player object representing the sender. A Player object may
* be constructed with
* {@link MossScriptEnv#getPlayerByName(String)}. If null a
* message is sent showing to users as having been sent by the
* server with the prefix <code>[*] Server:</code>
* @param message A string representing the message that shall be sent to the
* specified recipient.
*/
public void sendChatAll(Player from, String message) {
// TODO
}
/**
* Sets the health on an entity or player.
*
* @param p The player to set health on.
* @param health A positive integer representing the amount of health to set.
*/
public void setHp(Player p, int health) {
// TODO Once we have players doing stuff
}
/**
* Damages the tool of a player corresponding to a dig. The player's
* currently selected tool is damaged.
*
* @param actor The player that is digging a node.
* @param nd The node dug.
* @throws MossScriptException Thrown if the current tool cannot be used to dig the node.
*/
public void damageTool(Player actor, MapNode nd) throws MossScriptException {
// TODO Auto-generated method stub
}
/**
* Gives a player an item. The item stack will be added to the player's
* default inventory, adding to the first available partial stack. If no
* partial stacks are available the item is added to the first open slot in
* the inventory.
*
* @param player the player
* @param item the item
* @return True if the item could be added, false if the item could not be
* added due to insufficient space.
*/
public boolean givePlayer(Player player, MossItem.Stack item) {
MossInventory mi = player.getInventory("default", 4, 8, 128);
// use side effect
return (mi.addItem(item) == item.amount);
}
/**
* Sets a node of the world to a given type. This cannot be called on a
* NodePosition with an existing solid node; use
* {@link #removeNode(NodePosition)} first.
*
* @param pos The position at which to set a node.
* @param node The node to place at that position.
*/
public void setNode(NodePosition pos, MapNode node) throws MapGeneratorException {
MapChunk chk = this.nc.getChunkNoGenerate(pos.chunk);
if (chk == null)
return;
if (!(this.nm.containsNode(node) || node instanceof IDynamicNode))
throw new IllegalArgumentException("The mapnode passed is not contained in the world node manager");
chk.setNode(pos.xl, pos.yl, pos.zl, node.getNodeId());
}
/**
* Removes a node, setting it to air. This may be called on a NodePosition
* with an existing solid node.
*
* @param pos The NodePosition at which to remove the node.
*/
public void removeNode(NodePosition pos) throws MapGeneratorException {
MapChunk chk = this.nc.getChunkNoGenerate(pos.chunk);
if (chk == null)
return;
chk.setNode(pos.xl, pos.yl, pos.zl, this.nm.getNode("mg:air") //$NON-NLS-1$
.getNodeId());
this.nc.setChunk(pos.chunk, chk);
}
/**
* Get the MapNode at a certain location.
*
* @param pos The location at which to get the node
* @return A MapNode object representing the node at that location.
* @throws MapGeneratorException the map generator exception
*/
public MapNode getNode(NodePosition pos) throws MapGeneratorException {
return this.nm.getNode((short) this.nc.getChunk(pos.chunk).getNodeId(
pos.xl, pos.yl, pos.zl));
}
/**
* Registers a mapnode in the world, allowing it to be placed.
* @param nd
* @throws MossWorldLoadException
*/
public void registerNode(MapNode nd) throws MossWorldLoadException {
this.nm.putNode(nd);
}
/**
* Register a new liquid in the node manager, generating intermediates as needed.
*
* @param sysname The name such as default:lava to set. The prefix mg: is used
* for mapgen-specific nodes, and should be done by creating a
* node with a different prefix and aliasing mg:foo to it.
* @param userFacingName The name to display in the UI, such as Lava or Iron Ore
* @param params An implementation of the {@link LiquidNodeParams} interface
* detailing the action of the node. {@link LiquidSourceNodeParams} and
* {@link LiquidFlowingNodeParams} are valid for liquid sources and flowing liquid nodes,
* respectively.
* @param flowParams the source params
* @param textures A string stating the filename of the textures image.
* @param light The amount of light from 0 to 255 to be emitted.
* @return The MapNode object that has been created and added to the
* manager.
* @throws MossWorldLoadException If an exception occurs during the execution of the
* registering.
*/
public LiquidNode registerLiquid(String sysname, String userFacingName,
LiquidNodeParams params, LiquidNodeParams flowParams,
String textures, int light) throws MossWorldLoadException {
LiquidNode nd = new LiquidNode(params, textures, sysname,
userFacingName, light);
this.nm.putNode(nd);
nd.level = 0;
for (int i = 1; i < 8; i++) {
LiquidNode innerNd = new LiquidNode(flowParams, textures, sysname
+ "$LEVEL$" + i, userFacingName, light); //$NON-NLS-1$
innerNd.setByBounds(-.5f, .5f, -.5f, .5f, -.5f, (i / 8f) - 0.5f);
nd.liquidLevels[i] = innerNd;
innerNd.liquidLevels = nd.liquidLevels;
innerNd.level = i;
this.nm.putNode(innerNd);
}
nd.liquidLevels[0] = nd;
return nd;
}
/**
* Registers a node alias. Since the map generator and scripts work via
* string names, registering an alias of mg:dirt to myscript:specialdirt
* will cause a mapgen that recognizes mg:dirt as a generated element to use
* specialdirt for that.
*
* @param alias The alias to create, i.e. mg:dirt
* @param dst The existing node to set as the alias target, i.e
* myscript:specialdirt. This element must already exist.
*/
public void registerNodeAlias(String alias, String dst) {
this.nm.putNodeAlias(alias, dst);
}
/**
* Gets the inv by name.
*
* @param player the player
* @param name the name
* @return the inv by name
*/
public MossInventory getInvByName(Player player, String name) {
return null;
}
/**
* Creates the inv by name.
*
* @param p the p
* @param name the name
* @return the moss inventory
*/
public MossInventory createInvByName(Player p, String name) {
return null;
}
/**
* Gets the player by name.
*
* @param name the name
* @return the player by name
*/
public Player getPlayerByName(String name) {
return null;
}
/**
* Gets the node by name.
*
* @param name the name
* @return the node by name
*/
public MapNode getNodeByName(String name) {
return null;
}
/**
* Gets the db.
*
* @return the db
*/
public ScriptableDatabase getDb() {
return this.db;
}
/**
* Instantiates a new moss script env.
*
* @param db the db
* @param nc the nc
* @param fp the fp
* @param nm the nm
*/
public MossScriptEnv(ScriptableDatabase db, MapCache nc,
FuturesProcessor fp, INodeManager nm) {
this.db = db;
this.nc = nc;
this.fp = fp;
this.nm = nm;
}
/**
* Gets the futures processor.
*
* @return the futures processor
*/
public FuturesProcessor getFuturesProcessor() {
return this.fp;
}
public ArrayList<MossEventHandler> getEventHandlers(
Class<? extends IMossEvent> class1) {
// TODO Auto-generated method stub
return null;
}
}
package net.mosstest.scripting;
import net.mosstest.scripting.events.IMossEvent;
import net.mosstest.scripting.handlers.MossEventHandler;
import net.mosstest.scripting.handlers.MossNodeChangeHandler;
import net.mosstest.servercore.*;
import org.mozilla.javascript.NativeJavaPackage;
import java.util.ArrayList;
import java.util.HashMap;
/**
* This class is used by scripts and script-facing portions of Mosstest. Methods
* restricted to be called from trusted Java-side shall pass a
* {@link ScriptSandboxBorderToken}. Each event fired will run in the thread
* pool. All requests via this API need not concern themselves with threading as
* everything is handled by Mosstest itself.
* <p/>
* The event handlers called are the ones defined via this class's registerOnFoo
* methods, followed by any handlers defined in an instance of NodeParams via an
* anonymous inner class, and finally with the default handler.
* <p/>
* The order in which handlers registered here are called is undefined due to
* the undefined order of scripts being loaded. Generally, this is planned to
* occur in an order based on the SHA512 hash of the script. Comments with dummy
* information may be used by the script author to attempt to set the position
* of a script in the execution order via manipulating the hash. Handlers of the
* same types within the same script are guaranteed to be called in order.
* <p/>
* An event handler may interrupt handling of the event so that no further event
* handlers nor the default are ever called, by returning the proper boolean value
*
* @author rarkenin
* @version 0.0
* @since 0.0
*/
public class MossScriptEnv {
public void registerNodeChangeHandler(MossNodeChangeHandler h) {
}
private HashMap<Class<? extends IMossEvent>, ArrayList<MossEventHandler>> eventHandlers;
private ScriptableDatabase db;
private MapCache nc;
private FuturesProcessor fp;
private INodeManager nm;
/**
* Sends a chat message to a player.
*
* @param recipient A {@link Player} object representing the recipient. A Player
* object may be constructed with
* {@link MossScriptEnv#getPlayerByName(String)}.
* @param from A player object representing the sender. A Player object may
* be constructed with
* {@link MossScriptEnv#getPlayerByName(String)}. If null a
* message is sent showing to users as having been sent by the
* server with the prefix <code>[*] Server:</code>
* @param message A string representing the message that shall be sent to the
* specified recipient.
*/
public void sendChatMessage(Player recipient, Player from, String message) {
// TODO
}
/**
* Sends a chat message to all players.
*
* @param from A player object representing the sender. A Player object may
* be constructed with
* {@link MossScriptEnv#getPlayerByName(String)}. If null a
* message is sent showing to users as having been sent by the
* server with the prefix <code>[*] Server:</code>
* @param message A string representing the message that shall be sent to the
* specified recipient.
*/
public void sendChatAll(Player from, String message) {
// TODO
}
/**
* Sets the health on an entity or player.
*
* @param p The player to set health on.
* @param health A positive integer representing the amount of health to set.
*/
public void setHp(Player p, int health) {
// TODO Once we have players doing stuff
}
/**
* Damages the tool of a player corresponding to a dig. The player's
* currently selected tool is damaged.
*
* @param actor The player that is digging a node.
* @param nd The node dug.
* @throws MossScriptException Thrown if the current tool cannot be used to dig the node.
*/
public void damageTool(Player actor, MapNode nd) throws MossScriptException {
// TODO Auto-generated method stub
}
/**
* Gives a player an item. The item stack will be added to the player's
* default inventory, adding to the first available partial stack. If no
* partial stacks are available the item is added to the first open slot in
* the inventory.
*
* @param player the player
* @param item the item
* @return True if the item could be added, false if the item could not be
* added due to insufficient space.
*/
public boolean givePlayer(Player player, MossItem.Stack item) {
MossInventory mi = player.getInventory("default", 4, 8, 128);
// use side effect
return (mi.addItem(item) == item.amount);
}
/**
* Sets a node of the world to a given type. This cannot be called on a
* NodePosition with an existing solid node; use
* {@link #removeNode(NodePosition)} first.
*
* @param pos The position at which to set a node.
* @param node The node to place at that position.
*/
public void setNode(NodePosition pos, MapNode node) throws MapGeneratorException {
MapChunk chk = this.nc.getChunkNoGenerate(pos.chunk);
if (chk == null)
return;
if (!(this.nm.containsNode(node) || node instanceof IDynamicNode))
throw new IllegalArgumentException("The mapnode passed is not contained in the world node manager");
chk.setNode(pos.xl, pos.yl, pos.zl, node.getNodeId());
}
/**
* Removes a node, setting it to air. This may be called on a NodePosition
* with an existing solid node.
*
* @param pos The NodePosition at which to remove the node.
*/
public void removeNode(NodePosition pos) throws MapGeneratorException {
MapChunk chk = this.nc.getChunkNoGenerate(pos.chunk);
if (chk == null)
return;
chk.setNode(pos.xl, pos.yl, pos.zl, this.nm.getNode("mg:air") //$NON-NLS-1$
.getNodeId());
this.nc.setChunk(pos.chunk, chk);
}
/**
* Get the MapNode at a certain location.
*
* @param pos The location at which to get the node
* @return A MapNode object representing the node at that location.
* @throws MapGeneratorException the map generator exception
*/
public MapNode getNode(NodePosition pos) throws MapGeneratorException {
return this.nm.getNode((short) this.nc.getChunk(pos.chunk).getNodeId(
pos.xl, pos.yl, pos.zl));
}
/**
* Registers a mapnode in the world, allowing it to be placed.
* @param nd
* @throws MossWorldLoadException
*/
public void registerNode(MapNode nd) throws MossWorldLoadException {
this.nm.putNode(nd);
}
/**
* Register a new liquid in the node manager, generating intermediates as needed.
*
* @param sysname The name such as default:lava to set. The prefix mg: is used
* for mapgen-specific nodes, and should be done by creating a
* node with a different prefix and aliasing mg:foo to it.
* @param userFacingName The name to display in the UI, such as Lava or Iron Ore
* @param params An implementation of the {@link LiquidNodeParams} interface
* detailing the action of the node. {@link LiquidSourceNodeParams} and
* {@link LiquidFlowingNodeParams} are valid for liquid sources and flowing liquid nodes,
* respectively.
* @param flowParams the source params
* @param textures A string stating the filename of the textures image.
* @param light The amount of light from 0 to 255 to be emitted.
* @return The MapNode object that has been created and added to the
* manager.
* @throws MossWorldLoadException If an exception occurs during the execution of the
* registering.
*/
public LiquidNode registerLiquid(String sysname, String userFacingName,
LiquidNodeParams params, LiquidNodeParams flowParams,
String textures, int light) throws MossWorldLoadException {
LiquidNode nd = new LiquidNode(params, textures, sysname,
userFacingName, light);
this.nm.putNode(nd);
nd.level = 0;
for (int i = 1; i < 8; i++) {
LiquidNode innerNd = new LiquidNode(flowParams, textures, sysname
+ "$LEVEL$" + i, userFacingName, light); //$NON-NLS-1$
innerNd.setByBounds(-.5f, .5f, -.5f, .5f, -.5f, (i / 8f) - 0.5f);
nd.liquidLevels[i] = innerNd;
innerNd.liquidLevels = nd.liquidLevels;
innerNd.level = i;
this.nm.putNode(innerNd);
}
nd.liquidLevels[0] = nd;
return nd;
}
/**
* Registers a node alias. Since the map generator and scripts work via
* string names, registering an alias of mg:dirt to myscript:specialdirt
* will cause a mapgen that recognizes mg:dirt as a generated element to use
* specialdirt for that.
*
* @param alias The alias to create, i.e. mg:dirt
* @param dst The existing node to set as the alias target, i.e
* myscript:specialdirt. This element must already exist.
*/
public void registerNodeAlias(String alias, String dst) {
this.nm.putNodeAlias(alias, dst);
}
/**
* Gets the inv by name.
*
* @param player the player
* @param name the name
* @return the inv by name
*/
public MossInventory getInvByName(Player player, String name) {
return null;
}
/**
* Creates the inv by name.
*
* @param p the p
* @param name the name
* @return the moss inventory
*/
public MossInventory createInvByName(Player p, String name) {
return null;
}
/**
* Gets the player by name.
*
* @param name the name
* @return the player by name
*/
public Player getPlayerByName(String name) {
return null;
}
/**
* Gets the node by name.
*
* @param name the name
* @return the node by name
*/
public MapNode getNodeByName(String name) {
return null;
}
/**
* Gets the db.
*
* @return the db
*/
public ScriptableDatabase getDb() {
return this.db;
}
/**
* Instantiates a new moss script env.
*
* @param db the db
* @param nc the nc
* @param fp the fp
* @param nm the nm
*/
public MossScriptEnv(ScriptableDatabase db, MapCache nc,
FuturesProcessor fp, INodeManager nm) {
this.db = db;
this.nc = nc;
this.fp = fp;
this.nm = nm;
}
/**
* Gets the futures processor.
*
* @return the futures processor
*/
public FuturesProcessor getFuturesProcessor() {
return this.fp;
}
public ArrayList<MossEventHandler> getEventHandlers(
Class<? extends IMossEvent> class1) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -1,8 +1,8 @@
package net.mosstest.scripting.events;
/**
* Marker interface for all events.
*/
public interface IMossEvent {
}
package net.mosstest.scripting.events;
/**
* Marker interface for all events.
*/
public interface IMossEvent {
}

View File

@ -1,91 +1,91 @@
package net.mosstest.scripting.events;
import net.mosstest.scripting.MapNode;
import net.mosstest.scripting.MossItem;
import net.mosstest.scripting.NodePosition;
import net.mosstest.scripting.Player;
// TODO: Auto-generated Javadoc
/**
* The Class MossNodeChangeEvent.
*/
public class MossNodeChangeEvent implements IMossEvent{
/**
* The Enum NodeActionType.
*/
public enum NodeActionType {
/**
* Fired when the user fully digs a node.
*/
NODE_ACTION_DIG,
/** Fired when the user punches (left-clicks) a node. */
NODE_ACTION_PUNCH,
/**
* Fired when the user punches a node with a right-click. The default
* action is to place a node; onDig should return false to avoid this.
*/
NODE_ACTION_RIGHTPUNCH,
/**
* Fired when the user punches a node with a middle-click.
*/
NODE_ACTION_MIDDLE_MOUSE_PUNCH,
/**
* Fired when the user right-clicks the node while pressing shift. This
* is generally a sign of attempting to place a node as opposed to
* right-punching it.
*/
NODE_ACTION_PLACE,
/**
* Currently unused.
*/
NODE_ACTION_REPLACE
}
/**
* The player performing the action, or null for none (e.g. a plugin raising
* a dig event, for example via a node that is designed to dig another node
* with a ceratin tool and is raising the event to be evaluated as if it
* occurs with that tool.
*/
public final Player pl;
/**
* The NodePosition of the node in question.
*/
public final NodePosition pos;
/**
* A sequence number for this event. Refer to {@link net.mosstest.scripting.events}.
*/
public final long seqnum;
/** The type. */
public final NodeActionType type;
/** The node before. */
public final MapNode nodeBefore;
/** The wield item. */
public final MossItem wieldItem;
/**
* Instantiates a new moss node change event.
*
* @param pl the pl
* @param pos the pos
* @param seqnum the seqnum
* @param type the type
* @param nodeBefore the node before
* @param wieldItem the wield item
*/
public MossNodeChangeEvent(Player pl, NodePosition pos, long seqnum,
NodeActionType type, MapNode nodeBefore, MossItem wieldItem) {
this.pl = pl;
this.pos = pos;
this.seqnum = seqnum;
this.type = type;
this.nodeBefore = nodeBefore;
this.wieldItem = wieldItem;
}
}
package net.mosstest.scripting.events;
import net.mosstest.scripting.MapNode;
import net.mosstest.scripting.MossItem;
import net.mosstest.scripting.NodePosition;
import net.mosstest.scripting.Player;
// TODO: Auto-generated Javadoc
/**
* The Class MossNodeChangeEvent.
*/
public class MossNodeChangeEvent implements IMossEvent{
/**
* The Enum NodeActionType.
*/
public enum NodeActionType {
/**
* Fired when the user fully digs a node.
*/
NODE_ACTION_DIG,
/** Fired when the user punches (left-clicks) a node. */
NODE_ACTION_PUNCH,
/**
* Fired when the user punches a node with a right-click. The default
* action is to place a node; onDig should return false to avoid this.
*/
NODE_ACTION_RIGHTPUNCH,
/**
* Fired when the user punches a node with a middle-click.
*/
NODE_ACTION_MIDDLE_MOUSE_PUNCH,
/**
* Fired when the user right-clicks the node while pressing shift. This
* is generally a sign of attempting to place a node as opposed to
* right-punching it.
*/
NODE_ACTION_PLACE,
/**
* Currently unused.
*/
NODE_ACTION_REPLACE
}
/**
* The player performing the action, or null for none (e.g. a plugin raising
* a dig event, for example via a node that is designed to dig another node
* with a ceratin tool and is raising the event to be evaluated as if it
* occurs with that tool.
*/
public final Player pl;
/**
* The NodePosition of the node in question.
*/
public final NodePosition pos;
/**
* A sequence number for this event. Refer to {@link net.mosstest.scripting.events}.
*/
public final long seqnum;
/** The type. */
public final NodeActionType type;
/** The node before. */
public final MapNode nodeBefore;
/** The wield item. */
public final MossItem wieldItem;
/**
* Instantiates a new moss node change event.
*
* @param pl the pl
* @param pos the pos
* @param seqnum the seqnum
* @param type the type
* @param nodeBefore the node before
* @param wieldItem the wield item
*/
public MossNodeChangeEvent(Player pl, NodePosition pos, long seqnum,
NodeActionType type, MapNode nodeBefore, MossItem wieldItem) {
this.pl = pl;
this.pos = pos;
this.seqnum = seqnum;
this.type = type;
this.nodeBefore = nodeBefore;
this.wieldItem = wieldItem;
}
}

View File

@ -1,20 +1,20 @@
package net.mosstest.scripting.events;
import net.mosstest.servercore.MosstestSecurityManager;
/**
* Empty class, but has a security-oriented constructor.
*
*/
public class ThreadStopEvent implements IMossEvent {
/**
* Instantiates a new thread stop event.
*
* @throws SecurityException the security exception
*/
public ThreadStopEvent() throws SecurityException {
MosstestSecurityManager.instance.checkMosstestControl();
}
}
package net.mosstest.scripting.events;
import net.mosstest.servercore.MosstestSecurityManager;
/**
* Empty class, but has a security-oriented constructor.
*
*/
public class ThreadStopEvent implements IMossEvent {
/**
* Instantiates a new thread stop event.
*
* @throws SecurityException the security exception
*/
public ThreadStopEvent() throws SecurityException {
MosstestSecurityManager.instance.checkMosstestControl();
}
}

View File

@ -1,14 +1,14 @@
/**
* @author rarkenin
*
* This package contains various immutable Java objects to contain the parameters of events which scripts shall handle.
* <p>
* <b>Sequence numbers, aka <code>seqnum</code>s</b> are serial IDs given to events with certain ordering guarantees, which include guarantees that:
* <ul>
* <li>Seqnums are unique until wraparound occurs at 18446744073709551616.</li>
* <li>A seqnum with a higher value was received at the server after one with a lower value, even if the seqnums differ between sessions.</li>
* <li>Within a given session between the server and a compliant client, a lower-value seqnum is assigned to an event arising from an earlier client action than a higher-value seqnum.
*
* </ul>
*/
/**
* @author rarkenin
*
* This package contains various immutable Java objects to contain the parameters of events which scripts shall handle.
* <p>
* <b>Sequence numbers, aka <code>seqnum</code>s</b> are serial IDs given to events with certain ordering guarantees, which include guarantees that:
* <ul>
* <li>Seqnums are unique until wraparound occurs at 18446744073709551616.</li>
* <li>A seqnum with a higher value was received at the server after one with a lower value, even if the seqnums differ between sessions.</li>
* <li>Within a given session between the server and a compliant client, a lower-value seqnum is assigned to an event arising from an earlier client action than a higher-value seqnum.
*
* </ul>
*/
package net.mosstest.scripting.events;

View File

@ -1,10 +1,10 @@
package net.mosstest.scripting.handlers;
/**
* Marker interface for event handlers
*
*/
public interface MossEventHandler {
}
package net.mosstest.scripting.handlers;
/**
* Marker interface for event handlers
*
*/
public interface MossEventHandler {
}

View File

@ -1,25 +1,25 @@
package net.mosstest.scripting.handlers;
import net.mosstest.scripting.MapNode;
import net.mosstest.scripting.MossItem;
import net.mosstest.scripting.NodePosition;
import net.mosstest.scripting.Player;
import net.mosstest.scripting.events.MossNodeChangeEvent;
// TODO: Auto-generated Javadoc
/**
* The Interface MossNodeChangeHandler.
*/
public interface MossNodeChangeHandler extends MossEventHandler {
/**
* Called when a node is acted upon.
*
* @param evt A NodeChangeEvent object describing the event.
* @return True if this event should be processed by other subscribed and
* registered handlers, false otherwise.
*/
public abstract boolean onAction(MossNodeChangeEvent evt);
}
package net.mosstest.scripting.handlers;
import net.mosstest.scripting.MapNode;
import net.mosstest.scripting.MossItem;
import net.mosstest.scripting.NodePosition;
import net.mosstest.scripting.Player;
import net.mosstest.scripting.events.MossNodeChangeEvent;
// TODO: Auto-generated Javadoc
/**
* The Interface MossNodeChangeHandler.
*/
public interface MossNodeChangeHandler extends MossEventHandler {
/**
* Called when a node is acted upon.
*
* @param evt A NodeChangeEvent object describing the event.
* @return True if this event should be processed by other subscribed and
* registered handlers, false otherwise.
*/
public abstract boolean onAction(MossNodeChangeEvent evt);
}

View File

@ -1,3 +1,3 @@
AntiCheatController.THREAD_NAME=anticheat
MossEvent.MSG_CROSS_DMZ_SECURITY_WARNING=Attempt to access controlled resources in the script DMZ.
ScriptableDatabase.DB_NAME_INVALID=Invalid database name.
AntiCheatController.THREAD_NAME=anticheat
MossEvent.MSG_CROSS_DMZ_SECURITY_WARNING=Attempt to access controlled resources in the script DMZ.
ScriptableDatabase.DB_NAME_INVALID=Invalid database name.

View File

@ -1,87 +1,87 @@
package net.mosstest.servercore;
import com.google.common.collect.HashBiMap;
import net.mosstest.scripting.MapNode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
// TODO: Auto-generated Javadoc
/**
* The Class AbstractNodeManager.
*/
public abstract class AbstractNodeManager implements INodeManager {
/**
* The defined nodes.
*/
protected ArrayList<MapNode> definedNodes = new ArrayList<>();
/**
* The def node by name.
*/
protected HashMap<String, MapNode> defNodeByName = new HashMap<>();
/**
* The pending.
*/
protected HashBiMap<Short, String> pending = HashBiMap.create();
protected Set<MapNode> containedNodes = Collections.newSetFromMap(new ConcurrentHashMap<MapNode, Boolean>());
/**
* The Constant MAPNODE_UNKNOWN.
*/
public static final MapNode MAPNODE_UNKNOWN;
static {
MAPNODE_UNKNOWN = new MapNode("sys:unknown", Messages.getString("AbstractNodeManager.DESC_UNKNOWN_NODE"), "builtin/unknown.png",
1); //$NON-NLS-1$ //$NON-NLS-2$
MAPNODE_UNKNOWN.setNodeId((short) -1);
}
{
this.definedNodes.add(this.MAPNODE_UNKNOWN);
}
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#getNode(short)
*/
@Override
public abstract MapNode getNode(short nodeId);
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#putNode(net.mosstest.scripting.MapNode)
*/
@Override
public abstract short putNode(MapNode node) throws MossWorldLoadException;
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#putNodeAlias(java.lang.String, java.lang.String)
*/
@Override
public abstract void putNodeAlias(String alias, String dst);
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#getNode(java.lang.String, boolean)
*/
@Override
public abstract MapNode getNode(String string, boolean isModified);
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#getNode(java.lang.String)
*/
@Override
public abstract MapNode getNode(String string);
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#init()
*/
@Override
public abstract void init();
}
package net.mosstest.servercore;
import com.google.common.collect.HashBiMap;
import net.mosstest.scripting.MapNode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
// TODO: Auto-generated Javadoc
/**
* The Class AbstractNodeManager.
*/
public abstract class AbstractNodeManager implements INodeManager {
/**
* The defined nodes.
*/
protected ArrayList<MapNode> definedNodes = new ArrayList<>();
/**
* The def node by name.
*/
protected HashMap<String, MapNode> defNodeByName = new HashMap<>();
/**
* The pending.
*/
protected HashBiMap<Short, String> pending = HashBiMap.create();
protected Set<MapNode> containedNodes = Collections.newSetFromMap(new ConcurrentHashMap<MapNode, Boolean>());
/**
* The Constant MAPNODE_UNKNOWN.
*/
public static final MapNode MAPNODE_UNKNOWN;
static {
MAPNODE_UNKNOWN = new MapNode("sys:unknown", Messages.getString("AbstractNodeManager.DESC_UNKNOWN_NODE"), "builtin/unknown.png",
1); //$NON-NLS-1$ //$NON-NLS-2$
MAPNODE_UNKNOWN.setNodeId((short) -1);
}
{
this.definedNodes.add(this.MAPNODE_UNKNOWN);
}
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#getNode(short)
*/
@Override
public abstract MapNode getNode(short nodeId);
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#putNode(net.mosstest.scripting.MapNode)
*/
@Override
public abstract short putNode(MapNode node) throws MossWorldLoadException;
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#putNodeAlias(java.lang.String, java.lang.String)
*/
@Override
public abstract void putNodeAlias(String alias, String dst);
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#getNode(java.lang.String, boolean)
*/
@Override
public abstract MapNode getNode(String string, boolean isModified);
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#getNode(java.lang.String)
*/
@Override
public abstract MapNode getNode(String string);
/* (non-Javadoc)
* @see net.mosstest.servercore.INodeManager#init()
*/
@Override
public abstract void init();
}

View File

@ -1,19 +1,19 @@
package net.mosstest.servercore;
import com.jme3.asset.AssetLocator;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.List;
public interface IFileManager {
public IMossFile getFile(String name) throws IOException;
public void registerFile(String name, String sha256, long size);
public void receiveFileChunk(String sha512, int chunkId, ByteBuffer buf) throws IOException;
public Class<? extends AssetLocator> getAssetLocatorClass();
public List<? extends IMossFile> getFiles();
}
package net.mosstest.servercore;
import com.jme3.asset.AssetLocator;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.List;
public interface IFileManager {
public IMossFile getFile(String name) throws IOException;
public void registerFile(String name, String sha256, long size);
public void receiveFileChunk(String sha512, int chunkId, ByteBuffer buf) throws IOException;
public Class<? extends AssetLocator> getAssetLocatorClass();
public List<? extends IMossFile> getFiles();
}

View File

@ -1,22 +1,22 @@
package net.mosstest.servercore;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
public interface IMossFile {
long CHUNK_SIZE = 65536;
public Reader getReader() throws FileNotFoundException;
public InputStream getInputStream() throws FileNotFoundException;
public byte[] readChunk(int chunkId) throws IOException;
public void writeChunk(int chunkId, byte[] buf) throws IOException;
public String getSha256();
public String getName();
package net.mosstest.servercore;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
public interface IMossFile {
long CHUNK_SIZE = 65536;
public Reader getReader() throws FileNotFoundException;
public InputStream getInputStream() throws FileNotFoundException;
public byte[] readChunk(int chunkId) throws IOException;
public void writeChunk(int chunkId, byte[] buf) throws IOException;
public String getSha256();
public String getName();
}

View File

@ -1,19 +1,19 @@
package net.mosstest.servercore;
import net.mosstest.scripting.Player;
// TODO: Auto-generated Javadoc
/**
* The Interface IPlayerManager.
*/
public interface IPlayerManager extends PlayerCommunicator {
/**
* Gets the or create.
*
* @param name the name
* @return the or create
*/
public abstract Player getOrCreate(String name);
}
package net.mosstest.servercore;
import net.mosstest.scripting.Player;
// TODO: Auto-generated Javadoc
/**
* The Interface IPlayerManager.
*/
public interface IPlayerManager extends PlayerCommunicator {
/**
* Gets the or create.
*
* @param name the name
* @return the or create
*/
public abstract Player getOrCreate(String name);
}

View File

@ -1,56 +1,56 @@
package net.mosstest.servercore;
import java.io.IOException;
import java.io.InputStream;
import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetKey;
import com.jme3.asset.AssetLoadException;
import com.jme3.asset.AssetLocator;
import com.jme3.asset.AssetManager;
public class LocalAssetLocator implements AssetLocator {
private LocalFileManager lfm;
@Override
public AssetInfo locate(AssetManager manager, AssetKey key) {
if (this.lfm == null)
this.lfm = LocalFileManager.getFileManager("scripts");
if (this.lfm == null)
this.lfm = LocalFileManager.scriptsInstance;
try {
return new LocalAssetInfo(manager, key,
this.lfm.getFile(key.getName()));
} catch (IOException ex) {
throw new AssetLoadException("Failed to open file: "
+ key.getName(), ex);
}
}
@Override
public void setRootPath(String arg0) {
this.lfm = LocalFileManager.getFileManager(arg0);
}
private static class LocalAssetInfo extends AssetInfo {
private LocalFile file;
public LocalAssetInfo(AssetManager manager, AssetKey key, LocalFile file) {
super(manager, key);
this.file = file;
}
@Override
public InputStream openStream() {
try {
return this.file.getInputStream();
} catch (IOException ex) {
throw new AssetLoadException("Failed to open file: "
+ this.file.getFilename(), ex);
}
}
}
}
package net.mosstest.servercore;
import java.io.IOException;
import java.io.InputStream;
import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetKey;
import com.jme3.asset.AssetLoadException;
import com.jme3.asset.AssetLocator;
import com.jme3.asset.AssetManager;
public class LocalAssetLocator implements AssetLocator {
private LocalFileManager lfm;
@Override
public AssetInfo locate(AssetManager manager, AssetKey key) {
if (this.lfm == null)
this.lfm = LocalFileManager.getFileManager("scripts");
if (this.lfm == null)
this.lfm = LocalFileManager.scriptsInstance;
try {
return new LocalAssetInfo(manager, key,
this.lfm.getFile(key.getName()));
} catch (IOException ex) {
throw new AssetLoadException("Failed to open file: "
+ key.getName(), ex);
}
}
@Override
public void setRootPath(String arg0) {
this.lfm = LocalFileManager.getFileManager(arg0);
}
private static class LocalAssetInfo extends AssetInfo {
private LocalFile file;
public LocalAssetInfo(AssetManager manager, AssetKey key, LocalFile file) {
super(manager, key);
this.file = file;
}
@Override
public InputStream openStream() {
try {
return this.file.getInputStream();
} catch (IOException ex) {
throw new AssetLoadException("Failed to open file: "
+ this.file.getFilename(), ex);
}
}
}
}

View File

@ -1,87 +1,87 @@
package net.mosstest.servercore;
import org.apache.log4j.Logger;
import java.io.*;
import java.security.NoSuchAlgorithmException;
public class LocalFile implements IMossFile {
public String getFilename() {
return f.getAbsolutePath();
}
static Logger logger = Logger.getLogger(LocalFile.class);
private final File f;
private final RandomAccessFile rFile;
public LocalFile(File f, int numChunks, long length, String name, String sha256) throws FileNotFoundException {
this.f = f;
this.rFile = new RandomAccessFile(f, "r");
this.numChunks = numChunks;
this.length = length;
this.name = name;
this.sha256 = sha256;
}
private final int numChunks;
private final long length;
private final String name;
@Override
public String getName() {
return name;
}
private final String sha256;
public LocalFile(String name, File f) throws IOException, FileNotFoundException {
this.name = name;
if (!f.canRead())
throw new FileNotFoundException(
"File not existent or cannot be read");
this.f = f;
this.rFile = new RandomAccessFile(f, "r");
this.length = this.rFile.length();
this.numChunks = (int) Math.ceil(this.length
/ ((double) IMossFile.CHUNK_SIZE));
try {
this.sha256 = LocalFileManager.getHash(f);
logger.info("Hashed " + f.getAbsolutePath() + " as " + this.sha256);
} catch (NoSuchAlgorithmException e) {
logger.error("Could not find algorithm SHA-256 while hashing " + f.getAbsolutePath());
throw new IOException("Hashing failed while preparing file", e);
}
}
@Override
public Reader getReader() throws FileNotFoundException {
return new FileReader(this.f);
}
@Override
public InputStream getInputStream() throws FileNotFoundException {
return new FileInputStream(this.f);
}
@Override
public byte[] readChunk(int chunkId) throws IOException {
this.rFile.seek(chunkId * IMossFile.CHUNK_SIZE);
byte[] buf = new byte[(int) (chunkId == (this.numChunks - 1) ? (this.length % IMossFile.CHUNK_SIZE)
: IMossFile.CHUNK_SIZE)];
this.rFile.readFully(buf);
return buf;
}
@Override
public void writeChunk(int chunkId, byte[] buf) throws IOException {
throw new IOException(
"An attempt was made to write to a read-only local file");
}
@Override
public String getSha256() {
return this.sha256;
}
}
package net.mosstest.servercore;
import org.apache.log4j.Logger;
import java.io.*;
import java.security.NoSuchAlgorithmException;
public class LocalFile implements IMossFile {
public String getFilename() {
return f.getAbsolutePath();
}
static Logger logger = Logger.getLogger(LocalFile.class);
private final File f;
private final RandomAccessFile rFile;
public LocalFile(File f, int numChunks, long length, String name, String sha256) throws FileNotFoundException {
this.f = f;
this.rFile = new RandomAccessFile(f, "r");
this.numChunks = numChunks;
this.length = length;
this.name = name;
this.sha256 = sha256;
}
private final int numChunks;
private final long length;
private final String name;
@Override
public String getName() {
return name;
}
private final String sha256;
public LocalFile(String name, File f) throws IOException, FileNotFoundException {
this.name = name;
if (!f.canRead())
throw new FileNotFoundException(
"File not existent or cannot be read");
this.f = f;
this.rFile = new RandomAccessFile(f, "r");
this.length = this.rFile.length();
this.numChunks = (int) Math.ceil(this.length
/ ((double) IMossFile.CHUNK_SIZE));
try {
this.sha256 = LocalFileManager.getHash(f);
logger.info("Hashed " + f.getAbsolutePath() + " as " + this.sha256);
} catch (NoSuchAlgorithmException e) {
logger.error("Could not find algorithm SHA-256 while hashing " + f.getAbsolutePath());
throw new IOException("Hashing failed while preparing file", e);
}
}
@Override
public Reader getReader() throws FileNotFoundException {
return new FileReader(this.f);
}
@Override
public InputStream getInputStream() throws FileNotFoundException {
return new FileInputStream(this.f);
}
@Override
public byte[] readChunk(int chunkId) throws IOException {
this.rFile.seek(chunkId * IMossFile.CHUNK_SIZE);
byte[] buf = new byte[(int) (chunkId == (this.numChunks - 1) ? (this.length % IMossFile.CHUNK_SIZE)
: IMossFile.CHUNK_SIZE)];
this.rFile.readFully(buf);
return buf;
}
@Override
public void writeChunk(int chunkId, byte[] buf) throws IOException {
throw new IOException(
"An attempt was made to write to a read-only local file");
}
@Override
public String getSha256() {
return this.sha256;
}
}

View File

@ -1,191 +1,190 @@
package net.mosstest.servercore;
import com.google.common.collect.ImmutableList;
import com.jme3.asset.AssetLocator;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.log4j.Logger;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
public class LocalFileManager implements IFileManager {
public static final LocalFileManager scriptsInstance;
public static final int HASHING_BUFFER_SIZE = 8192;
public static final int BYTE_CAST_MASK = 0xFF;
@SuppressWarnings("StaticCollection")
private static HashMap<String, LocalFileManager> managers = new HashMap<>();
static {
scriptsInstance = new LocalFileManager(new File("data/scripts"));
managers.put("scripts", scriptsInstance);
}
private HashMap<String, LocalFile> files = new HashMap<>();
public static final IOFileFilter CVS_FILTER = FileFilterUtils.makeCVSAware(null);
public static LocalFileManager getFileManager(String key) {
return managers.get(key);
}
private final File basedir;
static Logger logger = Logger.getLogger(LocalFileManager.class);
@Override
public LocalFile getFile(String name) throws IOException, FileNotFoundException {
String normalized = FilenameUtils.normalize(name);
if (normalized == null) {
logger.warn("Failed to normalize game resource filename: " + name);
throw new FileNotFoundException("The filename " + name
+ " could not be normalized.");
}
File f = new File(this.basedir, normalized);
logger.info("Got local file " + name + " as " + f.getAbsolutePath());
return new LocalFile(name, f);
}
@Override
public void registerFile(String name, String sha256, long size) {
try {
this.files.put(name, new LocalFile(new File(basedir, name), (int) Math.ceil(size / (double) LocalFile.CHUNK_SIZE), size, name, sha256));
} catch (IOException ignored) {
}
}
public void registerFile(String name, LocalFile lf) {
this.files.put(name, lf);
}
@Override
public void receiveFileChunk(String sha512, int chunkId, ByteBuffer buf) throws IOException {
throw new IOException("This file is read-only due to its being in a non-cache directory.");
}
@Override
public Class<? extends AssetLocator> getAssetLocatorClass() {
return LocalAssetLocator.class;
}
public LocalFileManager(File basedir) {
this.basedir = basedir;
}
public static String getHash(File f) throws IOException,
NoSuchAlgorithmException, FileNotFoundException {
MessageDigest md = MessageDigest.getInstance("SHA-256");
try (FileInputStream fis = new FileInputStream(f)) {
try (FileChannel fc = fis.getChannel()) {
ByteBuffer bbf = ByteBuffer.allocateDirect(HASHING_BUFFER_SIZE);
int bytesRead;
bytesRead = fc.read(bbf);
while ((bytesRead != -1) && (bytesRead != 0)) {
bbf.flip();
byte[] bytes = new byte[bytesRead];
bbf.get(bytes);
md.update(bbf);
bbf.clear();
bytesRead = fc.read(bbf);
}
fis.close();
byte[] mdBytes = md.digest();
StringBuilder hexString = new StringBuilder();
for (byte b : mdBytes) {
hexString.append(Integer.toHexString((BYTE_CAST_MASK & b)));
}
return hexString.toString();
}
}
}
@Override
public List<? extends IMossFile> getFiles() {
return ImmutableList.copyOf(files.values());
}
public IMossFile getScriptInitFile(String scName) throws IOException, FileNotFoundException {
String normalized = FilenameUtils.normalize(scName);
if (normalized == null) {
logger.warn("Failed to normalize game resource filename: " + scName);
throw new FileNotFoundException("The filename " + scName
+ " could not be normalized.");
}
final String scriptName = normalized + "/init.js";
LocalFile scriptFile = getFile(scriptName);
registerFile(scriptName, scriptFile);
try {
final String indexName = normalized + "/index";
LocalFile fileIndex = getFile(indexName);
registerFile(indexName, scriptFile);
BufferedReader idxR = new BufferedReader(fileIndex.getReader());
String line;
while ((line = idxR.readLine()) != null) {
String normalizedLine = FilenameUtils.normalize(line.trim());
if (normalizedLine == null) {
logger.warn("Failed to normalize game resource filename from file index: "
+ line);
continue;
}
try {
final String filename = normalized + normalizedLine;
final LocalFile file = getFile(filename);
this.registerFile(filename, file);
} catch (FileNotFoundException e) {
logger.warn("File was in index but not on disk: "
+ line);
}
}
} catch (FileNotFoundException e) {
logger.warn("No index file found; no files will be served to the client.");
File base = new File(basedir, normalized);
Path basePath = Paths.get(basedir.getAbsolutePath());
for (File f : FileUtils.listFiles(base, CVS_FILTER, CVS_FILTER)) {
try {
Path path = Paths.get(f.getAbsolutePath());
final String resolvedName = basePath.relativize(path).toFile().getPath();
LocalFile file = this.getFile(resolvedName);
logger.debug("Got file via recursive directory listing: " + resolvedName);
this.registerFile(resolvedName, file);
} catch (FileNotFoundException fnfe2) {
// should not happen
logger.warn("Could not find file from recursive directory listing. This should never happen.");
}
}
}
return scriptFile;
}
}
package net.mosstest.servercore;
import com.google.common.collect.ImmutableList;
import com.jme3.asset.AssetLocator;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.log4j.Logger;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
public class LocalFileManager implements IFileManager {
public static final LocalFileManager scriptsInstance;
public static final int HASHING_BUFFER_SIZE = 8192;
public static final int BYTE_CAST_MASK = 0xFF;
@SuppressWarnings("StaticCollection")
private static HashMap<String, LocalFileManager> managers = new HashMap<>();
static {
scriptsInstance = new LocalFileManager(new File("data/scripts"));
managers.put("scripts", scriptsInstance);
}
private HashMap<String, LocalFile> files = new HashMap<>();
public static final IOFileFilter CVS_FILTER = FileFilterUtils.makeCVSAware(null);
public static LocalFileManager getFileManager(String key) {
return managers.get(key);
}
private final File basedir;
static Logger logger = Logger.getLogger(LocalFileManager.class);
@Override
public LocalFile getFile(String name) throws IOException, FileNotFoundException {
String normalized = FilenameUtils.normalize(name);
if (normalized == null) {
logger.warn("Failed to normalize game resource filename: " + name);
throw new FileNotFoundException("The filename " + name
+ " could not be normalized.");
}
File f = new File(this.basedir, normalized);
logger.info("Got local file " + name + " as " + f.getAbsolutePath());
return new LocalFile(name, f);
}
@Override
public void registerFile(String name, String sha256, long size) {
try {
this.files.put(name, new LocalFile(new File(basedir, name), (int) Math.ceil(size / (double) LocalFile.CHUNK_SIZE), size, name, sha256));
} catch (IOException ignored) {
}
}
public void registerFile(String name, LocalFile lf) {
this.files.put(name, lf);
}
@Override
public void receiveFileChunk(String sha512, int chunkId, ByteBuffer buf) throws IOException {
throw new IOException("This file is read-only due to its being in a non-cache directory.");
}
@Override
public Class<? extends AssetLocator> getAssetLocatorClass() {
return LocalAssetLocator.class;
}
public LocalFileManager(File basedir) {
this.basedir = basedir;
}
public static String getHash(File f) throws IOException,
NoSuchAlgorithmException, FileNotFoundException {
MessageDigest md = MessageDigest.getInstance("SHA-256");
try (FileInputStream fis = new FileInputStream(f)) {
try (FileChannel fc = fis.getChannel()) {
ByteBuffer bbf = ByteBuffer.allocateDirect(HASHING_BUFFER_SIZE);
int bytesRead;
bytesRead = fc.read(bbf);
while ((bytesRead != -1) && (bytesRead != 0)) {
bbf.flip();
md.update(bbf);
bbf.clear();
bytesRead = fc.read(bbf);
}
fis.close();
byte[] mdBytes = md.digest();
StringBuilder hexString = new StringBuilder();
for (byte b : mdBytes) {
hexString.append(Integer.toHexString((BYTE_CAST_MASK & b)));
}
return hexString.toString();
}
}
}
@Override
public List<? extends IMossFile> getFiles() {
return ImmutableList.copyOf(files.values());
}
public IMossFile getScriptInitFile(String scName) throws IOException, FileNotFoundException {
String normalized = FilenameUtils.normalize(scName);
if (normalized == null) {
logger.warn("Failed to normalize game resource filename: " + scName);
throw new FileNotFoundException("The filename " + scName
+ " could not be normalized.");
}
final String scriptName = normalized + "/init.js";
LocalFile scriptFile = getFile(scriptName);
registerFile(scriptName, scriptFile);
try {
final String indexName = normalized + "/index";
LocalFile fileIndex = getFile(indexName);
registerFile(indexName, scriptFile);
BufferedReader idxR = new BufferedReader(fileIndex.getReader());
String line;
while ((line = idxR.readLine()) != null) {
String normalizedLine = FilenameUtils.normalize(line.trim());
if (normalizedLine == null) {
logger.warn("Failed to normalize game resource filename from file index: "
+ line);
continue;
}
try {
final String filename = normalized + normalizedLine;
final LocalFile file = getFile(filename);
this.registerFile(filename, file);
} catch (FileNotFoundException e) {
logger.warn("File was in index but not on disk: "
+ line);
}
}
} catch (FileNotFoundException e) {
logger.warn("No index file found; no files will be served to the client.");
File base = new File(basedir, normalized);
Path basePath = Paths.get(basedir.getAbsolutePath());
for (File f : FileUtils.listFiles(base, CVS_FILTER, CVS_FILTER)) {
try {
Path path = Paths.get(f.getAbsolutePath());
final String resolvedName = basePath.relativize(path).toFile().getPath();
LocalFile file = this.getFile(resolvedName);
logger.debug("Got file via recursive directory listing: " + resolvedName);
this.registerFile(resolvedName, file);
} catch (FileNotFoundException fnfe2) {
// should not happen
logger.warn("Could not find file from recursive directory listing. This should never happen.");
}
}
}
return scriptFile;
}
}

View File

@ -1,151 +1,151 @@
package net.mosstest.servercore;
import com.google.common.cache.*;
import net.mosstest.scripting.MapChunk;
import net.mosstest.scripting.MapGenerators;
import net.mosstest.scripting.Position;
import org.apache.log4j.Logger;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
// TODO: Auto-generated Javadoc
/**
* The Class MapCache.
*/
public class MapCache {
private static final Logger logger = Logger.getLogger(MapCache.class);
private final LoadingCache<Position, MapChunk> chunkCache;
private final Map<Position, MapChunk> chunkCacheAsMap;
{
chunkCache = CacheBuilder.newBuilder()
.concurrencyLevel(4)
.softValues()
.expireAfterAccess(EngineSettings.getInt("chunkCacheTTL", 240), TimeUnit.SECONDS)
.removalListener(new RemovalListener())
.build(new PositionMapChunkCacheLoader());
chunkCacheAsMap = chunkCache.asMap();
}
/**
* The db.
*/
private MapDatabase db ;
/**
* Gets the chunk.
*
* @param pos the pos
* @return the chunk
* @throws MapGeneratorException the map generator exception
*/
public MapChunk getChunk(Position pos) throws MapGeneratorException {
// we want loading implicitly (which will generate it)
MapChunk chk = null;
try {
chk = chunkCache.get(pos);
} catch (ExecutionException e) {
logger.error("ExecutionException getting a chunk: "+e.getCause() + "/" + e.getMessage());
}
if(chk == null){
// loading from DB is still done if no chunk exists after an async load
chk = db.getChunk(pos);
// fill in, in case it was stored as compressed
MapGenerators.getDefaultMapgen().fillInChunk(chk.getNodes(), pos);
if(chk == null){
// if still not loaded, generate
chk = MapGenerators.getDefaultMapgen().generateChunk(pos);
}
}
return chk;
}
/**
* Gets the chunk fail fast.
*
* @param pos the pos
* @return the chunk fail fast
*/
public MapChunk getChunkFailFast(Position pos) {
// we don't want loading from DB or generating
return chunkCacheAsMap.get(pos);
}
/**
* Sets the chunk, updating cache and database.
*
* @param pos The position in question
* @param chunk the chunk to be stored
*/
public void setChunk(Position pos, MapChunk chunk) {
// plain and simple, we just store it
chunk.compact();
db.addMapChunk(pos, chunk);
chunkCache.put(pos, chunk);
}
/**
* Instantiates a new node cache.
*
* @param db the db
*/
public MapCache(MapDatabase db) {
this.db = db;
}
/**
* Gets the chunk, or null if it is not generated.
*
* @param pos The position in question
* @return the chunk, or null if it does not exist on disk.
*/
public MapChunk getChunkNoGenerate(Position pos) throws MapGeneratorException{
// we don't want loading implicitly (which will generate it)
MapChunk chk = chunkCacheAsMap.get(pos);
if(chk == null){
// loading from DB is still done
chk = db.getChunk(pos);
if(chk == null) return null; // not found in DB
// fill in, in case it was stored as compressed. This still requires mapgen use as chunks are not guaranteed to be stored fully.
MapGenerators.getDefaultMapgen().fillInChunk(chk.getNodes(), pos);
}
return chk;
}
private class RemovalListener implements com.google.common.cache.RemovalListener<Position, MapChunk> {
@Override
public void onRemoval(RemovalNotification<Position, MapChunk> notification) {
switch(notification.getCause()){
case COLLECTED:
logger.warn("Un-cacahing " + notification.getKey().toString() + " due to GC. Memory may be low.");
break;
case EXPIRED:
logger.info("Un-cacahing " + notification.getKey().toString() + " as it expired");
case SIZE:
logger.warn("Un-cacahing " + notification.getKey().toString() + " due to a size constraint");
}
}
}
private class PositionMapChunkCacheLoader extends CacheLoader<Position, MapChunk> {
@Override
public MapChunk load(Position position) throws Exception {
logger.info("Re-loading " + position.toString() + " into cache.");
MapChunk chk = MapCache.this.db.getChunk(position);
if(chk == null) {
chk = MapGenerators.getDefaultMapgen().generateChunk(position);
MapCache.this.db.addMapChunk(position, chk);
}
return chk;
}
}
}
package net.mosstest.servercore;
import com.google.common.cache.*;
import net.mosstest.scripting.MapChunk;
import net.mosstest.scripting.MapGenerators;
import net.mosstest.scripting.Position;
import org.apache.log4j.Logger;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
// TODO: Auto-generated Javadoc
/**
* The Class MapCache.
*/
public class MapCache {
private static final Logger logger = Logger.getLogger(MapCache.class);
private final LoadingCache<Position, MapChunk> chunkCache;
private final Map<Position, MapChunk> chunkCacheAsMap;
{
chunkCache = CacheBuilder.newBuilder()
.concurrencyLevel(4)
.softValues()
.expireAfterAccess(EngineSettings.getInt("chunkCacheTTL", 240), TimeUnit.SECONDS)
.removalListener(new RemovalListener())
.build(new PositionMapChunkCacheLoader());
chunkCacheAsMap = chunkCache.asMap();
}
/**
* The db.
*/
private MapDatabase db ;
/**
* Gets the chunk.
*
* @param pos the pos
* @return the chunk
* @throws MapGeneratorException the map generator exception
*/
public MapChunk getChunk(Position pos) throws MapGeneratorException {
// we want loading implicitly (which will generate it)
MapChunk chk = null;
try {
chk = chunkCache.get(pos);
} catch (ExecutionException e) {
logger.error("ExecutionException getting a chunk: "+e.getCause() + "/" + e.getMessage());
}
if(chk == null){
// loading from DB is still done if no chunk exists after an async load
chk = db.getChunk(pos);
// fill in, in case it was stored as compressed
MapGenerators.getDefaultMapgen().fillInChunk(chk.getNodes(), pos);
if(chk == null){
// if still not loaded, generate
chk = MapGenerators.getDefaultMapgen().generateChunk(pos);
}
}
return chk;
}
/**
* Gets the chunk fail fast.
*
* @param pos the pos
* @return the chunk fail fast
*/
public MapChunk getChunkFailFast(Position pos) {
// we don't want loading from DB or generating
return chunkCacheAsMap.get(pos);
}
/**
* Sets the chunk, updating cache and database.
*
* @param pos The position in question
* @param chunk the chunk to be stored
*/
public void setChunk(Position pos, MapChunk chunk) {
// plain and simple, we just store it
chunk.compact();
db.addMapChunk(pos, chunk);
chunkCache.put(pos, chunk);
}
/**
* Instantiates a new node cache.
*
* @param db the db
*/
public MapCache(MapDatabase db) {
this.db = db;
}
/**
* Gets the chunk, or null if it is not generated.
*
* @param pos The position in question
* @return the chunk, or null if it does not exist on disk.
*/
public MapChunk getChunkNoGenerate(Position pos) throws MapGeneratorException{
// we don't want loading implicitly (which will generate it)
MapChunk chk = chunkCacheAsMap.get(pos);
if(chk == null){
// loading from DB is still done
chk = db.getChunk(pos);
if(chk == null) return null; // not found in DB
// fill in, in case it was stored as compressed. This still requires mapgen use as chunks are not guaranteed to be stored fully.
MapGenerators.getDefaultMapgen().fillInChunk(chk.getNodes(), pos);
}
return chk;
}
private class RemovalListener implements com.google.common.cache.RemovalListener<Position, MapChunk> {
@Override
public void onRemoval(RemovalNotification<Position, MapChunk> notification) {
switch(notification.getCause()){
case COLLECTED:
logger.warn("Un-cacahing " + notification.getKey().toString() + " due to GC. Memory may be low.");
break;
case EXPIRED:
logger.info("Un-cacahing " + notification.getKey().toString() + " as it expired");
case SIZE:
logger.warn("Un-cacahing " + notification.getKey().toString() + " due to a size constraint");
}
}
}
private class PositionMapChunkCacheLoader extends CacheLoader<Position, MapChunk> {
@Override
public MapChunk load(Position position) throws Exception {
logger.info("Re-loading " + position.toString() + " into cache.");
MapChunk chk = MapCache.this.db.getChunk(position);
if(chk == null) {
chk = MapGenerators.getDefaultMapgen().generateChunk(position);
MapCache.this.db.addMapChunk(position, chk);
}
return chk;
}
}
}

View File

@ -1,141 +1,141 @@
package net.mosstest.servercore;
import net.mosstest.scripting.MapChunk;
import net.mosstest.scripting.Position;
import org.apache.log4j.Logger;
import org.iq80.leveldb.DB;
import org.iq80.leveldb.Options;
import java.io.File;
import java.io.IOException;
import static org.fusesource.leveldbjni.JniDBFactory.factory;
//import static org.iq80.leveldb.impl.Iq80DBFactory.factory;
// TODO: Auto-generated Javadoc
/**
* The Class MapDatabase.
*/
public class MapDatabase {
private static final Logger logger = Logger.getLogger(MapDatabase.class);
/**
* The map.
*/
DB map;
/** The entities. */
DB entities;
/** The metadata. */
DB metadata;
/** The map heavies. */
DB mapHeavies;
/** The landclaims. */
DB landclaims;
/** The players. */
DB players;
/** The nodes. */
public DB nodes;
/**
* Instantiates a new map database.
*
* @param basedir the basedir
* @throws MapDatabaseException the map database exception
* @throws MossWorldLoadException the moss world load exception
*/
@SuppressWarnings("nls")
public MapDatabase(File basedir) throws MapDatabaseException,
MossWorldLoadException {
File dbDir = new File(basedir, "db"); //$NON-NLS-1$
dbDir.mkdirs();
try {
Options options = new Options();
options.comparator(null);
this.map = factory.open(new File(dbDir, "map"), options); //$NON-NLS-1$
this.mapHeavies = factory.open(new File(dbDir, "mapHeavies"), //$NON-NLS-1$
options);
this.entities = factory.open(new File(dbDir, "entities"), options); //$NON-NLS-1$
this.metadata = factory.open(new File(dbDir, "metadata"), options); //$NON-NLS-1$
this.players = factory.open(new File(dbDir, "players"), options); //$NON-NLS-1$
this.nodes = factory.open(new File(dbDir, "nodes"), options); //$NON-NLS-1$
} catch (IOException e) {
logger.error("IOException in database loading: " + e.toString());
throw new MossWorldLoadException(Messages.getString("MapDatabase.ERR_DB_FAIL"), e); //$NON-NLS-1$
}
logger.info("Database loaded normally.");
}
/**
* Close.
*
* @throws MapDatabaseException the map database exception
*/
public void close() throws MapDatabaseException {
logger.info("Database shutting down (normally)");
try {
this.map.close();
this.entities.close();
this.metadata.close();
} catch (IOException e) {
throw new MapDatabaseException("Database shutdown failed!", e,
MapDatabaseException.SEVERITY_UNKNOWN
| MapDatabaseException.SEVERITY_FATAL_TRANSIENT); //$NON-NLS-1$
}
}
/**
* Gets the chunk, but does not generate it if it does not exist.
*
* @param pos the position
* @return the chunk
*/
public MapChunk getChunk(final Position pos) throws MapGeneratorException {
byte[] chunk = this.map.get(pos.toBytes());
if(chunk == null){
return null;
}
try {
return new MapChunk(chunk);
} catch (IOException e) {
logger.error("IOException loading a chunk from byte[]");
ExceptionHandler.registerException(e);
return null;
}
}
/**
* Adds the map chunk.
*
* @param pos the pos
* @param mapChunk the map chunk
*/
void addMapChunk(Position pos, MapChunk mapChunk) {
this.map.put(pos.toBytes(), mapChunk.writeLight(true));
}
/**
* Gets the heavy.
*
* @param pos the pos
* @return the heavy
*/
public byte[] getHeavy(Position pos) {
return this.mapHeavies.get(pos.toBytes());
}
}
package net.mosstest.servercore;
import net.mosstest.scripting.MapChunk;
import net.mosstest.scripting.Position;
import org.apache.log4j.Logger;
import org.iq80.leveldb.DB;
import org.iq80.leveldb.Options;
import java.io.File;
import java.io.IOException;
import static org.fusesource.leveldbjni.JniDBFactory.factory;
//import static org.iq80.leveldb.impl.Iq80DBFactory.factory;
// TODO: Auto-generated Javadoc
/**
* The Class MapDatabase.
*/
public class MapDatabase {
private static final Logger logger = Logger.getLogger(MapDatabase.class);
/**
* The map.
*/
DB map;
/** The entities. */
DB entities;
/** The metadata. */
DB metadata;
/** The map heavies. */
DB mapHeavies;
/** The landclaims. */
DB landclaims;
/** The players. */
DB players;
/** The nodes. */
public DB nodes;
/**
* Instantiates a new map database.
*
* @param basedir the basedir
* @throws MapDatabaseException the map database exception
* @throws MossWorldLoadException the moss world load exception
*/
@SuppressWarnings("nls")
public MapDatabase(File basedir) throws MapDatabaseException,
MossWorldLoadException {
File dbDir = new File(basedir, "db"); //$NON-NLS-1$
dbDir.mkdirs();
try {
Options options = new Options();
options.comparator(null);
this.map = factory.open(new File(dbDir, "map"), options); //$NON-NLS-1$
this.mapHeavies = factory.open(new File(dbDir, "mapHeavies"), //$NON-NLS-1$
options);
this.entities = factory.open(new File(dbDir, "entities"), options); //$NON-NLS-1$
this.metadata = factory.open(new File(dbDir, "metadata"), options); //$NON-NLS-1$
this.players = factory.open(new File(dbDir, "players"), options); //$NON-NLS-1$
this.nodes = factory.open(new File(dbDir, "nodes"), options); //$NON-NLS-1$
} catch (IOException e) {
logger.error("IOException in database loading: " + e.toString());
throw new MossWorldLoadException(Messages.getString("MapDatabase.ERR_DB_FAIL"), e); //$NON-NLS-1$
}
logger.info("Database loaded normally.");
}
/**
* Close.
*
* @throws MapDatabaseException the map database exception
*/
public void close() throws MapDatabaseException {
logger.info("Database shutting down (normally)");
try {
this.map.close();
this.entities.close();
this.metadata.close();
} catch (IOException e) {
throw new MapDatabaseException("Database shutdown failed!", e,
MapDatabaseException.SEVERITY_UNKNOWN
| MapDatabaseException.SEVERITY_FATAL_TRANSIENT); //$NON-NLS-1$
}
}
/**
* Gets the chunk, but does not generate it if it does not exist.
*
* @param pos the position
* @return the chunk
*/
public MapChunk getChunk(final Position pos) throws MapGeneratorException {
byte[] chunk = this.map.get(pos.toBytes());
if(chunk == null){
return null;
}
try {
return new MapChunk(chunk);
} catch (IOException e) {
logger.error("IOException loading a chunk from byte[]");
ExceptionHandler.registerException(e);
return null;
}
}
/**
* Adds the map chunk.
*
* @param pos the pos
* @param mapChunk the map chunk
*/
void addMapChunk(Position pos, MapChunk mapChunk) {
this.map.put(pos.toBytes(), mapChunk.writeLight(true));
}
/**
* Gets the heavy.
*
* @param pos the pos
* @return the heavy
*/
public byte[] getHeavy(Position pos) {
return this.mapHeavies.get(pos.toBytes());
}
}

View File

@ -1,130 +1,130 @@
package net.mosstest.servercore;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
// TODO: Auto-generated Javadoc
/**
* The Class MossDebugUtils.
*/
public class MossDebugUtils {
/**
* The logger.
*/
static Logger logger = Logger.getLogger(MossDebugUtils.class);
/**
* The Constant propertiesToGet.
*/
private static final String[] propertiesToGet = {"awt.toolkit", //$NON-NLS-1$
"file.encoding", "file.separator", "java.class.version", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"java.home", "java.runtime.name", "java.runtime.version", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"java.specification.name", "java.specification.vendor", //$NON-NLS-1$ //$NON-NLS-2$
"java.specification.version", "java.vendor", "java.vm.info", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"java.vm.name", "java.vm.specification.name", "java.vm.version", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"os.arch", "os.name", "path.separator", "sun.arch.data.model", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"sun.cpu.endian", "sun.desktop", "user.language" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
};
/**
* Write stracktrace.
*
* @param e the e
* @return the string
*/
public static String writeStracktrace(Exception e) {
String fName = Integer.toString(System.identityHashCode(e), 16) + "@"
+ System.currentTimeMillis();
File write = new File("stacktraces/" + fName + ".txt");
try {
new File("stacktraces").mkdirs();
write.createNewFile();
try (FileWriter writer = new FileWriter(write)) {
writer.write(getDebugInformation(e));
writer.close();
}
} catch (IOException e1) {
logger.fatal(e1.getClass().getName() + " caught trying to write stacktrace of an existing exception. Message: " + e1.getMessage());
}
return write.getAbsolutePath();
}
/**
* Gets the debug information.
*
* @param e the e
* @return the debug information
*/
public static String getDebugInformation(Exception e) {
StringBuilder s = new StringBuilder(
MossDebugUtils.getGitConfig("git.commit.id") + " on " + MossDebugUtils.getGitConfig("git.branch") + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
s.append(Messages.getString("MossDebugUtils.MSG_BUILT_ON")).append(MossDebugUtils.getGitConfig(Messages.getString("MossDebugUtils.27"))).append("\r\n\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
s.append(Messages.getString("MossDebugUtils.MSG_EXCEPTION_CAUGHT")); //$NON-NLS-1$
for (StackTraceElement ste : e.getStackTrace()) {
s.append(ste.toString()).append("\r\n"); //$NON-NLS-1$
}
s.append("\r\n"); //$NON-NLS-1$
s.append(getOsDetails());
return s.toString();
}
/**
* Gets the os details.
*
* @return the os details
*/
public static String getOsDetails() {
StringBuilder s = new StringBuilder();
s.append(Messages.getString("MossDebugUtils.MSG_SYS_PROPS")); //$NON-NLS-1$
s.append(Messages.getString("MossDebugUtils.MSG_CORES")).append(Runtime.getRuntime().availableProcessors()).append("\r\n"); //$NON-NLS-1$
s.append(Messages.getString("MossDebugUtils.MSG_FREEMEM")).append(Runtime.getRuntime().freeMemory()).append("\r\n"); //$NON-NLS-1$
long maxMemory = Runtime.getRuntime().maxMemory();
s.append(Messages.getString("MossDebugUtils.MSG_MAXMEM")).append(maxMemory == Long.MAX_VALUE ? Messages
.getString("MossDebugUtils.MSG_MEM_NO_LIMIT") : maxMemory).append("\r\n"); //$NON-NLS-1$
s.append(Messages.getString("MossDebugUtils.MSG_TOTAL_MEM")).append(Runtime.getRuntime().totalMemory()).append("\r\n"); //$NON-NLS-1$
File[] roots = File.listRoots();
for (File root : roots) {
s.append(Messages.getString("MossDebugUtils.MSG_FS_ROOT")).append(root.getAbsolutePath()).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
s.append(Messages.getString("MossDebugUtils.MSG_TOTAL_SPACE")).append(root.getTotalSpace()).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
s.append(Messages.getString("MossDebugUtils.MSG_FREE_SPACE")).append(root.getFreeSpace()).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
s.append(Messages.getString("MossDebugUtils.MSG_USABLE_SPACE")).append(root.getUsableSpace()).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
s.append("\r\n"); //$NON-NLS-1$
s.append(Messages.getString("MossDebugUtils.MSG_JAVA_PROPS")); //$NON-NLS-1$
for (String key : propertiesToGet) {
s.append(key).append(":").append(System.getProperty(key, "")).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return s.toString();
}
/**
* Gets the git config.
*
* @param cfgKey the cfg key
* @return the git config
*/
private static String getGitConfig(String cfgKey) {
Properties properties = new Properties();
try {
properties.load(MossDebugUtils.class.getClassLoader()
.getResourceAsStream("git.properties")); //$NON-NLS-1$
} catch (IOException e) {
return Messages.getString("MossDebugUtils.MSG_IO_EXCEPTION"); //$NON-NLS-1$
}
return properties.getProperty(cfgKey);
}
}
package net.mosstest.servercore;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
// TODO: Auto-generated Javadoc
/**
* The Class MossDebugUtils.
*/
public class MossDebugUtils {
/**
* The logger.
*/
static Logger logger = Logger.getLogger(MossDebugUtils.class);
/**
* The Constant propertiesToGet.
*/
private static final String[] propertiesToGet = {"awt.toolkit", //$NON-NLS-1$
"file.encoding", "file.separator", "java.class.version", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"java.home", "java.runtime.name", "java.runtime.version", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"java.specification.name", "java.specification.vendor", //$NON-NLS-1$ //$NON-NLS-2$
"java.specification.version", "java.vendor", "java.vm.info", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"java.vm.name", "java.vm.specification.name", "java.vm.version", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"os.arch", "os.name", "path.separator", "sun.arch.data.model", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"sun.cpu.endian", "sun.desktop", "user.language" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
};
/**
* Write stracktrace.
*
* @param e the e
* @return the string
*/
public static String writeStracktrace(Exception e) {
String fName = Integer.toString(System.identityHashCode(e), 16) + "@"
+ System.currentTimeMillis();
File write = new File("stacktraces/" + fName + ".txt");
try {
new File("stacktraces").mkdirs();
write.createNewFile();
try (FileWriter writer = new FileWriter(write)) {
writer.write(getDebugInformation(e));
writer.close();
}
} catch (IOException e1) {
logger.fatal(e1.getClass().getName() + " caught trying to write stacktrace of an existing exception. Message: " + e1.getMessage());
}
return write.getAbsolutePath();
}
/**
* Gets the debug information.
*
* @param e the e
* @return the debug information
*/
public static String getDebugInformation(Exception e) {
StringBuilder s = new StringBuilder(
MossDebugUtils.getGitConfig("git.commit.id") + " on " + MossDebugUtils.getGitConfig("git.branch") + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
s.append(Messages.getString("MossDebugUtils.MSG_BUILT_ON")).append(MossDebugUtils.getGitConfig(Messages.getString("MossDebugUtils.27"))).append("\r\n\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
s.append(Messages.getString("MossDebugUtils.MSG_EXCEPTION_CAUGHT")); //$NON-NLS-1$
for (StackTraceElement ste : e.getStackTrace()) {
s.append(ste.toString()).append("\r\n"); //$NON-NLS-1$
}
s.append("\r\n"); //$NON-NLS-1$
s.append(getOsDetails());
return s.toString();
}
/**
* Gets the os details.
*
* @return the os details
*/
public static String getOsDetails() {
StringBuilder s = new StringBuilder();
s.append(Messages.getString("MossDebugUtils.MSG_SYS_PROPS")); //$NON-NLS-1$
s.append(Messages.getString("MossDebugUtils.MSG_CORES")).append(Runtime.getRuntime().availableProcessors()).append("\r\n"); //$NON-NLS-1$
s.append(Messages.getString("MossDebugUtils.MSG_FREEMEM")).append(Runtime.getRuntime().freeMemory()).append("\r\n"); //$NON-NLS-1$
long maxMemory = Runtime.getRuntime().maxMemory();
s.append(Messages.getString("MossDebugUtils.MSG_MAXMEM")).append(maxMemory == Long.MAX_VALUE ? Messages
.getString("MossDebugUtils.MSG_MEM_NO_LIMIT") : maxMemory).append("\r\n"); //$NON-NLS-1$
s.append(Messages.getString("MossDebugUtils.MSG_TOTAL_MEM")).append(Runtime.getRuntime().totalMemory()).append("\r\n"); //$NON-NLS-1$
File[] roots = File.listRoots();
for (File root : roots) {
s.append(Messages.getString("MossDebugUtils.MSG_FS_ROOT")).append(root.getAbsolutePath()).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
s.append(Messages.getString("MossDebugUtils.MSG_TOTAL_SPACE")).append(root.getTotalSpace()).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
s.append(Messages.getString("MossDebugUtils.MSG_FREE_SPACE")).append(root.getFreeSpace()).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
s.append(Messages.getString("MossDebugUtils.MSG_USABLE_SPACE")).append(root.getUsableSpace()).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
s.append("\r\n"); //$NON-NLS-1$
s.append(Messages.getString("MossDebugUtils.MSG_JAVA_PROPS")); //$NON-NLS-1$
for (String key : propertiesToGet) {
s.append(key).append(":").append(System.getProperty(key, "")).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return s.toString();
}
/**
* Gets the git config.
*
* @param cfgKey the cfg key
* @return the git config
*/
private static String getGitConfig(String cfgKey) {
Properties properties = new Properties();
try {
properties.load(MossDebugUtils.class.getClassLoader()
.getResourceAsStream("git.properties")); //$NON-NLS-1$
} catch (IOException e) {
return Messages.getString("MossDebugUtils.MSG_IO_EXCEPTION"); //$NON-NLS-1$
}
return properties.getProperty(cfgKey);
}
}

View File

@ -1,88 +1,88 @@
package net.mosstest.servercore;
// TODO: Auto-generated Javadoc
/**
* The Class MossRenderSetPositionEvent.
*/
public class MossRenderSetPositionEvent extends MossRenderEvent {
/** The offset z. */
private final double offsetX, offsetY, offsetZ;
/** The chk z. */
private final int chkX, chkY, chkZ;
/**
* Instantiates a new moss render set position event.
*
* @param offsetX the offset x
* @param offsetY the offset y
* @param offsetZ the offset z
* @param chkX the chk x
* @param chkY the chk y
* @param chkZ the chk z
*/
public MossRenderSetPositionEvent(double offsetX, double offsetY,
double offsetZ, int chkX, int chkY, int chkZ) {
this.offsetX = offsetX;
this.offsetY = offsetY;
this.offsetZ = offsetZ;
this.chkX = chkX;
this.chkY = chkY;
this.chkZ = chkZ;
}
/**
* Gets the offset x.
*
* @return the offset x
*/
public double getOffsetX() {
return this.offsetX;
}
/**
* Gets the offset y.
*
* @return the offset y
*/
public double getOffsetY() {
return this.offsetY;
}
/**
* Gets the offset z.
*
* @return the offset z
*/
public double getOffsetZ() {
return this.offsetZ;
}
/**
* Gets the chk x.
*
* @return the chk x
*/
public int getChkX() {
return this.chkX;
}
/**
* Gets the chk y.
*
* @return the chk y
*/
public int getChkY() {
return this.chkY;
}
/**
* Gets the chk z.
*
* @return the chk z
*/
public int getChkZ() {
return this.chkZ;
}
}
package net.mosstest.servercore;
// TODO: Auto-generated Javadoc
/**
* The Class MossRenderSetPositionEvent.
*/
public class MossRenderSetPositionEvent extends MossRenderEvent {
/** The offset z. */
private final double offsetX, offsetY, offsetZ;
/** The chk z. */
private final int chkX, chkY, chkZ;
/**
* Instantiates a new moss render set position event.
*
* @param offsetX the offset x
* @param offsetY the offset y
* @param offsetZ the offset z
* @param chkX the chk x
* @param chkY the chk y
* @param chkZ the chk z
*/
public MossRenderSetPositionEvent(double offsetX, double offsetY,
double offsetZ, int chkX, int chkY, int chkZ) {
this.offsetX = offsetX;
this.offsetY = offsetY;
this.offsetZ = offsetZ;
this.chkX = chkX;
this.chkY = chkY;
this.chkZ = chkZ;
}
/**
* Gets the offset x.
*
* @return the offset x
*/
public double getOffsetX() {
return this.offsetX;
}
/**
* Gets the offset y.
*
* @return the offset y
*/
public double getOffsetY() {
return this.offsetY;
}
/**
* Gets the offset z.
*
* @return the offset z
*/
public double getOffsetZ() {
return this.offsetZ;
}
/**
* Gets the chk x.
*
* @return the chk x
*/
public int getChkX() {
return this.chkX;
}
/**
* Gets the chk y.
*
* @return the chk y
*/
public int getChkY() {
return this.chkY;
}
/**
* Gets the chk z.
*
* @return the chk z
*/
public int getChkZ() {
return this.chkZ;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,25 @@
package net.mosstest.servercore;
import net.mosstest.scripting.Player;
// TODO: Auto-generated Javadoc
/**
* The Interface PlayerCommunicator.
*/
public interface PlayerCommunicator {
/**
* Force set position.
*
* @param pl the pl
* @param cx the cx
* @param cy the cy
* @param cz the cz
* @param offsetx the offsetx
* @param offsety the offsety
* @param offsetz the offsetz
* @throws InterruptedException the interrupted exception
*/
void forceSetPosition(Player pl, int cx, int cy, int cz, double offsetx,
double offsety, double offsetz) throws InterruptedException;
}
package net.mosstest.servercore;
import net.mosstest.scripting.Player;
// TODO: Auto-generated Javadoc
/**
* The Interface PlayerCommunicator.
*/
public interface PlayerCommunicator {
/**
* Force set position.
*
* @param pl the pl
* @param cx the cx
* @param cy the cy
* @param cz the cz
* @param offsetx the offsetx
* @param offsety the offsety
* @param offsetz the offsetz
* @throws InterruptedException the interrupted exception
*/
void forceSetPosition(Player pl, int cx, int cy, int cz, double offsetx,
double offsety, double offsetz) throws InterruptedException;
}

View File

@ -10,7 +10,7 @@ import java.io.IOException;
// TODO: Auto-generated Javadoc
/**
* Static environment for executing scripts. Call {@link ScriptEnv.runScript()}
* Static environment for executing scripts. Call {@link ScriptEnv#runScript()}
* to call a script.
*
* @author rarkenin
@ -19,7 +19,7 @@ public class ScriptEnv {
static Logger logger = Logger.getLogger(MossDebugUtils.class);
ScriptableObject globalScope;
ImporterTopLevel globalScope;
/**
@ -52,14 +52,9 @@ public class ScriptEnv {
/**
* Executes a script with default permissions. This will allow sandboxed
* access to the database, and gameplay data, without access to
* authentication data. These scripts have access to
* <code>Hashmap&lt;String, Object&gt;</code>-style maps used for extended
* custom attributes, and may access various API classes via
* {@link net.mosstest.scripting.JavaApi JavaApi}(which internally uses
* reflection to obtain classes). Via an ACL, certain classes may be blocked
* authentication data. Via an ACL, certain classes may be blocked
* or replaced with limited versions thereof. At the time of writing, this
* feature is incomplete and will not allow any access to the Java(tm) SE
* API.
* feature uses a security manager to disallow anything that tries to access risky data or sockets.
*
* @param script A string representing the script to run
* @return A {@link ScriptEnv.ScriptResult} constant representing the
@ -101,9 +96,9 @@ public class ScriptEnv {
* @param ev the ev
*/
public ScriptEnv(MossScriptEnv ev) {
this.cx = ContextFactory.getGlobal().enterContext();
this.globalScope = this.cx.initStandardObjects();
this.globalScope = new ImporterTopLevel();
this.globalScope.initStandardObjects(cx, false);
cx.setOptimizationLevel(9);
this.globalScope.put("moss", this.globalScope, ev); //$NON-NLS-1$

View File

@ -1,110 +1,110 @@
package net.mosstest.swingui;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.PointerInfo;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JLabel;
// TODO: Auto-generated Javadoc
/**
* The listener interface for receiving dnD events.
* The class that is interested in processing a dnD
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addDnDListener<code> method. When
* the dnD event occurs, that object's appropriate
* method is invoked.
*
* @see DnDEvent
*/
public class DnDListener implements MouseListener {
/** The start y. */
private double startX, startY;
/** The end y. */
private double endX, endY;
/** The holder. */
private JLabel holder;
/**
* Instantiates a new dn d listener.
*
* @param parent the parent
*/
public DnDListener (JLabel parent) {
startX = 0;
startY = 0;
endX = 0;
endY = 0;
holder = parent;
}
/**
* Prints the diagnostics.
*/
public void printDiagnostics () {
System.out.println("START X: "+startX+" START Y: "+startY);
System.out.println("END X: "+endX+" END Y: "+endY);
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
*/
@Override
public void mousePressed(MouseEvent arg0) {
PointerInfo info = MouseInfo.getPointerInfo();
Point location = info.getLocation();
startX = location.getX();
startY = location.getY();
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
*/
@Override
public void mouseReleased(MouseEvent arg0) {
PointerInfo info = MouseInfo.getPointerInfo();
Point location = info.getLocation();
endX = location.getX() - 35; //35, 60: modifiers that need to be present or there
endY = location.getY() - 60; //is a significant offset when placement occurs.
holder.setLocation((int)endX, (int)endY);
printDiagnostics();
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
*/
@Override
public void mouseClicked(MouseEvent arg0) {
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
*/
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
*/
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
}
package net.mosstest.swingui;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.PointerInfo;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JLabel;
// TODO: Auto-generated Javadoc
/**
* The listener interface for receiving dnD events.
* The class that is interested in processing a dnD
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addDnDListener<code> method. When
* the dnD event occurs, that object's appropriate
* method is invoked.
*
* @see DnDEvent
*/
public class DnDListener implements MouseListener {
/** The start y. */
private double startX, startY;
/** The end y. */
private double endX, endY;
/** The holder. */
private JLabel holder;
/**
* Instantiates a new dn d listener.
*
* @param parent the parent
*/
public DnDListener (JLabel parent) {
startX = 0;
startY = 0;
endX = 0;
endY = 0;
holder = parent;
}
/**
* Prints the diagnostics.
*/
public void printDiagnostics () {
System.out.println("START X: "+startX+" START Y: "+startY);
System.out.println("END X: "+endX+" END Y: "+endY);
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
*/
@Override
public void mousePressed(MouseEvent arg0) {
PointerInfo info = MouseInfo.getPointerInfo();
Point location = info.getLocation();
startX = location.getX();
startY = location.getY();
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
*/
@Override
public void mouseReleased(MouseEvent arg0) {
PointerInfo info = MouseInfo.getPointerInfo();
Point location = info.getLocation();
endX = location.getX() - 35; //35, 60: modifiers that need to be present or there
endY = location.getY() - 60; //is a significant offset when placement occurs.
holder.setLocation((int)endX, (int)endY);
printDiagnostics();
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
*/
@Override
public void mouseClicked(MouseEvent arg0) {
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
*/
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
*/
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
}

View File

@ -1,10 +1,10 @@
package net.mosstest.swingui;
import javax.swing.JLabel;
/**
* The Class ItemSlot.
*/
public class ItemSlot extends JLabel {
}
package net.mosstest.swingui;
import javax.swing.JLabel;
/**
* The Class ItemSlot.
*/
public class ItemSlot extends JLabel {
}

View File

@ -1,62 +1,62 @@
package net.mosstest.swingui;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
// TODO: Auto-generated Javadoc
/**
* The Class SwingDragDrop.
*/
public class SwingDragDrop {
/** The frame. */
static JFrame frame;
/** The picture. */
static JLabel picture;
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
setupFrame();
setupLabels();
frame.repaint();
}
/**
* Setup frame.
*/
public static void setupFrame() {
frame = new JFrame("Drag and Drop Test");
frame.setSize(800, 600);
frame.setVisible(true);
frame.setLayout(null);
}
/**
* Setup labels.
*
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void setupLabels() throws IOException {
ImageIcon icon = new ImageIcon(ImageIO
.read(new File("item_switch.png")).getScaledInstance(64, 64,
Image.SCALE_REPLICATE));
picture = new JLabel(icon);
picture.setSize(64, 64);
picture.setLocation(200, 200);
picture.addMouseListener(new DnDListener(picture));
frame.add(picture);
}
}
package net.mosstest.swingui;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
// TODO: Auto-generated Javadoc
/**
* The Class SwingDragDrop.
*/
public class SwingDragDrop {
/** The frame. */
static JFrame frame;
/** The picture. */
static JLabel picture;
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
setupFrame();
setupLabels();
frame.repaint();
}
/**
* Setup frame.
*/
public static void setupFrame() {
frame = new JFrame("Drag and Drop Test");
frame.setSize(800, 600);
frame.setVisible(true);
frame.setLayout(null);
}
/**
* Setup labels.
*
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void setupLabels() throws IOException {
ImageIcon icon = new ImageIcon(ImageIO
.read(new File("item_switch.png")).getScaledInstance(64, 64,
Image.SCALE_REPLICATE));
picture = new JLabel(icon);
picture.setSize(64, 64);
picture.setLocation(200, 200);
picture.addMouseListener(new DnDListener(picture));
frame.add(picture);
}
}

View File

@ -1,8 +1,8 @@
#Stores URLs for this deployment
tracker.list=http://moss-servers.appspot.com/list
#Params should be ?skey=key&port=port&maxusers=max&curusers=current
tracker.serverheartbeat=http://moss-servers.appspot.com/serveralive
updater.updateurl=http://moss-servers.appspot.com/updater
updater.version=0.1.0-SNAPSHOT
#Stores URLs for this deployment
tracker.list=http://moss-servers.appspot.com/list
#Params should be ?skey=key&port=port&maxusers=max&curusers=current
tracker.serverheartbeat=http://moss-servers.appspot.com/serveralive
updater.updateurl=http://moss-servers.appspot.com/updater
updater.version=0.1.0-SNAPSHOT
updater.strategy=informational

View File

@ -1,8 +1,8 @@
package net.mosstest.tests;
/**
* The Class MainServerTest.
*/
public class MainServerTest {
//empty class
}
package net.mosstest.tests;
/**
* The Class MainServerTest.
*/
public class MainServerTest {
//empty class
}

View File

@ -1,36 +1,36 @@
package net.mosstest.tests;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import net.mosstest.scripting.MapChunk;
import net.mosstest.scripting.MapGenerators;
import net.mosstest.scripting.Position;
import net.mosstest.scripting.SimplexMapGenerator;
import net.mosstest.servercore.MapGeneratorException;
import org.junit.Before;
import org.junit.Test;
public class MapChunkTest {
public static final Position[] positions = {
new Position(1,1,1,0), new Position(2,4,6,0), new Position(-24,14,62,0), new Position(2,3,5,0), new Position(7,11,-13,0),
};
@Before
public void setUp() throws MapGeneratorException {
MapGenerators.setDefaultMapGenerator(new SimplexMapGenerator(), new MockNodeManager(), 1123581321, null);
}
@Test
public void testByteArraySerialization() throws MapGeneratorException, IOException {
for(Position p : positions) {
MapChunk mc1 = MapGenerators.getDefaultMapgen().generateChunk(p);
byte[] bytes = mc1.writeLight(false);
MapChunk mc2 = new MapChunk(bytes);
assertTrue(mc1.equals(mc2));
}
}
}
package net.mosstest.tests;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import net.mosstest.scripting.MapChunk;
import net.mosstest.scripting.MapGenerators;
import net.mosstest.scripting.Position;
import net.mosstest.scripting.SimplexMapGenerator;
import net.mosstest.servercore.MapGeneratorException;
import org.junit.Before;
import org.junit.Test;
public class MapChunkTest {
public static final Position[] positions = {
new Position(1,1,1,0), new Position(2,4,6,0), new Position(-24,14,62,0), new Position(2,3,5,0), new Position(7,11,-13,0),
};
@Before
public void setUp() throws MapGeneratorException {
MapGenerators.setDefaultMapGenerator(new SimplexMapGenerator(), new MockNodeManager(), 1123581321, null);
}
@Test
public void testByteArraySerialization() throws MapGeneratorException, IOException {
for(Position p : positions) {
MapChunk mc1 = MapGenerators.getDefaultMapgen().generateChunk(p);
byte[] bytes = mc1.writeLight(false);
MapChunk mc2 = new MapChunk(bytes);
assertTrue(mc1.equals(mc2));
}
}
}

View File

@ -1,54 +1,54 @@
package net.mosstest.tests;
import java.util.HashMap;
import java.util.Random;
import net.mosstest.scripting.MapChunk;
import net.mosstest.scripting.MapGenerators;
import net.mosstest.scripting.Position;
import net.mosstest.scripting.SimplexMapGenerator;
import net.mosstest.servercore.MapGeneratorException;
// TODO: Auto-generated Javadoc
/**
* The Class MapGenProfilerEntryPoint.
*/
public class MapGenProfilerEntryPoint {
/**
* The main method.
*
* @param args the arguments
* @throws MapGeneratorException the map generator exception
* @throws InterruptedException the interrupted exception
*/
public static void main(String[] args) throws MapGeneratorException, InterruptedException {
int chks = 0;
Thread.sleep(10000); // sleep to allow profiler launch
MapGenerators.setDefaultMapGenerator(new SimplexMapGenerator(),
new MockNodeManager(), 1011, null);
HashMap<Position, MapChunk> chunks = new HashMap<>();
Random rand = new Random();
whileLoop: while (true) {
long sTime = System.currentTimeMillis();
for (int i = 0; i < 100; i++) {
Position pos = new Position(rand.nextInt(), rand.nextInt(),
rand.nextInt(), 0);
MapChunk chk = MapGenerators.getDefaultMapgen().generateChunk(
pos);
chunks.put(pos, chk);
chks++;
if(chks > 10000) {
break whileLoop;
}
}
System.err.println(System.currentTimeMillis() - sTime + ", " + chks);
}
while(true) {
Thread.sleep(1000);
}
}
}
package net.mosstest.tests;
import java.util.HashMap;
import java.util.Random;
import net.mosstest.scripting.MapChunk;
import net.mosstest.scripting.MapGenerators;
import net.mosstest.scripting.Position;
import net.mosstest.scripting.SimplexMapGenerator;
import net.mosstest.servercore.MapGeneratorException;
// TODO: Auto-generated Javadoc
/**
* The Class MapGenProfilerEntryPoint.
*/
public class MapGenProfilerEntryPoint {
/**
* The main method.
*
* @param args the arguments
* @throws MapGeneratorException the map generator exception
* @throws InterruptedException the interrupted exception
*/
public static void main(String[] args) throws MapGeneratorException, InterruptedException {
int chks = 0;
Thread.sleep(10000); // sleep to allow profiler launch
MapGenerators.setDefaultMapGenerator(new SimplexMapGenerator(),
new MockNodeManager(), 1011, null);
HashMap<Position, MapChunk> chunks = new HashMap<>();
Random rand = new Random();
whileLoop: while (true) {
long sTime = System.currentTimeMillis();
for (int i = 0; i < 100; i++) {
Position pos = new Position(rand.nextInt(), rand.nextInt(),
rand.nextInt(), 0);
MapChunk chk = MapGenerators.getDefaultMapgen().generateChunk(
pos);
chunks.put(pos, chk);
chks++;
if(chks > 10000) {
break whileLoop;
}
}
System.err.println(System.currentTimeMillis() - sTime + ", " + chks);
}
while(true) {
Thread.sleep(1000);
}
}
}

View File

@ -1,153 +1,153 @@
msgid "GUIBugReportDialog.DLG_BUG_DESC"
msgstr "Detailed problem description:"
msgid "GUIBugReportDialog.DLG_BUG_DESC_DEFAULT"
msgstr ""
"Please describe your problem here, preferably including what you had done, "
"what you expected to happen, what happened, and any other details about the "
"world or game.\n"
"\n"
"Please note that we cannot help with third-party games or mods."
msgid "GUIBugReportDialog.DLG_BUG_EMAIL"
msgstr "e-mail (optional):"
msgid "GUIBugReportDialog.DLG_BUG_NAME"
msgstr "Name:"
msgid "GUIBugReportDialog.DLG_BUG_SUMMARY"
msgstr "Problem summary:"
msgid "GUIBugReportDialog.DLG_BUG_TITLE"
msgstr "Report a bug"
msgid "GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO"
msgstr "Include technical information"
msgid "GUIBugReportDialog.DLG_CXL"
msgstr "Cancel"
msgid "GUIBugReportDialog.DLG_OK"
msgstr "OK"
msgid "GUIBugReportDialog.DLG_SUBMIT"
msgstr "Submit"
msgid "GUIBugReportDialog.NOTICE_INFO_INCLUDED"
msgstr ""
"The following information will be included in the bug report if this box is "
"checked: \n"
"\n"
msgid "GUIClientsideLauncher.23"
msgstr "Report a bug..."
msgid "GUIClientsideLauncher.24"
msgstr "Request new feature..."
msgid "GUIClientsideLauncher.25"
msgstr "Visit website"
msgid "GUIClientsideLauncher.26"
msgstr "GitHub project"
msgid "GUIClientsideLauncher.27"
msgstr "Visit forums"
msgid "GUIClientsideLauncher.COL_GAME_PRESET"
msgstr "Game preset"
msgid "GUIClientsideLauncher.COL_WORLD_DESC"
msgstr "Description"
msgid "GUIClientsideLauncher.COL_WORLD_NAME"
msgstr "World name"
msgid "GUIClientsideLauncher.DLG_ABOUT"
msgstr "About"
msgid "GUIClientsideLauncher.DLG_DELETE"
msgstr "Delete..."
msgid "GUIClientsideLauncher.DLG_NEW"
msgstr "New..."
msgid "GUIClientsideLauncher.DLG_NO_WORLD_TO_DELETE"
msgstr ""
"No world was selected to be deleted. Please select an existing world in the "
"table."
msgid "GUIClientsideLauncher.DLG_PLAY"
msgstr "Play"
msgid "GUIClientsideLauncher.DLG_SETTINGS"
msgstr "Settings..."
msgid "GUIClientsideLauncher.DLG_SINGLEPLAYER"
msgstr "Singleplayer"
msgid "GUIClientsideLauncher.DLG_TITLE"
msgstr "Mosstest Client launcher <0.0.1-initial>"
msgid "GUIClientsideLauncher.ERR_NO_WORLD_SELECTED"
msgstr ""
"No world was selected to be started. Please select an existing world in the "
"table, or create a new world."
msgid "GUIClientsideLauncher.ERR_NO_WORLD_SELECTED_TITLE"
msgstr "No world selected"
msgid "GUIClientsideLauncher.NOTICE_DEFAULT_GAME_CODE"
msgstr ""
"Default game code and textures created by dolinksy296, hexafraction, et. "
"al.\n"
msgid "GUIClientsideLauncher.NOTICE_PRIMARY_AUTHORS"
msgstr "Made by hexafraction, thatnerd2, et al.\n"
msgid "GUIClientsideLauncher.NOTICE_TOOLS_USED"
msgstr ""
"Made with the help of Eclipse, Git, Maven, and countless services such as "
"TravisCI and GitHub.\n"
msgid "GUIClientsideLauncher.SYS_NEWLINE"
msgstr "\n"
msgid "GUIClientsideLauncher.USES_LIBS"
msgstr "Uses the following libraries:\n"
msgid "GUIClientsideLauncher.WARN_SET_LAF"
msgstr "Warning: The system look-and-feel cannot be set"
msgid "GUIWorldCreationDialog.CXL"
msgstr "Cancel"
msgid "GUIWorldCreationDialog.DLG_TITLE"
msgstr "Create new singleplayer world..."
msgid "GUIWorldCreationDialog.GAME_PROFILE"
msgstr "Game profile:"
msgid "GUIWorldCreationDialog.OK"
msgstr "OK"
msgid "GUIWorldCreationDialog.WORLD_DESC"
msgstr "Description:"
msgid "GUIWorldCreationDialog.WORLD_NAME"
msgstr "World name:"
msgid "GUIWorldDeletionDialog.AREYOUSURE_TEXT"
msgstr "Are you sure you wish to delete the world called "
msgid "GUIWorldDeletionDialog.DLG_TITLE"
msgstr "Delete singleplayer world..."
msgid "GUIWorldDeletionDialog.NO"
msgstr "No"
msgid "GUIWorldDeletionDialog.QUESTIONMARK_CANNOT_UNDO"
msgstr "? This operation cannot be undone."
msgid "GUIWorldDeletionDialog.YES"
msgstr "Yes"
msgid "GUIBugReportDialog.DLG_BUG_DESC"
msgstr "Detailed problem description:"
msgid "GUIBugReportDialog.DLG_BUG_DESC_DEFAULT"
msgstr ""
"Please describe your problem here, preferably including what you had done, "
"what you expected to happen, what happened, and any other details about the "
"world or game.\n"
"\n"
"Please note that we cannot help with third-party games or mods."
msgid "GUIBugReportDialog.DLG_BUG_EMAIL"
msgstr "e-mail (optional):"
msgid "GUIBugReportDialog.DLG_BUG_NAME"
msgstr "Name:"
msgid "GUIBugReportDialog.DLG_BUG_SUMMARY"
msgstr "Problem summary:"
msgid "GUIBugReportDialog.DLG_BUG_TITLE"
msgstr "Report a bug"
msgid "GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO"
msgstr "Include technical information"
msgid "GUIBugReportDialog.DLG_CXL"
msgstr "Cancel"
msgid "GUIBugReportDialog.DLG_OK"
msgstr "OK"
msgid "GUIBugReportDialog.DLG_SUBMIT"
msgstr "Submit"
msgid "GUIBugReportDialog.NOTICE_INFO_INCLUDED"
msgstr ""
"The following information will be included in the bug report if this box is "
"checked: \n"
"\n"
msgid "GUIClientsideLauncher.23"
msgstr "Report a bug..."
msgid "GUIClientsideLauncher.24"
msgstr "Request new feature..."
msgid "GUIClientsideLauncher.25"
msgstr "Visit website"
msgid "GUIClientsideLauncher.26"
msgstr "GitHub project"
msgid "GUIClientsideLauncher.27"
msgstr "Visit forums"
msgid "GUIClientsideLauncher.COL_GAME_PRESET"
msgstr "Game preset"
msgid "GUIClientsideLauncher.COL_WORLD_DESC"
msgstr "Description"
msgid "GUIClientsideLauncher.COL_WORLD_NAME"
msgstr "World name"
msgid "GUIClientsideLauncher.DLG_ABOUT"
msgstr "About"
msgid "GUIClientsideLauncher.DLG_DELETE"
msgstr "Delete..."
msgid "GUIClientsideLauncher.DLG_NEW"
msgstr "New..."
msgid "GUIClientsideLauncher.DLG_NO_WORLD_TO_DELETE"
msgstr ""
"No world was selected to be deleted. Please select an existing world in the "
"table."
msgid "GUIClientsideLauncher.DLG_PLAY"
msgstr "Play"
msgid "GUIClientsideLauncher.DLG_SETTINGS"
msgstr "Settings..."
msgid "GUIClientsideLauncher.DLG_SINGLEPLAYER"
msgstr "Singleplayer"
msgid "GUIClientsideLauncher.DLG_TITLE"
msgstr "Mosstest Client launcher <0.0.1-initial>"
msgid "GUIClientsideLauncher.ERR_NO_WORLD_SELECTED"
msgstr ""
"No world was selected to be started. Please select an existing world in the "
"table, or create a new world."
msgid "GUIClientsideLauncher.ERR_NO_WORLD_SELECTED_TITLE"
msgstr "No world selected"
msgid "GUIClientsideLauncher.NOTICE_DEFAULT_GAME_CODE"
msgstr ""
"Default game code and textures created by dolinksy296, hexafraction, et. "
"al.\n"
msgid "GUIClientsideLauncher.NOTICE_PRIMARY_AUTHORS"
msgstr "Made by hexafraction, thatnerd2, et al.\n"
msgid "GUIClientsideLauncher.NOTICE_TOOLS_USED"
msgstr ""
"Made with the help of Eclipse, Git, Maven, and countless services such as "
"TravisCI and GitHub.\n"
msgid "GUIClientsideLauncher.SYS_NEWLINE"
msgstr "\n"
msgid "GUIClientsideLauncher.USES_LIBS"
msgstr "Uses the following libraries:\n"
msgid "GUIClientsideLauncher.WARN_SET_LAF"
msgstr "Warning: The system look-and-feel cannot be set"
msgid "GUIWorldCreationDialog.CXL"
msgstr "Cancel"
msgid "GUIWorldCreationDialog.DLG_TITLE"
msgstr "Create new singleplayer world..."
msgid "GUIWorldCreationDialog.GAME_PROFILE"
msgstr "Game profile:"
msgid "GUIWorldCreationDialog.OK"
msgstr "OK"
msgid "GUIWorldCreationDialog.WORLD_DESC"
msgstr "Description:"
msgid "GUIWorldCreationDialog.WORLD_NAME"
msgstr "World name:"
msgid "GUIWorldDeletionDialog.AREYOUSURE_TEXT"
msgstr "Are you sure you wish to delete the world called "
msgid "GUIWorldDeletionDialog.DLG_TITLE"
msgstr "Delete singleplayer world..."
msgid "GUIWorldDeletionDialog.NO"
msgstr "No"
msgid "GUIWorldDeletionDialog.QUESTIONMARK_CANNOT_UNDO"
msgstr "? This operation cannot be undone."
msgid "GUIWorldDeletionDialog.YES"
msgstr "Yes"

View File

@ -1,8 +1,8 @@
msgid "AntiCheatController.THREAD_NAME"
msgstr "anticheat"
msgid "MossEvent.MSG_CROSS_DMZ_SECURITY_WARNING"
msgstr "Attempt to access controlled resources in the script DMZ."
msgid "ScriptableDatabase.DB_NAME_INVALID"
msgstr "Invalid database name."
msgid "AntiCheatController.THREAD_NAME"
msgstr "anticheat"
msgid "MossEvent.MSG_CROSS_DMZ_SECURITY_WARNING"
msgstr "Attempt to access controlled resources in the script DMZ."
msgid "ScriptableDatabase.DB_NAME_INVALID"
msgstr "Invalid database name."

View File

@ -1,157 +1,157 @@
msgid "AbstractNodeManager.DESC_UNKNOWN_NODE"
msgstr "An unknown piece of the world"
msgid "ClientNetworkingManager.DESC_NETWORK_TIMEOUT"
msgstr ""
"The connection to the server has been lost or has become too slow to "
"continue. \n"
"This is likely caused by an unstable connection, poor WiFi, loose cables, or "
"a firewall issue."
msgid "ClientNetworkingManager.ERR_NETWORK_TIMEOUT"
msgstr "Network Timeout"
msgid "ClientNetworkingManager.THREAD_NET_TIMEOUT"
msgstr "netTimeout"
msgid "ClientNetworkingManager.THREAD_QUEUEING"
msgstr "netClientSendQueue"
msgid "DefaultEventHandlers.NO_SUCH_CMD"
msgstr "No such chat command."
msgid "EventProcessor.MSG_ADD_DYNAMIC"
msgstr "Dynamically added thread"
msgid "EventProcessor.MSG_STOP_ONE_THREAD"
msgstr "Stopping one thread"
msgid "EventProcessor.MSG_THREAD_START"
msgstr "Worker thread started"
msgid "EventProcessor.THREAD_NAME_MGR"
msgstr "EventProcessorManager"
msgid "EventProcessor.THREADGROUP"
msgstr "EventProcessor"
msgid "FuturesProcessor.FUTURES_THREAD"
msgstr "futures"
msgid "LocalRenderPreparator.MG_EXCEPT"
msgstr "The map generator has thrown an exception."
msgid "LocalRenderPreparator.MSG_REQUESTED"
msgstr "REQUESTED "
msgid "LocalRenderPreparator.START_MSG"
msgstr "<<< START LOCAL RENDER PREPARATOR >>>"
msgid "MapChunk.BAD_SER_VER"
msgstr "Incorrect serialization version"
msgid "MapDatabase.ERR_DB_FAIL"
msgstr "Database loading failed."
msgid "MossDebugUtils.27"
msgstr "git.build.time"
msgid "MossDebugUtils.MSG_BUILT_ON"
msgstr "Built on: "
msgid "MossDebugUtils.MSG_CORES"
msgstr "Available cores: "
msgid "MossDebugUtils.MSG_EXCEPTION_CAUGHT"
msgstr "<<<Exception caught>>> \n"
msgid "MossDebugUtils.MSG_FREE_SPACE"
msgstr "Free space (bytes): "
msgid "MossDebugUtils.MSG_FREEMEM"
msgstr "Free memory (bytes): "
msgid "MossDebugUtils.MSG_FS_ROOT"
msgstr "File system root: "
msgid "MossDebugUtils.MSG_IO_EXCEPTION"
msgstr "IOException loading, perhaps non-existent?"
msgid "MossDebugUtils.MSG_JAVA_PROPS"
msgstr "<<<Java properties>>>\n"
msgid "MossDebugUtils.MSG_MAXMEM"
msgstr "Maximum memory (bytes): "
msgid "MossDebugUtils.MSG_MEM_NO_LIMIT"
msgstr "no limit"
msgid "MossDebugUtils.MSG_SYS_PROPS"
msgstr "<<<System properties>>>\n"
msgid "MossDebugUtils.MSG_TOTAL_MEM"
msgstr "Total memory (bytes): "
msgid "MossDebugUtils.MSG_TOTAL_SPACE"
msgstr "Total space (bytes): "
msgid "MossDebugUtils.MSG_USABLE_SPACE"
msgstr "Usable space (bytes): "
msgid "MossGame.CFG_LOAD_ERR"
msgstr "Error in loading the configuration file."
msgid "MossGame.DIR_OR_CFG_NOT_FOUND"
msgstr "Game directory or configuration file not found."
msgid "MossGame.FILE_NOT_FOUND"
msgstr "file not found: "
msgid "MossScript.[NAME]_NOT_FOUND"
msgstr " not found!"
msgid "MossScript.MSG_IO_EXCEPTION"
msgstr "IOException with script named "
msgid "MossScript.MSG_OOPS"
msgstr "Extremely unexpected situation on our hands"
msgid "MossScript.MSG_SCRIPT_NAMED_[NAME]"
msgstr "Script named "
msgid "MossTest.PORT_DESC"
msgstr "Port number to use"
msgid "MossTest.RUN_STANDALONE"
msgstr "Run as standalone server"
msgid "MossWorld.ERR_DB"
msgstr ""
"An error has occured when opening the database. It is likely inaccessible, "
"on a full disk, or corrupt."
msgid "MossWorld.MG_SELECT_FAILURE"
msgstr "The map generator could not be seeded."
msgid "MossWorld.NO_GAME_ID"
msgstr ""
"The game ID is not specified. The game ID must be specified in game.xml as "
"<gameid>foo</gameid> where data/games/foo is a directory with a valid game."
msgid "MossWorld.NO_NETWORKING_NOW"
msgstr "Networking cannot occur at this time"
msgid "NodeManager.DESC_UNKNWN_NODE"
msgstr "An unknown piece of the world"
msgid "ScriptEnv.ERR_SCRIPT_ERR"
msgstr "Script error has occured. Wrapped exception: \n"
msgid "ServerNetworkingManager.ACCEPT_THREAD"
msgstr "svrNetAccept"
msgid "ServerNetworkingManager.CONN_THREAD_NAME"
msgstr "connection thread"
msgid "ServerNetworkingManager.THREADGROUP"
msgstr "SvrNetGroup"
msgid "AbstractNodeManager.DESC_UNKNOWN_NODE"
msgstr "An unknown piece of the world"
msgid "ClientNetworkingManager.DESC_NETWORK_TIMEOUT"
msgstr ""
"The connection to the server has been lost or has become too slow to "
"continue. \n"
"This is likely caused by an unstable connection, poor WiFi, loose cables, or "
"a firewall issue."
msgid "ClientNetworkingManager.ERR_NETWORK_TIMEOUT"
msgstr "Network Timeout"
msgid "ClientNetworkingManager.THREAD_NET_TIMEOUT"
msgstr "netTimeout"
msgid "ClientNetworkingManager.THREAD_QUEUEING"
msgstr "netClientSendQueue"
msgid "DefaultEventHandlers.NO_SUCH_CMD"
msgstr "No such chat command."
msgid "EventProcessor.MSG_ADD_DYNAMIC"
msgstr "Dynamically added thread"
msgid "EventProcessor.MSG_STOP_ONE_THREAD"
msgstr "Stopping one thread"
msgid "EventProcessor.MSG_THREAD_START"
msgstr "Worker thread started"
msgid "EventProcessor.THREAD_NAME_MGR"
msgstr "EventProcessorManager"
msgid "EventProcessor.THREADGROUP"
msgstr "EventProcessor"
msgid "FuturesProcessor.FUTURES_THREAD"
msgstr "futures"
msgid "LocalRenderPreparator.MG_EXCEPT"
msgstr "The map generator has thrown an exception."
msgid "LocalRenderPreparator.MSG_REQUESTED"
msgstr "REQUESTED "
msgid "LocalRenderPreparator.START_MSG"
msgstr "<<< START LOCAL RENDER PREPARATOR >>>"
msgid "MapChunk.BAD_SER_VER"
msgstr "Incorrect serialization version"
msgid "MapDatabase.ERR_DB_FAIL"
msgstr "Database loading failed."
msgid "MossDebugUtils.27"
msgstr "git.build.time"
msgid "MossDebugUtils.MSG_BUILT_ON"
msgstr "Built on: "
msgid "MossDebugUtils.MSG_CORES"
msgstr "Available cores: "
msgid "MossDebugUtils.MSG_EXCEPTION_CAUGHT"
msgstr "<<<Exception caught>>> \n"
msgid "MossDebugUtils.MSG_FREE_SPACE"
msgstr "Free space (bytes): "
msgid "MossDebugUtils.MSG_FREEMEM"
msgstr "Free memory (bytes): "
msgid "MossDebugUtils.MSG_FS_ROOT"
msgstr "File system root: "
msgid "MossDebugUtils.MSG_IO_EXCEPTION"
msgstr "IOException loading, perhaps non-existent?"
msgid "MossDebugUtils.MSG_JAVA_PROPS"
msgstr "<<<Java properties>>>\n"
msgid "MossDebugUtils.MSG_MAXMEM"
msgstr "Maximum memory (bytes): "
msgid "MossDebugUtils.MSG_MEM_NO_LIMIT"
msgstr "no limit"
msgid "MossDebugUtils.MSG_SYS_PROPS"
msgstr "<<<System properties>>>\n"
msgid "MossDebugUtils.MSG_TOTAL_MEM"
msgstr "Total memory (bytes): "
msgid "MossDebugUtils.MSG_TOTAL_SPACE"
msgstr "Total space (bytes): "
msgid "MossDebugUtils.MSG_USABLE_SPACE"
msgstr "Usable space (bytes): "
msgid "MossGame.CFG_LOAD_ERR"
msgstr "Error in loading the configuration file."
msgid "MossGame.DIR_OR_CFG_NOT_FOUND"
msgstr "Game directory or configuration file not found."
msgid "MossGame.FILE_NOT_FOUND"
msgstr "file not found: "
msgid "MossScript.[NAME]_NOT_FOUND"
msgstr " not found!"
msgid "MossScript.MSG_IO_EXCEPTION"
msgstr "IOException with script named "
msgid "MossScript.MSG_OOPS"
msgstr "Extremely unexpected situation on our hands"
msgid "MossScript.MSG_SCRIPT_NAMED_[NAME]"
msgstr "Script named "
msgid "MossTest.PORT_DESC"
msgstr "Port number to use"
msgid "MossTest.RUN_STANDALONE"
msgstr "Run as standalone server"
msgid "MossWorld.ERR_DB"
msgstr ""
"An error has occured when opening the database. It is likely inaccessible, "
"on a full disk, or corrupt."
msgid "MossWorld.MG_SELECT_FAILURE"
msgstr "The map generator could not be seeded."
msgid "MossWorld.NO_GAME_ID"
msgstr ""
"The game ID is not specified. The game ID must be specified in game.xml as "
"<gameid>foo</gameid> where data/games/foo is a directory with a valid game."
msgid "MossWorld.NO_NETWORKING_NOW"
msgstr "Networking cannot occur at this time"
msgid "NodeManager.DESC_UNKNWN_NODE"
msgstr "An unknown piece of the world"
msgid "ScriptEnv.ERR_SCRIPT_ERR"
msgstr "Script error has occured. Wrapped exception: \n"
msgid "ServerNetworkingManager.ACCEPT_THREAD"
msgstr "svrNetAccept"
msgid "ServerNetworkingManager.CONN_THREAD_NAME"
msgstr "connection thread"
msgid "ServerNetworkingManager.THREADGROUP"
msgstr "SvrNetGroup"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<palette>
<category id="someUniqueId" name="Custom category" description="Category added for project MossTest" open="true">
<component class="javax.swing.JButton"/>
<component class="javax.swing.JRadioButton" name="Your name" description="You can write any description here."/>
</category>
<?xml version="1.0" encoding="UTF-8"?>
<palette>
<category id="someUniqueId" name="Custom category" description="Category added for project MossTest" open="true">
<component class="javax.swing.JButton"/>
<component class="javax.swing.JRadioButton" name="Your name" description="You can write any description here."/>
</category>
</palette>