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"] [submodule "data"]
path = data path = data
url = https://github.com/mosstest/mosstest-game-default.git url = https://github.com/mosstest/mosstest-game-default.git

View File

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

View File

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

View File

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

View File

@ -1,14 +1,14 @@
# Root logger option # Root logger option
log4j.rootLogger=DEBUG, file, stdout log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file # Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=mosslog.log log4j.appender.file.File=mosslog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout 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 log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %r %-5p %c{1} - %m%n
# Direct log messages to stdout # Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 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 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; package net.mosstest.launcher;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.*;
// TODO: Auto-generated Javadoc // TODO: Auto-generated Javadoc
/** /**
* The Class GUIBugReportDialog. * The Class GUIBugReportDialog.
*/ */
public class GUIBugReportDialog extends JDialog { public class GUIBugReportDialog extends JDialog {
/** /**
* The content panel. * The content panel.
*/ */
private final JPanel contentPanel = new JPanel(); private final JPanel contentPanel = new JPanel();
/** /**
* The reporter name. * The reporter name.
*/ */
private JTextField reporterName; private JTextField reporterName;
/** /**
* The email. * The email.
*/ */
private JTextField email; private JTextField email;
/** /**
* The problem summary. * The problem summary.
*/ */
private JTextField problemSummary; private JTextField problemSummary;
/** /**
* The chckbx include technical information. * The chckbx include technical information.
*/ */
private JCheckBox chckbxIncludeTechnicalInformation; private JCheckBox chckbxIncludeTechnicalInformation;
/** /**
* The lbl name. * The lbl name.
*/ */
private JLabel lblName; private JLabel lblName;
/** /**
* Launch the application. * Launch the application.
* *
* @param args the arguments * @param args the arguments
*/ */
public static void main(String[] args) { public static void main(String[] args) {
GUIBugReportDialog dialog = new GUIBugReportDialog("test traceback"); GUIBugReportDialog dialog = new GUIBugReportDialog("test traceback");
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true); dialog.setVisible(true);
} }
/** /**
* Create the dialog. * Create the dialog.
* *
* @param traceback the traceback * @param traceback the traceback
*/ */
public GUIBugReportDialog(String traceback) { public GUIBugReportDialog(String traceback) {
setModal(true); setModal(true);
setModalityType(ModalityType.APPLICATION_MODAL); setModalityType(ModalityType.APPLICATION_MODAL);
setMinimumSize(new Dimension(640, 480)); setMinimumSize(new Dimension(640, 480));
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
setTitle(Messages.getString("GUIBugReportDialog.DLG_BUG_TITLE")); //$NON-NLS-1$ setTitle(Messages.getString("GUIBugReportDialog.DLG_BUG_TITLE")); //$NON-NLS-1$
setBounds(100, 100, 640, 480); setBounds(100, 100, 640, 480);
getContentPane().setLayout(new BorderLayout()); getContentPane().setLayout(new BorderLayout());
contentPanel.setAlignmentX(Component.LEFT_ALIGNMENT); contentPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER); getContentPane().add(this.contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS)); contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
{ {
JPanel namePanel = new JPanel(); JPanel namePanel = new JPanel();
namePanel.setMaximumSize(new Dimension(32767, 20)); namePanel.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(namePanel); contentPanel.add(namePanel);
namePanel.setLayout(new BorderLayout(0, 0)); namePanel.setLayout(new BorderLayout(0, 0));
{ {
lblName = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_NAME")); //$NON-NLS-1$ lblName = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_NAME")); //$NON-NLS-1$
namePanel.add(lblName, BorderLayout.WEST); namePanel.add(lblName, BorderLayout.WEST);
lblName.setHorizontalTextPosition(SwingConstants.LEFT); lblName.setHorizontalTextPosition(SwingConstants.LEFT);
lblName.setHorizontalAlignment(SwingConstants.LEFT); lblName.setHorizontalAlignment(SwingConstants.LEFT);
lblName.setAlignmentY(Component.TOP_ALIGNMENT); lblName.setAlignmentY(Component.TOP_ALIGNMENT);
} }
lblName.setLabelFor(reporterName); lblName.setLabelFor(reporterName);
{ {
this.reporterName = new JTextField(); this.reporterName = new JTextField();
namePanel.add(reporterName, BorderLayout.CENTER); namePanel.add(reporterName, BorderLayout.CENTER);
reporterName.setMaximumSize(new Dimension(2147483647, 20)); reporterName.setMaximumSize(new Dimension(2147483647, 20));
reporterName.setAlignmentY(Component.TOP_ALIGNMENT); reporterName.setAlignmentY(Component.TOP_ALIGNMENT);
this.reporterName.setColumns(10); this.reporterName.setColumns(10);
} }
} }
{ {
JPanel emailPanel = new JPanel(); JPanel emailPanel = new JPanel();
emailPanel.setMaximumSize(new Dimension(32767, 20)); emailPanel.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(emailPanel); contentPanel.add(emailPanel);
emailPanel.setLayout(new BorderLayout(0, 0)); emailPanel.setLayout(new BorderLayout(0, 0));
{ {
JLabel lblEmailoptional = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_EMAIL")); //$NON-NLS-1$ JLabel lblEmailoptional = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_EMAIL")); //$NON-NLS-1$
emailPanel.add(lblEmailoptional, BorderLayout.WEST); emailPanel.add(lblEmailoptional, BorderLayout.WEST);
} }
{ {
this.email = new JTextField(); this.email = new JTextField();
emailPanel.add(email, BorderLayout.CENTER); emailPanel.add(email, BorderLayout.CENTER);
email.setMaximumSize(new Dimension(2147483647, 20)); email.setMaximumSize(new Dimension(2147483647, 20));
this.email.setColumns(10); this.email.setColumns(10);
} }
} }
{ {
JPanel summaryPnl = new JPanel(); JPanel summaryPnl = new JPanel();
summaryPnl.setMaximumSize(new Dimension(32767, 20)); summaryPnl.setMaximumSize(new Dimension(32767, 20));
contentPanel.add(summaryPnl); contentPanel.add(summaryPnl);
summaryPnl.setLayout(new BorderLayout(0, 0)); summaryPnl.setLayout(new BorderLayout(0, 0));
{ {
JLabel lblProblemDescription = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_SUMMARY")); //$NON-NLS-1$ JLabel lblProblemDescription = new JLabel(Messages.getString("GUIBugReportDialog.DLG_BUG_SUMMARY")); //$NON-NLS-1$
summaryPnl.add(lblProblemDescription, BorderLayout.WEST); summaryPnl.add(lblProblemDescription, BorderLayout.WEST);
} }
{ {
this.problemSummary = new JTextField(); this.problemSummary = new JTextField();
summaryPnl.add(problemSummary, BorderLayout.CENTER); summaryPnl.add(problemSummary, BorderLayout.CENTER);
this.problemSummary.setColumns(10); this.problemSummary.setColumns(10);
} }
} }
{ {
JPanel descPanel = new JPanel(); JPanel descPanel = new JPanel();
descPanel.setMinimumSize(new Dimension(80, 150)); descPanel.setMinimumSize(new Dimension(80, 150));
contentPanel.add(descPanel); contentPanel.add(descPanel);
descPanel.setLayout(new BorderLayout(0, 0)); descPanel.setLayout(new BorderLayout(0, 0));
{ {
JLabel lblDetailedProblemDescription = new JLabel( JLabel lblDetailedProblemDescription = new JLabel(
Messages.getString("GUIBugReportDialog.DLG_BUG_DESC")); //$NON-NLS-1$ Messages.getString("GUIBugReportDialog.DLG_BUG_DESC")); //$NON-NLS-1$
lblDetailedProblemDescription.setVerticalAlignment(SwingConstants.TOP); lblDetailedProblemDescription.setVerticalAlignment(SwingConstants.TOP);
descPanel.add(lblDetailedProblemDescription, BorderLayout.WEST); descPanel.add(lblDetailedProblemDescription, BorderLayout.WEST);
} }
{ {
JScrollPane scrollPane = new JScrollPane(); JScrollPane scrollPane = new JScrollPane();
descPanel.add(scrollPane, BorderLayout.CENTER); descPanel.add(scrollPane, BorderLayout.CENTER);
{ {
JTextArea txtLongDesc = new JTextArea(); JTextArea txtLongDesc = new JTextArea();
scrollPane.setViewportView(txtLongDesc); scrollPane.setViewportView(txtLongDesc);
txtLongDesc.setWrapStyleWord(true); txtLongDesc.setWrapStyleWord(true);
txtLongDesc.setLineWrap(true); txtLongDesc.setLineWrap(true);
txtLongDesc txtLongDesc
.setText(Messages.getString("GUIBugReportDialog.DLG_BUG_DESC_DEFAULT")); //$NON-NLS-1$ .setText(Messages.getString("GUIBugReportDialog.DLG_BUG_DESC_DEFAULT")); //$NON-NLS-1$
} }
} }
} }
{ {
JPanel techInfoPanel = new JPanel(); JPanel techInfoPanel = new JPanel();
contentPanel.add(techInfoPanel); contentPanel.add(techInfoPanel);
techInfoPanel.setLayout(new BorderLayout(0, 0)); techInfoPanel.setLayout(new BorderLayout(0, 0));
{ {
chckbxIncludeTechnicalInformation = new JCheckBox( chckbxIncludeTechnicalInformation = new JCheckBox(
Messages.getString("GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO")); //$NON-NLS-1$ Messages.getString("GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO")); //$NON-NLS-1$
techInfoPanel.add(chckbxIncludeTechnicalInformation, BorderLayout.WEST); techInfoPanel.add(chckbxIncludeTechnicalInformation, BorderLayout.WEST);
chckbxIncludeTechnicalInformation.setLocation(new Point(2, 0)); chckbxIncludeTechnicalInformation.setLocation(new Point(2, 0));
chckbxIncludeTechnicalInformation.setVerticalAlignment(SwingConstants.TOP); chckbxIncludeTechnicalInformation.setVerticalAlignment(SwingConstants.TOP);
chckbxIncludeTechnicalInformation.setHorizontalTextPosition(SwingConstants.LEFT); chckbxIncludeTechnicalInformation.setHorizontalTextPosition(SwingConstants.LEFT);
chckbxIncludeTechnicalInformation.setAlignmentX(Component.CENTER_ALIGNMENT); chckbxIncludeTechnicalInformation.setAlignmentX(Component.CENTER_ALIGNMENT);
chckbxIncludeTechnicalInformation.setHorizontalAlignment(SwingConstants.LEFT); chckbxIncludeTechnicalInformation.setHorizontalAlignment(SwingConstants.LEFT);
} }
{ {
JScrollPane scrollPane = new JScrollPane(); JScrollPane scrollPane = new JScrollPane();
techInfoPanel.add(scrollPane, BorderLayout.CENTER); techInfoPanel.add(scrollPane, BorderLayout.CENTER);
{ {
JTextArea textArea = new JTextArea(); JTextArea textArea = new JTextArea();
scrollPane.setViewportView(textArea); scrollPane.setViewportView(textArea);
textArea.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); textArea.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
textArea.setBackground(new Color(204, 204, 204)); textArea.setBackground(new Color(204, 204, 204));
textArea.setEditable(false); textArea.setEditable(false);
textArea.setWrapStyleWord(true); textArea.setWrapStyleWord(true);
textArea.setLineWrap(true); textArea.setLineWrap(true);
textArea.setText(Messages.getString("GUIBugReportDialog.NOTICE_INFO_INCLUDED") + traceback); //$NON-NLS-1$ textArea.setText(Messages.getString("GUIBugReportDialog.NOTICE_INFO_INCLUDED") + traceback); //$NON-NLS-1$
} }
} }
} }
{ {
JPanel buttonPane = new JPanel(); JPanel buttonPane = new JPanel();
getContentPane().add(buttonPane, BorderLayout.SOUTH); getContentPane().add(buttonPane, BorderLayout.SOUTH);
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS)); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
{ {
JProgressBar progressBar = new JProgressBar(); JProgressBar progressBar = new JProgressBar();
buttonPane.add(progressBar); buttonPane.add(progressBar);
} }
{ {
JButton okButton = new JButton(Messages.getString("GUIBugReportDialog.DLG_SUBMIT")); //$NON-NLS-1$ JButton okButton = new JButton(Messages.getString("GUIBugReportDialog.DLG_SUBMIT")); //$NON-NLS-1$
buttonPane.add(okButton); buttonPane.add(okButton);
okButton.setActionCommand(Messages.getString("GUIBugReportDialog.DLG_OK")); //$NON-NLS-1$ okButton.setActionCommand(Messages.getString("GUIBugReportDialog.DLG_OK")); //$NON-NLS-1$
getRootPane().setDefaultButton(okButton); getRootPane().setDefaultButton(okButton);
} }
{ {
JButton cancelButton = new JButton(Messages.getString("GUIBugReportDialog.DLG_CXL")); //$NON-NLS-1$ JButton cancelButton = new JButton(Messages.getString("GUIBugReportDialog.DLG_CXL")); //$NON-NLS-1$
buttonPane.add(cancelButton); buttonPane.add(cancelButton);
cancelButton.setActionCommand(Messages.getString("GUIBugReportDialog.DLG_CXL")); //$NON-NLS-1$ cancelButton.setActionCommand(Messages.getString("GUIBugReportDialog.DLG_CXL")); //$NON-NLS-1$
} }
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,14 @@
# Root logger option # Root logger option
log4j.rootLogger=DEBUG, file, stdout log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file # Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=mosslog.log log4j.appender.file.File=mosslog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout 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 log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout # Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 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 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=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_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_EMAIL=e-mail (optional):
GUIBugReportDialog.DLG_BUG_NAME=Name: GUIBugReportDialog.DLG_BUG_NAME=Name:
GUIBugReportDialog.DLG_BUG_SUMMARY=Problem summary: GUIBugReportDialog.DLG_BUG_SUMMARY=Problem summary:
GUIBugReportDialog.DLG_BUG_TITLE=Report a bug GUIBugReportDialog.DLG_BUG_TITLE=Report a bug
GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO=Include technical information GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO=Include technical information
GUIBugReportDialog.DLG_CXL=Cancel GUIBugReportDialog.DLG_CXL=Cancel
GUIBugReportDialog.DLG_OK=OK GUIBugReportDialog.DLG_OK=OK
GUIBugReportDialog.DLG_SUBMIT=Submit 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 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.23=Report a bug...
GUIClientsideLauncher.24=Request new feature... GUIClientsideLauncher.24=Request new feature...
GUIClientsideLauncher.25=Visit website GUIClientsideLauncher.25=Visit website
GUIClientsideLauncher.26=GitHub project GUIClientsideLauncher.26=GitHub project
GUIClientsideLauncher.27=Visit forums GUIClientsideLauncher.27=Visit forums
GUIClientsideLauncher.COL_GAME_PRESET=Game preset GUIClientsideLauncher.COL_GAME_PRESET=Game preset
GUIClientsideLauncher.COL_WORLD_DESC=Description GUIClientsideLauncher.COL_WORLD_DESC=Description
GUIClientsideLauncher.COL_WORLD_NAME=World name GUIClientsideLauncher.COL_WORLD_NAME=World name
GUIClientsideLauncher.DLG_ABOUT=About GUIClientsideLauncher.DLG_ABOUT=About
GUIClientsideLauncher.DLG_DELETE=Delete... GUIClientsideLauncher.DLG_DELETE=Delete...
GUIClientsideLauncher.DLG_NEW=New... 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_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_PLAY=Play
GUIClientsideLauncher.DLG_SETTINGS=Settings... GUIClientsideLauncher.DLG_SETTINGS=Settings...
GUIClientsideLauncher.DLG_SINGLEPLAYER=Singleplayer GUIClientsideLauncher.DLG_SINGLEPLAYER=Singleplayer
GUIClientsideLauncher.DLG_TITLE=Mosstest Client launcher <0.0.1-initial> 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=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.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_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_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.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.SYS_NEWLINE=\n
GUIClientsideLauncher.USES_LIBS=Uses the following libraries:\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. GUIClientsideLauncher.WARN_SET_LAF=Warning: The look-and-feel cannot be set to system. Using default look-and-feel.
GUIWorldCreationDialog.CXL=Cancel GUIWorldCreationDialog.CXL=Cancel
GUIWorldCreationDialog.DLG_TITLE=Create new singleplayer world... GUIWorldCreationDialog.DLG_TITLE=Create new singleplayer world...
GUIWorldCreationDialog.GAME_PROFILE=Game profile: GUIWorldCreationDialog.GAME_PROFILE=Game profile:
GUIWorldCreationDialog.OK=OK GUIWorldCreationDialog.OK=OK
GUIWorldCreationDialog.WORLD_DESC=Description: GUIWorldCreationDialog.WORLD_DESC=Description:
GUIWorldCreationDialog.WORLD_NAME=World name: GUIWorldCreationDialog.WORLD_NAME=World name:
GUIWorldDeletionDialog.AREYOUSURE_TEXT=Are you sure you wish to delete the world called GUIWorldDeletionDialog.AREYOUSURE_TEXT=Are you sure you wish to delete the world called
GUIWorldDeletionDialog.DLG_TITLE=Delete singleplayer world... GUIWorldDeletionDialog.DLG_TITLE=Delete singleplayer world...
GUIWorldDeletionDialog.NO=No GUIWorldDeletionDialog.NO=No
GUIWorldDeletionDialog.QUESTIONMARK_CANNOT_UNDO=? This operation cannot be undone. GUIWorldDeletionDialog.QUESTIONMARK_CANNOT_UNDO=? This operation cannot be undone.
GUIWorldDeletionDialog.YES=Yes GUIWorldDeletionDialog.YES=Yes

View File

@ -1,14 +1,14 @@
# Root logger option # Root logger option
log4j.rootLogger=DEBUG, file, stdout log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file # Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=mosslog.log log4j.appender.file.File=mosslog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout 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 log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout # Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 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 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; package net.mosstest.scripting;
import net.mosstest.servercore.INodeManager; import net.mosstest.servercore.INodeManager;
import net.mosstest.servercore.MapGeneratorException; import net.mosstest.servercore.MapGeneratorException;
// TODO: Auto-generated Javadoc // TODO: Auto-generated Javadoc
/** /**
* The Class FlatMapGenerator. * The Class FlatMapGenerator.
*/ */
public class FlatMapGenerator implements IMapGenerator { public class FlatMapGenerator implements IMapGenerator {
public static final int CHUNK_DIMENSION = 16; public static final int CHUNK_DIMENSION = 16;
/** /**
* The seed. * The seed.
*/ */
long seed; long seed;
/** /**
* The nm. * The nm.
*/ */
INodeManager nm; INodeManager nm;
/* (non-Javadoc) /* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#init(long, net.mosstest.servercore.INodeManager, java.lang.Object[]) * @see net.mosstest.scripting.IMapGenerator#init(long, net.mosstest.servercore.INodeManager, java.lang.Object[])
*/ */
@Override @Override
public void init(long seed, INodeManager nm, Object... params) public void init(long seed, INodeManager nm, Object... params)
throws MapGeneratorException { throws MapGeneratorException {
this.seed = seed; this.seed = seed;
this.nm = nm; this.nm = nm;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#generateChunk(net.mosstest.scripting.Position) * @see net.mosstest.scripting.IMapGenerator#generateChunk(net.mosstest.scripting.Position)
*/ */
@Override @Override
public MapChunk generateChunk(Position pos) public MapChunk generateChunk(Position pos)
throws MapGeneratorException { throws MapGeneratorException {
int[][][] nodes = new int[CHUNK_DIMENSION][CHUNK_DIMENSION][CHUNK_DIMENSION]; int[][][] nodes = new int[CHUNK_DIMENSION][CHUNK_DIMENSION][CHUNK_DIMENSION];
int fillNode = (pos.getZ() >= 0) ? this.nm.getNode( int fillNode = (pos.getZ() >= 0) ? this.nm.getNode(
"mg:air", false).getNodeId() : this.nm.getNode( //$NON-NLS-1$ "mg:air", false).getNodeId() : this.nm.getNode( //$NON-NLS-1$
"mg:ground", false).getNodeId(); //$NON-NLS-1$ "mg:ground", false).getNodeId(); //$NON-NLS-1$
for (int x = 0; x < CHUNK_DIMENSION; x++) { for (int x = 0; x < CHUNK_DIMENSION; x++) {
for (int y = 0; y < CHUNK_DIMENSION; y++) { for (int y = 0; y < CHUNK_DIMENSION; y++) {
for (int z = 0; z < CHUNK_DIMENSION; z++) { for (int z = 0; z < CHUNK_DIMENSION; z++) {
nodes[x][y][z] = fillNode; nodes[x][y][z] = fillNode;
} }
} }
} }
return new MapChunk(pos, nodes); return new MapChunk(pos, nodes);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#fillInChunk(int[][][], net.mosstest.scripting.Position) * @see net.mosstest.scripting.IMapGenerator#fillInChunk(int[][][], net.mosstest.scripting.Position)
*/ */
@Override @Override
public void fillInChunk(int[][][] lightNodes, Position pos) public void fillInChunk(int[][][] lightNodes, Position pos)
throws MapGeneratorException { throws MapGeneratorException {
int fillNode = (pos.getZ() >= 0) ? this.nm.getNode("mg:air", //$NON-NLS-1$ int fillNode = (pos.getZ() >= 0) ? this.nm.getNode("mg:air", //$NON-NLS-1$
false).getNodeId() : this.nm false).getNodeId() : this.nm
.getNode("mg:ground", false).getNodeId(); //$NON-NLS-1$ .getNode("mg:ground", false).getNodeId(); //$NON-NLS-1$
for (int x = 0; x < CHUNK_DIMENSION; x++) { for (int x = 0; x < CHUNK_DIMENSION; x++) {
for (int y = 0; y < CHUNK_DIMENSION; y++) { for (int y = 0; y < CHUNK_DIMENSION; y++) {
for (int z = 0; z < CHUNK_DIMENSION; z++) { for (int z = 0; z < CHUNK_DIMENSION; z++) {
if (lightNodes[x][y][z] == 0) { if (lightNodes[x][y][z] == 0) {
// operation in place on passed in array as per // operation in place on passed in array as per
// contract // contract
lightNodes[x][y][z] = fillNode; lightNodes[x][y][z] = fillNode;
} }
} }
} }
} }
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see net.mosstest.scripting.IMapGenerator#registerOre(net.mosstest.scripting.MapNode, double, double, double, int, java.lang.Object[]) * @see net.mosstest.scripting.IMapGenerator#registerOre(net.mosstest.scripting.MapNode, double, double, double, int, java.lang.Object[])
*/ */
@Override @Override
public void registerOre(MapNode oreNode, double minDepth, public void registerOre(MapNode oreNode, double minDepth,
double rarity, double clumping, int seed, Object... params) { double rarity, double clumping, int seed, Object... params) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,14 @@
/** /**
* @author rarkenin * @author rarkenin
* *
* This package contains various immutable Java objects to contain the parameters of events which scripts shall handle. * This package contains various immutable Java objects to contain the parameters of events which scripts shall handle.
* <p> * <p>
* <b>Sequence numbers, aka <code>seqnum</code>s</b> are serial IDs given to events with certain ordering guarantees, which include guarantees that: * <b>Sequence numbers, aka <code>seqnum</code>s</b> are serial IDs given to events with certain ordering guarantees, which include guarantees that:
* <ul> * <ul>
* <li>Seqnums are unique until wraparound occurs at 18446744073709551616.</li> * <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>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. * <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> * </ul>
*/ */
package net.mosstest.scripting.events; package net.mosstest.scripting.events;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,130 +1,130 @@
package net.mosstest.servercore; package net.mosstest.servercore;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.Properties; import java.util.Properties;
// TODO: Auto-generated Javadoc // TODO: Auto-generated Javadoc
/** /**
* The Class MossDebugUtils. * The Class MossDebugUtils.
*/ */
public class MossDebugUtils { public class MossDebugUtils {
/** /**
* The logger. * The logger.
*/ */
static Logger logger = Logger.getLogger(MossDebugUtils.class); static Logger logger = Logger.getLogger(MossDebugUtils.class);
/** /**
* The Constant propertiesToGet. * The Constant propertiesToGet.
*/ */
private static final String[] propertiesToGet = {"awt.toolkit", //$NON-NLS-1$ 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$ "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.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.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.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$ "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$ "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$ "sun.cpu.endian", "sun.desktop", "user.language" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}; };
/** /**
* Write stracktrace. * Write stracktrace.
* *
* @param e the e * @param e the e
* @return the string * @return the string
*/ */
public static String writeStracktrace(Exception e) { public static String writeStracktrace(Exception e) {
String fName = Integer.toString(System.identityHashCode(e), 16) + "@" String fName = Integer.toString(System.identityHashCode(e), 16) + "@"
+ System.currentTimeMillis(); + System.currentTimeMillis();
File write = new File("stacktraces/" + fName + ".txt"); File write = new File("stacktraces/" + fName + ".txt");
try { try {
new File("stacktraces").mkdirs(); new File("stacktraces").mkdirs();
write.createNewFile(); write.createNewFile();
try (FileWriter writer = new FileWriter(write)) { try (FileWriter writer = new FileWriter(write)) {
writer.write(getDebugInformation(e)); writer.write(getDebugInformation(e));
writer.close(); writer.close();
} }
} catch (IOException e1) { } catch (IOException e1) {
logger.fatal(e1.getClass().getName() + " caught trying to write stacktrace of an existing exception. Message: " + e1.getMessage()); logger.fatal(e1.getClass().getName() + " caught trying to write stacktrace of an existing exception. Message: " + e1.getMessage());
} }
return write.getAbsolutePath(); return write.getAbsolutePath();
} }
/** /**
* Gets the debug information. * Gets the debug information.
* *
* @param e the e * @param e the e
* @return the debug information * @return the debug information
*/ */
public static String getDebugInformation(Exception e) { public static String getDebugInformation(Exception e) {
StringBuilder s = new StringBuilder( 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$ 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_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$ s.append(Messages.getString("MossDebugUtils.MSG_EXCEPTION_CAUGHT")); //$NON-NLS-1$
for (StackTraceElement ste : e.getStackTrace()) { for (StackTraceElement ste : e.getStackTrace()) {
s.append(ste.toString()).append("\r\n"); //$NON-NLS-1$ s.append(ste.toString()).append("\r\n"); //$NON-NLS-1$
} }
s.append("\r\n"); //$NON-NLS-1$ s.append("\r\n"); //$NON-NLS-1$
s.append(getOsDetails()); s.append(getOsDetails());
return s.toString(); return s.toString();
} }
/** /**
* Gets the os details. * Gets the os details.
* *
* @return the os details * @return the os details
*/ */
public static String getOsDetails() { public static String getOsDetails() {
StringBuilder s = new StringBuilder(); StringBuilder s = new StringBuilder();
s.append(Messages.getString("MossDebugUtils.MSG_SYS_PROPS")); //$NON-NLS-1$ 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_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$ s.append(Messages.getString("MossDebugUtils.MSG_FREEMEM")).append(Runtime.getRuntime().freeMemory()).append("\r\n"); //$NON-NLS-1$
long maxMemory = Runtime.getRuntime().maxMemory(); long maxMemory = Runtime.getRuntime().maxMemory();
s.append(Messages.getString("MossDebugUtils.MSG_MAXMEM")).append(maxMemory == Long.MAX_VALUE ? Messages 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$ .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$ s.append(Messages.getString("MossDebugUtils.MSG_TOTAL_MEM")).append(Runtime.getRuntime().totalMemory()).append("\r\n"); //$NON-NLS-1$
File[] roots = File.listRoots(); File[] roots = File.listRoots();
for (File root : roots) { 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_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_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_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(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("\r\n"); //$NON-NLS-1$
s.append(Messages.getString("MossDebugUtils.MSG_JAVA_PROPS")); //$NON-NLS-1$ s.append(Messages.getString("MossDebugUtils.MSG_JAVA_PROPS")); //$NON-NLS-1$
for (String key : propertiesToGet) { for (String key : propertiesToGet) {
s.append(key).append(":").append(System.getProperty(key, "")).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ s.append(key).append(":").append(System.getProperty(key, "")).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} }
return s.toString(); return s.toString();
} }
/** /**
* Gets the git config. * Gets the git config.
* *
* @param cfgKey the cfg key * @param cfgKey the cfg key
* @return the git config * @return the git config
*/ */
private static String getGitConfig(String cfgKey) { private static String getGitConfig(String cfgKey) {
Properties properties = new Properties(); Properties properties = new Properties();
try { try {
properties.load(MossDebugUtils.class.getClassLoader() properties.load(MossDebugUtils.class.getClassLoader()
.getResourceAsStream("git.properties")); //$NON-NLS-1$ .getResourceAsStream("git.properties")); //$NON-NLS-1$
} catch (IOException e) { } catch (IOException e) {
return Messages.getString("MossDebugUtils.MSG_IO_EXCEPTION"); //$NON-NLS-1$ return Messages.getString("MossDebugUtils.MSG_IO_EXCEPTION"); //$NON-NLS-1$
} }
return properties.getProperty(cfgKey); return properties.getProperty(cfgKey);
} }
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -10,7 +10,7 @@ import java.io.IOException;
// TODO: Auto-generated Javadoc // 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. * to call a script.
* *
* @author rarkenin * @author rarkenin
@ -19,7 +19,7 @@ public class ScriptEnv {
static Logger logger = Logger.getLogger(MossDebugUtils.class); 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 * Executes a script with default permissions. This will allow sandboxed
* access to the database, and gameplay data, without access to * access to the database, and gameplay data, without access to
* authentication data. These scripts have access to * authentication data. Via an ACL, certain classes may be blocked
* <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
* or replaced with limited versions thereof. At the time of writing, this * 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 * feature uses a security manager to disallow anything that tries to access risky data or sockets.
* API.
* *
* @param script A string representing the script to run * @param script A string representing the script to run
* @return A {@link ScriptEnv.ScriptResult} constant representing the * @return A {@link ScriptEnv.ScriptResult} constant representing the
@ -101,9 +96,9 @@ public class ScriptEnv {
* @param ev the ev * @param ev the ev
*/ */
public ScriptEnv(MossScriptEnv ev) { public ScriptEnv(MossScriptEnv ev) {
this.cx = ContextFactory.getGlobal().enterContext(); this.cx = ContextFactory.getGlobal().enterContext();
this.globalScope = this.cx.initStandardObjects(); this.globalScope = new ImporterTopLevel();
this.globalScope.initStandardObjects(cx, false);
cx.setOptimizationLevel(9); cx.setOptimizationLevel(9);
this.globalScope.put("moss", this.globalScope, ev); //$NON-NLS-1$ this.globalScope.put("moss", this.globalScope, ev); //$NON-NLS-1$

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,36 +1,36 @@
package net.mosstest.tests; package net.mosstest.tests;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;
import net.mosstest.scripting.MapChunk; import net.mosstest.scripting.MapChunk;
import net.mosstest.scripting.MapGenerators; import net.mosstest.scripting.MapGenerators;
import net.mosstest.scripting.Position; import net.mosstest.scripting.Position;
import net.mosstest.scripting.SimplexMapGenerator; import net.mosstest.scripting.SimplexMapGenerator;
import net.mosstest.servercore.MapGeneratorException; import net.mosstest.servercore.MapGeneratorException;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class MapChunkTest { public class MapChunkTest {
public static final Position[] positions = { 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), 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 @Before
public void setUp() throws MapGeneratorException { public void setUp() throws MapGeneratorException {
MapGenerators.setDefaultMapGenerator(new SimplexMapGenerator(), new MockNodeManager(), 1123581321, null); MapGenerators.setDefaultMapGenerator(new SimplexMapGenerator(), new MockNodeManager(), 1123581321, null);
} }
@Test @Test
public void testByteArraySerialization() throws MapGeneratorException, IOException { public void testByteArraySerialization() throws MapGeneratorException, IOException {
for(Position p : positions) { for(Position p : positions) {
MapChunk mc1 = MapGenerators.getDefaultMapgen().generateChunk(p); MapChunk mc1 = MapGenerators.getDefaultMapgen().generateChunk(p);
byte[] bytes = mc1.writeLight(false); byte[] bytes = mc1.writeLight(false);
MapChunk mc2 = new MapChunk(bytes); MapChunk mc2 = new MapChunk(bytes);
assertTrue(mc1.equals(mc2)); assertTrue(mc1.equals(mc2));
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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