Skip to content

Commit

Permalink
Changed to use notify instead of sendmessage to avoid spam
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Mar 28, 2020
1 parent e9784b5 commit 086d251
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void onBlock(BlockMultiPlaceEvent e) {

private void notify(Cancellable e, User user, int limit, Material m) {
if (limit > -1) {
user.sendMessage("block-limits.hit-limit",
user.notify("block-limits.hit-limit",
"[material]", Util.prettifyText(m.toString()),
TextVariables.NUMBER, String.valueOf(limit));
e.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void onMinecart(VehicleCreateEvent e) {
for (Entity ent : e.getVehicle().getLocation().getWorld().getNearbyEntities(e.getVehicle().getLocation(), 5, 5, 5)) {
if (ent instanceof Player) {
((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())
, TextVariables.NUMBER, String.valueOf(addon.getSettings().getLimits().get(e.getVehicle().getType())));
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public void onBlock(HangingPlaceEvent e) {
if (!bypass && !island.isSpawn() && atLimit(island, e.getEntity())) {
// Not allowed
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()),
TextVariables.NUMBER, String.valueOf(addon.getSettings().getLimits().getOrDefault(e.getEntity().getType(), -1)));

Expand All @@ -145,7 +145,7 @@ private void checkLimit(CreatureSpawnEvent e, boolean bypass) {
if (w == null) return;
for (Entity ent : w.getNearbyEntities(e.getLocation(), 5, 5, 5)) {
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()),
TextVariables.NUMBER, String.valueOf(addon.getSettings().getLimits().get(e.getEntityType())));
}
Expand Down

0 comments on commit 086d251

Please sign in to comment.