Friends setting for greeter

This commit is contained in:
TheBritishMidget 2021-04-15 13:27:41 +01:00
parent e1146eec99
commit e2a4a4f7eb

View File

@ -13,6 +13,7 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
*/
public final class GreeterModule extends Module {
public final Value<Boolean> friends = new Value<Boolean>("Friends", new String[]{"Friend", "F"}, "Will only greet friends.", false);
public final Value<Mode> mode = new Value<Mode>("Mode", new String[]{"Mode", "M"}, "Change between greeter modes. Client mode will only appear for you, Server mode will broadcast the greeting message for everyone.", Mode.CLIENT);
private enum Mode {
@ -30,6 +31,7 @@ public final class GreeterModule extends Module {
@Listener
public void onPlayerJoin(EventPlayerJoin event) {
if (friends.getValue() && Seppuku.INSTANCE.getFriendManager().find(event.getName()) == null) return;
switch (this.mode.getValue()) {
case CLIENT:
Seppuku.INSTANCE.logChat(event.getName() + " has joined the game");
@ -42,6 +44,7 @@ public final class GreeterModule extends Module {
@Listener
public void onPlayerLeave(EventPlayerLeave event) {
if (friends.getValue() && Seppuku.INSTANCE.getFriendManager().find(event.getName()) == null) return;
switch (this.mode.getValue()) {
case CLIENT:
Seppuku.INSTANCE.logChat(event.getName() + " has left the game");