IF
IF copied to clipboard
add findByName
i add little feature but kinda cursial to me is find a gui component from xml as a web developer i am familiar with getElementById. it makes more efficient to work with xml temple
how to use?
this is the example.xml
<gui title="Example" type="chest" rows="3" onGlobalClick="globalClick">
...
<staticpane x="4" y="0" length="1" height="1" name="example">
...
<item id="player_head" x="1" y="0" name="example" />
...
</staticpane>
...
</gui>
when u load the gui with
final ChestGui gui = ChestGui.load(this, "example.xml");
now you easily get the get the pane with this code below
StaticPane profilePane = (StaticPane) gui.getPanelByName("example");
and u also can easily get the item in a pane with code below
GuiItem itemProfile = profilePane.getItemByName("example");
how it works?
it's simple. when the Gui.load()
method looping every pane node in the xml, i created a hashmap to contain name and the pane memory address. so it will efficient to query the pane that u looking for. it also same for the item