-
Notifications
You must be signed in to change notification settings - Fork 1
Example code
pixelrider2000 edited this page Sep 11, 2021
·
3 revisions
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
//Checks if the damager is a bullet and then returns the name of the player who fired it
BulletHandler bHandler = new BulletHandler();
String owner = bHandler.getBulletOwner(e.getDamager().getUniqueId().toString());
if(owner == null) return;
//Do stuff...
}
Example two
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player p = (Player) sender;
if(args.length == 1) {
if(args[0].equalsIgnoreCase("test")) {
if(p.hasPermission("flansapi.test")) {
VehicleHandler vHandler = new VehicleHandler();
//The player is standing on a chest thus these coordinates are of the chest
int cx = p.getLocation().getBlock().getX(),
cy = p.getLocation().getBlock().getY(),
cz = p.getLocation().getBlock().getZ();
vHandler.spawnDriveable(p.getLocation().getWorld().getName(), cx, cy, cz, "vehicle", (cx+15), (cy+10), cz, 0);
p.sendMessage("§6You successfully spawned a vehicle!");
}
}
}
}
return false;
}