mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
First commit
Change-Id: I4d273faba7286288d2b9a214c87c39a76724d787
This commit is contained in:
15
.classpath
Normal file
15
.classpath
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry excluding="mysql5/|db4o/" kind="src" path="src/dao"/>
|
||||
<classpathentry kind="src" path="src/dao/mysql5"/>
|
||||
<classpathentry kind="src" path="src/dao/db4o"/>
|
||||
<classpathentry kind="src" path="data/scripts"/>
|
||||
<classpathentry kind="src" path="data/template"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
23
.project
Normal file
23
.project
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>l2jserver2-gameserver</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
3
.settings/org.eclipse.jdt.core.prefs
Normal file
3
.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,3 @@
|
||||
#Thu Apr 28 15:32:21 BRT 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
8
.settings/org.maven.ide.eclipse.prefs
Normal file
8
.settings/org.maven.ide.eclipse.prefs
Normal file
@@ -0,0 +1,8 @@
|
||||
#Thu Apr 28 15:16:57 BRT 2011
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
||||
24
data/scripts/com/l2jserver/script/DummyScript.java
Normal file
24
data/scripts/com/l2jserver/script/DummyScript.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.l2jserver.script;
|
||||
|
||||
import com.l2jserver.model.world.capability.Scriptable;
|
||||
import com.l2jserver.service.game.script.Script;
|
||||
|
||||
public class DummyScript implements Script<Scriptable> {
|
||||
@Override
|
||||
public void load(Scriptable object) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Scriptable getObject() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
|
||||
public class TestPotionTemplate extends PotionTemplate {
|
||||
public TestPotionTemplate() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consume(Attacker source, Attackable target) {
|
||||
//TODO consume item
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.world.capability.Castable;
|
||||
import com.l2jserver.model.world.capability.Caster;
|
||||
|
||||
public class TestSkillTemplate extends SkillTemplate {
|
||||
public TestSkillTemplate() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cast(Caster caster, Castable target) {
|
||||
// TODO do casting
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Enchantable;
|
||||
|
||||
public class TestWeaponTemplate extends WeaponTemplate {
|
||||
private static final int DAMAGE = 10;
|
||||
private static final int MAX_ENCHANT_LEVEL = 10;
|
||||
|
||||
public TestWeaponTemplate() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Attacker source, Attackable target) {
|
||||
// TODO deal damage!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enchant(Enchantable target) {
|
||||
if (target.getEnchantLevel() == MAX_ENCHANT_LEVEL)
|
||||
return;
|
||||
// TODO do enchant
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage() {
|
||||
return DAMAGE;
|
||||
}
|
||||
}
|
||||
42
pom.xml
Normal file
42
pom.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<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>com.l2jserver</groupId>
|
||||
<artifactId>l2jserver2-gameserver</artifactId>
|
||||
<version>2.0.0-DEVEL</version>
|
||||
<name>L2JServer - Game Server Module</name>
|
||||
<description>Lineage II server emulator</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jboss.netty</groupId>
|
||||
<artifactId>netty</artifactId>
|
||||
<version>3.2.4.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.inject</groupId>
|
||||
<artifactId>guice</artifactId>
|
||||
<version>3.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>repository.jboss.org</id>
|
||||
<url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
13
src/dao/com/l2jserver/db/dao/PlayerDAO.java
Normal file
13
src/dao/com/l2jserver/db/dao/PlayerDAO.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.db.dao;
|
||||
|
||||
import com.l2jserver.model.world.Player;
|
||||
import com.l2jserver.service.database.DataAccessObject;
|
||||
|
||||
/**
|
||||
* The {@link PlayerDAO} is can load and save {@link Player player instances}.
|
||||
*
|
||||
* @author Rogiel
|
||||
*/
|
||||
public interface PlayerDAO extends DataAccessObject {
|
||||
void load(Player player);
|
||||
}
|
||||
15
src/dao/db4o/com/l2jserver/db/dao/db4o/AbstractDB4ODAO.java
Normal file
15
src/dao/db4o/com/l2jserver/db/dao/db4o/AbstractDB4ODAO.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.l2jserver.db.dao.db4o;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.service.database.AbstractDAO;
|
||||
import com.l2jserver.service.database.DB4ODatabaseService;
|
||||
|
||||
public class AbstractDB4ODAO extends AbstractDAO implements BD4ODAO {
|
||||
protected final DB4ODatabaseService database;
|
||||
|
||||
@Inject
|
||||
protected AbstractDB4ODAO(DB4ODatabaseService database) {
|
||||
super(database);
|
||||
this.database = database;
|
||||
}
|
||||
}
|
||||
5
src/dao/db4o/com/l2jserver/db/dao/db4o/BD4ODAO.java
Normal file
5
src/dao/db4o/com/l2jserver/db/dao/db4o/BD4ODAO.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.db.dao.db4o;
|
||||
|
||||
public interface BD4ODAO {
|
||||
|
||||
}
|
||||
18
src/dao/db4o/com/l2jserver/db/dao/db4o/DB4OPlayerDAO.java
Normal file
18
src/dao/db4o/com/l2jserver/db/dao/db4o/DB4OPlayerDAO.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.l2jserver.db.dao.db4o;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.db.dao.PlayerDAO;
|
||||
import com.l2jserver.model.world.Player;
|
||||
import com.l2jserver.service.database.DB4ODatabaseService;
|
||||
|
||||
public class DB4OPlayerDAO extends AbstractDB4ODAO implements PlayerDAO {
|
||||
@Inject
|
||||
protected DB4OPlayerDAO(DB4ODatabaseService database) {
|
||||
super(database);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Player player) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.l2jserver.game.net.codec;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.handler.codec.frame.FrameDecoder;
|
||||
|
||||
public class Lineage2Decoder extends FrameDecoder {
|
||||
@Override
|
||||
protected Object decode(ChannelHandlerContext ctx, Channel channel,
|
||||
ChannelBuffer buffer) throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.game.net.codec;
|
||||
|
||||
public class Lineage2Encoder {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.l2jserver.game.net.packet;
|
||||
|
||||
public abstract class AbstractClientPacket implements ClientPacket {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.l2jserver.game.net.packet;
|
||||
|
||||
public abstract class AbstractServerPacket implements ServerPacket {
|
||||
private final int opcode;
|
||||
|
||||
public AbstractServerPacket(int opcode) {
|
||||
this.opcode = opcode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpcode() {
|
||||
return opcode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.l2jserver.game.net.packet;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
public interface ClientPacket extends Packet {
|
||||
void read(ChannelBuffer buffer);
|
||||
}
|
||||
5
src/main/java/com/l2jserver/game/net/packet/Packet.java
Normal file
5
src/main/java/com/l2jserver/game/net/packet/Packet.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.game.net.packet;
|
||||
|
||||
|
||||
public interface Packet {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.game.net.packet;
|
||||
|
||||
public class PacketManager {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.l2jserver.game.net.packet;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
public class PacketModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.l2jserver.game.net.packet;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
public interface ServerPacket extends Packet {
|
||||
void write(ChannelBuffer buffer);
|
||||
int getOpcode();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.l2jserver.game.net.packet.client;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import com.l2jserver.game.net.packet.AbstractClientPacket;
|
||||
|
||||
public class TestPacket extends AbstractClientPacket {
|
||||
public static final int OPCODE = 0x00;
|
||||
|
||||
@Override
|
||||
public void read(ChannelBuffer buffer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.l2jserver.game.net.packet.server;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import com.l2jserver.game.net.packet.AbstractServerPacket;
|
||||
|
||||
public class TestPacket extends AbstractServerPacket {
|
||||
public static final int OPCODE = 0x00;
|
||||
|
||||
@Override
|
||||
public void write(ChannelBuffer buffer) {
|
||||
|
||||
}
|
||||
|
||||
public TestPacket() {
|
||||
super(OPCODE);
|
||||
}
|
||||
}
|
||||
5
src/main/java/com/l2jserver/model/id/CharacterID.java
Normal file
5
src/main/java/com/l2jserver/model/id/CharacterID.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
public interface CharacterID extends ObjectID {
|
||||
|
||||
}
|
||||
5
src/main/java/com/l2jserver/model/id/ID.java
Normal file
5
src/main/java/com/l2jserver/model/id/ID.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
public interface ID {
|
||||
|
||||
}
|
||||
5
src/main/java/com/l2jserver/model/id/ObjectID.java
Normal file
5
src/main/java/com/l2jserver/model/id/ObjectID.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
public interface ObjectID extends ID {
|
||||
|
||||
}
|
||||
5
src/main/java/com/l2jserver/model/id/SimpleID.java
Normal file
5
src/main/java/com/l2jserver/model/id/SimpleID.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
public class SimpleID implements ID {
|
||||
|
||||
}
|
||||
5
src/main/java/com/l2jserver/model/id/TemplateID.java
Normal file
5
src/main/java/com/l2jserver/model/id/TemplateID.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
public interface TemplateID extends ID {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
|
||||
public class AbstractTemplate {
|
||||
private final TemplateID id;
|
||||
|
||||
public AbstractTemplate(TemplateID id) {
|
||||
super();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TemplateID getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.capability.Consumable;
|
||||
|
||||
public abstract class ConsumableTemplate extends ItemTemplate implements
|
||||
Consumable {
|
||||
public ConsumableTemplate(TemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
|
||||
public abstract class ItemTemplate extends AbstractTemplate {
|
||||
public ItemTemplate(TemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
|
||||
public abstract class PotionTemplate extends ConsumableTemplate {
|
||||
public PotionTemplate(TemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.capability.Castable;
|
||||
|
||||
public abstract class SkillTemplate extends AbstractTemplate implements
|
||||
Castable {
|
||||
public SkillTemplate(TemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.capability.Attackable;
|
||||
import com.l2jserver.model.template.capability.Enchantable;
|
||||
|
||||
public abstract class WeaponTemplate extends ItemTemplate implements
|
||||
Attackable, Enchantable {
|
||||
public WeaponTemplate(TemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
|
||||
public interface Attackable extends TemplateCapability {
|
||||
void attack(Attacker source,
|
||||
com.l2jserver.model.world.capability.Attackable target);
|
||||
|
||||
public int getDamage();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
import com.l2jserver.model.world.capability.Caster;
|
||||
|
||||
public interface Castable extends TemplateCapability {
|
||||
void cast(Caster caster,
|
||||
com.l2jserver.model.world.capability.Castable target);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
|
||||
public interface Consumable extends TemplateCapability {
|
||||
void consume(Attacker source,
|
||||
com.l2jserver.model.world.capability.Attackable target);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
|
||||
public interface Enchantable extends TemplateCapability {
|
||||
void enchant(com.l2jserver.model.world.capability.Enchantable target);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
public interface TemplateCapability {
|
||||
|
||||
}
|
||||
19
src/main/java/com/l2jserver/model/world/AbstractObject.java
Normal file
19
src/main/java/com/l2jserver/model/world/AbstractObject.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.l2jserver.model.world;
|
||||
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
|
||||
/**
|
||||
* This is an abstract object representing all the world objects in Lineage II.
|
||||
* @author Rogiel
|
||||
*/
|
||||
public abstract class AbstractObject implements WorldObject {
|
||||
protected ObjectID id;
|
||||
|
||||
public ObjectID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(ObjectID id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
10
src/main/java/com/l2jserver/model/world/Character.java
Normal file
10
src/main/java/com/l2jserver/model/world/Character.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.l2jserver.model.world;
|
||||
|
||||
import com.l2jserver.model.id.CharacterID;
|
||||
|
||||
public class Character extends Player {
|
||||
@Override
|
||||
public CharacterID getId() {
|
||||
return (CharacterID) super.getId();
|
||||
}
|
||||
}
|
||||
45
src/main/java/com/l2jserver/model/world/Item.java
Normal file
45
src/main/java/com/l2jserver/model/world/Item.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.l2jserver.model.world;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Child;
|
||||
import com.l2jserver.model.world.capability.Playable;
|
||||
import com.l2jserver.model.world.capability.Spawnable;
|
||||
import com.l2jserver.util.Coordinate;
|
||||
|
||||
public class Item extends AbstractObject implements Playable, Spawnable,
|
||||
Attacker, Attackable, Child<Player> {
|
||||
@Override
|
||||
public void spawn(Coordinate coordinate) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveAttack(Attacker attacker) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Attackable target) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpawned() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getParent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coordinate getPosition() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
10
src/main/java/com/l2jserver/model/world/Pet.java
Normal file
10
src/main/java/com/l2jserver/model/world/Pet.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.l2jserver.model.world;
|
||||
|
||||
import com.l2jserver.model.world.capability.Child;
|
||||
|
||||
public class Pet extends Player implements Child<Character> {
|
||||
@Override
|
||||
public Character getParent() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
90
src/main/java/com/l2jserver/model/world/Player.java
Normal file
90
src/main/java/com/l2jserver/model/world/Player.java
Normal file
@@ -0,0 +1,90 @@
|
||||
package com.l2jserver.model.world;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Castable;
|
||||
import com.l2jserver.model.world.capability.Caster;
|
||||
import com.l2jserver.model.world.capability.Listenable;
|
||||
import com.l2jserver.model.world.capability.Parent;
|
||||
import com.l2jserver.model.world.capability.Playable;
|
||||
import com.l2jserver.model.world.capability.Spawnable;
|
||||
import com.l2jserver.model.world.player.PlayerEvent;
|
||||
import com.l2jserver.model.world.player.PlayerListener;
|
||||
import com.l2jserver.util.Coordinate;
|
||||
|
||||
/**
|
||||
* {@link Player} is any object that can be controlled by the player. The most
|
||||
* common implementation is {@link Character}.
|
||||
*
|
||||
* @author Rogiel
|
||||
*/
|
||||
public abstract class Player extends AbstractObject implements Playable,
|
||||
Spawnable, Attacker, Attackable,
|
||||
Listenable<PlayerListener, PlayerEvent>, Caster, Parent {
|
||||
@Override
|
||||
public void spawn(Coordinate coordinate) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveAttack(Attacker attacker) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Attackable target) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(PlayerListener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(PlayerListener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlayerListener> getListeners() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean support(Class<? extends PlayerEvent> eventType) {
|
||||
return eventType.isAssignableFrom(PlayerEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coordinate getPosition() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatch(PlayerEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cast(SkillTemplate skill, Castable cast) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpawned() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
9
src/main/java/com/l2jserver/model/world/WorldObject.java
Normal file
9
src/main/java/com/l2jserver/model/world/WorldObject.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.l2jserver.model.world;
|
||||
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
|
||||
public interface WorldObject {
|
||||
ObjectID getId();
|
||||
|
||||
void setId(ObjectID id);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can receive attacks from an
|
||||
* {@link Attacker}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Attackable extends WorldCapability {
|
||||
void receiveAttack(Attacker attacker);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can attack an {@link Attackable}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Attacker extends WorldCapability {
|
||||
void attack(Attackable target);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can receive skill castings.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Castable extends WorldCapability {
|
||||
void cast();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can cast skills.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Caster extends WorldCapability {
|
||||
void cast(SkillTemplate skill, Castable cast);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that is a child of another
|
||||
* {@link AbstractObject}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Child<P extends Parent> extends WorldCapability {
|
||||
public P getParent();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that an player can talk to.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Conversable extends WorldCapability {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be dropped on the ground.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Dropable extends WorldCapability {
|
||||
void drop();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be enchanted.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Enchantable extends WorldCapability {
|
||||
public int getEnchantLevel();
|
||||
|
||||
public int setEnchantLevel();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be equipped into an
|
||||
* {@link Equiper}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Equipable extends WorldCapability {
|
||||
void equip(Equiper equiper);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be equipped with {@link Equipable}
|
||||
* instances.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Equiper extends WorldCapability {
|
||||
void equip(Equipable equipable);
|
||||
|
||||
void setEquipment(Object slot, Equipable equipment);
|
||||
|
||||
void getEquipment(Object slot);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
import com.l2jserver.model.world.event.WorldEvent;
|
||||
import com.l2jserver.model.world.event.WorldListener;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can attach {@link WorldListener} that
|
||||
* notifies of events on that object.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
* @param <L>
|
||||
* the listener type
|
||||
* @param <E>
|
||||
* the event type
|
||||
*/
|
||||
public interface Listenable<L extends WorldListener<E>, E extends WorldEvent>
|
||||
extends WorldCapability {
|
||||
void addListener(L listener);
|
||||
|
||||
void removeListener(L listener);
|
||||
|
||||
List<L> getListeners();
|
||||
|
||||
boolean support(Class<? extends E> eventType);
|
||||
|
||||
void dispatch(E e);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that is the parent of another
|
||||
* {@link AbstractObject}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Parent extends WorldCapability {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be played (i.e. controlled by the
|
||||
* player)
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Playable extends WorldCapability {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
import com.l2jserver.util.Coordinate;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be positioned in the world.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Positionable extends WorldCapability {
|
||||
Coordinate getPosition();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
import com.l2jserver.service.game.script.Script;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that can be controller by an {@link Script}
|
||||
* implementation.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Scriptable extends WorldCapability {
|
||||
/**
|
||||
* The the current script attached to this object
|
||||
*
|
||||
* @return the attached script
|
||||
*/
|
||||
Script<Scriptable> getScript();
|
||||
|
||||
/**
|
||||
* Set the attached script to this object
|
||||
*
|
||||
* @param script
|
||||
* the script
|
||||
*/
|
||||
void setScript(Script<Scriptable> script);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
import com.l2jserver.util.Coordinate;
|
||||
|
||||
/**
|
||||
* Represents an {@link AbstractObject} that can be spawned.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Spawnable extends WorldCapability, Positionable {
|
||||
void spawn(Coordinate coordinate);
|
||||
|
||||
boolean isSpawned();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
import com.l2jserver.util.Coordinate;
|
||||
|
||||
/**
|
||||
* Represents an {@link AbstractObject} that can be summoned.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface Summunable extends Spawnable {
|
||||
void summon(Coordinate coordinate);
|
||||
|
||||
boolean isSummoned();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
/**
|
||||
* Defines an base interface for all capabilities for {@link AbstractObject}
|
||||
* instances. No implementing class need to implement this interface.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface WorldCapability extends WorldObject {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.l2jserver.model.world.event;
|
||||
|
||||
import com.l2jserver.model.world.capability.Spawnable;
|
||||
|
||||
public interface SpawnEvent extends WorldEvent {
|
||||
Spawnable getObject();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.model.world.event;
|
||||
|
||||
public interface WorldEvent {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.model.world.event;
|
||||
|
||||
public interface WorldListener<E extends WorldEvent> {
|
||||
void onAction(E e);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.l2jserver.model.world.filter;
|
||||
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
public class AndFilter<O extends WorldObject> implements WorldFilter<O> {
|
||||
private WorldFilter<O>[] filters;
|
||||
|
||||
public AndFilter(WorldFilter<O>... filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(O object) {
|
||||
for(final WorldFilter<O> filter : filters) {
|
||||
if(!filter.accept(object))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.l2jserver.model.world.filter;
|
||||
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
public class NotFilter<O extends WorldObject> implements WorldFilter<O> {
|
||||
private WorldFilter<O> filter;
|
||||
|
||||
public NotFilter(WorldFilter<O> filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(O object) {
|
||||
return !filter.accept(object);
|
||||
}
|
||||
}
|
||||
20
src/main/java/com/l2jserver/model/world/filter/OrFilter.java
Normal file
20
src/main/java/com/l2jserver/model/world/filter/OrFilter.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.l2jserver.model.world.filter;
|
||||
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
public class OrFilter<O extends WorldObject> implements WorldFilter<O> {
|
||||
private WorldFilter<O>[] filters;
|
||||
|
||||
public OrFilter(WorldFilter<O>... filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(O object) {
|
||||
for(final WorldFilter<O> filter : filters) {
|
||||
if(filter.accept(object))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.l2jserver.model.world.filter;
|
||||
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
/**
|
||||
* Filter an object in a world
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface WorldFilter<O extends WorldObject> {
|
||||
/**
|
||||
* Test if <tt>object</tt> matches the filter requirements
|
||||
*
|
||||
* @param object
|
||||
* the object
|
||||
* @return true if object match requirements
|
||||
*/
|
||||
boolean accept(O object);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.l2jserver.model.world.filter;
|
||||
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
public final class WorldFilters {
|
||||
public static final <O extends WorldObject> WorldFilter<O> and(
|
||||
WorldFilter<O>... filters) {
|
||||
return new AndFilter<O>(filters);
|
||||
}
|
||||
|
||||
public static final <O extends WorldObject> WorldFilter<O> or(
|
||||
WorldFilter<O>... filters) {
|
||||
return new OrFilter<O>(filters);
|
||||
}
|
||||
|
||||
public static final <O extends WorldObject> WorldFilter<O> notf(
|
||||
WorldFilter<O> filter) {
|
||||
return new NotFilter<O>(filter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.l2jserver.model.world.filter.impl;
|
||||
|
||||
import com.l2jserver.model.id.ID;
|
||||
import com.l2jserver.model.world.capability.Positionable;
|
||||
import com.l2jserver.model.world.filter.WorldFilter;
|
||||
|
||||
public class IDFilter implements WorldFilter<Positionable> {
|
||||
private final ID id;
|
||||
|
||||
public IDFilter(final ID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(Positionable other) {
|
||||
if (other == null)
|
||||
return false;
|
||||
return other.getId().equals(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.l2jserver.model.world.filter.impl;
|
||||
|
||||
import com.l2jserver.model.world.capability.Positionable;
|
||||
import com.l2jserver.model.world.filter.WorldFilter;
|
||||
import com.l2jserver.util.Coordinate;
|
||||
|
||||
public class RangeFilter implements WorldFilter<Positionable> {
|
||||
private final Coordinate coordinate;
|
||||
private final int range;
|
||||
|
||||
public RangeFilter(final Coordinate coordinate, final int range) {
|
||||
this.coordinate = coordinate;
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
public RangeFilter(final Positionable positionable, final int range) {
|
||||
this(positionable.getPosition(), range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(Positionable other) {
|
||||
if (other == null)
|
||||
return false;
|
||||
return other.getPosition().getDistance(coordinate) <= range;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.l2jserver.model.world.item;
|
||||
|
||||
import com.l2jserver.model.world.Item;
|
||||
import com.l2jserver.model.world.event.WorldEvent;
|
||||
|
||||
public interface ItemEvent extends WorldEvent {
|
||||
Item getItem();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.l2jserver.model.world.item;
|
||||
|
||||
import com.l2jserver.model.world.event.WorldListener;
|
||||
|
||||
public interface ItemListener extends WorldListener<ItemEvent> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.l2jserver.model.world.player;
|
||||
|
||||
import com.l2jserver.model.world.Player;
|
||||
import com.l2jserver.model.world.event.WorldEvent;
|
||||
|
||||
public interface PlayerEvent extends WorldEvent {
|
||||
Player getPlayer();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.l2jserver.model.world.player;
|
||||
|
||||
import com.l2jserver.model.world.event.WorldListener;
|
||||
|
||||
public interface PlayerListener extends WorldListener<PlayerEvent> {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.l2jserver.model.world.player;
|
||||
|
||||
import com.l2jserver.model.world.Player;
|
||||
import com.l2jserver.model.world.capability.Spawnable;
|
||||
import com.l2jserver.model.world.event.SpawnEvent;
|
||||
|
||||
public class PlayerSpawnEvent implements PlayerEvent, SpawnEvent {
|
||||
private final Player player;
|
||||
|
||||
public PlayerSpawnEvent(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spawnable getObject() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
19
src/main/java/com/l2jserver/service/Service.java
Normal file
19
src/main/java/com/l2jserver/service/Service.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.l2jserver.service;
|
||||
|
||||
public interface Service {
|
||||
/**
|
||||
* Start this service
|
||||
*
|
||||
* @throws ServiceStartException
|
||||
* if an error occurred
|
||||
*/
|
||||
void start() throws ServiceStartException;
|
||||
|
||||
/**
|
||||
* Stop this service
|
||||
*
|
||||
* @throws ServiceStartException
|
||||
* if an error occurred
|
||||
*/
|
||||
void stop() throws ServiceStopException;
|
||||
}
|
||||
21
src/main/java/com/l2jserver/service/ServiceException.java
Normal file
21
src/main/java/com/l2jserver/service/ServiceException.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.l2jserver.service;
|
||||
|
||||
public class ServiceException extends Exception {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ServiceException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ServiceException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ServiceException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ServiceException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
23
src/main/java/com/l2jserver/service/ServiceModule.java
Normal file
23
src/main/java/com/l2jserver/service/ServiceModule.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.l2jserver.service;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Scopes;
|
||||
import com.l2jserver.service.configuration.ConfigurationService;
|
||||
import com.l2jserver.service.configuration.ProxyConfigurationService;
|
||||
import com.l2jserver.service.database.DB4ODatabaseService;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
import com.l2jserver.service.network.NettyNetworkService;
|
||||
import com.l2jserver.service.network.NetworkService;
|
||||
|
||||
public class ServiceModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ConfigurationService.class).to(ProxyConfigurationService.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
bind(DatabaseService.class).to(DB4ODatabaseService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
|
||||
bind(NetworkService.class).to(NettyNetworkService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.l2jserver.service;
|
||||
|
||||
public class ServiceStartException extends ServiceException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ServiceStartException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ServiceStartException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ServiceStartException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ServiceStartException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.l2jserver.service;
|
||||
|
||||
public class ServiceStopException extends ServiceException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ServiceStopException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ServiceStopException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ServiceStopException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ServiceStopException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.l2jserver.service.compiler;
|
||||
|
||||
import com.l2jserver.service.Service;
|
||||
|
||||
public interface CompilerService extends Service {
|
||||
Class<?> compile(byte[] clazz);
|
||||
ClassLoader getClassLoader();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.l2jserver.service.compiler;
|
||||
|
||||
public class DynamicClassLoader extends ClassLoader {
|
||||
public DynamicClassLoader() {
|
||||
super();
|
||||
}
|
||||
|
||||
public DynamicClassLoader(ClassLoader parent) {
|
||||
super(parent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.l2jserver.service.compiler;
|
||||
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.ServiceStopException;
|
||||
|
||||
public class JavacCompilerService implements CompilerService {
|
||||
@Override
|
||||
public void start() throws ServiceStartException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> compile(byte[] clazz) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws ServiceStopException {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.l2jserver.service.configuration;
|
||||
|
||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
||||
|
||||
@ConfigurationName("l2j")
|
||||
public interface Configuration {
|
||||
|
||||
public @interface ConfigurationName {
|
||||
String value();
|
||||
}
|
||||
|
||||
public @interface ConfigurationPrefix {
|
||||
String value();
|
||||
}
|
||||
|
||||
public @interface ConfigurationPropertyGetter {
|
||||
String name();
|
||||
String defaultValue() default "";
|
||||
}
|
||||
|
||||
public @interface ConfigurationPropertySetter {
|
||||
String name();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.l2jserver.service.configuration;
|
||||
|
||||
public interface ConfigurationService {
|
||||
<C extends Configuration> C get(Class<C> config);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.l2jserver.service.configuration;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public class ProxyConfigurationService implements ConfigurationService {
|
||||
private Properties properties;
|
||||
|
||||
@Override
|
||||
public <C extends Configuration> C get(Class<C> config) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.l2jserver.service.database;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public abstract class AbstractDAO implements DataAccessObject {
|
||||
protected final DatabaseService database;
|
||||
|
||||
@Inject
|
||||
protected AbstractDAO(DatabaseService database) {
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
public DatabaseService getDatabase() {
|
||||
return database;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.l2jserver.service.database;
|
||||
|
||||
public class DB4ODatabaseService implements DatabaseService {
|
||||
@Override
|
||||
public void start() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.l2jserver.service.database;
|
||||
|
||||
/**
|
||||
* The DAO interface
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface DataAccessObject {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.l2jserver.service.database;
|
||||
|
||||
import com.l2jserver.service.configuration.Configuration;
|
||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
||||
import com.l2jserver.service.configuration.Configuration.ConfigurationPrefix;
|
||||
|
||||
@ConfigurationName("database")
|
||||
@ConfigurationPrefix("database")
|
||||
public interface DatabaseConfiguration extends Configuration {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.l2jserver.service.database;
|
||||
|
||||
import com.l2jserver.service.Service;
|
||||
|
||||
public interface DatabaseService extends Service {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.l2jserver.service.database;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.service.configuration.ConfigurationService;
|
||||
|
||||
public class MySQL5DatabaseService implements DatabaseService {
|
||||
private final MySQLDatabaseConfiguration config;
|
||||
|
||||
@Inject
|
||||
public MySQL5DatabaseService(ConfigurationService configService) {
|
||||
config = configService.get(MySQLDatabaseConfiguration.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.l2jserver.service.database;
|
||||
|
||||
import com.l2jserver.service.configuration.Configuration.ConfigurationPrefix;
|
||||
|
||||
@ConfigurationPrefix("mysql")
|
||||
public interface MySQLDatabaseConfiguration extends DatabaseConfiguration {
|
||||
/**
|
||||
* @return the jdbc url
|
||||
*/
|
||||
@ConfigurationPropertyGetter(name = "jdbc.url", defaultValue = "jdbc:mysql://localhost/l2jserver-gs")
|
||||
String getJdbcUrl();
|
||||
|
||||
/**
|
||||
* @param jdbcUrl
|
||||
* the new jdbc url
|
||||
*/
|
||||
@ConfigurationPropertySetter(name = "jdbc.url")
|
||||
void setJdbcUrl(String jdbcUrl);
|
||||
|
||||
@ConfigurationPropertyGetter(name = "jdbc.username", defaultValue = "root")
|
||||
String getUsername();
|
||||
|
||||
@ConfigurationPropertySetter(name = "jdbc.username")
|
||||
void setUsername(String username);
|
||||
|
||||
@ConfigurationPropertyGetter(name = "jdbc.password")
|
||||
String getPassword();
|
||||
|
||||
@ConfigurationPropertySetter(name = "jdbc.password")
|
||||
void setPassword(String password);
|
||||
}
|
||||
16
src/main/java/com/l2jserver/service/game/script/Script.java
Normal file
16
src/main/java/com/l2jserver/service/game/script/Script.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.l2jserver.service.game.script;
|
||||
|
||||
import com.l2jserver.model.world.capability.Scriptable;
|
||||
|
||||
public interface Script<O extends Scriptable> extends Runnable {
|
||||
/**
|
||||
* Load this script for <tt>object</tt>
|
||||
*
|
||||
* @param object
|
||||
*/
|
||||
void load(O object);
|
||||
|
||||
void unload();
|
||||
|
||||
O getObject();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.l2jserver.service.game.script;
|
||||
|
||||
import com.l2jserver.service.Service;
|
||||
|
||||
public interface ScriptingService extends Service {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.l2jserver.service.game.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.AbstractTemplate;
|
||||
import com.l2jserver.service.Service;
|
||||
|
||||
public interface TemplateService extends Service {
|
||||
/**
|
||||
* Get the template assigned with <tt>id</tt>
|
||||
*
|
||||
* @param id
|
||||
* the template id
|
||||
* @return the template matching the id
|
||||
*/
|
||||
AbstractTemplate getTemplate(TemplateID id);
|
||||
|
||||
/**
|
||||
* Recompile the template with id <tt>id</tt>. This can be used to reload
|
||||
* the template.
|
||||
*
|
||||
* @param id
|
||||
* the template id
|
||||
*/
|
||||
void recompile(TemplateID id);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user