|
|
|
@ -9,9 +9,9 @@
@@ -9,9 +9,9 @@
|
|
|
|
|
|
|
|
|
|
package engine.devcmd.cmds; |
|
|
|
|
|
|
|
|
|
import engine.Enum; |
|
|
|
|
import engine.devcmd.AbstractDevCmd; |
|
|
|
|
import engine.objects.AbstractGameObject; |
|
|
|
|
import engine.objects.PlayerCharacter; |
|
|
|
|
import engine.objects.*; |
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
|
|
|
|
|
@ -25,42 +25,17 @@ public class RegionCmd extends AbstractDevCmd {
@@ -25,42 +25,17 @@ public class RegionCmd extends AbstractDevCmd {
|
|
|
|
|
protected void _doCmd(PlayerCharacter pc, String[] words, |
|
|
|
|
AbstractGameObject target) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pc.region == null) { |
|
|
|
|
Regions region = ((AbstractCharacter)target).region; |
|
|
|
|
if (region == null) { |
|
|
|
|
this.throwbackInfo(pc, "No Region Found."); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String newLine = System.getProperty("line.separator"); |
|
|
|
|
String result = ""; |
|
|
|
|
result += (pc.region.getClass().getSimpleName()); |
|
|
|
|
result += (" {"); |
|
|
|
|
result += (newLine); |
|
|
|
|
Field[] fields = pc.region.getClass().getDeclaredFields(); |
|
|
|
|
|
|
|
|
|
//print field names paired with their values
|
|
|
|
|
for (Field field : fields) { |
|
|
|
|
field.setAccessible(true); |
|
|
|
|
result += (" "); |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
if (field.getName().contains("Furniture")) |
|
|
|
|
continue; |
|
|
|
|
result += (field.getName()); |
|
|
|
|
result += (": "); |
|
|
|
|
//requires access to private field:
|
|
|
|
|
result += (field.get(pc.region).toString()); |
|
|
|
|
} catch (IllegalAccessException ex) { |
|
|
|
|
System.out.println(ex); |
|
|
|
|
} |
|
|
|
|
result.trim(); |
|
|
|
|
result += (newLine); |
|
|
|
|
if(region != null) { |
|
|
|
|
this.throwbackInfo(pc, "Region Info: " + ((AbstractCharacter) target).getName()); |
|
|
|
|
this.throwbackInfo(pc, "Region Name: " + region); |
|
|
|
|
this.throwbackInfo(pc, "Region Height: " + region.lerpY((AbstractCharacter)target)); |
|
|
|
|
} |
|
|
|
|
result += ("}"); |
|
|
|
|
|
|
|
|
|
this.throwbackInfo(pc, result.toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|