blob: 455ddd1a5610eb945c0172f2fa51c40548dae726 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package net.ess3.commands;
import java.util.Random;
import net.ess3.api.IUser;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ocelot;
public class Commandkittycannon extends EssentialsCommand
{
private static Random random = new Random();
@Override
protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
final EntityType cat = EntityType.OCELOT;
final Ocelot ocelot = (Ocelot)user.getPlayer().getWorld().spawn(user.getPlayer().getEyeLocation(), cat.getEntityClass());
if (ocelot == null)
{
return;
}
final int i = random.nextInt(Ocelot.Type.values().length);
ocelot.setCatType(Ocelot.Type.values()[i]);
ocelot.setTamed(true);
ocelot.setVelocity(user.getPlayer().getEyeLocation().getDirection().multiply(2));
ess.getPlugin().scheduleSyncDelayedTask(new Runnable()
{
@Override
public void run()
{
final Location loc = ocelot.getLocation();
ocelot.remove();
loc.getWorld().createExplosion(loc, 0F);
}
}, 20);
}
}
|