forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
@@ -18,86 +17,86 @@ import engine.objects.*;
|
||||
|
||||
public class GotoObj extends AbstractDevCmd {
|
||||
|
||||
public GotoObj() {
|
||||
public GotoObj() {
|
||||
super("gotoobj");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||
AbstractGameObject target) {
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
int uuid;
|
||||
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
|
||||
Enum.DbObjectType objectType;
|
||||
int uuid;
|
||||
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
|
||||
Enum.DbObjectType objectType;
|
||||
|
||||
try {
|
||||
uuid = Integer.parseInt(words[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
this.throwbackError(player, "Failed to parse UUID" + e.toString());
|
||||
return;
|
||||
}
|
||||
try {
|
||||
uuid = Integer.parseInt(words[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
this.throwbackError(player, "Failed to parse UUID" + e.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
objectType = DbManager.BuildingQueries.GET_UID_ENUM(uuid);
|
||||
objectType = DbManager.BuildingQueries.GET_UID_ENUM(uuid);
|
||||
|
||||
switch (objectType) {
|
||||
switch (objectType) {
|
||||
|
||||
case NPC:
|
||||
NPC npc = (NPC) DbManager.getFromCache(Enum.GameObjectType.NPC, uuid);
|
||||
case NPC:
|
||||
NPC npc = (NPC) DbManager.getFromCache(Enum.GameObjectType.NPC, uuid);
|
||||
|
||||
if (npc != null)
|
||||
targetLoc = npc.getLoc();
|
||||
break;
|
||||
case MOB:
|
||||
Mob mob = (Mob) DbManager.getFromCache(Enum.GameObjectType.Mob, uuid);
|
||||
if (npc != null)
|
||||
targetLoc = npc.getLoc();
|
||||
break;
|
||||
case MOB:
|
||||
Mob mob = (Mob) DbManager.getFromCache(Enum.GameObjectType.Mob, uuid);
|
||||
|
||||
if (mob != null)
|
||||
targetLoc = mob.getLoc();
|
||||
break;
|
||||
case CHARACTER:
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, uuid);
|
||||
if (mob != null)
|
||||
targetLoc = mob.getLoc();
|
||||
break;
|
||||
case CHARACTER:
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, uuid);
|
||||
|
||||
if (playerCharacter != null)
|
||||
targetLoc = playerCharacter.getLoc();
|
||||
break;
|
||||
case BUILDING:
|
||||
Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
|
||||
if (playerCharacter != null)
|
||||
targetLoc = playerCharacter.getLoc();
|
||||
break;
|
||||
case BUILDING:
|
||||
Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
|
||||
|
||||
if (building != null)
|
||||
targetLoc = building.getLoc();
|
||||
break;
|
||||
case ZONE:
|
||||
Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, uuid);
|
||||
if (building != null)
|
||||
targetLoc = building.getLoc();
|
||||
break;
|
||||
case ZONE:
|
||||
Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, uuid);
|
||||
|
||||
if (zone != null)
|
||||
targetLoc = zone.getLoc();
|
||||
break;
|
||||
case CITY:
|
||||
City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, uuid);
|
||||
if (zone != null)
|
||||
targetLoc = zone.getLoc();
|
||||
break;
|
||||
case CITY:
|
||||
City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, uuid);
|
||||
|
||||
if (city != null)
|
||||
targetLoc = city.getLoc();
|
||||
break;
|
||||
}
|
||||
// Teleport player
|
||||
if (city != null)
|
||||
targetLoc = city.getLoc();
|
||||
break;
|
||||
}
|
||||
// Teleport player
|
||||
|
||||
if (targetLoc == Vector3fImmutable.ZERO) {
|
||||
this.throwbackError(player, "Failed to locate UUID");
|
||||
return;
|
||||
}
|
||||
if (targetLoc == Vector3fImmutable.ZERO) {
|
||||
this.throwbackError(player, "Failed to locate UUID");
|
||||
return;
|
||||
}
|
||||
|
||||
player.teleport(targetLoc);
|
||||
player.teleport(targetLoc);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Teleports player to a UUID";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /gotoobj <UID>'";
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /gotoobj <UID>'";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user