Merge pull request #61 from TheBritishMidget/master

Friends setting for greeter
This commit is contained in:
noil 2021-04-15 11:35:33 -04:00 committed by GitHub
commit 9c4bf42180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

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");