1package com.runehive.util.parser.impl;
3import com.google.gson.JsonObject;
4import com.runehive.game.world.entity.mob.npc.Npc;
5import com.runehive.game.world.position.Position;
6import com.runehive.util.Utility;
7import com.runehive.util.parser.GsonParser;
8import org.jire.runehiveps.OldToNew;
10import java.util.HashMap;
24 public static final Map<Position, ForcedMessage>
FORCED_MESSAGES =
new HashMap<>();
30 super(
"def/npc/npc_force_chat",
false);
34 protected void parse(JsonObject data) {
35 int id = data.get(
"id").getAsInt();
42 final int interval = data.get(
"interval").getAsInt();
46 String[] messages =
new String[]{};
48 if (data.has(
"messages")) {
49 messages =
builder.fromJson(data.get(
"messages"), String[].class);
123 throw new IllegalArgumentException(
"Unhandled type: " +
type +
".");
Represents a single tile on the game world.
Handles miscellaneous methods.
static int random(int bound)
GsonParser(String path)
Creates a new GsonParser.
transient Gson builder
The Gson object.
The forced message class.
ForcedMessage(int id, int interval, String[] messages, MessageType type)
Constructs a new ForcedMessage.
int next
The next message.
final MessageType type
The message type.
final String[] messages
The array of messages the npc will perform.
final int interval
The interval at which the message will be performed.
void parse(JsonObject data)
The method allows a user to modify the data as its being parsed.
static final Map< Position, ForcedMessage > FORCED_MESSAGES
The map containing all the forced messages.
NpcForceChatParser()
Constructs a new NpcForceChatParser.
The enum of message types.