Skip to content

Commit

Permalink
Optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
APickledWalrus committed Jun 4, 2022
1 parent a8cf51d commit 3c5bf59
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,9 @@ private void changeInventory(int size, @Nullable String name) {
if (size >= inventory.getSize()) {
newInventory.setContents(inventory.getContents());
} else { // The inventory is shrinking
ItemStack[] oldContents = inventory.getContents();
ItemStack[] contents = new ItemStack[size];
for (int slot = 0; slot < size; slot++) {
contents[slot] = oldContents[slot];
newInventory.setItem(slot, inventory.getItem(slot));
}
newInventory.setContents(contents);
}

eventHandler.pause(); // Don't process any events as we transfer data and players
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public boolean hasGUI(Player player) {
@Nullable
public GUI getGUI(String id) {
for (GUI gui : guis) {
if (gui.getID() != null && gui.getID().equals(id)) {
if (id.equals(gui.getID())) {
return gui;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import ch.njol.skript.SkriptEventHandler;
import io.github.apickledwalrus.skriptgui.SkriptGUI;
import io.github.apickledwalrus.skriptgui.gui.GUI;
import io.github.apickledwalrus.skriptgui.gui.GUI.SlotData;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
Expand Down

0 comments on commit 3c5bf59

Please sign in to comment.