mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-08 08:23:11 +00:00
Adds ecore models
This commit is contained in:
@@ -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<Desire>();
|
||||
queue = CollectionFactory.newPriorityQueue();
|
||||
}
|
||||
|
||||
// Iterate over the list to find similar desires
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <a href="http://www.rogiel.com">Rogiel</a>
|
||||
@@ -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<CharacterID> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user