当前位置: 首页>>代码示例>>Java>>正文


Java VehicleDamageEvent.getAttacker方法代码示例

本文整理汇总了Java中org.bukkit.event.vehicle.VehicleDamageEvent.getAttacker方法的典型用法代码示例。如果您正苦于以下问题:Java VehicleDamageEvent.getAttacker方法的具体用法?Java VehicleDamageEvent.getAttacker怎么用?Java VehicleDamageEvent.getAttacker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.vehicle.VehicleDamageEvent的用法示例。


在下文中一共展示了VehicleDamageEvent.getAttacker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onVehicleDamageEvent

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onVehicleDamageEvent(VehicleDamageEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info(e.getAttacker().getType().toString());
    }
    if (Util.inWorld(e.getVehicle())) {
        if (!(e.getAttacker() instanceof Player)) {
            return;
        }
        Player p = (Player) e.getAttacker();
        if (actionAllowed(p, e.getVehicle().getLocation(), SettingsFlag.BREAK_BLOCKS)) {
            return;
        }
        // Not allowed
        Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:20,代码来源:IslandGuard.java

示例2: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleDamage(VehicleDamageEvent event) {
    EntityProtection entityProtection = this.module.getProtectManager().getEntityProtection(event.getVehicle().getType(), event.getVehicle().getUniqueId());
    if(entityProtection.exists()) {
        if(event.getAttacker() instanceof Player) {
            Player player = (Player) event.getAttacker();

            if(entityProtection.getOwner().equals(player.getUniqueId()) || player.hasPermission(ProtectPermissions.MODIFY_ALL)) {
                return;
            }

            sendMessage(player, "protect.entity-protected-by", getDisplayName(this.module.getManager().getUsername(entityProtection.getOwner()), event.getVehicle().getWorld().getName()));
        }

        event.setCancelled(true);
    }
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:18,代码来源:ProtectListener.java

示例3: onVehicleDamageEvent

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onVehicleDamageEvent(VehicleDamageEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info(e.getAttacker().getType().toString());
    }
    if (inWorld(e.getVehicle())) {
        if (!(e.getAttacker() instanceof Player)) {
            return;
        }
        Player p = (Player) e.getAttacker();
        if (actionAllowed(p, e.getVehicle().getLocation(), SettingsFlag.BREAK_BLOCKS)) {
            return;
        }
        // Not allowed
        Util.sendMessage(p, ChatColor.RED + plugin.myLocale(p.getUniqueId()).islandProtected);
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:20,代码来源:IslandGuard.java

示例4: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleDamage(final VehicleDamageEvent event) {
	debug("VehicleDamageEvent triggered!");

	if (event.getAttacker() == null) {
		// If the attacker is unknown atleast check if the damaged entity is protected and cancel event
		Optional<EntityProtection> prot = this.module.cache.getByUniqueId(event.getVehicle().getUniqueId());
		if (prot.isPresent()) {
			event.setCancelled(true);
			debug("onVehicleDamage("+event.getVehicle().getType()+")",
					"Cancelled event because entity is protected and damager unknown!");
		}
		
		return;
	}

	final Entity damager = Utility.getRealDamager(event.getAttacker());
	if (!(damager instanceof Player)) { return; }
	debug("Determined real damager: " + damager.getName());

	if (!this.canInteract(event.getVehicle(), (Player)damager)) { event.setCancelled(true); }
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:23,代码来源:EntityProtectionBreakListener.java

示例5: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleDamage(VehicleDamageEvent event) {
    if (event.getAttacker() != null && event.getAttacker() instanceof Player) {
        if (isSpectating((Player) event.getAttacker())) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:9,代码来源:SpectatorModule.java

示例6: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleDamage(VehicleDamageEvent event) {
    if (event.getAttacker() instanceof Player) {
        Player player = (Player) event.getAttacker();
        if (isPlayerSpectator(player)) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:redwallhp,项目名称:AthenaGM,代码行数:10,代码来源:SpectatorModule.java

示例7: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
/**
 * Prevents damaging vehicles outside of the game area
 * @param event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onVehicleDamage(final VehicleDamageEvent event) {
    if (!(event.getAttacker() instanceof Player)) {
        return;
    }
    Player player = (Player)event.getAttacker();
    if (player.getWorld().equals(getBeaconzWorld())) {
        if (getGameMgr().getGame(event.getVehicle().getLocation()) == null) {
            event.setCancelled(true);
            player.sendMessage(ChatColor.RED + Lang.errorYouCannotDoThat);
        }
    }
}
 
开发者ID:tastybento,项目名称:beaconz,代码行数:18,代码来源:PlayerMovementListener.java

示例8: on

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void on(VehicleDamageEvent e) {
    if (breakVehicleEnabled || !(e.getAttacker() instanceof Player)) {
        return;
    }
    Player player = (Player) e.getAttacker();
    if (hasPermission(player, "usb.mod.bypassprotection") || plugin.playerIsOnIsland(player)) {
        return;
    }
    e.setCancelled(true);
    player.sendMessage(tr("\u00a7eYou cannot break vehicles while being a visitor!"));
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:13,代码来源:ExploitEvents.java

示例9: onClick

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
/**
 * @param e
 *            This event check throws the boat at a player when they hit it
 *            unless someone is in it
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onClick(VehicleDamageEvent e) {
    // plugin.getLogger().info("Damage event " + e.getDamage());
    // Find out what block is being clicked
    Vehicle boat = e.getVehicle();
    if (!(boat instanceof Boat)) {
        return;
    }
    if (!boat.isEmpty()) {
        return;
    }
    final World playerWorld = boat.getWorld();
    if (!playerWorld.getName().equalsIgnoreCase(Settings.worldName)) {
        // Not the right world
        return;
    }
    // plugin.getLogger().info("Boat ");
    // Find out who is doing the clicking
    if (!(e.getAttacker() instanceof Player)) {
        // If a creeper blows up the boat, tough cookies!
        return;
    }
    Player p = (Player) e.getAttacker();
    if (p == null) {
        return;
    }
    // Try to remove the boat and throw it at the player
    Location boatSpot = new Location(boat.getWorld(), boat.getLocation().getX(), boat.getLocation().getY() + 2, boat.getLocation().getZ());
    Location throwTo = new Location(boat.getWorld(), p.getLocation().getX(), p.getLocation().getY() + 1, p.getLocation().getZ());
    ItemStack newBoat = new ItemStack(Material.BOAT, 1);
    // Find the direction the boat should move in
    Vector dir = throwTo.toVector().subtract(boatSpot.toVector()).normalize();
    dir = dir.multiply(0.5);
    Entity newB = boat.getWorld().dropItem(boatSpot, newBoat);
    newB.setVelocity(dir);
    boat.remove();
    e.setCancelled(true);
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:44,代码来源:SafeBoat.java

示例10: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleDamage(VehicleDamageEvent e) {
    if (e.getAttacker() instanceof Player) {
        Player player = (Player) e.getAttacker();
        User u = Necessities.getUM().getUser(player.getUniqueId());
        YamlConfiguration config = Necessities.getInstance().getConfig();
        if (config.contains("Necessities.Guilds") && config.getBoolean("Necessities.Guilds") && !player.hasPermission("Necessities.guilds.admin")) {
            Guild g = Necessities.getGM().chunkOwner(e.getVehicle().getLocation().getChunk());
            if (g != null && u.getGuild() != g)
                e.setCancelled(true);
        }
    }
}
 
开发者ID:pupnewfster,项目名称:Necessities,代码行数:14,代码来源:Listeners.java

示例11: VehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void VehicleDamage(final VehicleDamageEvent event)
{
	if (!(event.getAttacker() instanceof Player))
		return;
	final Player player = (Player) event.getAttacker();
	if (plugin.isLoggedIn(player))
		return;
	event.setCancelled(true);
	plugin.sendAuthReminderMessage(player);
}
 
开发者ID:ST-DDT,项目名称:CrazyLogin,代码行数:12,代码来源:DynamicVehicleListener.java

示例12: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
/**
 * Stops players trying to break entities such as Minecarts, Boats, etc.
 */
@EventHandler (priority = EventPriority.HIGHEST)
public void onVehicleDamage(final VehicleDamageEvent e)
{
	if (e.getAttacker() instanceof Player && p.getPlayerData((Player) e.getAttacker()).isSpectating())
	{
		e.setCancelled(true);
	}
}
 
开发者ID:pgmann,项目名称:SpectatorPlus,代码行数:12,代码来源:SpectatorsInteractionsListener.java

示例13: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleDamage(VehicleDamageEvent event) {
    if (event.getAttacker() instanceof Player && isObserver((Player) event.getAttacker())) {
        event.setCancelled(true);
    }
}
 
开发者ID:Minehut,项目名称:GamePlate,代码行数:7,代码来源:ObserverModule.java

示例14: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleDamage(VehicleDamageEvent event) {
    if (event.getAttacker() instanceof Player) {
        this.manager.invoke((Player) event.getAttacker(), event);
    }
}
 
开发者ID:AbilityAPI,项目名称:AbilityAPI,代码行数:7,代码来源:SequenceListener.java

示例15: onVehicleDamage

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleDamage(VehicleDamageEvent event) {
    if (!match.isRunning() || event.getAttacker() instanceof Player && TeamUtils.getTeamByPlayer((Player) event.getAttacker()).isObserver()) {
        event.setCancelled(true);
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:7,代码来源:ObserverModule.java


注:本文中的org.bukkit.event.vehicle.VehicleDamageEvent.getAttacker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。