Added Flags#EXPERIENCE_BOTTLE_THROWING (splited from POTION_THROWING)
This commit is contained in:
parent
f422a22f02
commit
980cdb9b9f
|
@ -11,7 +11,7 @@ import world.bentobox.bentobox.api.flags.FlagListener;
|
|||
import world.bentobox.bentobox.lists.Flags;
|
||||
|
||||
/**
|
||||
* Handles {@link world.bentobox.bentobox.lists.Flags#POTION_THROWING}.
|
||||
* Handles {@link Flags#POTION_THROWING} and {@link Flags#EXPERIENCE_BOTTLE_THROWING}.
|
||||
* @author Poslovitch
|
||||
* @since 1.1
|
||||
*/
|
||||
|
@ -23,9 +23,12 @@ public class ThrowingListener extends FlagListener {
|
|||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerThrowPotion(ProjectileLaunchEvent e) {
|
||||
if (e.getEntity().getShooter() instanceof Player
|
||||
&& (e.getEntity() instanceof ThrownPotion || e.getEntity() instanceof ThrownExpBottle)) {
|
||||
checkIsland(e, (Player)e.getEntity().getShooter(), e.getEntity().getLocation(), Flags.POTION_THROWING);
|
||||
if (e.getEntity().getShooter() instanceof Player && (e.getEntity() instanceof ThrownPotion)) {
|
||||
if (e.getEntity() instanceof ThrownPotion) {
|
||||
checkIsland(e, (Player) e.getEntity().getShooter(), e.getEntity().getLocation(), Flags.POTION_THROWING);
|
||||
} else if (e.getEntity() instanceof ThrownExpBottle) {
|
||||
checkIsland(e, (Player) e.getEntity().getShooter(), e.getEntity().getLocation(), Flags.EXPERIENCE_BOTTLE_THROWING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,6 +163,12 @@ public final class Flags {
|
|||
* @see ThrowingListener
|
||||
*/
|
||||
public static final Flag POTION_THROWING = new Flag.Builder("POTION_THROWING", Material.SPLASH_POTION).listener(new ThrowingListener()).build();
|
||||
/**
|
||||
* Prevents players from throwing experience bottles.
|
||||
* @since 1.3.1
|
||||
* @see ThrowingListener
|
||||
*/
|
||||
public static final Flag EXPERIENCE_BOTTLE_THROWING = new Flag.Builder("EXPERIENCE_BOTTLE_THROWING", Material.EXPERIENCE_BOTTLE).build();
|
||||
|
||||
/*
|
||||
* Fire
|
||||
|
|
|
@ -606,6 +606,10 @@ protection:
|
|||
name: "Enter/Exit messages"
|
||||
now-entering: "&bNow entering [name]"
|
||||
now-leaving: "&bNow leaving [name]"
|
||||
EXPERIENCE_BOTTLE_THROWING:
|
||||
name: "Experience bottle throwing"
|
||||
description: "Toggle throwing experience bottles."
|
||||
hint: "Not allowed to throw experience bottles"
|
||||
FIRE_BURNING:
|
||||
name: "Fire burning"
|
||||
description: |-
|
||||
|
@ -781,8 +785,7 @@ protection:
|
|||
name: "Potion throwing"
|
||||
description: |-
|
||||
&aToggle throwing potions.
|
||||
&aThis include splash and lingering
|
||||
&apotions and experience bottles.
|
||||
&aThis include splash and lingering potions.
|
||||
hint: "Not allowed to throw potions"
|
||||
NETHER_PORTAL:
|
||||
description: "Toggle use"
|
||||
|
|
Loading…
Reference in New Issue