本文整理汇总了Java中org.bukkit.event.entity.EntityShootBowEvent类的典型用法代码示例。如果您正苦于以下问题:Java EntityShootBowEvent类的具体用法?Java EntityShootBowEvent怎么用?Java EntityShootBowEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityShootBowEvent类属于org.bukkit.event.entity包,在下文中一共展示了EntityShootBowEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBowShot
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler
public void onBowShot(EntityShootBowEvent e) {
if (e.getEntity() instanceof Player &&
e.getProjectile() instanceof Arrow) {
Bukkit.getScheduler().runTaskLater(this, () -> {
if (!e.getProjectile().isDead()) {
EntityTrail t = new EntityTrail(this, e.getProjectile(),
new ScatteringSupplier(particles,
new Vector3(2.0f, 1.0f, 2.0f),
Vector3.ORIGIN, 5, 20, 1)
, 1);
trails.put(e.getProjectile(), t);
t.begin();
}
}, 5L);
}
}
示例2: onBowShot
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler
public void onBowShot(EntityShootBowEvent e) {
if (e.getEntity() instanceof Player &&
e.getProjectile() instanceof Arrow) {
Bukkit.getScheduler().runTaskLater(this, () -> {
if (!e.getProjectile().isDead()) {
EntityTrail t = new EntityTrail(this, e.getProjectile(),
new CircumferenceSupplier(particle, 1.2f, 0.9f, 0.0f, 1)
.rotateY(tick -> tick * (2.0f * (float) Math.PI / 20))
, 1);
trails.put(e.getProjectile(), t);
t.begin();
}
}, 5L);
}
}
示例3: onShotArrow
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler
public void onShotArrow(EntityShootBowEvent event)
{
if(event.getEntity() instanceof Player){
Player p = (Player)event.getEntity();
if(event.getProjectile() instanceof Arrow){
Arena a = am.getArena(p);
if(a!=null){
if(a.isGame()){
SPlayer player = SPlayer.getDPlayer(p);
player.addShots(1);
}
}
}
}
}
示例4: onEntityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler
public void onEntityShootBow(EntityShootBowEvent event)
{
LivingEntity eShooter = event.getEntity();
if(!(eShooter instanceof Player))
return;
Player shooter = (Player) eShooter;
BPPlayer bpShooter = BPPlayer.get(shooter);
Game game = bpShooter.getGame();
if(game == null)
return;
game.getListener().onPlayerShootBow(event, bpShooter);
}
示例5: onShootArrow
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onShootArrow(final EntityShootBowEvent event) {
final PlayerStat stat = PlayerStat.ARROWS_SHOT;
if (!(event.getEntity() instanceof Player)) {
return; // It was not a player that shoot a bow
}
// Get player
final Player player = (Player) event.getEntity();
// Do general check
if (!plugin.doGeneralCheck(player, stat))
return;
// Update value to new stat.
plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid",
player.getUniqueId(), "value", 1, "world", player.getWorld().getName(), "forceShot", event.getForce()));
}
示例6: onEntityShootBowEvent
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityShootBowEvent(EntityShootBowEvent event) {
if ((event.getBow().hasItemMeta() && event.getBow().getItemMeta().getDisplayName().equals("Ender bow")) || event
.getBow() instanceof EnderBowPlugin.EnderBow) {
// Create custom event
EntityShootEnderBowEvent entityShootEnderBowEvent = new EntityShootEnderBowEvent(event);
// Call the custom event
EnderBowPlugin.getInstance().getServer().getPluginManager().callEvent(entityShootEnderBowEvent);
// Do the following, if it wasn't cancelled
if (!entityShootEnderBowEvent.isCancelled()) {
// Fire an ender pearl
event.getEntity().launchProjectile(EnderPearl.class).setVelocity(event.getProjectile().getVelocity());
// Play the 'ENDERMAN_TELEPORT' sound
event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1);
}
// Cancel the original Event, so no arrows are fired
event.setCancelled(true);
}
}
示例7: onShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler
public void onShootBow(EntityShootBowEvent e){
if (e.isCancelled() || !(e.getEntity() instanceof Player)){
return;
}
Player p = (Player) e.getEntity();
Entity proj = e.getProjectile();
List<String> Pots = RPConfig.getStringList("server-protection.deny-potions");
if (proj != null && (proj instanceof TippedArrow)){
TippedArrow arr = (TippedArrow) proj;
if (Pots.contains(arr.getBasePotionData().getType().name())){
RPLang.sendMessage(p, "playerlistener.denypotion");
e.setCancelled(true);
}
}
}
示例8: onArrowFire
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onArrowFire(EntityShootBowEvent e) {
if (e.getEntityType().equals(EntityType.PLAYER) && e.getBow().hasItemMeta()) {
ItemMeta meta = e.getBow().getItemMeta();
if (meta.hasDisplayName() && Util.containsIgnoreCase(meta.getDisplayName(), "dick") && e.getEntity().hasPermission("bow.dick")) {
arrows.add(e.getProjectile());
String name = meta.getDisplayName();
if (name.contains(":")) {
String[] splitName = name.split(":");
if (splitName[0].equalsIgnoreCase("dick")) {
splitName[1] = splitName[1].replace(" ", "");
try {
int id = Integer.parseInt(splitName[1]);
arrowMaterials.put(e.getProjectile(), Material.getMaterial(id));
} catch (NumberFormatException exc) {
}
}
}
}
}
}
示例9: onSkeletonShoot
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler
public void onSkeletonShoot(EntityShootBowEvent event){
if(event.getEntity() instanceof Skeleton){
Skeleton s = (Skeleton) event.getEntity();
if(DroneShocktroop.isPossiblyShocktroop(s)){
DroneShocktroop troop = getShocktroop(s);
if(troop == null){
s.remove();
//System.out.println("troop for named skeleton is null, removing!");
event.setCancelled(true);
} else {
//System.out.println("Allowed fire!");
}
}
}
}
示例10: onShoot
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public void onShoot(EntityShootBowEvent event)
{
if ((event.getEntity() instanceof Player)) {
Player archer = (Player)event.getEntity();
if (archer.getAllowFlight()) {
if ((archer.isFlying()) && (!archer.hasPermission("Fly.damage")) &&
(archer.getGameMode() != GameMode.CREATIVE)) {
event.setCancelled(true);
archer.updateInventory();
}
if (!archer.isFlying() && archer.getGameMode() != GameMode.CREATIVE) {
archer.setFlying(false);
archer.setAllowFlight(false);
archer.sendMessage(ChatColor.GOLD + "You were put out of fly mode.");
}
}
}
}
示例11: onEntityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityShootBow(EntityShootBowEvent event) {
Entity projectile = event.getProjectile();
if (!(projectile instanceof Arrow)) {
return;
}
ItemStack bow = event.getBow();
if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
}
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
}
示例12: onArrowShoot
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler
public void onArrowShoot(EntityShootBowEvent event){
if(Minigame.getCurrentMinigame()!=null){
switch(Minigame.getCurrentMinigame().getMap().getType()){
case CIRCLE_OF_BOOM:
if(Team.getTeam((Player)event.getEntity()).equals(Minigame.getObservers())){
event.setCancelled(true);
}
break;
case KEY_QUEST:
break;
case WATER_THE_MONUMENT:
break;
default:
break;
}
}
}
示例13: onEntityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler
public void onEntityShootBow(EntityShootBowEvent event) {
if (event.getEntity() instanceof Player) {
if (plugin.getMaterial("Harp").isMaterial(event.getBow())) {
event.setCancelled(true);
for (Player player : event.getEntity().getWorld().getPlayers()) {
if (player.getLocation().distanceSquared(event.getEntity().getLocation()) <= 64) {
try {
File musicDirectory = new File(plugin.getDataFolder(), "music");
plugin.getJingleNoteManager().play(plugin, player.getName(), new MidiJingleSequencer(new File(musicDirectory, "canon.mid"), false));
} catch (MidiUnavailableException | InvalidMidiDataException | IOException exception) {
exception.printStackTrace();
}
}
}
}
}
}
示例14: onEntityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityShootBow (EntityShootBowEvent event)
{
if ( ! (event.getEntity() instanceof Player))
return;
if (plugin.getConfig().getBoolean("general.particle-trail")
&& event.getProjectile() instanceof Arrow)
{
plugin.addArrow((Arrow) event.getProjectile());
plugin.updateEffectMaker();
}
Player player = (Player) event.getEntity();
if ( !player.hasPermission("headshot.bypass.reload-time"))
{
long cooldown =
plugin.getConfig().getLong("general.reload-time", 0) * 50;
if (cooldown == 0)
return;
plugin.setCooldown(player, System.currentTimeMillis() + cooldown);
}
}
示例15: onEntityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
private void onEntityShootBow(EntityShootBowEvent event) {
// Return for disabled world
if (Zones.inNoDemigodsZone(event.getEntity().getLocation())) return;
// If they right clicked a block with the ITEM in hand, do stuff
if (Items.areEqual(event.getBow(), ITEM)) {
PlayerInventory inventory = null;
Arrow startArrow = (Arrow) event.getProjectile();
startArrow.setVelocity(startArrow.getVelocity().multiply(.8));
if (event.getEntity() instanceof Player) inventory = ((Player) event.getEntity()).getInventory();
for (int i = 1; i < 3; i++) {
if (inventory != null) {
if (!inventory.contains(Material.ARROW, 1)) break;
inventory.remove(new ItemStack(Material.ARROW, 1));
}
Arrow spawnedArrow = (Arrow) event.getEntity().getWorld().spawnEntity(startArrow.getLocation(), EntityType.ARROW);
spawnedArrow.setShooter(event.getEntity());
spawnedArrow.setVelocity(startArrow.getVelocity().multiply(.9 / i));
}
}
}