Fixes to observer settings

This commit is contained in:
phobia 2016-02-14 09:51:59 +11:00
parent 4f5625d63e
commit 24254635a8
3 changed files with 14 additions and 2 deletions

View File

@ -608,7 +608,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
player.getInventory().setHelmet(null); player.getInventory().setHelmet(null);
runSyncLater(() -> { runSyncLater(() -> {
player.getInventory().setHelmet(helmet); player.getInventory().setHelmet(helmet);
}, 5L); }, 20L);
} }
} }

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
@ -106,6 +107,17 @@ public class ObserverManager extends MiniPlugin
} }
} }
@EventHandler
public void onBreak(BlockBreakEvent event)
{
ObserverData data = _observerMap.get(event.getPlayer());
if (data != null)
{
if (!data.getSettings().contains(ObserverSettings.CAN_BREAK_BLOCKS))
event.setCancelled(true);
} }
@EventHandler @EventHandler
public void onInventoryClick(InventoryClickEvent event) public void onInventoryClick(InventoryClickEvent event)
{ {

View File

@ -16,7 +16,7 @@ public enum ObserverSettings
public static EnumSet<ObserverSettings> getSettings(Rank rank) public static EnumSet<ObserverSettings> getSettings(Rank rank)
{ {
if (rank.has(Rank.DEVELOPER)) if (rank.has(Rank.DEVELOPER))
return EnumSet.of(CAN_OPEN_CHESTS); return EnumSet.of(CAN_OPEN_CHESTS, CAN_BREAK_BLOCKS);
return EnumSet.noneOf(ObserverSettings.class); return EnumSet.noneOf(ObserverSettings.class);
} }