Skip to content

Commit

Permalink
Unique message for each flag
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyDertan committed Mar 16, 2019
1 parent ac2051f commit c4371c2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>sergeydertan.sregionprotector</groupId>
<artifactId>SRegionProtector</artifactId>
<version>18.1</version>
<version>18.2</version>
<name>SRegionProtector</name>
<description>Flexible region protection plugin for nukkit</description>
<url>https://github.com/SergeyDertan/SRegionProtector</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void playerInteract(PlayerInteractEvent e) {
this.handleEvent(RegionFlags.FLAG_INTERACT, e.getBlock(), e.getPlayer(), e);
if (e.isCancelled()) return;
if (e.getItem().getId() == ItemID.FLINT_AND_STEEL) {
this.handleEvent(RegionFlags.FLAG_LIGHTER, e.getBlock(), e.getPlayer(), e, false, true);
this.handleEvent(RegionFlags.FLAG_LIGHTER, e.getBlock(), e.getPlayer(), e, false, false);
return;
}
Block block = e.getBlock();
Expand Down Expand Up @@ -189,7 +189,7 @@ public void playerDropItem(PlayerDropItemEvent e) { //item drop

//move flag
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void playerMove(PlayerMoveEvent e) { //player move
public void playerMove(PlayerMoveEvent e) {
this.handleEvent(RegionFlags.FLAG_MOVE, e.getTo(), e.getPlayer(), e, true, true);
}

Expand Down Expand Up @@ -239,7 +239,9 @@ private void handleEvent(int flag, Position pos, Player player, Event ev, boolea
if (!region.getFlagState(flag)) if (this.prioritySystem) break;

ev.setCancelled();
if (player != null && this.needMessage[flag]) Messenger.getInstance().sendMessage(player, "region.protected");
if (player != null && this.needMessage[flag]) {
Messenger.getInstance().sendMessage(player, "region.protected." + RegionFlags.getFlagName(flag));
}
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

public final class Chunk {

private static final Comparator<Region> regionComparator = (r, r2) -> r2.getPriority() - r.getPriority();
public final Object lock = new Object();
public final long x;
public final long z;
private static final Comparator<Region> regionComparator = (r, r2) -> r2.getPriority() - r.getPriority();
private final List<Region> regions;

public Chunk(long x, long z) {
Expand Down
21 changes: 19 additions & 2 deletions src/main/resources/lang/eng.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,30 @@ regions-manual-save: "{@amount} regions was saved by {@initiator}"
loading.chunks.success: "Loaded {@count} chunks."
loading.regions.success: "Loaded {@count} regions."

region.protected: "There`s region"
region.protected.build: "You can`t build here"
region.protected.interact: "You can`t interact with this region"
region.protected.use: "You can`t interact with this region"
region.protected.pvp: "You can`t pvp in this region"
region.protected.lighter: "You can`t use lighter in this region"
region.protected.invincible: "You can`t take damage in this region"
region.protected.potin-launch: "You can`t use potions in this region"
region.protected.move: "You can`t move in this region"
region.protected.item-drop: "You can`t drop items in this region"
region.protected.send-chat: "You can`t send messages in this region"
region.protected.receive-chat: "You can`t send messages in this region"
region.protected.health-regen: "You can`t regenerate health in this region"
region.protected.crops-destroy: "You can`t destroy crops in this region"
region.protected.ender-pearl: "You can`t use enderpearl in this region"
region.protected.chest-access: "You can`t use chests in this region"
region.protected.sleep: "You can`t use bed in this region"
region.protected.fire: "You can`t ignite blocks in this region"

region.flag.state.enabled: "enabled"
region.flag.state.disabled: "disabled"
region.selection.pos1: "First pos set"
region.selection.pos2: "Second pos set"

command.region.permission: You have no permission
command.region.permission: "You have no permission"
command.region.available-commands: "Available commands: {@list}"
command.region.region.command-doesnt-exits: "Commands {@name} doesnt exists"
command.region.desription: "SRegionProtector commands"
Expand Down
19 changes: 18 additions & 1 deletion src/main/resources/lang/rus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,24 @@ regions-manual-save: "{@amount} было сохранено по инициат
loading.chunks.success: "Загружено {@count} чанков."
loading.regions.success: "Загружено {@count} регионов."

region.protected: "Тут регион"
region.protected.build: "Вы не можете строить здесь"
region.protected.interact: "Вы не можете взаимодействовать с этим регионом"
region.protected.use: "Вы не можете взаимодействовать с этим регионом"
region.protected.pvp: "Вы не можете драться в этом регионе"
region.protected.lighter: "Вы не можете использовать зажигалку в этом регионе"
region.protected.invincible: "Вы не можете получать урон в этом регионе"
region.protected.potin-launch: "Вы не можете использовать зелья в этом регионе"
region.protected.move: "Вы не можете двигаться в этом регионе"
region.protected.item-drop: "Вы не можете выбрасывать предметы в этом регионе"
region.protected.send-chat: "Вы не можете отправлять сообщения в этом регионе"
region.protected.receive-chat: "Вы не можете получить сообщения в этом регионе"
region.protected.health-regen: "Вы не можете восстанавливать здоровье в этом регионе"
region.protected.crops-destroy: "Вы не можете уничтожать посевы в этом регионе"
region.protected.ender-pearl: "Вы не можете использовать око эндера в этом регионе"
region.protected.chest-access: "Вы не можете использовать сундуки в этом регионе"
region.protected.sleep: "Вы не можете использовать кровать в этом регионе"
region.protected.fire: "Вы не можете поджигать в этом регионе"

region.flag.state.enabled: "вкл"
region.flag.state.disabled: "выкл"
region.selection.pos1: "Первая точка установлена"
Expand Down

0 comments on commit c4371c2

Please sign in to comment.