mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 20:09:49 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -13,87 +13,83 @@ import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
public class GuiNPCFactionSelection extends GuiNPCInterface implements IScrollData
|
||||
{
|
||||
private GuiNPCStringSlot slot;
|
||||
private GuiScreen parent;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
private int factionId;
|
||||
public GuiSelectionListener listener;
|
||||
public GuiNPCFactionSelection(EntityNPCInterface npc,GuiScreen parent,int dialog)
|
||||
{
|
||||
super(npc);
|
||||
drawDefaultBackground = false;
|
||||
title = "Select Faction Category";
|
||||
this.parent = parent;
|
||||
this.factionId = dialog;
|
||||
public class GuiNPCFactionSelection extends GuiNPCInterface implements IScrollData {
|
||||
private GuiNPCStringSlot slot;
|
||||
private GuiScreen parent;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
private int factionId;
|
||||
public GuiSelectionListener listener;
|
||||
|
||||
public GuiNPCFactionSelection(EntityNPCInterface npc, GuiScreen parent, int dialog) {
|
||||
super(npc);
|
||||
drawDefaultBackground = false;
|
||||
title = "Select Faction Category";
|
||||
this.parent = parent;
|
||||
this.factionId = dialog;
|
||||
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
|
||||
if(parent instanceof GuiSelectionListener){
|
||||
listener = (GuiSelectionListener) parent;
|
||||
}
|
||||
if (parent instanceof GuiSelectionListener) {
|
||||
listener = (GuiSelectionListener) parent;
|
||||
}
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
Vector<String> list = new Vector<String>();
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
slot = new GuiNPCStringSlot(list, this, false, 18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 -100, height - 41,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "gui.select"));
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, height - 41, 98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41, 98, 20, "gui.select"));
|
||||
}
|
||||
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
slot.drawScreen(i, j, f);
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 2)
|
||||
{
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 2) {
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
if(id == 4)
|
||||
{
|
||||
doubleClicked();
|
||||
if (id == 4) {
|
||||
doubleClicked();
|
||||
}
|
||||
}
|
||||
public void doubleClicked() {
|
||||
if(slot.selected == null || slot.selected.isEmpty())
|
||||
return;
|
||||
factionId = data.get(slot.selected);
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
|
||||
}
|
||||
public void save() {
|
||||
if(factionId >= 0){
|
||||
if(listener != null)
|
||||
listener.selected(factionId, slot.selected);
|
||||
}
|
||||
}
|
||||
public void doubleClicked() {
|
||||
if (slot.selected == null || slot.selected.isEmpty())
|
||||
return;
|
||||
factionId = data.get(slot.selected);
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
this.data = data;
|
||||
this.slot.setList(list);
|
||||
if(factionId >= 0)
|
||||
for(String name : data.keySet())
|
||||
if(data.get(name) == factionId)
|
||||
slot.selected = name;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
public void save() {
|
||||
if (factionId >= 0) {
|
||||
if (listener != null)
|
||||
listener.selected(factionId, slot.selected);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
this.data = data;
|
||||
this.slot.setList(list);
|
||||
if (factionId >= 0)
|
||||
for (String name : data.keySet())
|
||||
if (data.get(name) == factionId)
|
||||
slot.selected = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user