mirror of
https://github.com/nkomarn/harbor.git
synced 2024-12-19 23:08:58 +01:00
Add BedEnter/BedLeave Events & continue refactoring
This commit is contained in:
parent
ece82c9e7f
commit
a9b9932a08
@ -18,7 +18,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
final World world = event.getPlayer().getWorld();
|
final World world = event.getPlayer().getWorld();
|
||||||
if (morePlayerNeeded(world)) {
|
if (morePlayerNeeded(world)) {
|
||||||
Message.SendChatMessage("messages.chat.sleeping");
|
Message.SendChatMessage(world, "messages.chat.sleeping");
|
||||||
Message.SendActionbarMessage(world, "messages.actionbar.sleeping");
|
Message.SendActionbarMessage(world, "messages.actionbar.sleeping");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onBedLeave(final PlayerBedLeaveEvent event) {
|
public void onBedLeave(final PlayerBedLeaveEvent event) {
|
||||||
final World world = event.getPlayer().getWorld();
|
final World world = event.getPlayer().getWorld();
|
||||||
if (Checker.isNight(world) && !Checker.skippingWorlds.contains(world) && morePlayerNeeded(world)) {
|
if (Checker.isNight(world) && !Checker.skippingWorlds.contains(world) && morePlayerNeeded(world)) {
|
||||||
Message.SendChatMessage("messages.chat.left");
|
Message.SendChatMessage(world, "messages.chat.left");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,13 +12,13 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class Message {
|
public class Message {
|
||||||
public static void SendChatMessage(final String messageLocation) {
|
public static void SendChatMessage(final World world, final String messageLocation) {
|
||||||
sendChatMessage(Config.getString(messageLocation));
|
sendChatMessage(prepareMessageWithParams(Config.getString(messageLocation), world));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendActionbarMessage(final World world, final String messageLocation) {
|
public static void SendActionbarMessage(final World world, final String messageLocation) {
|
||||||
if (Config.getBoolean("messages.actionbar.actionbar")) {
|
if (Config.getBoolean("messages.actionbar.actionbar")) {
|
||||||
final String message = Message.prepareMessageWithParams(Config.getString(messageLocation), world);
|
final String message = prepareMessageWithParams(Config.getString(messageLocation), world);
|
||||||
world.getPlayers().forEach(p -> sendActionbarMessage(p, message));
|
world.getPlayers().forEach(p -> sendActionbarMessage(p, message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user