Search in sources :

Example 1 with QuestComponent

use of com.playmonumenta.scriptedquests.quests.components.QuestComponent in project scripted-quests by TeamMonumenta.

the class CodeEntry method doActionsIfCodeMatches.

public boolean doActionsIfCodeMatches(Plugin plugin, Player player, String code) {
    String goodCode = getCodeForPlayer(player).toLowerCase().replaceAll("\\s", "");
    code = code.toLowerCase().replaceAll("\\s", "");
    if (goodCode.equals(code)) {
        for (QuestComponent component : mComponents) {
            component.doActionsIfPrereqsMet(new QuestContext(plugin, player, null));
        }
        return true;
    }
    return false;
}
Also used : QuestComponent(com.playmonumenta.scriptedquests.quests.components.QuestComponent)

Example 2 with QuestComponent

use of com.playmonumenta.scriptedquests.quests.components.QuestComponent in project scripted-quests by TeamMonumenta.

the class ClientChatProtocol method sendPacket.

public static void sendPacket(List<QuestComponent> packet, QuestContext context) {
    // implements `S->C 'actions'`
    JsonObject data = JsonObjectBuilder.get().add("type", "actions").add("data", packet.stream().map(v -> v.serializeForClientAPI(context)).map(v -> v.orElse(null)).collect(Collectors.toList())).build();
    sendJson(context.getPlayer(), data);
}
Also used : JsonObject(com.google.gson.JsonObject) CommandSender(org.bukkit.command.CommandSender) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Constants(com.playmonumenta.scriptedquests.Constants) Set(java.util.Set) StandardByteReader(com.floweytf.utils.stdstreams.StandardByteReader) UUID(java.util.UUID) Player(org.bukkit.entity.Player) Collectors(java.util.stream.Collectors) CommandExecutor(org.bukkit.command.CommandExecutor) Plugin(com.playmonumenta.scriptedquests.Plugin) JsonElement(com.google.gson.JsonElement) QuestComponent(com.playmonumenta.scriptedquests.quests.components.QuestComponent) HashSet(java.util.HashSet) IStandardByteReader(com.floweytf.utils.stdstreams.IStandardByteReader) List(java.util.List) PluginMessageListener(org.bukkit.plugin.messaging.PluginMessageListener) ByteArrayInputStream(java.io.ByteArrayInputStream) StandardByteWriter(com.floweytf.utils.stdstreams.StandardByteWriter) Gson(com.google.gson.Gson) Command(org.bukkit.command.Command) QuestContext(com.playmonumenta.scriptedquests.quests.QuestContext) JsonObject(com.google.gson.JsonObject)

Aggregations

QuestComponent (com.playmonumenta.scriptedquests.quests.components.QuestComponent)2 IStandardByteReader (com.floweytf.utils.stdstreams.IStandardByteReader)1 StandardByteReader (com.floweytf.utils.stdstreams.StandardByteReader)1 StandardByteWriter (com.floweytf.utils.stdstreams.StandardByteWriter)1 Gson (com.google.gson.Gson)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 Constants (com.playmonumenta.scriptedquests.Constants)1 Plugin (com.playmonumenta.scriptedquests.Plugin)1 QuestContext (com.playmonumenta.scriptedquests.quests.QuestContext)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 UUID (java.util.UUID)1 Collectors (java.util.stream.Collectors)1 Command (org.bukkit.command.Command)1 CommandExecutor (org.bukkit.command.CommandExecutor)1 CommandSender (org.bukkit.command.CommandSender)1