mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Iris debug toggle
This commit is contained in:
parent
993d433d03
commit
ce2d386b7e
@ -64,6 +64,17 @@ public class IrisSettings {
|
||||
return Math.max(2, c < 0 ? Runtime.getRuntime().availableProcessors() / -c : c);
|
||||
}
|
||||
|
||||
public void forceSave() {
|
||||
File s = Iris.instance.getDataFile("settings.json");
|
||||
|
||||
try {
|
||||
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
|
||||
} catch (JSONException | IOException e) {
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class IrisSettingsCache {
|
||||
public int complexCacheSize = 131072;
|
||||
|
@ -36,6 +36,9 @@ public class CommandIris extends MortarCommand {
|
||||
@Command
|
||||
private CommandIrisVerify verify;
|
||||
|
||||
@Command
|
||||
private CommandIrisDebug debug;
|
||||
|
||||
@Command
|
||||
private CommandIrisFix fix;
|
||||
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.core.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.plugin.MortarCommand;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
|
||||
public class CommandIrisDebug extends MortarCommand {
|
||||
public CommandIrisDebug() {
|
||||
super("debug", "dbg");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setDescription("Toggle debug mode");
|
||||
setCategory("Studio");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(VolmitSender sender, String[] args) {
|
||||
IrisSettings.get().getGeneral().setDebug(!IrisSettings.get().getGeneral().isDebug());
|
||||
IrisSettings.get().forceSave();
|
||||
sender.sendMessage("Debug Mode: " + (IrisSettings.get().getGeneral().isDebug() ? "Enabled" : "Disabled"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage() {
|
||||
return "<number> [|,&,^,>>,<<,%] <other>";
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user