diff --git a/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonEscape.java b/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonEscape.java index c25f6826b..966da3ed4 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonEscape.java +++ b/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonEscape.java @@ -2,12 +2,12 @@ package com.gmail.nossr50.datatypes.buttons; import org.getspout.spoutapi.gui.GenericButton; -public class ButtonEscape extends GenericButton -{ - public ButtonEscape() - { - this.setText("EXIT"); - this.setWidth(60).setHeight(20); - this.setDirty(true); - } +public class ButtonEscape extends GenericButton { + + public ButtonEscape() { + this.setText("EXIT"); + this.setWidth(60); + this.setHeight(20); + this.setDirty(true); + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonHUDStyle.java b/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonHUDStyle.java index 53c708e4d..34d30b5d2 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonHUDStyle.java +++ b/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonHUDStyle.java @@ -1,21 +1,14 @@ package com.gmail.nossr50.datatypes.buttons; -import org.getspout.spoutapi.gui.GenericButton; - import com.gmail.nossr50.datatypes.PlayerProfile; -public class ButtonHUDStyle extends GenericButton -{ - public ButtonHUDStyle(PlayerProfile PP) - { - this.setText("HUD Type: "+PP.getHUDType().toString()); - this.setTooltip("Change your HUD style!"); - this.setWidth(120).setHeight(20); - this.setDirty(true); - } - public void updateText(PlayerProfile PP) - { - this.setText("HUD Type: "+PP.getHUDType().toString()); - this.setDirty(true); - } -} \ No newline at end of file +public class ButtonHUDStyle extends ButtonToggle { + + public ButtonHUDStyle(PlayerProfile PP) { + super("HUD Type: ", PP.getHUDType().toString(), "Change your HUD style!"); + } + + public void updateText(PlayerProfile PP) { + super.updateText("HUD Type: ", PP.getHUDType().toString()); + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonPartyToggle.java b/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonPartyToggle.java index ec0201d8c..39692e3a1 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonPartyToggle.java +++ b/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonPartyToggle.java @@ -1,21 +1,14 @@ package com.gmail.nossr50.datatypes.buttons; -import org.getspout.spoutapi.gui.GenericButton; - import com.gmail.nossr50.datatypes.PlayerProfile; -public class ButtonPartyToggle extends GenericButton -{ - public ButtonPartyToggle(PlayerProfile PP) - { - this.setText("Party HUD: "+PP.getPartyHUD()); - this.setTooltip("Toggle the Party HUD!"); - this.setWidth(120).setHeight(20); - this.setDirty(true); - } - public void updateText(PlayerProfile PP) - { - this.setText("Party HUD: "+PP.getPartyHUD()); - this.setDirty(true); - } -} \ No newline at end of file +public class ButtonPartyToggle extends ButtonToggle { + + public ButtonPartyToggle(PlayerProfile PP) { + super("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString(), "Toggle the Party HUD!"); + } + + public void updateText(PlayerProfile PP) { + super.updateText("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString()); + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonToggle.java b/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonToggle.java new file mode 100644 index 000000000..75b46707c --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/buttons/ButtonToggle.java @@ -0,0 +1,19 @@ +package com.gmail.nossr50.datatypes.buttons; + +import org.getspout.spoutapi.gui.GenericButton; + +public class ButtonToggle extends GenericButton{ + + public ButtonToggle(String text1, String text2, String tooltip) { + this.setText(text1 + text2); + this.setTooltip(tooltip); + this.setWidth(120); + this.setHeight(20); + this.setDirty(true); + } + + public void updateText(String text1, String text2) { + this.setText(text1 + text2); + this.setDirty(true); + } +}