Skip to content

Commit

Permalink
Server mod example
Browse files Browse the repository at this point in the history
  • Loading branch information
ago1024 committed May 2, 2016
0 parents commit 1928872
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/target/
.classpath
.project
.settings
88 changes: 88 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.gotti.wurmunlimited</groupId>
<artifactId>samplemod</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>samplemod</name>

<dependencies>
<dependency>
<groupId>org.gotti.wurmunlimited</groupId>
<artifactId>server-modlauncher</artifactId>
<version>0.17.0-SNAPSHOT</version>
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>ru.concerteza.buildnumber</groupId>
<artifactId>maven-jgit-buildnumber-plugin</artifactId>
<version>1.2.9</version>
<executions>
<execution>
<id>git-buildnumber</id>
<goals>
<goal>extract-buildnumber</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<javaScriptBuildnumberCallback>
(tag ? tag : branch) + "-" + shortRevision
</javaScriptBuildnumberCallback>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestEntries>
<Implementation-Version>${git.buildnumber}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptors>
<descriptor>src/assembly/mod-package.xml</descriptor>
</descriptors>
<finalName>${project.name}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
22 changes: 22 additions & 0 deletions src/assembly/mod-package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>mod</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/dist</directory>
<outputDirectory>mods/</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.build.directory}/${project.name}-${project.version}.jar</source>
<outputDirectory>mods/${project.name}</outputDirectory>
<destName>${project.name}.jar</destName>
</file>
</files>
</assembly>
2 changes: 2 additions & 0 deletions src/dist/samplemod.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
classname=org.gotti.wurmunlimited.mods.samplemod.SampleMod
classpath=samplemod.jar
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.gotti.wurmunlimited.mods.samplemod;

import java.util.logging.Logger;

import org.gotti.wurmunlimited.modloader.interfaces.Initable;
import org.gotti.wurmunlimited.modloader.interfaces.ItemTemplatesCreatedListener;
import org.gotti.wurmunlimited.modloader.interfaces.PreInitable;
import org.gotti.wurmunlimited.modloader.interfaces.ServerStartedListener;
import org.gotti.wurmunlimited.modloader.interfaces.WurmMod;

import com.wurmonline.server.MiscConstants;
import com.wurmonline.server.items.ItemTypes;

public class SampleMod implements WurmMod, Initable, PreInitable, ServerStartedListener, ItemTemplatesCreatedListener, ItemTypes, MiscConstants {

private static final Logger LOGGER = Logger.getLogger(SampleMod.class.getName());

@Override
public void onItemTemplatesCreated() {
LOGGER.info("onItemTemplatesCreated");
}

@Override
public void onServerStarted() {
LOGGER.info("onServerStarted");
}

@Override
public void init() {
LOGGER.info("init");
}

@Override
public void preInit() {
LOGGER.info("preInit");
}

}

0 comments on commit 1928872

Please sign in to comment.