mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 02:36:59 +00:00
Create Citizenslink
This commit is contained in:
parent
b5fe2bcc60
commit
9cb9719461
46
src/main/java/com/volmit/iris/link/CitizensLink.java
Normal file
46
src/main/java/com/volmit/iris/link/CitizensLink.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package com.volmit.iris.link;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
public class CitizensLink
|
||||||
|
{
|
||||||
|
public CitizensLink()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean supported()
|
||||||
|
{
|
||||||
|
return getCitizens() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity spawn(EntityType name, Location a)
|
||||||
|
{
|
||||||
|
if(!supported())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
NPC npc = CitizensAPI.getNPCRegistry().createNPC(name, "");
|
||||||
|
npc.spawn(a);
|
||||||
|
return npc.getEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plugin getCitizens()
|
||||||
|
{
|
||||||
|
Plugin p = Bukkit.getPluginManager().getPlugin("Citizens");
|
||||||
|
|
||||||
|
if(p == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user