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:
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.l2jserver.service.game.world;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
import com.l2jserver.model.world.event.WorldEvent;
|
||||
|
||||
public interface WorldEventDispatcher {
|
||||
void dispatch(AbstractObject object, WorldEvent event);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.l2jserver.service.game.world;
|
||||
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.service.Service;
|
||||
|
||||
public interface WorldService extends Service, Iterable<WorldObject> {
|
||||
/**
|
||||
* Register a new {@link WorldObject} to the service.
|
||||
*
|
||||
* @param object
|
||||
* the object
|
||||
*/
|
||||
void register(WorldObject object);
|
||||
|
||||
/**
|
||||
* Removes an registered {@link WorldObject} from the service.
|
||||
*
|
||||
* @param object
|
||||
* the object
|
||||
*/
|
||||
void unregister(WorldObject object);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.l2jserver.service.game.world;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.model.world.filter.WorldFilter;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.ServiceStopException;
|
||||
|
||||
public class WorldServiceImpl implements WorldService {
|
||||
private Set<WorldObject> objects;
|
||||
|
||||
@Override
|
||||
public void start() throws ServiceStartException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(WorldObject object) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister(WorldObject object) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<WorldObject> iterator() {
|
||||
return objects.iterator();
|
||||
}
|
||||
|
||||
public <T extends WorldObject> Iterator<T> iterator(WorldFilter<T> filter) {
|
||||
//return objects.iterator();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws ServiceStopException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
19
src/main/java/com/l2jserver/service/logging/JdkLogger.java
Normal file
19
src/main/java/com/l2jserver/service/logging/JdkLogger.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.l2jserver.service.logging;
|
||||
|
||||
public class JdkLogger implements Logger {
|
||||
private final java.util.logging.Logger logger;
|
||||
|
||||
public JdkLogger(java.util.logging.Logger logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String message) {
|
||||
logger.info(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String message, Exception e) {
|
||||
logger.info(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.l2jserver.service.logging;
|
||||
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.ServiceStopException;
|
||||
|
||||
public class JdkLoggingService implements LoggingService {
|
||||
@Override
|
||||
public void start() throws ServiceStartException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger(Class<?> clazz) {
|
||||
return new JdkLogger(LogManager.getLogManager().getLogger(
|
||||
clazz.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws ServiceStopException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
7
src/main/java/com/l2jserver/service/logging/Logger.java
Normal file
7
src/main/java/com/l2jserver/service/logging/Logger.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.l2jserver.service.logging;
|
||||
|
||||
public interface Logger {
|
||||
void info(String message);
|
||||
|
||||
void info(String message, Exception e);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.l2jserver.service.logging;
|
||||
|
||||
import com.l2jserver.service.Service;
|
||||
|
||||
public interface LoggingService extends Service {
|
||||
Logger getLogger(Class<?> clazz);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.l2jserver.service.network;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.service.configuration.ConfigurationService;
|
||||
|
||||
public class NettyNetworkService implements NetworkService {
|
||||
private final NetworkConfiguration config;
|
||||
|
||||
@Inject
|
||||
public NettyNetworkService(ConfigurationService configService) {
|
||||
this.config = configService.get(NetworkConfiguration.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.l2jserver.service.network;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import com.l2jserver.service.configuration.Configuration;
|
||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
||||
import com.l2jserver.service.configuration.Configuration.ConfigurationPrefix;
|
||||
|
||||
@ConfigurationName("network")
|
||||
@ConfigurationPrefix("net")
|
||||
public interface NetworkConfiguration extends Configuration {
|
||||
// TODO set default value
|
||||
/**
|
||||
* Get the server listen address
|
||||
*
|
||||
* @return the listen address
|
||||
*/
|
||||
@ConfigurationPropertyGetter(name = "listen", defaultValue = "0.0.0.0:54")
|
||||
InetSocketAddress getListenAddress();
|
||||
|
||||
/**
|
||||
* Set the server listen address
|
||||
*
|
||||
* @param addr
|
||||
* the listen address
|
||||
*/
|
||||
@ConfigurationPropertySetter(name = "listen")
|
||||
void setListenAddress(InetSocketAddress addr);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.l2jserver.service.network;
|
||||
|
||||
import com.l2jserver.service.Service;
|
||||
|
||||
public interface NetworkService extends Service {
|
||||
|
||||
}
|
||||
30
src/main/java/com/l2jserver/util/Coordinate.java
Normal file
30
src/main/java/com/l2jserver/util/Coordinate.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.l2jserver.util;
|
||||
|
||||
public class Coordinate {
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
public Coordinate(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public int getDistance(Coordinate other) {
|
||||
//TODO calculation
|
||||
return x + y + z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.l2jserver.util.factory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Factory class to create {@link Collection} instances.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CollectionFactory {
|
||||
/**
|
||||
* Creates a new list of type <tt>T</tt>
|
||||
*
|
||||
* @param <T>
|
||||
* the type
|
||||
* @param type
|
||||
* the type
|
||||
* @return the created list
|
||||
*/
|
||||
public static final <T> List<T> newList(Class<T> type) {
|
||||
return new ArrayList<T>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new set of type <tt>T</tt>
|
||||
*
|
||||
* @param <T>
|
||||
* the type
|
||||
* @param type
|
||||
* the type
|
||||
* @return the created set
|
||||
*/
|
||||
public static final <T> Set<T> newSet(Class<T> type) {
|
||||
return new HashSet<T>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user