38 lines
920 B
Java
38 lines
920 B
Java
|
package com.massivecraft.factions.entity;
|
||
|
|
||
|
import org.bukkit.Bukkit;
|
||
|
|
||
|
import com.massivecraft.mcore.store.Coll;
|
||
|
import com.massivecraft.mcore.store.Colls;
|
||
|
import com.massivecraft.mcore.store.Entity;
|
||
|
import com.massivecraft.mcore.util.MUtil;
|
||
|
import com.massivecraft.mcore.util.SenderUtil;
|
||
|
|
||
|
public abstract class XColls<C extends Coll<E>, E> extends Colls<C, E>
|
||
|
{
|
||
|
@Override
|
||
|
public C get(Object o)
|
||
|
{
|
||
|
if (o == null) return null;
|
||
|
|
||
|
if (o instanceof Entity)
|
||
|
{
|
||
|
return this.getForUniverse(((Entity<?>)o).getUniverse());
|
||
|
}
|
||
|
|
||
|
if (o instanceof Coll)
|
||
|
{
|
||
|
return this.getForUniverse(((Coll<?>)o).getUniverse());
|
||
|
}
|
||
|
|
||
|
if (SenderUtil.isNonplayer(o))
|
||
|
{
|
||
|
return this.getForWorld(Bukkit.getWorlds().get(0).getName());
|
||
|
}
|
||
|
|
||
|
String worldName = MUtil.extract(String.class, "worldName", o);
|
||
|
if (worldName == null) return null;
|
||
|
return this.getForWorld(worldName);
|
||
|
}
|
||
|
}
|