diff --git a/l2jserver2-common/pom.xml b/l2jserver2-common/pom.xml index 0b8d95064..9289c18e5 100644 --- a/l2jserver2-common/pom.xml +++ b/l2jserver2-common/pom.xml @@ -17,8 +17,7 @@ junit junit - 4.8.2 - jar + 4.10 test @@ -37,7 +36,7 @@ org.jboss.netty netty - 3.2.4.Final + 3.2.7.Final diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/ai/desires/DesireQueue.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/ai/desires/DesireQueue.java index 786b20dad..90c64cda9 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/ai/desires/DesireQueue.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/ai/desires/DesireQueue.java @@ -20,6 +20,8 @@ import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.PriorityQueue; +import com.l2jserver.util.factory.CollectionFactory; + /** * This class represents desire queue, it's thread-safe. Desires can be added * and removed. If desire is added - previous desires will be checked, if same @@ -80,7 +82,7 @@ public class DesireQueue { public synchronized void addDesire(Desire desire) { // Lazy initialization of desire queue if (queue == null) { - queue = new PriorityQueue(); + queue = CollectionFactory.newPriorityQueue(); } // Iterate over the list to find similar desires diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ADMIN_COMMAND.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ADMIN_COMMAND.java index 73662b228..a65e5ed9e 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ADMIN_COMMAND.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/game/net/packet/client/CM_ADMIN_COMMAND.java @@ -21,6 +21,7 @@ import org.jboss.netty.buffer.ChannelBuffer; import com.google.inject.Inject; import com.l2jserver.game.net.Lineage2Client; import com.l2jserver.game.net.packet.AbstractClientPacket; +import com.l2jserver.service.ServiceException; import com.l2jserver.service.game.admin.AdministratorService; import com.l2jserver.util.BufferUtils; @@ -77,7 +78,14 @@ public class CM_ADMIN_COMMAND extends AbstractClientPacket { // conn.sendActionFailed(); // } // } - adminService.command(conn, conn.getCharacter(), "", new String[] {}); + try { + adminService + .command(conn, conn.getCharacter(), "", new String[] {}); + } catch (ServiceException e) { + conn.sendMessage("Invalid administrator command or syntax"); + } finally { + conn.sendActionFailed(); + } // TODO implement admin commands } diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/admin/AdministratorService.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/admin/AdministratorService.java index 606d26e51..4eddd1dc4 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/admin/AdministratorService.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/admin/AdministratorService.java @@ -19,6 +19,7 @@ package com.l2jserver.service.game.admin; import com.l2jserver.game.net.Lineage2Client; import com.l2jserver.model.world.L2Character; import com.l2jserver.service.Service; +import com.l2jserver.service.ServiceException; /** * This service handles administrators in the server @@ -37,9 +38,11 @@ public interface AdministratorService extends Service { * the command * @param args * the arguments + * @throws ServiceException + * if any service exception occur */ void command(Lineage2Client conn, L2Character character, String command, - String... args); + String... args) throws ServiceException; /** * The base interface for Administrator commands diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/admin/AdministratorServiceImpl.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/admin/AdministratorServiceImpl.java index 295031173..3649e035f 100644 --- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/admin/AdministratorServiceImpl.java +++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/admin/AdministratorServiceImpl.java @@ -21,12 +21,18 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.inject.Inject; import com.l2jserver.game.net.Lineage2Client; import com.l2jserver.game.net.packet.server.SM_HTML; import com.l2jserver.model.id.object.CharacterID; +import com.l2jserver.model.world.Actor; import com.l2jserver.model.world.L2Character; import com.l2jserver.service.AbstractService; import com.l2jserver.service.game.admin.panel.AdminHomeTemplate; +import com.l2jserver.service.game.spawn.CharacterAlreadyTeleportingServiceException; +import com.l2jserver.service.game.spawn.NotSpawnedServiceException; +import com.l2jserver.service.game.spawn.SpawnService; +import com.l2jserver.util.geometry.Coordinate; /** * @author Rogiel @@ -39,16 +45,45 @@ public class AdministratorServiceImpl extends AbstractService implements */ private final Logger log = LoggerFactory.getLogger(this.getClass()); + /** + * The {@link SpawnService} + */ + private final SpawnService spawnService; + /** * List of online administrators */ @SuppressWarnings("unused") private List online; + /** + * @param spawnService + * the spawn service + */ + @Inject + private AdministratorServiceImpl(SpawnService spawnService) { + this.spawnService = spawnService; + } + @Override public void command(Lineage2Client conn, L2Character character, - String command, String... args) { + String command, String... args) throws NotSpawnedServiceException, + CharacterAlreadyTeleportingServiceException { log.debug("{} is opening admin control panel", character); - conn.write(new SM_HTML(null, new AdminHomeTemplate())); + switch (command) { + case "tele": + Actor teleport = character; + if (character.getTarget() != null) + teleport = character.getTarget(); + spawnService.teleport( + teleport, + Coordinate.fromXYZ(Integer.parseInt(args[0]), + Integer.parseInt(args[1]), + Integer.parseInt(args[2]))); + break; + default: + conn.write(new SM_HTML(null, new AdminHomeTemplate())); + break; + } } } diff --git a/l2jserver2-gameserver/src/main/uml/AIService.ecore b/l2jserver2-gameserver/src/main/uml/AIService.ecore new file mode 100644 index 000000000..b135f0eb5 --- /dev/null +++ b/l2jserver2-gameserver/src/main/uml/AIService.ecore @@ -0,0 +1,34 @@ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + diff --git a/l2jserver2-gameserver/src/main/uml/AIService.ecorediag b/l2jserver2-gameserver/src/main/uml/AIService.ecorediag new file mode 100644 index 000000000..414c50a81 --- /dev/null +++ b/l2jserver2-gameserver/src/main/uml/AIService.ecorediag @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/l2jserver2-gameserver/src/main/uml/GameServerModel.ecore b/l2jserver2-gameserver/src/main/uml/GameServerModel.ecore new file mode 100644 index 000000000..0159c964e --- /dev/null +++ b/l2jserver2-gameserver/src/main/uml/GameServerModel.ecore @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/l2jserver2-gameserver/src/main/uml/GameServerModel.ecorediag b/l2jserver2-gameserver/src/main/uml/GameServerModel.ecorediag new file mode 100644 index 000000000..279f73274 --- /dev/null +++ b/l2jserver2-gameserver/src/main/uml/GameServerModel.ecorediag @@ -0,0 +1,877 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +