bap 18 Posted October 26, 2021 THESE SNIPPETS USE LOMBOK! USE LOMBOK/REMOVE THE LOMBOK ANNOTATIONS FOR THEM TO WORK! import lombok.AllArgsConstructor; import lombok.Getter; import java.util.HashMap; import java.util.Map; @Getter @AllArgsConstructor public enum ChatMessageType { /** * A normal game message. */ GAMEMESSAGE(0), /** * A message in the public chat from a moderator */ MODCHAT(1), /** * A message in the public chat. */ PUBLICCHAT(2), /** * A private message from another player. */ PRIVATECHAT(3), /** * A message that the game engine sends. */ ENGINE(4), /** * A message received when a friend logs in or out. */ LOGINLOGOUTNOTIFICATION(5), /** * A private message sent to another player. */ PRIVATECHATOUT(6), /** * A private message received from a moderator. */ MODPRIVATECHAT(7), /** * A message received in friends chat. */ FRIENDSCHAT(9), /** * A message received with information about the current friends chat. */ FRIENDSCHATNOTIFICATION(11), /** * A trade request being sent. */ TRADE_SENT(12), /** * A game broadcast. */ BROADCAST(14), /** * An abuse report submitted. */ SNAPSHOTFEEDBACK(26), /** * Examine item description. */ ITEM_EXAMINE(27), /** * Examine NPC description. */ NPC_EXAMINE(28), /** * Examine object description. */ OBJECT_EXAMINE(29), /** * Adding player to friend list. */ FRIENDNOTIFICATION(30), /** * Adding player to ignore list. */ IGNORENOTIFICATION(31), /** * A chat message in a clan chat. */ CLAN_CHAT(41), /** * A system message in a clan chat. */ CLAN_MESSAGE(43), /** * A chat message in the guest clan chat. */ CLAN_GUEST_CHAT(44), /** * A system message in the guest clan chat. */ CLAN_GUEST_MESSAGE(46), /** * An autotyper message from a player. */ AUTOTYPER(90), /** * An autotyper message from a mod. */ MODAUTOTYPER(91), /** * A game message. (ie. when a setting is changed) */ CONSOLE(99), /** * A message received when somebody sends a trade offer. */ TRADEREQ(101), /** * A message received when completing a trade or a duel */ TRADE(102), /** * A message received when somebody sends a duel offer. */ CHALREQ_TRADE(103), /** * A message received when someone sends a friends chat challenge offer. */ CHALREQ_FRIENDSCHAT(104), /** * A message that was filtered. */ SPAM(105), /** * A message that is relating to the player. */ PLAYERRELATED(106), /** * A message that times out after 10 seconds. */ TENSECTIMEOUT(107), /** * The "Welcome to RuneScape" message */ WELCOME(108), /** * Clan creation invitation. */ CLAN_CREATION_INVITATION(109), /** * Clan wars challenge for clans rather than FCs */ CLAN_CLAN_WARS_CHALLENGE(110), CLAN_GIM_FORM_GROUP(111), CLAN_GIM_GROUP_WITH(112), /** * An unknown message type. */ UNKNOWN(-1); private final int type; private static final Map<Integer, ChatMessageType> MESSAGE_TYPES = new HashMap<>(); static { for (ChatMessageType type : values()) { MESSAGE_TYPES.put(type.type,type); } } public static ChatMessageType of(int type) { return MESSAGE_TYPES.getOrDefault(type,UNKNOWN); } } import lombok.AllArgsConstructor; import lombok.Getter; import java.util.Arrays; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; @AllArgsConstructor @Getter public enum GameState { /** * Unknown game state. */ UNKNOWN(-1), /** * The client is starting. */ STARTING(0), /** * The client is at the login screen. */ LOGIN_SCREEN(10), /** * The client is at the login screen entering authenticator code. */ LOGIN_SCREEN_AUTHENTICATOR(11), /** * There is a player logging in. */ LOGGING_IN(20), /** * The game is being loaded. */ LOADING(25), /** * The user has successfully logged in. */ LOGGED_IN(30), /** * Connection to the server was lost. */ CONNECTION_LOST(40), /** * A world hop is taking place. */ HOPPING(45); private static final Map<Integer, GameState> stateValueMap = Arrays.stream(GameState.values()) .collect(Collectors.toMap(gs -> gs.state, Function.identity())); /** * The raw state value. */ private final int state; /** * Utility method that maps the rank value to its respective * {@link GameState} value. * * @param state the raw state value * @return the gamestate */ public static GameState of(int state) { return stateValueMap.getOrDefault(state, UNKNOWN); } } public static String getScriptArgs(String[] args) { for (String s : args) { return s; } return null; }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.