Finalize commands, add to GUI

This commit is contained in:
dfsek
2020-10-01 02:47:30 -07:00
parent f7f98b6dcc
commit efd52a2002
6 changed files with 64 additions and 19 deletions

View File

@@ -1,7 +1,9 @@
package com.dfsek.terra.command.image.gui;
import com.dfsek.terra.command.WorldCommand;
import com.dfsek.terra.config.ConfigUtil;
import com.dfsek.terra.config.WorldConfig;
import com.dfsek.terra.image.ImageLoader;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
@@ -13,7 +15,13 @@ import java.util.List;
public class RawGUICommand extends WorldCommand {
@Override
public boolean onCommand(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
WorldConfig.fromWorld(world).imageLoader.debug(false, sender.getWorld());
if(! ConfigUtil.debug) {
sender.sendMessage("Debug mode must be enabled to use the debug GUI! The debug GUI is NOT PRODUCTION SAFE!");
return true;
}
ImageLoader loader = WorldConfig.fromWorld(world).imageLoader;
if(loader != null) loader.debug(false, sender.getWorld());
else ImageLoader.debugWorld(false, world);
return true;
}

View File

@@ -1,7 +1,9 @@
package com.dfsek.terra.command.image.gui;
import com.dfsek.terra.command.WorldCommand;
import com.dfsek.terra.config.ConfigUtil;
import com.dfsek.terra.config.WorldConfig;
import com.dfsek.terra.image.ImageLoader;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
@@ -13,7 +15,13 @@ import java.util.List;
public class StepGUICommand extends WorldCommand {
@Override
public boolean onCommand(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
WorldConfig.fromWorld(world).imageLoader.debug(true, sender.getWorld());
if(! ConfigUtil.debug) {
sender.sendMessage("Debug mode must be enabled to use the debug GUI! The debug GUI is NOT PRODUCTION SAFE!");
return true;
}
ImageLoader loader = WorldConfig.fromWorld(world).imageLoader;
if(loader != null) loader.debug(true, sender.getWorld());
else ImageLoader.debugWorld(true, world);
return true;
}