Skip to content

Commit

Permalink
EntityFormObject (internal interface adjustment)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Sep 17, 2018
1 parent c1448c7 commit 052647c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
@@ -0,0 +1,8 @@
package net.aufdemrand.denizen.objects;

import net.aufdemrand.denizencore.objects.dObject;

public interface EntityFormObject extends dObject {

dEntity getDenizenEntity();
}
Expand Up @@ -40,7 +40,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class dEntity implements dObject, Adjustable {
public class dEntity implements dObject, Adjustable, EntityFormObject {


/////////////////////
Expand Down Expand Up @@ -520,6 +520,11 @@ public String getSaveName() {
return baseID.substring(0, 2) + "." + baseID;
}

@Override
public dEntity getDenizenEntity() {
return this;
}

/**
* Get the dObject that most accurately describes this entity,
* useful for automatically saving dEntities to contexts as
Expand All @@ -528,7 +533,7 @@ public String getSaveName() {
* @return The dObject
*/

public dObject getDenizenObject() {
public EntityFormObject getDenizenObject() {

if (entity == null && npc == null) {
return null;
Expand Down
Expand Up @@ -50,7 +50,7 @@
import java.util.Map;
import java.util.regex.Pattern;

public class dNPC implements dObject, Adjustable, InventoryHolder {
public class dNPC implements dObject, Adjustable, InventoryHolder, EntityFormObject {

public static dNPC mirrorCitizensNPC(NPC npc) {
if (dNPCRegistry._isRegistered(npc)) {
Expand Down Expand Up @@ -192,6 +192,7 @@ public LivingEntity getLivingEntity() {
}


@Override
public dEntity getDenizenEntity() {
try {
return new dEntity(getCitizen().getEntity());
Expand Down
Expand Up @@ -46,7 +46,7 @@
import java.util.UUID;
import java.util.regex.Pattern;

public class dPlayer implements dObject, Adjustable {
public class dPlayer implements dObject, Adjustable, EntityFormObject {


/////////////////////
Expand Down Expand Up @@ -230,6 +230,7 @@ public ImprovedOfflinePlayer getNBTEditor() {
return NMSHandler.getInstance().getPlayerHelper().getOfflineData(getOfflinePlayer());
}

@Override
public dEntity getDenizenEntity() {
return new dEntity(getPlayerEntity());
}
Expand Down

0 comments on commit 052647c

Please sign in to comment.