BeginTask.java
jmud-0.11/src/BeginTask.java · 838 B
From the archive jmud-0_11.tgz
Download the archive « Back to the archive contents
import java.util.NoSuchElementException;
import util.log.Log;
class BeginTask extends Task {
private int roomId;
BeginTask(Client cli, int room) {
super(cli);
roomId = room;
}
static void arriveInfo(Char ch) {
ch.getPlace().actionNotToChar("$p entrou na sala.", true, ch);
ch.look();
}
void execute() {
Char ch = theClient.getChar();
if (roomId >= 0) {
try {
theWorld.insertChar(ch, roomId);
theWorld.insertPlayer(ch);
arriveInfo(ch);
return;
}
catch(NoSuchElementException e) {
Log.err("Zona/sala inicial não encontrada para: " + ch.getName());
}
}
try {
theWorld.insertChar(ch);
theWorld.insertPlayer(ch);
arriveInfo(ch);
}
catch(NoSuchElementException e) {
Log.abort("Sala inicial default não encontrada");
}
}
}