RuneHive-Game
Loading...
Searching...
No Matches
PrivacyChatMode.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.mob.player.relations;
2
3import java.util.Optional;
4
5public enum PrivacyChatMode {
6 ON(0),
8 OFF(2),
9 HIDE(3);
10
11 private final int code;
12
14 this.code = code;
15 }
16
17 public static boolean isValid(int code) {
18 return code >= 0 && code < PrivacyChatMode.values().length;
19 }
20
21 public static Optional<PrivacyChatMode> get(int code) {
22 if (!isValid(code)) {
23 return Optional.empty();
24 }
25 return Optional.of(PrivacyChatMode.values()[code]);
26 }
27
28 public int getCode() {
29 return code;
30 }
31
32}