1package com.osroyale.game.action.impl;
3import com.google.gson.Gson;
4import com.google.gson.GsonBuilder;
5import com.osroyale.game.task.Task;
6import com.osroyale.net.packet.out.SendInputMessage;
7import com.osroyale.net.packet.out.SendMessage;
8import com.osroyale.game.world.entity.mob.player.Player;
9import com.osroyale.util.MessageColor;
11import java.io.FileWriter;
12import java.util.HashMap;
51public class DebugAction
extends Task {
53 private Map<Integer, String> DATA =
new HashMap<>();
55 private final Player player;
57 private int identification;
61 private boolean pause;
63 private boolean inputTaken;
65 public DebugAction(
Player player) {
69 this.identification = 0;
70 this.inputTaken =
false;
72 this.DATA =
new HashMap<>();
75 private final void save() {
76 Gson gson =
new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
77 try (FileWriter fw =
new FileWriter(
"./data/INTERFACES.json")) {
78 fw.write(gson.toJson(DATA));
79 }
catch (
final Exception e) {
84 private void input(
Player player) {
85 player.send(
new SendInputMessage(
"Enter the itemcontainer description", 100, input -> {
86 DATA.put(identification, input);
103 player.dialogueFactory.sendOption(
108 player.dialogueFactory.clear();
116 player.send(
new SendMessage(
"A total of " + DATA.size() +
" interfaces were saved."));
122 player.interfaceManager.open(identification);
synchronized final void cancel()
Task(boolean instant, int delay)