diff options
author | syeyoung <cyong06@naver.com> | 2021-08-03 18:16:55 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-08-03 18:16:55 +0900 |
commit | 5f8c2788c2a7a62bf8b522ecfa39c6801333b577 (patch) | |
tree | e88c7a2912c657f9a22ed930e309ea0ca25fe974 /src/main/java/kr/syeyoung/dungeonsguide/features | |
parent | 982e460c861579f49959c08e25505a27e9c6b3f0 (diff) | |
download | Skyblock-Dungeons-Guide-5f8c2788c2a7a62bf8b522ecfa39c6801333b577.tar.gz Skyblock-Dungeons-Guide-5f8c2788c2a7a62bf8b522ecfa39c6801333b577.tar.bz2 Skyblock-Dungeons-Guide-5f8c2788c2a7a62bf8b522ecfa39c6801333b577.zip |
- Fix copyright on Penguin
- Fix Parameter edit not resizing correctly
- Debug can now be enabled via config
- Config resizes according to user's minecraft size
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java | 4 | ||||
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java | 66 |
2 files changed, 69 insertions, 1 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index d70b9066..c5bff650 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.features; import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureDebug; import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureDebuggableMap; import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomCoordDisplay; import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomDebugInfo; @@ -59,6 +60,7 @@ public class FeatureRegistry { } public static <T extends AbstractFeature> T register(T abstractFeature) { + if (featureByKey.containsKey(abstractFeature.getKey())) throw new IllegalArgumentException("DUPLICATE FEATURE DEFINITION"); featureList.add(abstractFeature); featureByKey.put(abstractFeature.getKey(), abstractFeature); List<AbstractFeature> features = featuresByCategory.get(abstractFeature.getCategory()); @@ -69,7 +71,7 @@ public class FeatureRegistry { return abstractFeature; } - public static final SimpleFeature DEBUG = register(new SimpleFeature("hidden", "Debug", "Toggles debug mode", "debug", false)); + public static final SimpleFeature DEBUG = register(new FeatureDebug()); public static final SimpleFeature ADVANCED_ROOMEDIT = register(new SimpleFeature("Advanced", "Room Edit", "Allow editing dungeon rooms\n\nWarning: using this feature can break or freeze your Minecraft\nThis is only for advanced users only", "advanced.roomedit", false)); public static final FeatureRoomDebugInfo ADVANCED_DEBUG_ROOM = register(new FeatureRoomDebugInfo()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java new file mode 100644 index 00000000..e4b18e3e --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java @@ -0,0 +1,66 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.features.impl.advanced; + +import com.google.common.base.Supplier; +import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.MFeatureEdit; +import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.MParameterEdit; +import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.RootConfigPanel; +import kr.syeyoung.dungeonsguide.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.gui.elements.MLabel; + +public class FeatureDebug extends SimpleFeature { + public FeatureDebug() { + super("Advanced", "Debug", "Toggles debug mode", "debug", false); + parameters.put("Key", new FeatureParameter<String>("Key", "Secret Key given by syeyoung", "Put the debug enable key here to enable debug mode", "","string")); + } + @Override + public boolean isEnabled() { + return "just hide it".equals(this.<String>getParameter("Key").getValue()); + } + @Override + public boolean isDisyllable() { + return false; + } + + @Override + public String getEditRoute(RootConfigPanel rootConfigPanel) { + ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { + @Override + public MPanel get() { + MFeatureEdit featureEdit = new MFeatureEdit(FeatureDebug.this, rootConfigPanel); + for (FeatureParameter parameter: getParameters()) { + featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureDebug.this, parameter, rootConfigPanel)); + } + featureEdit.addParameterEdit("IsEnabled", new MParameterEdit(FeatureDebug.this, new FeatureParameter("Key Status", "Key Status", "Key Enabled? Or not?", "", "idk"), rootConfigPanel, new MLabel() { + @Override + public String getText() { + return isEnabled() ? "Enabled!" : "Incorrect Key"; + } + })); + return featureEdit; + } + }); + return "base." + getKey() ; + } +} |