diff options
Diffstat (limited to 'src/main/java/kr/syeyoung')
10 files changed, 343 insertions, 173 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/CategoryEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/config/CategoryEditPane.java deleted file mode 100755 index 0a0aea98..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/CategoryEditPane.java +++ /dev/null @@ -1,159 +0,0 @@ -package kr.syeyoung.dungeonsguide.config; - -import kr.syeyoung.dungeonsguide.roomedit.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; -import net.minecraftforge.common.config.ConfigCategory; -import net.minecraftforge.common.config.Property; - -import java.awt.*; -import java.util.*; -import java.util.List; - -public class CategoryEditPane extends MPanel implements DynamicEditor { - private ConfigCategory category; - - private MButton save; - private Map<String, Parameter> parameters = new HashMap<String, Parameter>(); - private List<MLabelAndElement> le = new ArrayList<MLabelAndElement>(); - - public CategoryEditPane(ConfigCategory category) { - this.category = category; - buildElements(); - } - - public String typeToclass(Property.Type type) { - switch (type) { - case STRING: - return String.class.getName(); - case INTEGER: - return Integer.class.getName(); - case BOOLEAN: - return Boolean.class.getName(); - case COLOR: - return Color.class.getName(); - } - return "null"; - } - - public void buildElements() { - { - save = new MButton(); - save.setText("Save"); - save.setBackgroundColor(Color.green); - save.setBounds(new Rectangle(0,0,100,20)); - save.setOnActionPerformed(new Runnable() { - @Override - public void run() { - for (Map.Entry<String,Parameter> parameter:parameters.entrySet()) { - if (parameter.getValue() != null) - category.get(parameter.getKey()).setValue(String.valueOf(parameter.getValue().getNewData())); - } - Config.syncConfig(false); - } - }); - } - { - for (Map.Entry<String, Property> en : category.entrySet()) { - ValueEditCreator vec = ValueEditRegistry.getValueEditMap(typeToclass(en.getValue().getType())); - final Parameter parameter; - vec.createDefaultValue(parameter = new Parameter(en.getValue().comment, getValue(en.getValue()), getValue(en.getValue()))); - - MPanel element = null; - if (en.getValue().getType() == Property.Type.STRING) { - element = new MTextField() { - @Override - public void edit(String str) { - parameter.setNewData(str); - } - }; - ((MTextField)element).setText(en.getValue().getString()); - } else if (en.getValue().getType() == Property.Type.INTEGER) { - element = new MIntegerSelectionButton(en.getValue().getInt()); - final MPanel finalElement = element; - ((MIntegerSelectionButton)element).setOnUpdate(new Runnable() { - @Override - public void run() { - parameter.setNewData(((MIntegerSelectionButton) finalElement).getData()); - } - }); - }else if (en.getValue().getType() == Property.Type.BOOLEAN) { - element = new MStringSelectionButton(Arrays.asList(new String[] {"on", "off"}), en.getValue().getBoolean() ? "on":"off"); - final MPanel finalElement1 = element; - ((MStringSelectionButton)element).setOnUpdate(new Runnable() { - @Override - public void run() { - parameter.setNewData(((MStringSelectionButton) finalElement1).getSelected().equals("on") ? true : false); - } - }); - } - - MLabelAndElement labelAndElement = new MLabelAndElement(en.getValue().comment, element); - labelAndElement.setBounds(new Rectangle(0,0,bounds.width,20)); - parameters.put(en.getKey(), parameter); - le.add(labelAndElement); - } - } - } - - private Object getValue(Property property) { - switch(property.getType()) { - case STRING: - return property.getString(); - case INTEGER: - return property.getInt(); - case BOOLEAN: - return property.getBoolean(); - } - return null; - } - - @Override - public void onBoundsUpdate() { - for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(bounds.width, 20)); - } - } - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); - } - - - public void delete(MParameter parameter) { - parameters.remove(parameter); - } - - @Override - public List<String> allowedClass() { - return ValueEditRegistry.getClassesSupported(); - } - - - @Override - public List<MPanel> getChildComponents() { - ArrayList<MPanel> panels = new ArrayList<MPanel>(le); - panels.add(save); - return panels; - } - - private int offsetY = 0; - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - int heights = 0; - for (MPanel panel:getChildComponents()) { - panel.setPosition(new Point(0, -offsetY + heights)); - heights += panel.getBounds().height; - } - } - - @Override - public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { - if (scrollAmount > 0) offsetY -= 20; - else if (scrollAmount < 0) offsetY += 20; - if (offsetY < 0) offsetY = 0; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/Config.java b/src/main/java/kr/syeyoung/dungeonsguide/config/Config.java index aff6a02f..908d8ca2 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/Config.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/Config.java @@ -1,23 +1,50 @@ package kr.syeyoung.dungeonsguide.config; +import com.google.gson.Gson; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.google.gson.stream.JsonWriter; +import kr.syeyoung.dungeonsguide.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStreamReader; +import java.io.*; public class Config { public static JsonObject configuration; + public static File f; - public static void loadConfig(File f) throws FileNotFoundException { - configuration = (JsonObject) new JsonParser().parse(new InputStreamReader(new FileInputStream(f))); - + public static void loadConfig(File f) throws IOException { + try { + configuration = (JsonObject) new JsonParser().parse(new InputStreamReader(new FileInputStream(Config.f = f))); + } catch (Exception e) { + configuration = new JsonObject(); + } + for (AbstractFeature feature : FeatureRegistry.getFeatureList()) { + JsonObject object = configuration.getAsJsonObject(feature.getKey()); + if (object != null) feature.loadConfig(object); + } + saveConfig(); } + public static void saveConfig() throws IOException { + for (AbstractFeature feature : FeatureRegistry.getFeatureList()) { + JsonObject object = feature.saveConfig(); + configuration.add(feature.getKey(), object); + } + + String str = new Gson().toJson(configuration); + FileOutputStream fos = null; + try { + fos = new FileOutputStream(f); + BufferedWriter bos = new BufferedWriter(new OutputStreamWriter(fos)); + bos.write(str); + bos.flush(); + } finally { + fos.close(); + } + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java new file mode 100755 index 00000000..40641386 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java @@ -0,0 +1,205 @@ +package kr.syeyoung.dungeonsguide.config; + +import kr.syeyoung.dungeonsguide.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.roomedit.MPanel; +import kr.syeyoung.dungeonsguide.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.roomedit.elements.*; +import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor; +import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; +import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraftforge.common.config.ConfigCategory; +import net.minecraftforge.common.config.Property; + +import java.awt.*; +import java.io.IOException; +import java.util.*; +import java.util.List; + +public class FeatureEditPane extends MPanel { + private List<AbstractFeature> features; + + private MButton save; + private List<MFeature> le = new ArrayList<MFeature>(); + + public FeatureEditPane(List<AbstractFeature> features) { + this.features = features; + buildElements(); + } + + + public void buildElements() { + { + save = new MButton(); + save.setText("Save"); + save.setBackgroundColor(Color.green); + save.setBounds(new Rectangle(0,0,100,20)); + save.setOnActionPerformed(new Runnable() { + @Override + public void run() { + try { + Config.saveConfig(); + } catch (IOException e) { + e.printStackTrace(); + } + } + }); + } + for (AbstractFeature feature : features) { + MFeature mFeature = new MFeature(feature); + mFeature.setHover(new Color(100,100,100,200)); + le.add(mFeature); + add(mFeature); + } + } + @Override + public void onBoundsUpdate() { + for (MPanel panel :getChildComponents()){ + panel.setSize(new Dimension(bounds.width, 20)); + } + } + @Override + public void resize(int parentWidth, int parentHeight) { + this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); + } + + @Override + public List<MPanel> getChildComponents() { + ArrayList<MPanel> panels = new ArrayList<MPanel>(le); + panels.add(save); + return panels; + } + + private int offsetY = 0; + private MPanel within; + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + int heights = 0; + within = null; + for (MPanel panel:getChildComponents()) { + panel.setPosition(new Point(0, -offsetY + heights)); + heights += panel.getBounds().height; + + if (panel.getBounds().contains(relMousex0, relMousey0)) within = panel; + } + } + + @Override + public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { + super.render0(resolution, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks); + + + if (within instanceof MFeature) { + AbstractFeature feature = ((MFeature) within).getFeature(); + drawHoveringText(new ArrayList<String>(Arrays.asList(feature.getDescription().split("\n"))), relMousex0, relMousey0, Minecraft.getMinecraft().fontRendererObj); + } + } + + private float zLevel = 0; + protected void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font) + { + if (!textLines.isEmpty()) + { + GlStateManager.disableRescaleNormal(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + int i = 0; + + for (String s : textLines) + { + int j = font.getStringWidth(s); + + if (j > i) + { + i = j; + } + } + + int l1 = x + 12; + int i2 = y - 12; + int k = 8; + + if (textLines.size() > 1) + { + k += 2 + (textLines.size() - 1) * 10; + } + + this.zLevel = 300.0F; + int l = -267386864; + this.drawGradientRect(l1 - 3, i2 - 4, l1 + i + 3, i2 - 3, l, l); + this.drawGradientRect(l1 - 3, i2 + k + 3, l1 + i + 3, i2 + k + 4, l, l); + this.drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 + k + 3, l, l); + this.drawGradientRect(l1 - 4, i2 - 3, l1 - 3, i2 + k + 3, l, l); + this.drawGradientRect(l1 + i + 3, i2 - 3, l1 + i + 4, i2 + k + 3, l, l); + int i1 = 1347420415; + int j1 = (i1 & 16711422) >> 1 | i1 & -16777216; + this.drawGradientRect(l1 - 3, i2 - 3 + 1, l1 - 3 + 1, i2 + k + 3 - 1, i1, j1); + this.drawGradientRect(l1 + i + 2, i2 - 3 + 1, l1 + i + 3, i2 + k + 3 - 1, i1, j1); + this.drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 - 3 + 1, i1, i1); + this.drawGradientRect(l1 - 3, i2 + k + 2, l1 + i + 3, i2 + k + 3, j1, j1); + + for (int k1 = 0; k1 < textLines.size(); ++k1) + { + String s1 = (String)textLines.get(k1); + font.drawStringWithShadow(s1, (float)l1, (float)i2, -1); + + if (k1 == 0) + { + i2 += 2; + } + + i2 += 10; + } + + this.zLevel = 0.0F; + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + RenderHelper.enableStandardItemLighting(); + GlStateManager.enableRescaleNormal(); + } + } + protected void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) + { + float f = (float)(startColor >> 24 & 255) / 255.0F; + float f1 = (float)(startColor >> 16 & 255) / 255.0F; + float f2 = (float)(startColor >> 8 & 255) / 255.0F; + float f3 = (float)(startColor & 255) / 255.0F; + float f4 = (float)(endColor >> 24 & 255) / 255.0F; + float f5 = (float)(endColor >> 16 & 255) / 255.0F; + float f6 = (float)(endColor >> 8 & 255) / 255.0F; + float f7 = (float)(endColor & 255) / 255.0F; + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.shadeModel(7425); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)right, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex(); + worldrenderer.pos((double)left, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex(); + worldrenderer.pos((double)left, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex(); + worldrenderer.pos((double)right, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex(); + tessellator.draw(); + GlStateManager.shadeModel(7424); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + } + + @Override + public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { + if (scrollAmount > 0) offsetY -= 20; + else if (scrollAmount < 0) offsetY += 20; + if (offsetY < 0) offsetY = 0; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/GuiConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/GuiConfig.java index e8bfc6bd..ef7d0a12 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/GuiConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/GuiConfig.java @@ -1,5 +1,7 @@ package kr.syeyoung.dungeonsguide.config; +import kr.syeyoung.dungeonsguide.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.roomedit.MPanel; import kr.syeyoung.dungeonsguide.roomedit.elements.MTabbedPane; import net.minecraft.client.Minecraft; @@ -11,6 +13,8 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.io.IOException; +import java.util.List; +import java.util.Map; public class GuiConfig extends GuiScreen { @@ -23,8 +27,9 @@ public class GuiConfig extends GuiScreen { mainPanel.add(tabbedPane); tabbedPane.setBackground2(new Color(17, 17, 17, 179)); -// for (String cate:Config.configuration.getCategoryNames()) -// tabbedPane.addTab(cate, new CategoryEditPane(Config.configuration.getCategory(cate))); + for (Map.Entry<String, List<AbstractFeature>> cate: FeatureRegistry.getFeaturesByCategory().entrySet()) + if (!cate.getKey().equals("hidden")) + tabbedPane.addTab(cate.getKey(), new FeatureEditPane(cate.getValue())); this.tabbedPane = tabbedPane; } @@ -38,8 +43,10 @@ public class GuiConfig extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + GL11.glPushMatrix(); GlStateManager.pushAttrib(); + GlStateManager.color(0,0,0,0); mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); GlStateManager.popAttrib(); GL11.glPopMatrix(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java new file mode 100755 index 00000000..3a0a01bc --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java @@ -0,0 +1,82 @@ +package kr.syeyoung.dungeonsguide.config; + +import kr.syeyoung.dungeonsguide.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.roomedit.MPanel; +import kr.syeyoung.dungeonsguide.roomedit.elements.MButton; +import kr.syeyoung.dungeonsguide.roomedit.elements.MLabel; +import kr.syeyoung.dungeonsguide.roomedit.elements.MStringSelectionButton; +import lombok.Getter; +import lombok.Setter; +import net.minecraft.client.gui.Gui; +import scala.actors.threadpool.Arrays; + +import java.awt.*; +import java.util.List; +import java.util.ArrayList; + +public class MFeature extends MPanel { + private MLabel label; + + @Getter + private AbstractFeature feature; + + private List<MPanel> addons = new ArrayList<MPanel>(); + + @Getter @Setter + private Color hover; + + public MFeature(AbstractFeature abstractFeature) { + this.feature = abstractFeature; + + this.add(this.label = new MLabel()); + this.label.setText(abstractFeature.getName()); + + if (abstractFeature instanceof GuiFeature) { + MButton button = new MButton(); + button.setText("GUI"); + addons.add(button); + add(button); + } + if (!abstractFeature.getParameters().isEmpty()) { + MButton button = new MButton(); + button.setText("Edit"); + addons.add(button); + add(button); + } + { + final MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(new ArrayList<String>(Arrays.asList(new String[] {"on", "off"})), abstractFeature.isEnabled() ? "on" : "off"); + mStringSelectionButton.setOnUpdate(new Runnable() { + @Override + public void run() { + String selected = mStringSelectionButton.getSelected(); + feature.setEnabled("on".equals(selected)); + } + }); + addons.add(mStringSelectionButton); + add(mStringSelectionButton); + } + } + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + if (hover != null && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMousex0, relMousey0)) { + Gui.drawRect(0,0,bounds.width, bounds.height, hover.getRGB()); + } + } + + @Override + public void resize(int parentWidth, int parentHeight) { + this.setSize(new Dimension(parentWidth, bounds.height)); + } + + @Override + public void onBoundsUpdate() { + int x = bounds.width - 70; + for (MPanel panel : addons) { + panel.setBounds(new Rectangle(x, 0, 70, bounds.height)); + x -= 70; + } + label.setBounds(new Rectangle(0,0,x, bounds.height)); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java index aeefe8c8..13c16d5d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/e.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java @@ -85,7 +85,7 @@ public class e implements c { } try { Config.loadConfig( configFile ); - } catch (FileNotFoundException e) { + } catch (IOException e) { e.printStackTrace(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index f1dd3bff..3651593a 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -209,7 +209,7 @@ public class DungeonListener { @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent keyInputEvent) { - if (FeatureRegistry.DEBUG.isEnabled() && Keybinds.editingSession.isKeyDown() ){ + if (FeatureRegistry.ADVANCED_ROOMEDIT.isEnabled() && Keybinds.editingSession.isKeyDown() ){ EditingContext ec = EditingContext.getEditingContext(); if (ec == null) { DungeonContext context = e.getDungeonsGuide().getSkyblockStatus().getContext(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java index 4964ee5f..cec8492c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java @@ -32,7 +32,7 @@ public abstract class AbstractFeature { @Getter @Setter - private boolean enabled = false; + private boolean enabled = true; public void drawWorld(float partialTicks) {} public void drawScreen(float partialTicks) {} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index 67d1e971..c92e09a1 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -44,6 +44,9 @@ public class FeatureRegistry { public static final AbstractFeature TOOLTIP_DUNGEONSTAT = register(new SimpleFeature("tooltip", "Dungeon Item Stats", "Shows quality of dungeon items (floor, percentage)", "tooltip.dungeonitem")); public static final AbstractFeature TOOLTIP_PRICE = register(new SimpleFeature("tooltip", "Item Price", "Shows price of items", "tooltip.price")); - public static final AbstractFeature DEBUG = register(new SimpleFeature("advanced", "Debug", "Toggles debug mode", "debug")); + public static final AbstractFeature 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 AbstractFeature DEBUG = register(new SimpleFeature("hidden", "Debug", "Toggles debug mode", "debug", false)); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java index cdeaaa44..893addfe 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java @@ -2,9 +2,14 @@ package kr.syeyoung.dungeonsguide.features; public class SimpleFeature extends AbstractFeature { protected SimpleFeature(String category, String name, String key) { - super(category, name, name, key); + this(category, name, name, key); } protected SimpleFeature(String category, String name, String description, String key) { + this(category, name, description, key, true); + } + + protected SimpleFeature(String category, String name, String description, String key, boolean enabled) { super(category, name, description, key); + this.setEnabled(enabled); } } |