mirror of
https://github.com/BentoBoxWorld/Limits.git
synced 2024-11-22 18:46:02 +01:00
Changed to use notify instead of sendmessage to avoid spam
https://github.com/BentoBoxWorld/Limits/issues/75
This commit is contained in:
parent
e9784b508c
commit
086d251d3f
@ -210,7 +210,7 @@ public class BlockLimitsListener implements Listener {
|
|||||||
|
|
||||||
private void notify(Cancellable e, User user, int limit, Material m) {
|
private void notify(Cancellable e, User user, int limit, Material m) {
|
||||||
if (limit > -1) {
|
if (limit > -1) {
|
||||||
user.sendMessage("block-limits.hit-limit",
|
user.notify("block-limits.hit-limit",
|
||||||
"[material]", Util.prettifyText(m.toString()),
|
"[material]", Util.prettifyText(m.toString()),
|
||||||
TextVariables.NUMBER, String.valueOf(limit));
|
TextVariables.NUMBER, String.valueOf(limit));
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
@ -59,7 +59,7 @@ public class EntityLimitListener implements Listener {
|
|||||||
for (Entity ent : e.getVehicle().getLocation().getWorld().getNearbyEntities(e.getVehicle().getLocation(), 5, 5, 5)) {
|
for (Entity ent : e.getVehicle().getLocation().getWorld().getNearbyEntities(e.getVehicle().getLocation(), 5, 5, 5)) {
|
||||||
if (ent instanceof Player) {
|
if (ent instanceof Player) {
|
||||||
((Player) ent).updateInventory();
|
((Player) ent).updateInventory();
|
||||||
User.getInstance(ent).sendMessage("entity-limits.hit-limit", "[entity]",
|
User.getInstance(ent).notify("entity-limits.hit-limit", "[entity]",
|
||||||
Util.prettifyText(e.getVehicle().getType().toString())
|
Util.prettifyText(e.getVehicle().getType().toString())
|
||||||
, TextVariables.NUMBER, String.valueOf(addon.getSettings().getLimits().get(e.getVehicle().getType())));
|
, TextVariables.NUMBER, String.valueOf(addon.getSettings().getLimits().get(e.getVehicle().getType())));
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ public class EntityLimitListener implements Listener {
|
|||||||
if (!bypass && !island.isSpawn() && atLimit(island, e.getEntity())) {
|
if (!bypass && !island.isSpawn() && atLimit(island, e.getEntity())) {
|
||||||
// Not allowed
|
// Not allowed
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
User.getInstance(player).sendMessage("block-limits.hit-limit", "[material]",
|
User.getInstance(player).notify("block-limits.hit-limit", "[material]",
|
||||||
Util.prettifyText(e.getEntity().getType().toString()),
|
Util.prettifyText(e.getEntity().getType().toString()),
|
||||||
TextVariables.NUMBER, String.valueOf(addon.getSettings().getLimits().getOrDefault(e.getEntity().getType(), -1)));
|
TextVariables.NUMBER, String.valueOf(addon.getSettings().getLimits().getOrDefault(e.getEntity().getType(), -1)));
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ public class EntityLimitListener implements Listener {
|
|||||||
if (w == null) return;
|
if (w == null) return;
|
||||||
for (Entity ent : w.getNearbyEntities(e.getLocation(), 5, 5, 5)) {
|
for (Entity ent : w.getNearbyEntities(e.getLocation(), 5, 5, 5)) {
|
||||||
if (ent instanceof Player) {
|
if (ent instanceof Player) {
|
||||||
User.getInstance(ent).sendMessage("entity-limits.hit-limit", "[entity]",
|
User.getInstance(ent).notify("entity-limits.hit-limit", "[entity]",
|
||||||
Util.prettifyText(e.getEntityType().toString()),
|
Util.prettifyText(e.getEntityType().toString()),
|
||||||
TextVariables.NUMBER, String.valueOf(addon.getSettings().getLimits().get(e.getEntityType())));
|
TextVariables.NUMBER, String.valueOf(addon.getSettings().getLimits().get(e.getEntityType())));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user