1
0
mirror of https://github.com/nkomarn/harbor.git synced 2024-12-18 22:37:36 +01:00

Add BedEnter/BedLeave Events & continue refactoring

This commit is contained in:
Roland von Rotz 2019-10-01 09:45:06 +02:00
parent ece82c9e7f
commit a9b9932a08
2 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ public class PlayerListener implements Listener {
}
final World world = event.getPlayer().getWorld();
if (morePlayerNeeded(world)) {
Message.SendChatMessage("messages.chat.sleeping");
Message.SendChatMessage(world, "messages.chat.sleeping");
Message.SendActionbarMessage(world, "messages.actionbar.sleeping");
}
}
@ -27,7 +27,7 @@ public class PlayerListener implements Listener {
public void onBedLeave(final PlayerBedLeaveEvent event) {
final World world = event.getPlayer().getWorld();
if (Checker.isNight(world) && !Checker.skippingWorlds.contains(world) && morePlayerNeeded(world)) {
Message.SendChatMessage("messages.chat.left");
Message.SendChatMessage(world, "messages.chat.left");
}
}

View File

@ -12,13 +12,13 @@ import java.util.List;
import java.util.Random;
public class Message {
public static void SendChatMessage(final String messageLocation) {
sendChatMessage(Config.getString(messageLocation));
public static void SendChatMessage(final World world, final String messageLocation) {
sendChatMessage(prepareMessageWithParams(Config.getString(messageLocation), world));
}
public static void SendActionbarMessage(final World world, final String messageLocation) {
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));
}
}