mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Added redstone flag
Courtesy of @jpresent
This commit is contained in:
parent
1c7f7a2dfc
commit
87776c5b15
@ -689,7 +689,7 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setupDefaultFlags() {
|
public static void setupDefaultFlags() {
|
||||||
final List<String> booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp", "no-worldedit");
|
final List<String> booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp", "no-worldedit", "redstone");
|
||||||
final List<String> intervalFlags = Arrays.asList("feed", "heal");
|
final List<String> intervalFlags = Arrays.asList("feed", "heal");
|
||||||
final List<String> stringFlags = Arrays.asList("greeting", "farewell");
|
final List<String> stringFlags = Arrays.asList("greeting", "farewell");
|
||||||
final List<String> intFlags = Arrays.asList("entity-cap", "animal-cap", "mop-cap");
|
final List<String> intFlags = Arrays.asList("entity-cap", "animal-cap", "mop-cap");
|
||||||
|
@ -39,9 +39,11 @@ import org.bukkit.event.block.BlockFormEvent;
|
|||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
import org.bukkit.event.block.BlockGrowEvent;
|
import org.bukkit.event.block.BlockGrowEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
import org.bukkit.event.block.BlockSpreadEvent;
|
import org.bukkit.event.block.BlockSpreadEvent;
|
||||||
import org.bukkit.event.block.EntityBlockFormEvent;
|
import org.bukkit.event.block.EntityBlockFormEvent;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
@ -107,6 +109,75 @@ import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
|||||||
*/
|
*/
|
||||||
public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotListener implements Listener {
|
public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotListener implements Listener {
|
||||||
|
|
||||||
|
public void onRedstoneEvent(BlockRedstoneEvent event) {
|
||||||
|
Block block = event.getBlock();
|
||||||
|
Location loc = BukkitUtil.getLocation(block.getLocation());
|
||||||
|
if (!isPlotWorld(loc.getWorld())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = MainUtil.getPlot(loc);
|
||||||
|
Flag redstone = FlagManager.getPlotFlag(plot, "redstone");
|
||||||
|
if (redstone == null || (Boolean) redstone.getValue()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isPlotArea(loc)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (block.getType()) {
|
||||||
|
case REDSTONE_LAMP_OFF:
|
||||||
|
case REDSTONE_LAMP_ON:
|
||||||
|
case PISTON_BASE:
|
||||||
|
case PISTON_STICKY_BASE:
|
||||||
|
case IRON_DOOR_BLOCK:
|
||||||
|
case LEVER:
|
||||||
|
case WOODEN_DOOR:
|
||||||
|
case FENCE_GATE:
|
||||||
|
case WOOD_BUTTON:
|
||||||
|
case STONE_BUTTON:
|
||||||
|
case IRON_PLATE:
|
||||||
|
case WOOD_PLATE:
|
||||||
|
case STONE_PLATE:
|
||||||
|
case GOLD_PLATE:
|
||||||
|
case SPRUCE_DOOR:
|
||||||
|
case BIRCH_DOOR:
|
||||||
|
case JUNGLE_DOOR:
|
||||||
|
case ACACIA_DOOR:
|
||||||
|
case DARK_OAK_DOOR:
|
||||||
|
case IRON_TRAPDOOR:
|
||||||
|
case SPRUCE_FENCE_GATE:
|
||||||
|
case BIRCH_FENCE_GATE:
|
||||||
|
case JUNGLE_FENCE_GATE:
|
||||||
|
case ACACIA_FENCE_GATE:
|
||||||
|
case DARK_OAK_FENCE_GATE:
|
||||||
|
case POWERED_RAIL: {
|
||||||
|
event.setNewCurrent(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPhysicsEvent(BlockPhysicsEvent event) {
|
||||||
|
Block block = event.getBlock();
|
||||||
|
Location loc = BukkitUtil.getLocation(block.getLocation());
|
||||||
|
if (!isPlotWorld(loc.getWorld())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = MainUtil.getPlot(loc);
|
||||||
|
Flag redstone = FlagManager.getPlotFlag(plot, "redstone");
|
||||||
|
if (redstone == null || (Boolean) redstone.getValue()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isPlotArea(loc)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (block.getType()) {
|
||||||
|
case REDSTONE_COMPARATOR_OFF:
|
||||||
|
case REDSTONE_COMPARATOR_ON: {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onProjectileHit(ProjectileHitEvent event) {
|
public void onProjectileHit(ProjectileHitEvent event) {
|
||||||
Projectile entity = (Projectile) event.getEntity();
|
Projectile entity = (Projectile) event.getEntity();
|
||||||
|
Loading…
Reference in New Issue
Block a user