Merge pull request #23 from YellowZaki/patch-3

Personalize messages differencing between block an entities
This commit is contained in:
tastybento 2019-06-16 14:39:44 -07:00 committed by GitHub
commit e5f900a193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 6 deletions

View File

@ -94,7 +94,7 @@ public class LimitPanel {
}
IslandBlockCount ibc = addon.getBlockLimitListener().getIsland(island.getUniqueId());
Map<Material, Integer> matLimits = addon.getBlockLimitListener().getMaterialLimits(world, island.getUniqueId());
if (matLimits.isEmpty()) {
if (matLimits.isEmpty() && addon.getSettings().getLimits().isEmpty()) {
user.sendMessage("island.limits.no-limits");
return;
}

View File

@ -173,7 +173,7 @@ public class BlockLimitsListener implements Listener {
private void notify(Cancellable e, User user, int limit, Material m) {
if (limit > -1) {
user.sendMessage("limits.hit-limit",
user.sendMessage("block-limits.hit-limit",
"[material]", Util.prettifyText(m.toString()),
TextVariables.NUMBER, String.valueOf(limit));
e.setCancelled(true);

View File

@ -53,7 +53,7 @@ public class EntityLimitListener implements Listener {
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("limits.hit-limit", "[material]",
User.getInstance(ent).sendMessage("entity-limits.hit-limit", "[entity]",
Util.prettifyText(e.getVehicle().getType().toString())
,"[number]", String.valueOf(addon.getSettings().getLimits().get(e.getVehicle().getType())));
}
@ -116,7 +116,7 @@ public class EntityLimitListener implements Listener {
if (!e.getSpawnReason().equals(SpawnReason.SPAWNER)) {
for (Entity ent : e.getLocation().getWorld().getNearbyEntities(e.getLocation(), 5, 5, 5)) {
if (ent instanceof Player) {
User.getInstance(ent).sendMessage("limits.hit-limit", "[material]",
User.getInstance(ent).sendMessage("entity-limits.hit-limit", "[entity]",
Util.prettifyText(e.getEntityType().toString()),
"[number]", String.valueOf(addon.getSettings().getLimits().get(e.getEntityType())));
}

View File

@ -4,7 +4,8 @@
###########################################################################################
limits:
hit-limit: "&c[material] limited to [number]!"
entity-hit-limit: "&c[entity] spawning limited to [number]!"
block-hit-limit: "&c[material] limited to [number]!"
panel-title: "Island limits"
admin:
@ -26,4 +27,4 @@ island:
block-limit-syntax: "[number]/[limit]"
no-limits: "&cNo limits set in this world"