Removing Pair<> #45
@ -5,12 +5,10 @@ import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.sql.*;
|
||||
import javafx.util.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.util.*;
|
||||
@ -19,7 +17,7 @@ class GUI {
|
||||
private GUI(){}
|
||||
|
||||
static void changeType(Player p, Schematic schem){
|
||||
List<Pair<SWItem, SchematicType>> types = new LinkedList<>();
|
||||
List<SWListInv.SWListEntry<SchematicType>> types = new LinkedList<>();
|
||||
for(SchematicType type : SchematicType.values()){
|
||||
if(!type.isAssignable())
|
||||
continue;
|
||||
@ -28,13 +26,13 @@ class GUI {
|
||||
if(type.fightType())
|
||||
item.setEnchanted(true);
|
||||
|
||||
types.add(new Pair<>(item, type));
|
||||
types.add(new SWListInv.SWListEntry<>(item, type));
|
||||
}
|
||||
|
||||
SWListInv<SchematicType> inv = new SWListInv<>(p, "Typ ändern", (clickType, schematicType) -> {
|
||||
SWListInv<SchematicType> inv = new SWListInv<>(p, "Typ ändern", types, (clickType, schematicType) -> {
|
||||
SchematicCommand.changetype(p, schem, schematicType);
|
||||
p.closeInventory();
|
||||
}, types);
|
||||
});
|
||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
@ -59,34 +57,34 @@ class GUI {
|
||||
}
|
||||
|
||||
static void delmembers(Player p, Schematic schem){
|
||||
List<Pair<SWItem, SchematicMember>> members = new LinkedList<>();
|
||||
List<SWListInv.SWListEntry<SchematicMember>> members = new LinkedList<>();
|
||||
for(SchematicMember member : SchematicMember.getSchemMembers(schem.getSchemName(), schem.getSchemOwner())){
|
||||
SteamwarUser user = SteamwarUser.get(member.getMember());
|
||||
members.add(new Pair<>(SWItem.getPlayerSkull(Bukkit.getOfflinePlayer(user.getUUID())), member));
|
||||
members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(Bukkit.getOfflinePlayer(user.getUUID())), member));
|
||||
}
|
||||
|
||||
SWListInv<SchematicMember> inv = new SWListInv<>(p, "Mitglieder entfernen", (clickType, member) -> {
|
||||
SWListInv<SchematicMember> inv = new SWListInv<>(p, "Mitglieder entfernen", members, (clickType, member) -> {
|
||||
member.remove();
|
||||
p.closeInventory();
|
||||
delmembers(p, schem);
|
||||
}, members);
|
||||
});
|
||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void changeItem(Player p, Schematic schem){
|
||||
List<Pair<SWItem, Material>> materials = new LinkedList<>();
|
||||
List<SWListInv.SWListEntry<Material>> materials = new LinkedList<>();
|
||||
for(Material material : Material.values()){
|
||||
SWItem item = new SWItem(material, "§7" + material.name());
|
||||
if(item.getItemMeta() != null && material.isItem())
|
||||
materials.add(new Pair<>(item, material));
|
||||
materials.add(new SWListInv.SWListEntry<>(item, material));
|
||||
}
|
||||
|
||||
SWListInv<Material> inv = new SWListInv<>(p, "Item ändern", (clickType, material) -> {
|
||||
SWListInv<Material> inv = new SWListInv<>(p, "Item ändern", materials, (clickType, material) -> {
|
||||
schem.setItem(material.name());
|
||||
p.closeInventory();
|
||||
info(p, schem);
|
||||
}, materials);
|
||||
});
|
||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
@ -139,13 +137,11 @@ class GUI {
|
||||
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), click -> {});
|
||||
|
||||
SteamwarUser owneruser = SteamwarUser.get(schem.getSchemOwner());
|
||||
SWItem owner = new SWItem();
|
||||
ItemStack head = new ItemStack(SWItem.getMaterial("SKULL_ITEM"), 1, (short)3);
|
||||
SkullMeta headmeta = (SkullMeta)head.getItemMeta();
|
||||
SWItem owner = SWItem.getPlayerSkull(owneruser.getUserName());
|
||||
SkullMeta headmeta = (SkullMeta)owner.getItemMeta();
|
||||
headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(owneruser.getUUID()));
|
||||
headmeta.setDisplayName("§7von §e" + owneruser.getUserName());
|
||||
head.setItemMeta(headmeta);
|
||||
owner.setItemStack(head);
|
||||
owner.setItemMeta(headmeta);
|
||||
inv.setItem(6, owner);
|
||||
}
|
||||
|
||||
@ -158,7 +154,7 @@ class GUI {
|
||||
}
|
||||
|
||||
static void list(Player p, int pid){
|
||||
List<Pair<SWItem, Schematic>> schemList = new LinkedList<>();
|
||||
List<SWListInv.SWListEntry<Schematic>> schemList = new LinkedList<>();
|
||||
List<Schematic> schems = Schematic.getSchemsAccessibleByUser(pid);
|
||||
|
||||
for(Schematic schem : schems) {
|
||||
@ -169,19 +165,19 @@ class GUI {
|
||||
m = SWItem.getMaterial(schem.getItem());
|
||||
|
||||
SWItem item = new SWItem(m, "§e" + schem.getSchemName(), Collections.singletonList("§7" + schem.getSchemType().name()), !schem.getSchemType().writeable(), click -> {});
|
||||
schemList.add(new Pair<>(item, schem));
|
||||
schemList.add(new SWListInv.SWListEntry<>(item, schem));
|
||||
}
|
||||
|
||||
SWListInv<Schematic> inv = new SWListInv<>(p, "§eSchematicliste", (clickType, schem) -> {
|
||||
SWListInv<Schematic> inv = new SWListInv<>(p, "§eSchematicliste", schemList, (clickType, schem) -> {
|
||||
p.closeInventory();
|
||||
info(p, schem);
|
||||
}, schemList);
|
||||
});
|
||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
|
||||
static boolean listSearch(Player player, String search) {
|
||||
List<Pair<SWItem, Schematic>> schemList = new LinkedList<>();
|
||||
List<SWListInv.SWListEntry<Schematic>> schemList = new LinkedList<>();
|
||||
List<Schematic> filteredSchems = new ArrayList<>();
|
||||
|
||||
for(Schematic currentSchem : Schematic.getSchemsAccessibleByUser(player.getUniqueId())) {
|
||||
@ -200,13 +196,13 @@ class GUI {
|
||||
m = SWItem.getMaterial(currentSchem.getItem());
|
||||
|
||||
SWItem item = new SWItem(m, "§e" + currentSchem.getSchemName(), Collections.singletonList("§7" + currentSchem.getSchemType().name()), !currentSchem.getSchemType().writeable(), click -> {});
|
||||
schemList.add(new Pair<>(item, currentSchem));
|
||||
schemList.add(new SWListInv.SWListEntry<>(item, currentSchem));
|
||||
}
|
||||
|
||||
SWListInv<Schematic> inv = new SWListInv<>(player, "§eSuchergebnisse", (clickType, schem) -> {
|
||||
SWListInv<Schematic> inv = new SWListInv<>(player, "§eSuchergebnisse", schemList, (clickType, schem) -> {
|
||||
player.closeInventory();
|
||||
info(player, schem);
|
||||
}, schemList);
|
||||
});
|
||||
inv.setCallback(-999, (ClickType click) -> player.closeInventory());
|
||||
inv.open();
|
||||
return true;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren