當前位置: 首頁>>代碼示例>>Java>>正文


Java HangingBreakByEntityEvent.getRemover方法代碼示例

本文整理匯總了Java中org.bukkit.event.hanging.HangingBreakByEntityEvent.getRemover方法的典型用法代碼示例。如果您正苦於以下問題:Java HangingBreakByEntityEvent.getRemover方法的具體用法?Java HangingBreakByEntityEvent.getRemover怎麽用?Java HangingBreakByEntityEvent.getRemover使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.hanging.HangingBreakByEntityEvent的用法示例。


在下文中一共展示了HangingBreakByEntityEvent.getRemover方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onFrameBreak

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
public void onFrameBreak(HangingBreakByEntityEvent e) {
    if (e.getRemover() instanceof Player) {
        return;
    }
    Player p = (Player) e.getRemover();

    Map cpl = RegionMapGen.getPlayerLocations();
    cpl.put(p.getUniqueId(), RegionMapGen.getMap()[(int)p.getLocation().getX()][(int)p.getLocation().getZ()]);
    RegionMapGen.setPlayerLocations(cpl);

    if (cpl.get(p.getUniqueId()).equals("lava")) {
        Broadcast.toPlayer(p.getPlayer(), Broadcast.BroadcastType.FAILURE, "You cannot break item frames in Warvale's territory.");
        e.setCancelled(true);
    } else if (cpl.get(p.getUniqueId()).equals(Main.get().getConfig().getString("Player-Data."+p.getUniqueId()+"Guild-Name"))) {
        e.setCancelled(false);
    } else {
        Broadcast.toPlayer(p, Broadcast.BroadcastType.FAILURE, "You cannot break item frames in "+cpl.get(p.getUniqueId())+"'s territory.");
        e.setCancelled(true);
    }
}
 
開發者ID:Warvale,項目名稱:Scorch,代碼行數:21,代碼來源:RegionMapListener.java

示例2: onItemFrameDamage

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onItemFrameDamage(final HangingBreakByEntityEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("DEBUG: Hanging break by entity event");
        plugin.getLogger().info("DEBUG: cause = " + e.getCause());
        plugin.getLogger().info("DEBUG: entity = " + e.getEntity());
        plugin.getLogger().info("DEBUG: remover = " + e.getRemover());
    }
    // Check world
    if (!Util.inWorld(e.getEntity()) || !(e.getEntity() instanceof ItemFrame)) {
        return;
    }
    if (e.getRemover() instanceof Skeleton || e.getRemover() instanceof Golem) {
        if (DEBUG)
            plugin.getLogger().info("DEBUG: Remover is mob");
        if (!Settings.allowMobDamageToItemFrames) {
            if (DEBUG)
                plugin.getLogger().info("DEBUG: Damage not allowed, cancelling");
            e.setCancelled(true);
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:23,代碼來源:IslandGuard.java

示例3: onHangingDamaged

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler
  public void onHangingDamaged(HangingBreakByEntityEvent e) {
  	if (e.isCancelled()) {
          return;
      }
  	
      Entity ent = e.getRemover();
      Location loc = e.getEntity().getLocation();
      Region r = RedProtect.get().rm.getTopRegion(loc);
      if (r != null){
	return;
}
      
      if (ent instanceof Player) { 
      	Player p = (Player)ent;
          if (!bypassBuild(p, null, 0)) {
              e.setCancelled(true);
          }
      }
  }
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:21,代碼來源:RPGlobalListener.java

示例4: onFrameBrake

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler
 public void onFrameBrake(HangingBreakByEntityEvent e) {
 	RedProtect.get().logger.debug("Is BlockListener - HangingBreakByEntityEvent event");
 	if (e.isCancelled()){
 		return;
 	}
 	
 	Entity remover = e.getRemover();
 	Entity ent = e.getEntity();
 	Location l = e.getEntity().getLocation();
 	    	
 	if ((ent instanceof ItemFrame || ent instanceof Painting) && remover instanceof Monster) {
 		Region r = RedProtect.get().rm.getTopRegion(l);
 		if (r != null && !r.canMobLoot()){
 			e.setCancelled(true);
}
     }    
 }
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:19,代碼來源:RPBlockListener.java

示例5: onHangingDamaged

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler
public void onHangingDamaged(HangingBreakByEntityEvent e) {
	if (e.isCancelled()) {
        return;
    }
	RedProtect.get().logger.debug("Is RPPlayerListener - HangingBreakByEntityEvent event");
    Entity ent = e.getRemover();
    Location loc = e.getEntity().getLocation();
    Region r = RedProtect.get().rm.getTopRegion(loc);
    
    if (ent instanceof Player) {
        Player player = (Player)ent; 
        if (r != null && !r.canBuild(player) && !r.canBreak(e.getEntity().getType())) {
        	RPLang.sendMessage(player, "blocklistener.region.cantbuild");
            e.setCancelled(true);
        }
    } 
    if (ent instanceof Monster){
    	if (r != null && !r.canMobLoot()) {
            e.setCancelled(true);
        }
    }
}
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:24,代碼來源:RPPlayerListener.java

示例6: onHangingBreak

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
    EntityProtection entityProtection = this.module.getProtectManager().getEntityProtection(event.getEntity().getType(), event.getEntity().getUniqueId());
    if(entityProtection.exists()) {
        if(event instanceof HangingBreakByEntityEvent) {
            HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
            if(entityEvent.getRemover() instanceof Player) {
                Player player = (Player) entityEvent.getRemover();

                if(entityProtection.getOwner().equals(player.getUniqueId()) || player.hasPermission(ProtectPermissions.MODIFY_ALL)) {
                    entityProtection.remove();
                    sendMessage(player, "protect.entity-unprotected");
                    return;
                }

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

        event.setCancelled(true);
    }
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:23,代碼來源:ProtectListener.java

示例7: onHangingEntityBreak

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
/**
 * Handles breaking paintings, item frames, leashes
 *
 * @param event The event
 */
@EventHandler
public void onHangingEntityBreak(HangingBreakByEntityEvent event) {
	if(!(event.getRemover() instanceof Player)) {
		return;
	}

	Player player = (Player) event.getRemover();
	NovaPlayer nPlayer = PlayerManager.getPlayer(player);
	boolean isLeash = event.getEntity() instanceof LeashHitch;

	if(RegionManager.get(event.getEntity()) != null
			&& (!plugin.getRegionManager().canInteract(player, event.getEntity()) || (!nPlayer.getPreferences().getBypass() && !nPlayer.hasPermission(isLeash ? GuildPermission.MOB_LEASH : GuildPermission.BLOCK_BREAK)))) {
		event.setCancelled(true);
		(isLeash ? Message.CHAT_REGION_DENY_UNLEASH : Message.CHAT_REGION_DENY_INTERACT).send(player);
	}
}
 
開發者ID:MarcinWieczorek,項目名稱:NovaGuilds,代碼行數:22,代碼來源:RegionInteractListener.java

示例8: onItemFrameDamage

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onItemFrameDamage(final HangingBreakByEntityEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("DEBUG: Hanging break by entity event");
        plugin.getLogger().info("DEBUG: cause = " + e.getCause());
        plugin.getLogger().info("DEBUG: entity = " + e.getEntity());
        plugin.getLogger().info("DEBUG: remover = " + e.getRemover());
    }
    // Check world
    if (!inWorld(e.getEntity()) || !(e.getEntity() instanceof ItemFrame)) {
        return;
    }
    if (e.getRemover() instanceof Skeleton || e.getRemover() instanceof Golem) {
        if (DEBUG)
            plugin.getLogger().info("DEBUG: Remover is mob");
        if (!Settings.allowMobDamageToItemFrames) {
            if (DEBUG)
                plugin.getLogger().info("DEBUG: Damage not allowed, cancelling");
            e.setCancelled(true);
        }
    }
}
 
開發者ID:tastybento,項目名稱:acidisland,代碼行數:23,代碼來源:IslandGuard.java

示例9: onHangingBreakByEntity

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
/**
 * On hanging break by entity.
 * 
 * @param event
 *            the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {

	Player player;

	if (event.getRemover() instanceof Player
			&& !playerConf.get((player = (Player) event.getRemover()))
					.isAdminMod()) {

		IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
				event.getEntity().getLocation());

		if ((land instanceof ILand && ((ILand) land).isBanned(player))
				|| !checkPermission(land, player,
						PermissionList.BUILD.getPermissionType())
				|| !checkPermission(land, player,
						PermissionList.BUILD_DESTROY.getPermissionType())) {
			messagePermission(player);
			event.setCancelled(true);
		}
	}
}
 
開發者ID:Tabinol,項目名稱:Factoid,代碼行數:29,代碼來源:PlayerListener.java

示例10: onHangingBreak

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler
public void onHangingBreak(HangingBreakByEntityEvent e) {
    if (e.getRemover() != null && e.getRemover() instanceof Player) {
        Player p = (Player) e.getRemover();
        User u = Necessities.getUM().getUser(p.getUniqueId());
        YamlConfiguration config = Necessities.getInstance().getConfig();
        if (config.contains("Necessities.Guilds") && config.getBoolean("Necessities.Guilds") && !p.hasPermission("Necessities.guilds.admin")) {
            Guild owner = Necessities.getGM().chunkOwner(e.getEntity().getLocation().getChunk());
            if (owner != null && u.getGuild() != owner) {
                Variables var = Necessities.getVar();
                u.getPlayer().sendMessage(var.getEr() + "Error: " + var.getErMsg() + "You are not a part of that guild, and are not allowed to build there.");
                e.setCancelled(true);
            }
        }
    }
}
 
開發者ID:pupnewfster,項目名稱:Necessities,代碼行數:17,代碼來源:Listeners.java

示例11: onHangingBreakByEntity

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onHangingBreakByEntity(final ExtendedHangingBreakEvent ext) {
    if (ext.getBaseEvent() instanceof HangingBreakByEntityEvent) {
        final HangingBreakByEntityEvent event = (HangingBreakByEntityEvent)ext.getBaseEvent();
        if (event.getRemover().getType() == EntityType.PLAYER) {
            final Player player = (Player)event.getRemover();
            if (ext.getRegion() != null && ext.getRegion().getFlag(Flag.BUILD) && !ext.getRegion().isUser(player)) {
                event.setCancelled(true);
            }
        } else {
            if (ext.getRegion() != null && (ext.getRegion().getFlag(Flag.BUILD) || ext.getRegion().getFlag(Flag.MOB))) {
                event.setCancelled(true);
            }
        }
    }
}
 
開發者ID:Ribesg,項目名稱:NPlugins,代碼行數:17,代碼來源:BuildFlagListener.java

示例12: onBreakEvent

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
/**
 * Checks the player is allowed to break the hanging entity.
 *
 * @param event     event being handled
 */
@EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBreakEvent(HangingBreakByEntityEvent event) {
    if (!(event.getRemover() instanceof Player)) {
        return;
    }

    final Player player = (Player) event.getRemover();
    final Block block = event.getEntity().getLocation().getBlock();
    if (!canBuild(player, block)) {
        final Town town = plugin.getTown(block.getChunk());
        if (town == null) {
            player.sendMessage(plugin.getLocalisation().get(LocalisationEntry.MSG_CANNOT_BUILD_HERE));
        } else {
            player.sendMessage(plugin.getLocalisation().get(LocalisationEntry.MSG_ONLY_TOWN_MEMBERS_CAN_BREAK_BLOCKS, town.getName()));
        }
        event.setCancelled(true);
    }
}
 
開發者ID:JamesHealey94,項目名稱:SimpleTowns,代碼行數:24,代碼來源:STListener.java

示例13: onPaintingBreak

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPaintingBreak(final HangingBreakByEntityEvent event)
{
	final ProtectHolder settings = prot.getSettings();
	Entity remover = event.getRemover();
	if ((event.getCause() == HangingBreakEvent.RemoveCause.ENTITY)
		&& ((remover instanceof Creeper) && getSettings().isCreeperBlockdamage())
		|| ((remover instanceof Wither) && getSettings().isWitherSpawnBlockdamage())
		|| ((remover instanceof Fireball) && getSettings().isFireballBlockdamage())
		|| ((remover instanceof TNTPrimed) && getSettings().isTntBlockdamage())
		|| ((remover instanceof WitherSkull) && getSettings().isWitherskullBlockdamage())
		|| ((remover instanceof ExplosiveMinecart) && getSettings().isTntMinecartBlockdamage()))
	{
		event.setCancelled(true);
	}
}
 
開發者ID:Curtis3321,項目名稱:Essentials,代碼行數:17,代碼來源:EssentialsProtectEntityListener.java

示例14: onHangingDestroy

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler
public void onHangingDestroy(HangingBreakByEntityEvent event) { // Item Frames and Paintings
    if (event.getRemover() != null && event.getRemover() instanceof Player) {
        if (isSpectating((Player) event.getRemover())) {
            event.setCancelled(true);
        }
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:9,代碼來源:SpectatorModule.java

示例15: onHangingBreak

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //導入方法依賴的package包/類
@EventHandler
public void onHangingBreak(HangingBreakByEntityEvent event) {
    if (!(event.getRemover() instanceof Player))
        event.setCancelled(true);
    PlayerDataRPG pd = plugin.getPD((Player) event.getRemover());
    if (pd == null)
        event.setCancelled(true);
    if (((Player) event.getRemover()).getGameMode() != GameMode.CREATIVE)
        event.setCancelled(true);
    if (!canBuild(pd))
        event.setCancelled(true);
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:13,代碼來源:EnvironmentManager.java


注:本文中的org.bukkit.event.hanging.HangingBreakByEntityEvent.getRemover方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。