mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-10-03 00:57:34 +02:00
Make the EXP_DROPS flag a build-compat flag and set its deny message.
Fixes WORLDGUARD-3231.
This commit is contained in:
parent
bdff22cbac
commit
c050d274f5
@ -25,7 +25,6 @@
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent;
|
||||
import com.sk89q.worldguard.bukkit.util.Materials;
|
||||
import com.sk89q.worldguard.protection.association.RegionAssociable;
|
||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||
@ -35,7 +34,6 @@
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
@ -109,21 +107,6 @@ public void onBreakBlock(final BreakBlockEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onSpawnEntity(final SpawnEntityEvent event) {
|
||||
if (!isRegionSupportEnabled(event.getWorld())) return; // Region support disabled
|
||||
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
|
||||
// ================================================================
|
||||
// EXP_DROPS flag
|
||||
// ================================================================
|
||||
|
||||
if (event.getEffectiveType() == EntityType.EXPERIENCE_ORB) {
|
||||
event.filter(testState(query, DefaultFlag.EXP_DROPS), false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new predicate to test a state flag for each location.
|
||||
*
|
||||
|
@ -315,6 +315,11 @@ public void onSpawnEntity(SpawnEntityEvent event) {
|
||||
canSpawn = query.testBuild(target, associable, DefaultFlag.ITEM_DROP);
|
||||
what = "drop items";
|
||||
|
||||
/* XP drops */
|
||||
} else if (event.getEffectiveType() == EntityType.EXPERIENCE_ORB) {
|
||||
canSpawn = query.testBuild(target, associable, DefaultFlag.EXP_DROPS);
|
||||
what = "drop XP";
|
||||
|
||||
/* Everything else */
|
||||
} else {
|
||||
canSpawn = query.testBuild(target, associable);
|
||||
|
@ -64,6 +64,7 @@ public final class DefaultFlag {
|
||||
// BUILD flag. In the future, StateFlags will need a DISALLOW state.
|
||||
public static final StateFlag ITEM_PICKUP = new StateFlag("item-pickup", true); // Intentionally true
|
||||
public static final StateFlag ITEM_DROP = new StateFlag("item-drop", true); // Intentionally true
|
||||
public static final StateFlag EXP_DROPS = new StateFlag("exp-drops", true); // Intentionally true
|
||||
|
||||
// These flags adjust behavior and are not checked in tandem with the
|
||||
// BUILD flag so they need to be TRUE for their defaults.
|
||||
@ -91,7 +92,6 @@ public final class DefaultFlag {
|
||||
public static final StateFlag SOIL_DRY = new StateFlag("soil-dry", true);
|
||||
public static final StateFlag ENDER_BUILD = new StateFlag("enderman-grief", true);
|
||||
public static final StateFlag INVINCIBILITY = new StateFlag("invincible", false);
|
||||
public static final StateFlag EXP_DROPS = new StateFlag("exp-drops", true);
|
||||
public static final StateFlag SEND_CHAT = new StateFlag("send-chat", true);
|
||||
public static final StateFlag RECEIVE_CHAT = new StateFlag("receive-chat", true);
|
||||
public static final StateFlag ENTRY = new StateFlag("entry", true, RegionGroup.NON_MEMBERS);
|
||||
|
Loading…
Reference in New Issue
Block a user