Proper Reformating

This commit is contained in:
Kam committed 2025-03-13 17:14:45 -04:00
1 parent ce75880aba
commit 180d257024
1179 files changed
+59847 -61583

No files matched your search

@@ -9,20 +9,20 @@ import noppes.npcs.constants.EnumOptionType;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.controllers.data.DialogOption;
public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData, ITextfieldListener, GuiSelectionListener, ISubGuiListener{
private DialogOption option;
public static int LastColor = 0xe0e0e0;
public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData, ITextfieldListener, GuiSelectionListener, ISubGuiListener {
private DialogOption option;
public static int LastColor = 0xe0e0e0;
public SubGuiNpcDialogOption(DialogOption option){
this.option = option;
setBackground("menubg.png");
xSize = 256;
ySize = 216;
closeOnEsc = true;
public SubGuiNpcDialogOption(DialogOption option) {
this.option = option;
setBackground("menubg.png");
xSize = 256;
ySize = 216;
closeOnEsc = true;
}
@Override
public void initGui(){
public void initGui() {
super.initGui();
this.addLabel(new GuiNpcLabel(66, "dialog.editoption", guiLeft, guiTop + 4));
this.getLabel(66).center(xSize);
@@ -31,97 +31,96 @@ public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData,
this.addTextField(new GuiNpcTextField(0, this, this.fontRendererObj, guiLeft + 40, guiTop + 15, 196, 20, option.title));
String color = Integer.toHexString(option.optionColor);
while(color.length() < 6)
color = 0 + color;
while (color.length() < 6)
color = 0 + color;
addLabel(new GuiNpcLabel(2, "gui.color", guiLeft + 4, guiTop + 45));
this.addButton(new GuiNpcButton(2, guiLeft + 62, guiTop + 40, 92, 20, color));
this.getButton(2).setTextColor(option.optionColor);
this.addButton(new GuiNpcButton(2, guiLeft + 62, guiTop + 40, 92, 20, color));
this.getButton(2).setTextColor(option.optionColor);
this.addLabel(new GuiNpcLabel(1, "dialog.optiontype", guiLeft + 4, guiTop + 67));
this.addButton(new GuiNpcButton(1, guiLeft + 62, guiTop + 62, 92, 20, new String[]{"gui.close","dialog.dialog","gui.disabled","menu.role","tile.commandBlock.name"},option.optionType.ordinal()));
this.addButton(new GuiNpcButton(1, guiLeft + 62, guiTop + 62, 92, 20, new String[]{"gui.close", "dialog.dialog", "gui.disabled", "menu.role", "tile.commandBlock.name"}, option.optionType.ordinal()));
if(option.optionType == EnumOptionType.DialogOption){
this.addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 84, "availability.selectdialog"));
if(option.dialogId >= 0)
if (option.optionType == EnumOptionType.DialogOption) {
this.addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 84, "availability.selectdialog"));
if (option.dialogId >= 0)
DialogGetPacket.getDialog(option.dialogId);
}
if(option.optionType == EnumOptionType.CommandBlock){
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, option.command));
this.getTextField(4).setMaxStringLength(32767);
}
if (option.optionType == EnumOptionType.CommandBlock) {
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, option.command));
this.getTextField(4).setMaxStringLength(32767);
this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 110));
this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 125));
this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 140));
this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 155));
this.addLabel(new GuiNpcLabel(9, "dialog.commandmultiple", guiLeft + 4, guiTop + 170));
}
}
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190,98, 20, "gui.done"));
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190, 98, 20, "gui.done"));
}
@Override
protected void actionPerformed(GuiButton guibutton){
GuiNpcButton button = (GuiNpcButton) guibutton;
protected void actionPerformed(GuiButton guibutton) {
GuiNpcButton button = (GuiNpcButton) guibutton;
if(button.id == 1){
option.optionType = EnumOptionType.values()[button.getValue()];
initGui();
}
if(button.id == 2){
this.setSubGui(new SubGuiColorSelector(option.optionColor));
}
if(button.id == 3){
if (button.id == 1) {
option.optionType = EnumOptionType.values()[button.getValue()];
initGui();
}
if (button.id == 2) {
this.setSubGui(new SubGuiColorSelector(option.optionColor));
}
if (button.id == 3) {
setSubGui(new GuiDialogSelection(option.dialogId));
}
if(button.id == 66)
{
close();
}
if (button.id == 66) {
close();
}
}
@Override
public void unFocused(GuiNpcTextField textfield) {
if(textfield.id == 0){
if(textfield.isEmpty())
textfield.setText(option.title);
else{
option.title = textfield.getText();
}
}
if(textfield.id == 4){
option.command = textfield.getText();
}
}
@Override
public void setGuiData(NBTTagCompound compound) {
if(compound.hasKey("DialogId")){
Dialog dialog = new Dialog();
dialog.readNBT(compound);
option.dialogId = dialog.id;
if(this.getButton(3) != null)
getButton(3).setDisplayText(dialog.title);
}
}
@Override
public void selected(int ob, String name) {
option.dialogId = ob;
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
if(subgui instanceof SubGuiColorSelector) {
LastColor = option.optionColor = ((SubGuiColorSelector)subgui).color;
@Override
public void unFocused(GuiNpcTextField textfield) {
if (textfield.id == 0) {
if (textfield.isEmpty())
textfield.setText(option.title);
else {
option.title = textfield.getText();
}
}
if(subgui instanceof GuiDialogSelection) {
Dialog dialog = ((GuiDialogSelection)subgui).selectedDialog;
if(dialog != null) {
if (textfield.id == 4) {
option.command = textfield.getText();
}
}
@Override
public void setGuiData(NBTTagCompound compound) {
if (compound.hasKey("DialogId")) {
Dialog dialog = new Dialog();
dialog.readNBT(compound);
option.dialogId = dialog.id;
if (this.getButton(3) != null)
getButton(3).setDisplayText(dialog.title);
}
}
@Override
public void selected(int ob, String name) {
option.dialogId = ob;
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
if (subgui instanceof SubGuiColorSelector) {
LastColor = option.optionColor = ((SubGuiColorSelector) subgui).color;
}
if (subgui instanceof GuiDialogSelection) {
Dialog dialog = ((GuiDialogSelection) subgui).selectedDialog;
if (dialog != null) {
option.dialogId = dialog.id;
}
}
initGui();
}
}
}