Reflection support for accessors (wrappers)

This commit is contained in:
Clisprail
2014-08-05 20:31:58 +02:00
parent fd4b0e4121
commit 7216426567
5 changed files with 47 additions and 0 deletions
@@ -1,5 +1,6 @@
package org.rev317.min.api.wrappers;
import org.parabot.core.reflect.RefClass;
import org.rev317.min.Loader;
import org.rev317.min.api.interfaces.Locatable;
import org.rev317.min.api.methods.Calculations;
@@ -144,6 +145,14 @@ public class Character implements Locatable {
}
return null;
}
/**
* Gets the accessor class
* @return RefClass of accessor
*/
public RefClass getRefClass() {
return new RefClass(this.accessor);
}
@Override
public int hashCode() {
@@ -1,5 +1,6 @@
package org.rev317.min.api.wrappers;
import org.parabot.core.reflect.RefClass;
import org.rev317.min.api.interfaces.Locatable;
import org.rev317.min.api.methods.Calculations;
import org.rev317.min.api.methods.Game;
@@ -75,5 +76,13 @@ public class GroundItem implements Locatable {
public int getId() {
return accessor.getId();
}
/**
* Gets the accessor class
* @return RefClass of accessor
*/
public RefClass getRefClass() {
return new RefClass(this.accessor);
}
}
+10
View File
@@ -1,5 +1,7 @@
package org.rev317.min.api.wrappers;
import org.parabot.core.reflect.RefClass;
/**
*
* @author Everel
@@ -21,5 +23,13 @@ public final class Npc extends Character {
public final NpcDef getDef() {
return new NpcDef(this.accessor.getDef());
}
/**
* Gets the accessor class
* @return RefClass of accessor
*/
public RefClass getRefClass() {
return new RefClass(this.accessor);
}
}
@@ -1,5 +1,7 @@
package org.rev317.min.api.wrappers;
import org.parabot.core.reflect.RefClass;
/**
*
* @author Everel
@@ -19,6 +21,14 @@ public class NpcDef {
public int getId() {
return accessor.getId();
}
/**
* Gets the accessor class
* @return RefClass of accessor
*/
public RefClass getRefClass() {
return new RefClass(this.accessor);
}
}
@@ -1,5 +1,6 @@
package org.rev317.min.api.wrappers;
import org.parabot.core.reflect.RefClass;
import org.rev317.min.accessors.SceneObjectTile;
import org.rev317.min.api.interfaces.Locatable;
import org.rev317.min.api.methods.Calculations;
@@ -93,6 +94,14 @@ public class SceneObject implements Locatable {
Menu.interact(this, actionIndex);
}
/**
* Gets the accessor class
* @return RefClass of accessor
*/
public RefClass getRefClass() {
return new RefClass(this.accessor);
}
@Override
public String toString() {
return String.format("[ID: %d, X: %d, Y: %d]", getId(), getLocalRegionX(), getLocalRegionY());