aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-25 22:22:24 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-25 22:22:24 +0900
commit3a3b70806358e5e44232e793c84879514b1857b4 (patch)
tree2e3b77b56c1b0234b4deef384b3c8dd9eb2752cf /src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java
parenta34fa2c68fd4a1c47fd22d5de5b87959210eceab (diff)
downloadSkyblock-Dungeons-Guide-3a3b70806358e5e44232e793c84879514b1857b4.tar.gz
Skyblock-Dungeons-Guide-3a3b70806358e5e44232e793c84879514b1857b4.tar.bz2
Skyblock-Dungeons-Guide-3a3b70806358e5e44232e793c84879514b1857b4.zip
conttexaltasdhuewbgsidqeaghosguh[ujw-fia
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java
index b1f15300..77f9718b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java
@@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
import kr.syeyoung.dungeonsguide.roomedit.GuiDungeonRoomEdit;
import kr.syeyoung.dungeonsguide.utils.MapUtils;
import net.minecraft.client.Minecraft;
@@ -23,12 +24,12 @@ import java.awt.*;
public class CommandEditRoom extends CommandBase {
@Override
public String getCommandName() {
- return "editroom";
+ return "editsession";
}
@Override
public String getCommandUsage(ICommandSender sender) {
- return "editroom";
+ return "editsession";
}
@Override
@@ -55,16 +56,22 @@ public class CommandEditRoom extends CommandBase {
return;
}
- openit = new GuiDungeonRoomEdit(dungeonRoom);
+ if (EditingContext.getEditingContext() != null) {
+ sender.addChatMessage(new ChatComponentText("There is an editing session currently open."));
+ return;
+ }
+
+ EditingContext.createEditingContext(dungeonRoom);
+ openGuiReq = true;
}
- GuiScreen openit = null;
+ private boolean openGuiReq = false;
@SubscribeEvent
public void tick(TickEvent.ClientTickEvent tick){
- if ( openit != null &&tick.phase == TickEvent.Phase.END && tick.side == Side.CLIENT && tick.type == TickEvent.Type.CLIENT) {
- Minecraft.getMinecraft().displayGuiScreen(openit);
- openit = null;
+ if ( openGuiReq &&tick.phase == TickEvent.Phase.END && tick.side == Side.CLIENT && tick.type == TickEvent.Type.CLIENT) {
+ DungeonRoom dr = EditingContext.getEditingContext().getRoom();
+ EditingContext.getEditingContext().openGui(new GuiDungeonRoomEdit(dr));
}
}