1
mirror of https://github.com/CarmJos/UserPrefix.git synced 2026-06-04 15:28:21 +08:00

优化代码

This commit is contained in:
carm
2021-09-08 19:10:22 +08:00
parent bd303f24b7
commit ee2cc259ef
@@ -55,11 +55,11 @@ public class GUI {
case FIVEBYNINE: case FIVEBYNINE:
this.items = new GUIItem[45]; this.items = new GUIItem[45];
break; break;
default:
case SIXBYNINE: case SIXBYNINE:
this.items = new GUIItem[54]; this.items = new GUIItem[54];
break; break;
case CANCEL: case CANCEL:
default:
this.items = null; this.items = null;
} }
} }
@@ -167,18 +167,8 @@ public class GUI {
if (this.type == GUIType.CANCEL) { if (this.type == GUIType.CANCEL) {
throw new NullPointerException("被取消或不存在的GUI"); throw new NullPointerException("被取消或不存在的GUI");
} }
switch (type) { inv = Bukkit.createInventory(null, this.items.length, this.name);
default:
case ONEBYNINE:
case TWOBYNINE:
case THREEBYNINE:
case FOURBYNINE:
case FIVEBYNINE:
case SIXBYNINE:
inv = Bukkit.createInventory(null, this.items.length, this.name);
break;
}
for (int index = 0; index < this.items.length; index++) { for (int index = 0; index < this.items.length; index++) {
if (items[index] == null) { if (items[index] == null) {
inv.setItem(index, new ItemStack(Material.AIR)); inv.setItem(index, new ItemStack(Material.AIR));