org.spongepowered.api.event.filter.type.Exclude Java Examples

The following examples show how to use org.spongepowered.api.event.filter.type.Exclude. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InventoryListener.java    From UltimateCore with MIT License 6 votes vote down vote up
@Listener
@Exclude({ClickInventoryEvent.Close.class, ClickInventoryEvent.Open.class})
public void onInteract(ClickInventoryEvent event, @Root Player p) {
    try {
        //Get target inventory owner
        Inventory inv = event.getTargetInventory();
        if (!(inv instanceof CarriedInventory)) return;
        CarriedInventory cinv = (CarriedInventory) inv;
        if (!cinv.getCarrier().isPresent() || !(cinv.getCarrier().get() instanceof User)) return;
        User t = (User) cinv.getCarrier().get();

        //Check if player is in invsee & Cancel event if player doesn't have permission
        UltimateUser up = UltimateCore.get().getUserService().getUser(p);
        if (up.get(InventoryKeys.INVSEE_TARGET).isPresent() && up.get(InventoryKeys.INVSEE_TARGET).get().equals(t.getUniqueId())) {
            if (!p.hasPermission("uc.inventory.invsee.modify")) {
                event.getCursorTransaction().setValid(false);
                event.setCancelled(true);
            }
        }
    } catch (Exception ignore) {
    }
}
 
Example #2
Source File: EventForwarder.java    From BlueMap with MIT License 5 votes vote down vote up
@Listener(order = Order.POST)
@Exclude({ChangeBlockEvent.Post.class, ChangeBlockEvent.Pre.class, ChangeBlockEvent.Modify.class})
public void onBlockChange(ChangeBlockEvent evt) {
	for (Transaction<BlockSnapshot> tr : evt.getTransactions()) {
		if(!tr.isValid()) continue;
		
		Optional<Location<org.spongepowered.api.world.World>> ow = tr.getFinal().getLocation();
		if (ow.isPresent()) {
			listener.onBlockChange(ow.get().getExtent().getUniqueId(), ow.get().getPosition().toInt());
		}
	}
}
 
Example #3
Source File: PreventListener.java    From FlexibleLogin with MIT License 4 votes vote down vote up
@Exclude(NumberPress.class)
@Listener(order = Order.FIRST, beforeModifications = true)
public void onInventoryChange(ChangeInventoryEvent changeInventoryEvent, @First Player player) {
    checkLoginStatus(changeInventoryEvent, player);
}
 
Example #4
Source File: PreventListener.java    From FlexibleLogin with MIT License 4 votes vote down vote up
@Exclude(NumberPress.class)
@Listener(order = Order.FIRST, beforeModifications = true)
public void onInventoryInteract(InteractInventoryEvent interactInventoryEvent, @First Player player) {
    checkLoginStatus(interactInventoryEvent, player);
}
 
Example #5
Source File: PreventListener.java    From FlexibleLogin with MIT License 4 votes vote down vote up
@Exclude(NumberPress.class)
@Listener(order = Order.FIRST, beforeModifications = true)
public void onInventoryClick(ClickInventoryEvent clickInventoryEvent, @First Player player) {
    checkLoginStatus(clickInventoryEvent, player);
}