mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Use ItemInteract for item right clicks in Sponge.
They don't fire for InteractBlock. # Conflicts: # worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java
This commit is contained in:
parent
351fd6771a
commit
8022d8e911
@ -51,6 +51,7 @@ import org.spongepowered.api.event.game.state.GamePostInitializationEvent;
|
||||
import org.spongepowered.api.event.game.state.GamePreInitializationEvent;
|
||||
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
|
||||
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
|
||||
import org.spongepowered.api.event.item.inventory.InteractItemEvent;
|
||||
import org.spongepowered.api.item.ItemType;
|
||||
import org.spongepowered.api.item.inventory.ItemStack;
|
||||
import org.spongepowered.api.plugin.Plugin;
|
||||
@ -204,6 +205,22 @@ public class SpongeWorldEdit {
|
||||
return this.spongeAdapter;
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onPlayerItemInteract(InteractItemEvent event, @Root Player spongePlayer) {
|
||||
if (platform == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!platform.isHookingEvents()) return; // We have to be told to catch these events
|
||||
|
||||
WorldEdit we = WorldEdit.getInstance();
|
||||
|
||||
SpongePlayer player = wrapPlayer(spongePlayer);
|
||||
if (we.handleRightClick(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onPlayerInteract(InteractBlockEvent event, @Root Player spongePlayer) {
|
||||
if (platform == null) {
|
||||
@ -244,7 +261,6 @@ public class SpongeWorldEdit {
|
||||
}
|
||||
}
|
||||
} else if (event instanceof InteractBlockEvent.Secondary) {
|
||||
if (interactedType != BlockTypes.AIR) {
|
||||
if (!optLoc.isPresent()) {
|
||||
return;
|
||||
}
|
||||
@ -260,11 +276,6 @@ public class SpongeWorldEdit {
|
||||
if (we.handleRightClick(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
if (we.handleRightClick(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user