Doot doot.

Fixes WORLDGUARD-3695.
This commit is contained in:
wizjany 2016-05-26 02:52:43 -04:00
parent 8765bbb192
commit 5bd2125963
2 changed files with 15 additions and 9 deletions

View File

@ -33,8 +33,6 @@
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.NoSuchElementException;
/**
* Handles blocked potions.
*/
@ -63,7 +61,7 @@ public void onItemInteract(UseItemEvent event) {
&& item.getType() != Material.LINGERING_POTION) {
return;
}
} catch (NoSuchElementException ignored) {
} catch (NoSuchFieldError ignored) {
// PotionMeta technically has been around since 1.7, so the code below
// *should* work still. we just have different materials now.
if (item.getType() != Material.POTION) {
@ -106,7 +104,7 @@ public void onItemInteract(UseItemEvent event) {
boolean isSplash = false;
try {
isSplash = (!oldPotions && (item.getType() == Material.SPLASH_POTION || item.getType() == Material.LINGERING_POTION));
} catch (NoSuchElementException ignored) {
} catch (NoSuchFieldError ignored) {
}
isSplash |= (oldPotions && (Potion.fromItemStack(item).isSplash()));
if (isSplash && wcfg.blockPotionsAlways) {

View File

@ -37,8 +37,8 @@
import com.sk89q.worldguard.bukkit.protection.DelayedRegionOverlapAssociation;
import com.sk89q.worldguard.bukkit.util.Entities;
import com.sk89q.worldguard.bukkit.util.Events;
import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.bukkit.util.InteropUtils;
import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.domains.Association;
import com.sk89q.worldguard.protection.association.Associables;
import com.sk89q.worldguard.protection.association.RegionAssociable;
@ -46,16 +46,24 @@
import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.flags.StateFlag.State;
import org.bukkit.*;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.bukkit.event.Event.Result;
import org.bukkit.event.EventHandler;
import org.bukkit.event.vehicle.VehicleExitEvent;
import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
/**
* Handle events that need to be processed by region protection.
@ -187,7 +195,7 @@ public boolean apply(Location target) {
canPlace = query.testBuild(target, associable, combine(event, DefaultFlag.BLOCK_PLACE));
try {
event.setSilent(type == Material.FROSTED_ICE);
} catch (NoSuchElementException ignored) {} // back compat
} catch (NoSuchFieldError ignored) {} // back compat
what = "place that block";
}