Created a DestroyObjectIntent

This commit is contained in:
Obique PSWG
2016-03-03 21:32:06 -06:00
parent 72075728e8
commit e45a793489
3 changed files with 98 additions and 6 deletions
+23 -6
View File
@@ -35,6 +35,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import intents.object.DestroyObjectIntent;
import intents.object.ObjectCreatedIntent;
import intents.object.ObjectTeleportIntent;
import intents.player.DeleteCharacterIntent;
@@ -92,6 +93,7 @@ public class ObjectManager extends Manager {
registerForIntent(GalacticPacketIntent.TYPE);
registerForIntent(ObjectTeleportIntent.TYPE);
registerForIntent(ObjectCreatedIntent.TYPE);
registerForIntent(DestroyObjectIntent.TYPE);
registerForIntent(DeleteCharacterIntent.TYPE);
}
@@ -174,12 +176,23 @@ public class ObjectManager extends Manager {
@Override
public void onIntentReceived(Intent i) {
if (i instanceof GalacticPacketIntent) {
processGalacticPacketIntent((GalacticPacketIntent) i);
} else if (i instanceof ObjectCreatedIntent) {
processObjectCreatedIntent((ObjectCreatedIntent) i);
} else if (i instanceof DeleteCharacterIntent) {
deleteObject(((DeleteCharacterIntent) i).getCreature().getObjectId());
switch (i.getType()) {
case GalacticPacketIntent.TYPE:
if (i instanceof GalacticPacketIntent)
processGalacticPacketIntent((GalacticPacketIntent) i);
break;
case ObjectCreatedIntent.TYPE:
if (i instanceof ObjectCreatedIntent)
processObjectCreatedIntent((ObjectCreatedIntent) i);
break;
case DestroyObjectIntent.TYPE:
if (i instanceof DestroyObjectIntent)
processDestroyObjectIntent((DestroyObjectIntent) i);
break;
case DeleteCharacterIntent.TYPE:
if (i instanceof DeleteCharacterIntent)
deleteObject(((DeleteCharacterIntent) i).getCreature().getObjectId());
break;
}
}
@@ -187,6 +200,10 @@ public class ObjectManager extends Manager {
putObject(intent.getObject());
}
private void processDestroyObjectIntent(DestroyObjectIntent doi) {
destroyObject(doi.getObject());
}
private void processGalacticPacketIntent(GalacticPacketIntent gpi) {
Packet packet = gpi.getPacket();
if (packet instanceof SelectCharacter) {