mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-05 18:40:06 +01:00
Use User#notify() instead of #sendMessage() in PVPListener
This commit is contained in:
parent
fbf88483f0
commit
ee9c7937ea
@ -50,9 +50,9 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
// Protect visitors
|
// Protect visitors
|
||||||
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && protectedVisitor((Player)e.getEntity())) {
|
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && protectedVisitor((Player)e.getEntity())) {
|
||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player) {
|
||||||
User.getInstance(e.getDamager()).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
User.getInstance(e.getDamager()).notify(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||||
} else if (e.getDamager() instanceof Projectile && ((Projectile)e.getDamager()).getShooter() instanceof Player) {
|
} else if (e.getDamager() instanceof Projectile && ((Projectile)e.getDamager()).getShooter() instanceof Player) {
|
||||||
User.getInstance((Player)((Projectile)e.getDamager()).getShooter()).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
User.getInstance((Player)((Projectile)e.getDamager()).getShooter()).notify(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||||
}
|
}
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
} else {
|
} else {
|
||||||
@ -73,7 +73,7 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
if (damager instanceof Player) {
|
if (damager instanceof Player) {
|
||||||
User user = User.getInstance(damager);
|
User user = User.getInstance(damager);
|
||||||
if (!setUser(user).checkIsland((Event)e, damager.getLocation(), flag)) {
|
if (!setUser(user).checkIsland((Event)e, damager.getLocation(), flag)) {
|
||||||
user.sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
user.notify(Flags.PVP_OVERWORLD.getHintReference());
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (damager instanceof Projectile) {
|
} else if (damager instanceof Projectile) {
|
||||||
@ -88,7 +88,7 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
if (!setUser(user).checkIsland((Event)e, damager.getLocation(), flag)) {
|
if (!setUser(user).checkIsland((Event)e, damager.getLocation(), flag)) {
|
||||||
damager.setFireTicks(0);
|
damager.setFireTicks(0);
|
||||||
damager.remove();
|
damager.remove();
|
||||||
user.sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
user.notify(Flags.PVP_OVERWORLD.getHintReference());
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,11 +104,11 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
}
|
}
|
||||||
// Protect visitors
|
// Protect visitors
|
||||||
if (protectedVisitor((Player)e.getCaught())) {
|
if (protectedVisitor((Player)e.getCaught())) {
|
||||||
User.getInstance(e.getPlayer()).sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
User.getInstance(e.getPlayer()).notify(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
} else if (!checkIsland(e, e.getCaught().getLocation(), getFlag(e.getCaught().getWorld()))) {
|
} else if (!checkIsland(e, e.getCaught().getLocation(), getFlag(e.getCaught().getWorld()))) {
|
||||||
e.getHook().remove();
|
e.getHook().remove();
|
||||||
User.getInstance(e.getPlayer()).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
User.getInstance(e.getPlayer()).notify(Flags.PVP_OVERWORLD.getHintReference());
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,12 +143,12 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
if (le instanceof Player) {
|
if (le instanceof Player) {
|
||||||
// Protect visitors
|
// Protect visitors
|
||||||
if (protectedVisitor(le)) {
|
if (protectedVisitor(le)) {
|
||||||
user.sendMessage(Flags.INVINCIBLE_VISITORS.getHintReference());
|
user.notify(Flags.INVINCIBLE_VISITORS.getHintReference());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check if PVP is allowed or not
|
// Check if PVP is allowed or not
|
||||||
if (!checkIsland(e, le.getLocation(), flag)) {
|
if (!checkIsland(e, le.getLocation(), flag)) {
|
||||||
user.sendMessage(Flags.PVP_OVERWORLD.getHintReference());
|
user.notify(Flags.PVP_OVERWORLD.getHintReference());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user