Java Code Examples for org.bukkit.event.player.PlayerArmorStandManipulateEvent.setCancelled()

The following are Jave code examples for showing how to use setCancelled() of the org.bukkit.event.player.PlayerArmorStandManipulateEvent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: CloudNet   File: ArmorStandListener.java   Source Code and License Vote up 6 votes
@EventHandler
public void handle(PlayerArmorStandManipulateEvent e)
{
    MobSelector.MobImpl mob = CollectionWrapper.filter(MobSelector.getInstance().getMobs().values(), new Acceptable<MobSelector.MobImpl>() {
        @Override
        public boolean isAccepted(MobSelector.MobImpl value)
        {
            try
            {
                return e.getRightClicked().getEntityId() == (int) value.getDisplayMessage().getClass().getMethod("getEntityId").invoke(value.getDisplayMessage());
            } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e1)
            {
                return false;
            }
        }
    });
    if (mob != null)
    {
        e.setCancelled(true);
    }
}
 
Example 2
Project: Achtbaan   File: EntityClick_Listener.java   Source Code and License Vote up 6 votes
@EventHandler
public void ArmorStandGreef(PlayerArmorStandManipulateEvent e){
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			ArrayList<Location> all_main_seats = new ArrayList<Location>();
			for(attractie att : Main.r.Attracties.values()){
				for(ArmorStand a : att.getMainSeats())
				{
					all_main_seats.add(a.getLocation());
				}
			}
			if(all_main_seats.contains(clickedA.getLocation())){
				e.setCancelled(true);
			}
		}
	}
}
 
Example 3
Project: KingdomFactions   File: BuildEventListener.java   Source Code and License Vote up 5 votes
@EventHandler
public void onArmorStandManupulation(PlayerArmorStandManipulateEvent e) {
	KingdomFactionsPlayer p = PlayerModule.getInstance().getPlayer(e.getPlayer());
	if(p.isVanished()) return;
	if(e.isCancelled()) return;
	if(e.getRightClicked() == null) return;
	if(!p.canBuild(e.getRightClicked().getLocation())) {
		e.setCancelled(!ProtectionModule.getInstance().tryInfluence(p, 200));
	} 
}
 
Example 4
Project: Achtbaan   File: EntityClick_Listener.java   Source Code and License Vote up 5 votes
@EventHandler
public void ArmorStandGreef(PlayerArmorStandManipulateEvent e){
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			ArrayList<ArmorStand> all_main_seats = new ArrayList<ArmorStand>();
			for(Rollercoaster att : Main.r.Attracties.values()){
				all_main_seats.addAll(att.getMainSeats());
			}
			if(all_main_seats.contains(clickedA)){
				e.setCancelled(true);
			}
		}
	}
}
 
Example 5
Project: Achtbaan   File: EntityClick_Listener.java   Source Code and License Vote up 5 votes
@EventHandler
public void ArmorStandGreef(PlayerArmorStandManipulateEvent e){
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			ArrayList<ArmorStand> all_main_seats = new ArrayList<ArmorStand>();
			for(attractie att : Main.r.Attracties.values()){
				all_main_seats.addAll(att.getMainSeats());
			}
			if(all_main_seats.contains(clickedA)){
				e.setCancelled(true);
			}
		}
	}
}
 
Example 6
Project: ShopChest   File: ShopInteractListener.java   Source Code and License Vote up 5 votes
@EventHandler(ignoreCancelled = true)
public void onPlayerManipulateArmorStand(PlayerArmorStandManipulateEvent e) {
    // When clicking an armor stand with an armor item, the armor stand will take it.
    // As a hologram consists of armor stands, they would also take the item.
    ArmorStand armorStand = e.getRightClicked();
    if (Hologram.isPartOfHologram(armorStand)) {
        e.setCancelled(true);
    }
}
 
Example 7
Project: NovaGuilds   File: RegionInteractListener.java   Source Code and License Vote up 5 votes
/**
 * Handles editing items on an ArmorStand
 *
 * @param event The event
 */
@EventHandler
public void onPlayerManipulateArmorStand(PlayerArmorStandManipulateEvent event) {
	Player player = event.getPlayer();
	NovaPlayer nPlayer = PlayerManager.getPlayer(player);
	Location location = event.getRightClicked().getLocation();

	if(RegionManager.get(location) != null
			&& (!plugin.getRegionManager().canInteract(player, location) || (!nPlayer.getPreferences().getBypass() && !nPlayer.hasPermission(GuildPermission.INTERACT)))) {
		event.setCancelled(true);
		Message.CHAT_REGION_DENY_INTERACT.send(player);
	}
}
 
Example 8
Project: PlotMe-Core   File: BukkitPlotListener.java   Source Code and License Vote up 5 votes
@EventHandler
public void onArmorStand(PlayerArmorStandManipulateEvent event) {
    Location location = BukkitUtil.adapt(event.getRightClicked().getLocation());

    if (manager.isPlotWorld(location)) {
        if (event.getPlayer().hasPermission(PermissionNames.ADMIN_BUILDANYWHERE)) {
            return;
        }

        Plot plot = manager.getPlot(location);

        if (plot == null) {
            event.getPlayer().sendMessage(api.C("CannotBuild"));
            event.setCancelled(true);
        } else {
            if (plot.getOwnerId().equals(event.getPlayer().getUniqueId())) {
                return;
            }
            Optional<Plot.AccessLevel> member = plot.isMember(event.getPlayer().getUniqueId());
            if (member.isPresent()) {
                if (member.get().equals(Plot.AccessLevel.TRUSTED) && !api.getServerBridge().getOfflinePlayer(plot.getOwnerId()).isOnline()) {
                    event.getPlayer().sendMessage(api.C("CannotBuild"));
                    event.setCancelled(true);
                } else if (api.isPlotLocked(plot.getId())) {
                    event.getPlayer().sendMessage(api.C("PlotLocked"));
                    event.setCancelled(true);
                }
            } else {
                event.getPlayer().sendMessage(api.C("CannotBuild"));
                event.setCancelled(true);
            }
        }
    }
}
 
Example 9
Project: CraftoPlugin   File: EntityProtectionBreakListener.java   Source Code and License Vote up 5 votes
@EventHandler
public void onArmorStandManip(final PlayerArmorStandManipulateEvent event) {
	debug("PlayerArmorStandManipulateEvent(" + event.getPlayer().getName() + ", " + event.getRightClicked().getType() + ", "
			+ event.getArmorStandItem().getType() + ", " + event.getPlayerItem() + ")");

	final ArmorStand entity = event.getRightClicked();
	if (!canInteract(entity, event.getPlayer())) { debug("CANCELLED!"); event.setCancelled(true); }
	else { debug("ALLOWED!"); }
}
 
Example 10
Project: ZentrelaRPG   File: EnvironmentManager.java   Source Code and License Vote up 4 votes
@EventHandler
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
    event.setCancelled(true);
}
 
Example 11
Project: Arcadia-Spigot   File: Freeze.java   Source Code and License Vote up 4 votes
@EventHandler
public void onEntityManipulate(PlayerArmorStandManipulateEvent event) {
    if(event.getRightClicked().getUniqueId() == entity.getUniqueId())
        event.setCancelled(true);
}
 
Example 12
Project: Hub   File: EntityEditionListener.java   Source Code and License Vote up 4 votes
@EventHandler
public void onArmorStandEdit(PlayerArmorStandManipulateEvent event)
{
    if (!this.canDoAction(event.getPlayer()))
        event.setCancelled(true);
}
 
Example 13
Project: Kineticraft   File: ArmorStands.java   Source Code and License Vote up 4 votes
@EventHandler(ignoreCancelled = true)
public void onArmorStand(PlayerArmorStandManipulateEvent evt) {
    evt.setCancelled(MetadataManager.hasMetadata(evt.getRightClicked(), "noModify"));
}
 
Example 14
Project: GhostScavengerHunt   File: ClaimAnimation.java   Source Code and License Vote up 4 votes
@EventHandler
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
    if(event.getRightClicked().getUniqueId() == armorStand.getUniqueId())
        event.setCancelled(true);
}
 
Example 15
Project: SoundMuffler   File: SoundMuffler.java   Source Code and License Vote up 4 votes
@EventHandler
public void on(PlayerArmorStandManipulateEvent event) {
	if ("SoundMuffler".equals(event.getRightClicked().getCustomName())) {
		event.setCancelled(true);
	}
}