mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-22 18:26:04 +01:00
Treat armorstand/itemframe interaction as container (#1208)
This commit is contained in:
parent
d63adfc889
commit
868ab5c6c4
@ -18,7 +18,6 @@ import com.massivecraft.factions.zcore.gui.FactionGUI;
|
|||||||
import com.massivecraft.factions.zcore.persist.MemoryFPlayer;
|
import com.massivecraft.factions.zcore.persist.MemoryFPlayer;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -247,6 +246,22 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
|
public void onPlayerInteract(PlayerInteractEntityEvent event) {
|
||||||
|
Material material = null;
|
||||||
|
switch (event.getRightClicked().getType()) {
|
||||||
|
case ARMOR_STAND:
|
||||||
|
material = Material.ARMOR_STAND;
|
||||||
|
break;
|
||||||
|
case ITEM_FRAME:
|
||||||
|
material = Material.ITEM_FRAME;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (material != null && !playerCanUseItemHere(event.getPlayer(), event.getRightClicked().getLocation(), material, false)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
// only need to check right-clicks and physical as of MC 1.4+; good performance boost
|
// only need to check right-clicks and physical as of MC 1.4+; good performance boost
|
||||||
@ -464,6 +479,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
case GRINDSTONE:
|
case GRINDSTONE:
|
||||||
case SMOKER:
|
case SMOKER:
|
||||||
case STONECUTTER:
|
case STONECUTTER:
|
||||||
|
case ARMOR_STAND:
|
||||||
|
case ITEM_FRAME:
|
||||||
action = PermissableAction.CONTAINER;
|
action = PermissableAction.CONTAINER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user