Implementation of deleting access to schem #64
@ -38,7 +38,7 @@ class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
static void delete(Player p, Schematic schem){
|
||||
private static void deleteOwn(Player p, Schematic schem){
|
||||
SWInventory inv = new SWInventory(p, 9, schem.getSchemName() + " löschen");
|
||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> {
|
||||
schem.remove();
|
||||
@ -57,6 +57,27 @@ class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void deleteMembership(Player p, Schematic schem){
|
||||
SWInventory inv = new SWInventory(p, 9, schem.getSchemName() + " entfernen");
|
||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eZugriff entfernen", click -> {
|
||||
schem.remove();
|
||||
SchematicMember member = SchematicMember.getSchemMemberFromDB(schem.getSchemName(), schem.getSchemID(), SteamwarUser.get(p.getUniqueId()).getId());
|
||||
member.remove();
|
||||
p.sendMessage(SchematicSystem.PREFIX + "Zugriff zu Schematic §e" + schem.getSchemName() + " §7entfernt");
|
||||
p.closeInventory();
|
||||
});
|
||||
inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
||||
inv.setCallback(-999, click -> p.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
|
||||
static void delete(Player p, Schematic schem){
|
||||
if(SteamwarUser.get(p.getUniqueId()).getId() == schem.getSchemOwner())
|
||||
deleteOwn(p, schem);
|
||||
else
|
||||
deleteMembership(p, schem);
|
||||
}
|
||||
|
||||
static void delmembers(Player p, Schematic schem){
|
||||
List<SWListInv.SWListEntry<SchematicMember>> members = new LinkedList<>();
|
||||
for(SchematicMember member : SchematicMember.getSchemMembers(schem.getSchemName(), schem.getSchemOwner())){
|
||||
@ -146,6 +167,11 @@ class GUI {
|
||||
headmeta.setDisplayName("§7von §e" + owneruser.getUserName());
|
||||
owner.setItemMeta(headmeta);
|
||||
inv.setItem(6, owner);
|
||||
|
||||
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> {
|
||||
p.closeInventory();
|
||||
delete(p, schem);
|
||||
});
|
||||
}
|
||||
|
||||
inv.setCallback(-999, click -> p.closeInventory());
|
||||
|
@ -162,11 +162,6 @@ public class SchematicCommand implements CommandExecutor {
|
||||
if(schematic == null)
|
||||
return;
|
||||
|
||||
if(SteamwarUser.get(player.getUniqueId()).getId() != schematic.getSchemOwner()){
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst nur deine eigenen Schematics löschen");
|
||||
return;
|
||||
}
|
||||
|
||||
GUI.delete(player, schematic);
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren