mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-20 06:11:37 +01:00
Removed code smells.
This commit is contained in:
parent
bb4c199487
commit
045855f6ad
@ -403,7 +403,7 @@ protection:
|
||||
&aConfigure invincible visitor
|
||||
&asettings.
|
||||
name: "Invincible Visitors"
|
||||
visitors-protected: "&cVisitors protected"
|
||||
hint: "&cVisitors protected"
|
||||
ISLAND_RESPAWN:
|
||||
description: |
|
||||
&aPlayers respawn
|
||||
@ -478,8 +478,7 @@ protection:
|
||||
&cEnable/Disable PVP
|
||||
&con island.
|
||||
name: "Overworld PVP"
|
||||
pvp-not-allowed: "&cPVP is not allowed"
|
||||
hint: "No PVP allowed in this world"
|
||||
hint: "&cPVP is not allowed"
|
||||
REDSTONE:
|
||||
description: "Toggle use"
|
||||
name: "Redstone items"
|
||||
|
@ -58,6 +58,12 @@ public class Clipboard {
|
||||
|
||||
private static final String BLOCK = "blocks";
|
||||
|
||||
private static final String FACING = "facing";
|
||||
|
||||
private static final String POWERED = "powered";
|
||||
|
||||
private static final String LOAD_ERROR = "Could not load schems file - does not exist : ";
|
||||
|
||||
private YamlConfiguration blockConfig = new YamlConfiguration();
|
||||
private Location pos1;
|
||||
private Location pos2;
|
||||
@ -185,7 +191,7 @@ public class Clipboard {
|
||||
// Block state
|
||||
|
||||
if (s.getBoolean(ATTACHED) && m.toString().contains("TORCH")) {
|
||||
TorchDir d = TorchDir.valueOf(s.getString("facing"));
|
||||
TorchDir d = TorchDir.valueOf(s.getString(FACING));
|
||||
|
||||
Block rel = block.getRelative(BlockFace.DOWN);
|
||||
Material rm = rel.getType();
|
||||
@ -222,16 +228,16 @@ public class Clipboard {
|
||||
|
||||
if (md instanceof Directional) {
|
||||
Directional facing = (Directional)md;
|
||||
facing.setFacingDirection(BlockFace.valueOf(s.getString("facing")));
|
||||
facing.setFacingDirection(BlockFace.valueOf(s.getString(FACING)));
|
||||
}
|
||||
|
||||
if (md instanceof Lever) {
|
||||
Lever r = (Lever)md;
|
||||
r.setPowered(s.getBoolean("powered"));
|
||||
r.setPowered(s.getBoolean(POWERED));
|
||||
}
|
||||
if (md instanceof Button) {
|
||||
Button r = (Button)md;
|
||||
r.setPowered(s.getBoolean("powered"));
|
||||
r.setPowered(s.getBoolean(POWERED));
|
||||
}
|
||||
// Block data
|
||||
if (bs instanceof Sign) {
|
||||
@ -297,11 +303,11 @@ public class Clipboard {
|
||||
}
|
||||
if (md instanceof Directional) {
|
||||
Directional facing = (Directional)md;
|
||||
s.set("facing", facing.getFacing().name());
|
||||
s.set(FACING, facing.getFacing().name());
|
||||
}
|
||||
if (md instanceof Attachable) {
|
||||
Attachable facing = (Attachable)md;
|
||||
s.set("facing", facing.getFacing().name());
|
||||
s.set(FACING, facing.getFacing().name());
|
||||
s.set("attached-face", facing.getAttachedFace().name());
|
||||
s.set(ATTACHED, true);
|
||||
}
|
||||
@ -315,7 +321,7 @@ public class Clipboard {
|
||||
}
|
||||
if (md instanceof Redstone) {
|
||||
Redstone r = (Redstone)md;
|
||||
blockConfig.set("powered", r.isPowered());
|
||||
blockConfig.set(POWERED, r.isPowered());
|
||||
}
|
||||
|
||||
// Block data
|
||||
@ -413,14 +419,14 @@ public class Clipboard {
|
||||
public void load(String fileName) throws IOException, InvalidConfigurationException {
|
||||
File zipFile = new File(schemFolder, fileName + ".schem");
|
||||
if (!zipFile.exists()) {
|
||||
plugin.logError("Could not load schems file - does not exist : " + zipFile.getName());
|
||||
throw new IOException("Could not load schems file - does not exist : " + zipFile.getName());
|
||||
plugin.logError(LOAD_ERROR + zipFile.getName());
|
||||
throw new IOException(LOAD_ERROR + zipFile.getName());
|
||||
}
|
||||
unzip(zipFile.getAbsolutePath());
|
||||
File file = new File(schemFolder, fileName);
|
||||
if (!file.exists()) {
|
||||
plugin.logError("Could not load schems file - does not exist : " + file.getName());
|
||||
throw new IOException("Could not load schems file - does not exist : " + file.getName());
|
||||
plugin.logError(LOAD_ERROR + file.getName());
|
||||
throw new IOException(LOAD_ERROR + file.getName());
|
||||
}
|
||||
blockConfig = new YamlConfiguration();
|
||||
blockConfig.load(file);
|
||||
|
@ -22,6 +22,7 @@ import us.tastybento.bskyblock.lists.Flags;
|
||||
public class EnterExitListener extends AbstractFlagListener {
|
||||
|
||||
private static final Vector XZ = new Vector(1,0,1);
|
||||
private static final String NAME = "[name]";
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onMove(PlayerMoveEvent e) {
|
||||
@ -48,12 +49,12 @@ public class EnterExitListener extends AbstractFlagListener {
|
||||
}
|
||||
User user = User.getInstance(e.getPlayer());
|
||||
// Send message if island is owned by someone
|
||||
from.filter(i -> i.getOwner() != null).ifPresent(i -> user.sendMessage("protection.flags.ENTER_EXIT_MESSAGES.now-leaving", "[name]", !i.getName().isEmpty() ? i.getName() :
|
||||
user.getTranslation("protection.flags.ENTER_EXIT_MESSAGES.island", "[name]", getPlugin().getPlayers().getName(i.getOwner()))));
|
||||
to.filter(i -> i.getOwner() != null).ifPresent(i -> user.sendMessage("protection.flags.ENTER_EXIT_MESSAGES.now-entering", "[name]", !i.getName().isEmpty() ? i.getName() :
|
||||
user.getTranslation("protection.flags.ENTER_EXIT_MESSAGES.island", "[name]", getPlugin().getPlayers().getName(i.getOwner()))));
|
||||
from.filter(i -> i.getOwner() != null).ifPresent(i -> user.sendMessage("protection.flags.ENTER_EXIT_MESSAGES.now-leaving", NAME, !i.getName().isEmpty() ? i.getName() :
|
||||
user.getTranslation("protection.flags.ENTER_EXIT_MESSAGES.island", NAME, getPlugin().getPlayers().getName(i.getOwner()))));
|
||||
to.filter(i -> i.getOwner() != null).ifPresent(i -> user.sendMessage("protection.flags.ENTER_EXIT_MESSAGES.now-entering", NAME, !i.getName().isEmpty() ? i.getName() :
|
||||
user.getTranslation("protection.flags.ENTER_EXIT_MESSAGES.island", NAME, getPlugin().getPlayers().getName(i.getOwner()))));
|
||||
// Send message if island is unowned, but has a name
|
||||
from.filter(i -> i.getOwner() == null && !i.getName().isEmpty()).ifPresent(i -> user.sendMessage("protection.flags.ENTER_EXIT_MESSAGES.now-leaving", "[name]", i.getName()));
|
||||
to.filter(i -> i.getOwner() == null && !i.getName().isEmpty()).ifPresent(i -> user.sendMessage("protection.flags.ENTER_EXIT_MESSAGES.now-entering", "[name]", i.getName()));
|
||||
from.filter(i -> i.getOwner() == null && !i.getName().isEmpty()).ifPresent(i -> user.sendMessage("protection.flags.ENTER_EXIT_MESSAGES.now-leaving", NAME, i.getName()));
|
||||
to.filter(i -> i.getOwner() == null && !i.getName().isEmpty()).ifPresent(i -> user.sendMessage("protection.flags.ENTER_EXIT_MESSAGES.now-entering", NAME, i.getName()));
|
||||
}
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ public class PVPListener extends AbstractFlagListener {
|
||||
// Protect visitors
|
||||
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && protectedVisitor((Player)e.getEntity())) {
|
||||
if (e.getDamager() instanceof Player) {
|
||||
User.getInstance(e.getDamager()).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
User.getInstance(e.getDamager()).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
} else if (e.getDamager() instanceof Projectile && ((Projectile)e.getDamager()).getShooter() instanceof Player) {
|
||||
User.getInstance((Player)((Projectile)e.getDamager()).getShooter()).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
User.getInstance((Player)((Projectile)e.getDamager()).getShooter()).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
}
|
||||
e.setCancelled(true);
|
||||
} else {
|
||||
@ -68,7 +68,7 @@ public class PVPListener extends AbstractFlagListener {
|
||||
if (damager instanceof Player) {
|
||||
User user = User.getInstance(damager);
|
||||
if (!setUser(user).checkIsland((Event)e, damager.getLocation(), flag)) {
|
||||
user.sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
user.sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else if (damager instanceof Projectile) {
|
||||
@ -79,7 +79,7 @@ public class PVPListener extends AbstractFlagListener {
|
||||
if (!setUser(user).checkIsland((Event)e, damager.getLocation(), flag)) {
|
||||
damager.setFireTicks(0);
|
||||
damager.remove();
|
||||
user.sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
user.sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -91,11 +91,11 @@ public class PVPListener extends AbstractFlagListener {
|
||||
if (e.getCaught() instanceof Player && getPlugin().getIWM().inWorld(e.getCaught().getLocation())) {
|
||||
// Protect visitors
|
||||
if (protectedVisitor((Player)e.getCaught())) {
|
||||
User.getInstance(e.getPlayer()).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
User.getInstance(e.getPlayer()).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
e.setCancelled(true);
|
||||
} else if (!checkIsland(e, e.getCaught().getLocation(), getFlag(e.getCaught().getWorld()))) {
|
||||
e.getHook().remove();
|
||||
User.getInstance(e.getPlayer()).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
User.getInstance(e.getPlayer()).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -118,12 +118,12 @@ public class PVPListener extends AbstractFlagListener {
|
||||
if (le instanceof Player) {
|
||||
// Protect visitors
|
||||
if (protectedVisitor(le)) {
|
||||
user.sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
user.sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
return true;
|
||||
}
|
||||
// Check if PVP is allowed or not
|
||||
if (!checkIsland(e, le.getLocation(), flag)) {
|
||||
user.sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
user.sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -155,8 +155,14 @@ public class PVPListener extends AbstractFlagListener {
|
||||
}
|
||||
|
||||
private Flag getFlag(World w) {
|
||||
return w.getEnvironment().equals(World.Environment.NORMAL) ? Flags.PVP_OVERWORLD
|
||||
: w.getEnvironment().equals(World.Environment.NETHER) ? Flags.PVP_NETHER : Flags.PVP_END;
|
||||
switch (w.getEnvironment()) {
|
||||
case NETHER:
|
||||
return Flags.PVP_NETHER;
|
||||
case THE_END:
|
||||
return Flags.PVP_END;
|
||||
default:
|
||||
return Flags.PVP_OVERWORLD;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ import us.tastybento.bskyblock.api.panels.Panel;
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.lists.Flags;
|
||||
import us.tastybento.bskyblock.managers.FlagsManager;
|
||||
import us.tastybento.bskyblock.managers.IslandWorldManager;
|
||||
import us.tastybento.bskyblock.managers.IslandsManager;
|
||||
@ -390,7 +391,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onEntityDamage(e);
|
||||
// PVP should be banned
|
||||
assertTrue(e.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
|
||||
// Enable visitor protection
|
||||
// This player is a visitor and any damage is not allowed
|
||||
@ -399,7 +400,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onEntityDamage(e);
|
||||
// visitor should be protected
|
||||
assertTrue(e.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -415,7 +416,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onEntityDamage(e);
|
||||
// PVP should be allowed
|
||||
assertFalse(e.isCancelled());
|
||||
Mockito.verify(player, Mockito.never()).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player, Mockito.never()).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
|
||||
// Enable visitor protection
|
||||
// This player is a visitor and any damage is not allowed
|
||||
@ -424,7 +425,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onEntityDamage(e);
|
||||
// visitor should be protected
|
||||
assertTrue(e.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
|
||||
}
|
||||
|
||||
@ -442,7 +443,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onEntityDamage(e);
|
||||
// PVP should be banned
|
||||
assertTrue(e.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
|
||||
// Visitor protection
|
||||
// This player is a visitor and any damage is not allowed
|
||||
@ -452,7 +453,7 @@ public class PVPListenerTest {
|
||||
// visitor should be protected
|
||||
assertTrue(e.isCancelled());
|
||||
// PVP trumps visitor protection
|
||||
Mockito.verify(player).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
|
||||
}
|
||||
|
||||
@ -472,7 +473,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onEntityDamage(e);
|
||||
// PVP should be allowed
|
||||
assertFalse(e.isCancelled());
|
||||
Mockito.verify(player, Mockito.never()).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player, Mockito.never()).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
|
||||
// Enable visitor protection
|
||||
// This player is a visitor and any damage is not allowed
|
||||
@ -481,7 +482,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onEntityDamage(e);
|
||||
// visitor should be protected
|
||||
assertTrue(e.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
|
||||
}
|
||||
|
||||
@ -505,7 +506,7 @@ public class PVPListenerTest {
|
||||
|
||||
// PVP should be banned
|
||||
assertTrue(pfe.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
// Hook should be removed
|
||||
Mockito.verify(hook).remove();
|
||||
|
||||
@ -551,7 +552,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onFishing(pfe);
|
||||
// visitor should be protected
|
||||
assertTrue(pfe.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -574,7 +575,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onFishing(pfe);
|
||||
// visitor should be protected
|
||||
assertTrue(pfe.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -626,7 +627,7 @@ public class PVPListenerTest {
|
||||
PotionSplashEvent e = new PotionSplashEvent(tp, map);
|
||||
new PVPListener().onSplashPotionSplash(e);
|
||||
assertTrue(e.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
|
||||
// Wrong world
|
||||
when(iwm.inWorld(Mockito.any())).thenReturn(false);
|
||||
@ -654,7 +655,7 @@ public class PVPListenerTest {
|
||||
PotionSplashEvent e = new PotionSplashEvent(tp, map);
|
||||
new PVPListener().onSplashPotionSplash(e);
|
||||
assertFalse(e.isCancelled());
|
||||
Mockito.verify(player, Mockito.never()).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player, Mockito.never()).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
}
|
||||
|
||||
|
||||
@ -682,7 +683,7 @@ public class PVPListenerTest {
|
||||
new PVPListener().onSplashPotionSplash(e);
|
||||
// visitor should be protected
|
||||
assertTrue(e.isCancelled());
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
|
||||
// Wrong world
|
||||
when(iwm.inWorld(Mockito.any())).thenReturn(false);
|
||||
@ -753,14 +754,14 @@ public class PVPListenerTest {
|
||||
listener.onLingeringPotionDamage(ae);
|
||||
assertEquals(3, ae.getAffectedEntities().size());
|
||||
assertFalse(ae.getAffectedEntities().contains(player2));
|
||||
Mockito.verify(player).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
// Wrong world
|
||||
when(iwm.inWorld(Mockito.any())).thenReturn(false);
|
||||
listener.onLingeringPotionSplash(e);
|
||||
// No change to results
|
||||
assertEquals(3, ae.getAffectedEntities().size());
|
||||
assertFalse(ae.getAffectedEntities().contains(player2));
|
||||
Mockito.verify(player).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -788,12 +789,12 @@ public class PVPListenerTest {
|
||||
AreaEffectCloudApplyEvent ae = new AreaEffectCloudApplyEvent(cloud, list);
|
||||
listener.onLingeringPotionDamage(ae);
|
||||
assertEquals(4, ae.getAffectedEntities().size());
|
||||
Mockito.verify(player, Mockito.never()).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player, Mockito.never()).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
// Wrong world
|
||||
when(iwm.inWorld(Mockito.any())).thenReturn(false);
|
||||
listener.onLingeringPotionSplash(e);
|
||||
assertEquals(4, ae.getAffectedEntities().size());
|
||||
Mockito.verify(player, Mockito.never()).sendMessage("protection.flags.PVP_OVERWORLD.pvp-not-allowed");
|
||||
Mockito.verify(player, Mockito.never()).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
||||
}
|
||||
|
||||
|
||||
@ -828,13 +829,13 @@ public class PVPListenerTest {
|
||||
listener.onLingeringPotionDamage(ae);
|
||||
assertEquals(3, ae.getAffectedEntities().size());
|
||||
assertFalse(ae.getAffectedEntities().contains(player2));
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
// Wrong world
|
||||
when(iwm.inWorld(Mockito.any())).thenReturn(false);
|
||||
listener.onLingeringPotionSplash(e);
|
||||
assertEquals(3, ae.getAffectedEntities().size());
|
||||
assertFalse(ae.getAffectedEntities().contains(player2));
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -868,12 +869,12 @@ public class PVPListenerTest {
|
||||
listener.onLingeringPotionDamage(ae);
|
||||
assertEquals(3, ae.getAffectedEntities().size());
|
||||
assertFalse(ae.getAffectedEntities().contains(player2));
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
// Wrong world
|
||||
when(iwm.inWorld(Mockito.any())).thenReturn(false);
|
||||
listener.onLingeringPotionSplash(e);
|
||||
assertEquals(3, ae.getAffectedEntities().size());
|
||||
assertFalse(ae.getAffectedEntities().contains(player2));
|
||||
Mockito.verify(player).sendMessage("protection.flags.INVINCIBLE_VISITORS.visitors-protected");
|
||||
Mockito.verify(player).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user