mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 09:59:42 +00:00
Made API return a DBC player object if a player is a DBC player. Deprecated old getDBCPlayer() function.
This commit is contained in:
1 parent
ad222657c4
commit
d57571ea0d
3 files changed
+54
-34
No files matched your search
@@ -33,7 +33,7 @@ import java.util.*;
|
||||
|
||||
public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
protected T entity;
|
||||
private Map<String,Object> tempData = new HashMap<String,Object>();
|
||||
private Map<String,Object> tempData = new HashMap<>();
|
||||
|
||||
public ScriptEntity(T entity){
|
||||
this.entity = entity;
|
||||
@@ -513,6 +513,12 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
return tempData.get(key);
|
||||
}
|
||||
|
||||
public void copyTempData(IEntity<?> scriptEntity) {
|
||||
if (scriptEntity != null) {
|
||||
this.tempData = ((ScriptEntity<?>) scriptEntity).tempData;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tempdata gets cleared when the entity gets unloaded or the world restarts
|
||||
* @param key The key for the data stored
|
||||
|
||||
@@ -705,17 +705,9 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
return data.getGUIOpen();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ScriptDBCPlayer<T> getDBCPlayer() {
|
||||
Set keySet = player.getEntityData().getCompoundTag("PlayerPersisted").func_150296_c();
|
||||
Iterator iterator = keySet.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String s = (String)iterator.next();
|
||||
if(s.contains("jrmc"))
|
||||
return new ScriptDBCPlayer<T>(this.player);
|
||||
}
|
||||
return null;
|
||||
return this instanceof ScriptDBCPlayer ? (ScriptDBCPlayer<T>) this : null;
|
||||
}
|
||||
|
||||
public boolean blocking() {
|
||||
|
||||
Reference in new issue
Block a user