13
0

Fix heads to utilise SWItem-API #76

Manuell gemergt
Lixfel hat 1 Commits von fix-heads nach master 2020-12-26 22:13:06 +01:00 zusammengeführt
Nur Änderungen aus Commit e24c0296d0 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -26,11 +26,9 @@ import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv; import de.steamwar.inventory.SWListInv;
import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.schematicsystem.SchematicSystem;
import de.steamwar.sql.*; import de.steamwar.sql.*;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.*; import java.util.*;
@ -102,7 +100,7 @@ class GUI {
List<SWListInv.SWListEntry<SchematicMember>> members = new LinkedList<>(); List<SWListInv.SWListEntry<SchematicMember>> members = new LinkedList<>();
for(SchematicMember member : SchematicMember.getSchemMembers(schem.getSchemName(), schem.getSchemOwner())){ for(SchematicMember member : SchematicMember.getSchemMembers(schem.getSchemName(), schem.getSchemOwner())){
SteamwarUser user = SteamwarUser.get(member.getMember()); SteamwarUser user = SteamwarUser.get(member.getMember());
members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(Bukkit.getOfflinePlayer(user.getUUID())), member)); members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(user.getUserName()), member));
} }
SWListInv<SchematicMember> inv = new SWListInv<>(p, "Mitglieder entfernen", members, (clickType, member) -> { SWListInv<SchematicMember> inv = new SWListInv<>(p, "Mitglieder entfernen", members, (clickType, member) -> {
@ -169,10 +167,13 @@ class GUI {
p.closeInventory(); p.closeInventory();
SchematicCommand.download(p, schem); SchematicCommand.download(p, schem);
}); });
inv.setItem(6, SWItem.getMaterial("SKULL_ITEM"), "§eMitglieder", click -> { SWItem skull = SWItem.getPlayerSkull("MHF_STEVE");
skull.setCallback(click -> {
p.closeInventory(); p.closeInventory();
delmembers(p, schem); delmembers(p, schem);
}); });
skull.setName("§eMitglieder");
inv.setItem(6, skull);
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> { inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> {
p.closeInventory(); p.closeInventory();
delete(p, schem); delete(p, schem);
@ -181,12 +182,9 @@ class GUI {
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), click -> {}); inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), click -> {});
SteamwarUser owneruser = SteamwarUser.get(schem.getSchemOwner()); SteamwarUser owneruser = SteamwarUser.get(schem.getSchemOwner());
SWItem owner = SWItem.getPlayerSkull(owneruser.getUserName()); SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName());
SkullMeta headmeta = (SkullMeta)owner.getItemMeta(); skull.setName("§7von §e" + owneruser.getUserName());
headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(owneruser.getUUID())); inv.setItem(6, skull);
headmeta.setDisplayName("§7von §e" + owneruser.getUserName());
owner.setItemMeta(headmeta);
inv.setItem(6, owner);
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> { inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> {
p.closeInventory(); p.closeInventory();