.
This commit is contained in:
parent
140201478f
commit
043ea853f8
@ -24,7 +24,7 @@ public abstract class EntityContainerAbstract<E extends EntityInternal<E>> imple
|
|||||||
@Override
|
@Override
|
||||||
public String fixId(Object oid)
|
public String fixId(Object oid)
|
||||||
{
|
{
|
||||||
if (oid == null) return null;
|
if (oid == null) throw new NullPointerException("oid");
|
||||||
|
|
||||||
String ret = null;
|
String ret = null;
|
||||||
if (oid instanceof String) ret = (String) oid;
|
if (oid instanceof String) ret = (String) oid;
|
||||||
@ -45,29 +45,33 @@ public abstract class EntityContainerAbstract<E extends EntityInternal<E>> imple
|
|||||||
@Override
|
@Override
|
||||||
public E get(Object oid)
|
public E get(Object oid)
|
||||||
{
|
{
|
||||||
|
if (oid == null) throw new NullPointerException("oid");
|
||||||
return this.getFixed(this.fixId(oid));
|
return this.getFixed(this.fixId(oid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E get(Object oid, boolean creative)
|
public E get(Object oid, boolean creative)
|
||||||
{
|
{
|
||||||
|
if (oid == null) throw new NullPointerException("oid");
|
||||||
return this.getFixed(this.fixId(oid), creative);
|
return this.getFixed(this.fixId(oid), creative);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E getFixed(String id)
|
public E getFixed(String id)
|
||||||
{
|
{
|
||||||
|
if (id == null) throw new NullPointerException("id");
|
||||||
return this.getFixed(id, this.isCreative());
|
return this.getFixed(id, this.isCreative());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E getFixed(String id, boolean creative)
|
public E getFixed(String id, boolean creative)
|
||||||
{
|
{
|
||||||
|
if (id == null) throw new NullPointerException("id");
|
||||||
return this.getFixed(id, creative, true);
|
return this.getFixed(id, creative, true);
|
||||||
}
|
}
|
||||||
protected E getFixed(String id, boolean creative, boolean noteModification)
|
protected E getFixed(String id, boolean creative, boolean noteModification)
|
||||||
{
|
{
|
||||||
if (id == null) return null;
|
if (id == null) throw new NullPointerException("id");
|
||||||
E ret = this.getIdToEntity().get(id);
|
E ret = this.getIdToEntity().get(id);
|
||||||
if (ret != null) return ret;
|
if (ret != null) return ret;
|
||||||
if ( ! creative) return null;
|
if ( ! creative) return null;
|
||||||
@ -79,19 +83,21 @@ public abstract class EntityContainerAbstract<E extends EntityInternal<E>> imple
|
|||||||
@Override
|
@Override
|
||||||
public boolean containsId(Object oid)
|
public boolean containsId(Object oid)
|
||||||
{
|
{
|
||||||
|
if (oid == null) throw new NullPointerException("oid");
|
||||||
return this.containsIdFixed(this.fixId(oid));
|
return this.containsIdFixed(this.fixId(oid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsIdFixed(String id)
|
public boolean containsIdFixed(String id)
|
||||||
{
|
{
|
||||||
if (id == null) return false;
|
if (id == null) throw new NullPointerException("id");
|
||||||
return this.getIdToEntity().containsKey(id);
|
return this.getIdToEntity().containsKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsEntity(Object entity)
|
public boolean containsEntity(Object entity)
|
||||||
{
|
{
|
||||||
|
if (entity == null) throw new NullPointerException("entity");
|
||||||
return this.getIdToEntity().containsValue(entity);
|
return this.getIdToEntity().containsValue(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ public class SenderColl<E extends SenderEntity<E>> extends Coll<E> implements Se
|
|||||||
@Override
|
@Override
|
||||||
public E get(Object oid)
|
public E get(Object oid)
|
||||||
{
|
{
|
||||||
|
if (oid == null) throw new NullPointerException("oid");
|
||||||
if (MUtil.isNpc(oid)) return null;
|
if (MUtil.isNpc(oid)) return null;
|
||||||
return super.get(oid);
|
return super.get(oid);
|
||||||
}
|
}
|
||||||
@ -61,6 +62,7 @@ public class SenderColl<E extends SenderEntity<E>> extends Coll<E> implements Se
|
|||||||
@Override
|
@Override
|
||||||
public E get(Object oid, boolean creative)
|
public E get(Object oid, boolean creative)
|
||||||
{
|
{
|
||||||
|
if (oid == null) throw new NullPointerException("oid");
|
||||||
if (MUtil.isNpc(oid)) return null;
|
if (MUtil.isNpc(oid)) return null;
|
||||||
return super.get(oid, creative);
|
return super.get(oid, creative);
|
||||||
}
|
}
|
||||||
@ -69,7 +71,7 @@ public class SenderColl<E extends SenderEntity<E>> extends Coll<E> implements Se
|
|||||||
public String fixId(Object oid)
|
public String fixId(Object oid)
|
||||||
{
|
{
|
||||||
// A null oid should always return null.
|
// A null oid should always return null.
|
||||||
if (oid == null) return null;
|
if (oid == null) throw new NullPointerException("oid");
|
||||||
|
|
||||||
String ret = null;
|
String ret = null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user