Added Item Frame listener

This commit is contained in:
socram8888 2013-06-06 17:00:59 +02:00
parent e5eba603ec
commit 804ef9d823
2 changed files with 12 additions and 16 deletions

View File

@ -45,13 +45,13 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.3.1-R1.0</version>
<version>1.5.1-R0.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>ru.tehkode</groupId>
<artifactId>PermissionsEx</artifactId>
<version>1.19.3</version>
<version>1.19.5</version>
</dependency>
</dependencies>
<repositories>

View File

@ -23,10 +23,11 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.*;
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
import org.bukkit.event.painting.PaintingBreakEvent;
import org.bukkit.event.painting.PaintingPlaceEvent;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.plugin.Plugin;
import ru.tehkode.modifyworld.ModifyworldListener;
import ru.tehkode.modifyworld.PlayerInformer;
@ -56,21 +57,16 @@ public class BlockListener extends ModifyworldListener {
}
@EventHandler(priority = EventPriority.LOW)
public void onPaintingBreak(PaintingBreakEvent event) {
if (!(event instanceof PaintingBreakByEntityEvent)) {
return;
}
PaintingBreakByEntityEvent pbee = (PaintingBreakByEntityEvent) event;
if (pbee.getRemover() instanceof Player
&& permissionDenied((Player) pbee.getRemover(), "modifyworld.blocks.destroy", Material.PAINTING)) {
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
if (event.getRemover() instanceof Player
&& permissionDenied((Player) event.getRemover(), "modifyworld.blocks.destroy", event.getEntity().getType())) {
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOW)
public void onPaintingPlace(PaintingPlaceEvent event) {
if (permissionDenied(event.getPlayer(), "modifyworld.blocks.place", Material.PAINTING)) {
public void onPaintingPlace(HangingPlaceEvent event) {
if (permissionDenied(event.getPlayer(), "modifyworld.blocks.place", event.getEntity().getType())) {
event.setCancelled(true);
}
}