Merge pull request 'Last Filters in SchematicSelector' (#247) from last-filters into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #247 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
3957ab5c97
@ -69,6 +69,11 @@ SCHEM_SELECTOR_SCHEMATIC=Schematic
|
|||||||
SCHEM_SELECTOR_DIRECTORY=Directory
|
SCHEM_SELECTOR_DIRECTORY=Directory
|
||||||
SCHEM_SELECTOR_SCHEMATIC_NODE=Schematic/Directory
|
SCHEM_SELECTOR_SCHEMATIC_NODE=Schematic/Directory
|
||||||
|
|
||||||
|
SCHEM_SELECTOR_FILTER_TITLE_SINGLE=§eSingle Filter
|
||||||
|
SCHEM_SELECTOR_FILTER_TITLE_MULTI=§e{0} Filters
|
||||||
|
SCHEM_SELECTOR_FILTER_TITLE_EMPTY=§eNo Filters
|
||||||
|
SCHEM_SELECTOR_FILTER_EMPTY=§7Empty
|
||||||
|
|
||||||
MATERIAL_SELECTOR_TITLE=Select material
|
MATERIAL_SELECTOR_TITLE=Select material
|
||||||
|
|
||||||
BAN_TEAM={0} §e{1} §7was §e§lbanned§7 by §e{2} {3}§8: §f{4}
|
BAN_TEAM={0} §e{1} §7was §e§lbanned§7 by §e{2} {3}§8: §f{4}
|
||||||
|
@ -64,6 +64,11 @@ SCHEM_SELECTOR_SCHEMATIC=Schematic
|
|||||||
SCHEM_SELECTOR_DIRECTORY=Ordner
|
SCHEM_SELECTOR_DIRECTORY=Ordner
|
||||||
SCHEM_SELECTOR_SCHEMATIC_NODE=Schematic/Ordner
|
SCHEM_SELECTOR_SCHEMATIC_NODE=Schematic/Ordner
|
||||||
|
|
||||||
|
SCHEM_SELECTOR_FILTER_TITLE_SINGLE=§eEinzelfilter
|
||||||
|
SCHEM_SELECTOR_FILTER_TITLE_MULTI=§e{0} §e§lMehrfachfilter
|
||||||
|
SCHEM_SELECTOR_FILTER_TITLE_EMPTY=§eKeine Filter
|
||||||
|
SCHEM_SELECTOR_FILTER_EMPTY=§7Leer
|
||||||
|
|
||||||
MATERIAL_SELECTOR_TITLE=Material auswählen
|
MATERIAL_SELECTOR_TITLE=Material auswählen
|
||||||
|
|
||||||
BAN_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgebannt§8: §f{4}
|
BAN_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgebannt§8: §f{4}
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
package de.steamwar.inventory;
|
package de.steamwar.inventory;
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.sql.*;
|
import de.steamwar.sql.*;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
@ -34,6 +37,7 @@ import java.util.function.Consumer;
|
|||||||
public class SchematicSelector {
|
public class SchematicSelector {
|
||||||
|
|
||||||
private static final Sorting[] all_sortings = Sorting.values();
|
private static final Sorting[] all_sortings = Sorting.values();
|
||||||
|
private static final Map<Player, SelectorFilter[]> filterCache = new HashMap<>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Player player;
|
private final Player player;
|
||||||
@ -44,7 +48,7 @@ public class SchematicSelector {
|
|||||||
private Consumer<SchematicNode> callback;
|
private Consumer<SchematicNode> callback;
|
||||||
private final SelectorTarget target;
|
private final SelectorTarget target;
|
||||||
@Getter
|
@Getter
|
||||||
private final SelectorFilter filter = new SelectorFilter();
|
private SelectorFilter filter;
|
||||||
private SchematicSelectorInjectable injectable = SchematicSelectorInjectable.DEFAULT;
|
private SchematicSelectorInjectable injectable = SchematicSelectorInjectable.DEFAULT;
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
@ -96,7 +100,7 @@ public class SchematicSelector {
|
|||||||
|
|
||||||
private void openList(SchematicNode parent) {
|
private void openList(SchematicNode parent) {
|
||||||
lastParent = parent;
|
lastParent = parent;
|
||||||
List<SchematicNode> nodes = applySorting(filter.isFilter()?getFilteredSchematics():getSchematicList(parent));
|
List<SchematicNode> nodes = applySorting(filter != null?getFilteredSchematics():getSchematicList(parent));
|
||||||
|
|
||||||
if(sdoTrigger) {
|
if(sdoTrigger) {
|
||||||
sdoTrigger = false;
|
sdoTrigger = false;
|
||||||
@ -115,7 +119,7 @@ public class SchematicSelector {
|
|||||||
list.add(renderItem(node));
|
list.add(renderItem(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
SWListInv<SchematicNode> inv = new SWListInv<>(player, MessageFormat.format(injectable.createTitle(player), target.target.getName(player), filter.getName() == null?(parent == null?"/":parent.generateBreadcrumbs()):filter.getName()), false, list, (clickType, node) -> handleClick(node, parent));
|
SWListInv<SchematicNode> inv = new SWListInv<>(player, MessageFormat.format(injectable.createTitle(player), target.target.getName(player), (filter == null || filter.getName() == null)?(parent == null?"/":parent.generateBreadcrumbs()):filter.getName()), false, list, (clickType, node) -> handleClick(node, parent));
|
||||||
if(publicMode == PublicMode.ALL) {
|
if(publicMode == PublicMode.ALL) {
|
||||||
if(user.getId() == 0) {
|
if(user.getId() == 0) {
|
||||||
inv.setItem(48, Material.BUCKET, Core.MESSAGE.parse("SCHEM_SELECTOR_OWN", player), clickType -> {
|
inv.setItem(48, Material.BUCKET, Core.MESSAGE.parse("SCHEM_SELECTOR_OWN", player), clickType -> {
|
||||||
@ -188,12 +192,12 @@ public class SchematicSelector {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(node.isDir()) {
|
if(node.isDir()) {
|
||||||
if(filter.isFilter() && target.target.dirs) {
|
if(filter != null && target.target.dirs) {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
callback.accept(node);
|
callback.accept(node);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
filter.reset();
|
filter = null;
|
||||||
depth++;
|
depth++;
|
||||||
openList(node);
|
openList(node);
|
||||||
return;
|
return;
|
||||||
@ -227,9 +231,9 @@ public class SchematicSelector {
|
|||||||
private SWListInv.SWListEntry<SchematicNode> renderItem(SchematicNode node) {
|
private SWListInv.SWListEntry<SchematicNode> renderItem(SchematicNode node) {
|
||||||
Material m = SWItem.getMaterial(node.getItem());
|
Material m = SWItem.getMaterial(node.getItem());
|
||||||
|
|
||||||
String name = Core.MESSAGE.parse(filter.name == null?"SCHEM_SELECTOR_ITEM_NAME":"SCHEM_SELECTOR_ITEM_NAME_FILTER", player, node.getName());
|
String name = Core.MESSAGE.parse((filter != null && filter.name == null)?"SCHEM_SELECTOR_ITEM_NAME":"SCHEM_SELECTOR_ITEM_NAME_FILTER", player, node.getName());
|
||||||
|
|
||||||
if(filter.getName() != null) {
|
if(filter != null && filter.getName() != null) {
|
||||||
name = name.replace(filter.getName(), Core.MESSAGE.parse("SCHEM_SELECTOR_ITEM_REPLACE", player, filter.getName()));
|
name = name.replace(filter.getName(), Core.MESSAGE.parse("SCHEM_SELECTOR_ITEM_REPLACE", player, filter.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,16 +277,20 @@ public class SchematicSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void openFilter() {
|
private void openFilter() {
|
||||||
SWInventory inv = new SWInventory(player, 9, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_TITLE", player));
|
if (filter == null) {
|
||||||
|
filter = new SelectorFilter(null, null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
SWInventory inv = new SWInventory(player, 9 * 2, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_TITLE", player));
|
||||||
InvCallback nameCallback = clickType -> {
|
InvCallback nameCallback = clickType -> {
|
||||||
if(clickType.isRightClick()) {
|
if(clickType.isRightClick()) {
|
||||||
filter.setName(null);
|
filter = filter.withName(null);
|
||||||
openFilter();
|
openFilter();
|
||||||
} else {
|
} else {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_ENTER_NAME", player));
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_ENTER_NAME", player));
|
||||||
swAnvilInv.setItem(Material.NAME_TAG, Collections.singletonList(Core.MESSAGE.parse("SCHEM_SELECTOR_CLICK_BACK", player)), false);
|
swAnvilInv.setItem(Material.NAME_TAG, Collections.singletonList(Core.MESSAGE.parse("SCHEM_SELECTOR_CLICK_BACK", player)), false);
|
||||||
swAnvilInv.setCallback(s -> {
|
swAnvilInv.setCallback(s -> {
|
||||||
filter.setName(s);
|
filter = filter.withName(s);
|
||||||
openFilter();
|
openFilter();
|
||||||
});
|
});
|
||||||
addLeftCloseAction(swAnvilInv, this::openFilter);
|
addLeftCloseAction(swAnvilInv, this::openFilter);
|
||||||
@ -297,14 +305,14 @@ public class SchematicSelector {
|
|||||||
|
|
||||||
InvCallback ownerCallback = clickType -> {
|
InvCallback ownerCallback = clickType -> {
|
||||||
if(clickType.isRightClick()) {
|
if(clickType.isRightClick()) {
|
||||||
filter.setOwner(null);
|
filter = filter.withOwner(null);
|
||||||
openFilter();
|
openFilter();
|
||||||
} else {
|
} else {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_ENTER_OWNER", player));
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_ENTER_OWNER", player));
|
||||||
swAnvilInv.setItem(SWItem.getMaterial("SKULL_ITEM"), (byte) 3, Collections.singletonList(Core.MESSAGE.parse("SCHEM_SELECTOR_CLICK_BACK", player)), false);
|
swAnvilInv.setItem(SWItem.getMaterial("SKULL_ITEM"), (byte) 3, Collections.singletonList(Core.MESSAGE.parse("SCHEM_SELECTOR_CLICK_BACK", player)), false);
|
||||||
swAnvilInv.setCallback(s -> {
|
swAnvilInv.setCallback(s -> {
|
||||||
if(SteamwarUser.get(s) != null) {
|
if(SteamwarUser.get(s) != null) {
|
||||||
filter.setOwner(SteamwarUser.get(s).getId());
|
filter = filter.withOwner(SteamwarUser.get(s).getId());
|
||||||
}
|
}
|
||||||
openFilter();
|
openFilter();
|
||||||
});
|
});
|
||||||
@ -327,15 +335,13 @@ public class SchematicSelector {
|
|||||||
if(target.target != Target.SCHEMATIC_TYPE) {
|
if(target.target != Target.SCHEMATIC_TYPE) {
|
||||||
InvCallback schemTypeCallback = clickType -> {
|
InvCallback schemTypeCallback = clickType -> {
|
||||||
if(clickType.isRightClick()) {
|
if(clickType.isRightClick()) {
|
||||||
filter.setType(null);
|
filter = filter.withType(null);
|
||||||
openFilter();
|
openFilter();
|
||||||
} else {
|
} else {
|
||||||
List<SWListInv.SWListEntry<SchematicType>> types = new ArrayList<>();
|
List<SWListInv.SWListEntry<SchematicType>> types = new ArrayList<>();
|
||||||
SchematicType.values().forEach(schematicType -> {
|
SchematicType.values().forEach(schematicType -> types.add(new SWListInv.SWListEntry<>(new SWItem(SWItem.getMaterial(schematicType.getMaterial()), "§e" + schematicType.name(), Collections.emptyList(), schematicType.fightType(), n -> {}), schematicType)));
|
||||||
types.add(new SWListInv.SWListEntry<>(new SWItem(SWItem.getMaterial(schematicType.getMaterial()), "§e" + schematicType.name(), Collections.emptyList(), schematicType.fightType(), n -> {}), schematicType));
|
|
||||||
});
|
|
||||||
SWListInv<SchematicType> listInv = new SWListInv<>(player, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_SEL_TYPE", player), types, (clickType1, schematicType) -> {
|
SWListInv<SchematicType> listInv = new SWListInv<>(player, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_SEL_TYPE", player), types, (clickType1, schematicType) -> {
|
||||||
filter.setType(schematicType);
|
filter = filter.withType(schematicType);
|
||||||
openFilter();
|
openFilter();
|
||||||
});
|
});
|
||||||
listInv.open();
|
listInv.open();
|
||||||
@ -351,11 +357,11 @@ public class SchematicSelector {
|
|||||||
|
|
||||||
InvCallback materialCallback = clickType -> {
|
InvCallback materialCallback = clickType -> {
|
||||||
if(clickType.isRightClick()) {
|
if(clickType.isRightClick()) {
|
||||||
filter.setItem(null);
|
filter = filter.withItem(null);
|
||||||
openFilter();
|
openFilter();
|
||||||
} else {
|
} else {
|
||||||
UtilGui.openMaterialSelector(player, material -> {
|
UtilGui.openMaterialSelector(player, material -> {
|
||||||
filter.setItem(material);
|
filter = filter.withItem(material);
|
||||||
openFilter();
|
openFilter();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -369,13 +375,67 @@ public class SchematicSelector {
|
|||||||
inv.setItem(iSlot, filter.getItem(), Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_MAT", player), Collections.singletonList(Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_MAT_SEARCH", player, filter.getItem().name())), true, materialCallback);
|
inv.setItem(iSlot, filter.getItem(), Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_MAT", player), Collections.singletonList(Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_MAT_SEARCH", player, filter.getItem().name())), true, materialCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!filterCache.containsKey(player)) {
|
||||||
|
filterCache.put(player, new SelectorFilter[9]);
|
||||||
|
|
||||||
|
String cfg = UserConfig.getConfig(user.getId(), "selector:filters");
|
||||||
|
|
||||||
|
if (cfg != null) {
|
||||||
|
JsonArray array = JsonParser.parseString(cfg).getAsJsonArray();
|
||||||
|
for (int i = 0; i < array.size(); i++) {
|
||||||
|
JsonObject object = array.get(i).getAsJsonObject();
|
||||||
|
filterCache.get(player)[i] = new SelectorFilter(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectorFilter[] filters = filterCache.get(player);
|
||||||
|
|
||||||
|
for (int i = 0; i < filters.length; i++) {
|
||||||
|
SelectorFilter filterCached = filters[i];
|
||||||
|
if (filterCached == null) {
|
||||||
|
inv.setItem(i + 9, new SWItem(Material.BARRIER, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_EMPTY", player), click -> {}));
|
||||||
|
} else {
|
||||||
|
SWItem item = filterCached.toItemStack(player);
|
||||||
|
item.setEnchanted(filterCached.equals(filter));
|
||||||
|
inv.setItem(i + 9, item.getItemStack(), click -> {
|
||||||
|
filter = filterCached;
|
||||||
|
openFilter();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inv.setItem(7, SWItem.getDye(1), Core.MESSAGE.parse("SCHEM_SELECTOR_CANCEL", player), clickType -> {
|
inv.setItem(7, SWItem.getDye(1), Core.MESSAGE.parse("SCHEM_SELECTOR_CANCEL", player), clickType -> {
|
||||||
filter.reset();
|
filter = null;
|
||||||
depth = 0;
|
depth = 0;
|
||||||
openList(null);
|
openList(null);
|
||||||
});
|
});
|
||||||
inv.setItem(8, SWItem.getDye(10), Core.MESSAGE.parse("SCHEM_SELECTOR_GO", player), clickType -> {
|
inv.setItem(8, SWItem.getDye(10), Core.MESSAGE.parse("SCHEM_SELECTOR_GO", player), clickType -> {
|
||||||
filter.setFilter(true);
|
if (!filter.equals(filters[0])) {
|
||||||
|
for (int i = filters.length - 1; i > 0; i--) {
|
||||||
|
filters[i] = filters[i-1];
|
||||||
|
if (filter.equals(filters[i])) {
|
||||||
|
filters[i] = null;
|
||||||
|
for (int j = i; j < filters.length - 1; j++) {
|
||||||
|
filters[j] = filters[j+1];
|
||||||
|
}
|
||||||
|
filters[filters.length - 1] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
filters[0] = filter;
|
||||||
|
|
||||||
|
filterCache.put(player, filters);
|
||||||
|
JsonArray array = new JsonArray();
|
||||||
|
for (SelectorFilter f : filters) {
|
||||||
|
if (f != null) {
|
||||||
|
array.add(f.toJson());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UserConfig.updatePlayerConfig(user.getId(), "selector:filters", array.toString());
|
||||||
|
}
|
||||||
|
|
||||||
injectable.onFilterApply(this);
|
injectable.onFilterApply(this);
|
||||||
depth = 0;
|
depth = 0;
|
||||||
openList(null);
|
openList(null);
|
||||||
@ -454,7 +514,7 @@ public class SchematicSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
static class SelectorTarget {
|
public static class SelectorTarget {
|
||||||
|
|
||||||
private final Target target;
|
private final Target target;
|
||||||
private final SchematicType type;
|
private final SchematicType type;
|
||||||
@ -476,31 +536,26 @@ public class SchematicSelector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@With
|
||||||
|
@EqualsAndHashCode
|
||||||
public static class SelectorFilter {
|
public static class SelectorFilter {
|
||||||
|
private final String name;
|
||||||
|
private final Integer owner;
|
||||||
|
private final SchematicType type;
|
||||||
|
private final Material item;
|
||||||
|
|
||||||
private boolean filter;
|
public SelectorFilter(JsonObject object) {
|
||||||
|
this.name = object.get("name").isJsonNull() ? null : object.get("name").getAsString();
|
||||||
private String name = null;
|
this.owner = object.get("owner").isJsonNull() ? null : object.get("owner").getAsInt();
|
||||||
private Integer owner = null;
|
this.type = object.get("type").isJsonNull() ? null : SchematicType.fromDB(object.get("type").getAsString());
|
||||||
private SchematicType type = null;
|
this.item = object.get("item").isJsonNull() ? null : Material.valueOf(object.get("item").getAsString());
|
||||||
private Material item = null;
|
|
||||||
|
|
||||||
public void reset() {
|
|
||||||
name = null;
|
|
||||||
owner = null;
|
|
||||||
type = null;
|
|
||||||
item = null;
|
|
||||||
filter = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(SchematicNode node) {
|
public boolean matches(SchematicNode node) {
|
||||||
boolean matches = true;
|
boolean matches = name == null || node.getName().contains(name);
|
||||||
if(name != null && !node.getName().contains(name)) {
|
|
||||||
matches = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(owner != null && node.getOwner() != owner) {
|
if(owner != null && node.getOwner() != owner) {
|
||||||
matches = false;
|
matches = false;
|
||||||
@ -523,6 +578,60 @@ public class SchematicSelector {
|
|||||||
}
|
}
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getCount() {
|
||||||
|
return Arrays.stream(new Object[]{name, owner, type, item}).filter(Objects::nonNull).count();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getItemLore(Player player) {
|
||||||
|
List<String> lore = new ArrayList<>(4);
|
||||||
|
if(name != null) {
|
||||||
|
lore.add(Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_NAME_SEARCH", player, name));
|
||||||
|
}
|
||||||
|
if(owner != null) {
|
||||||
|
lore.add(Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_OWNER_SEARCH", player, SteamwarUser.get(owner).getUserName()));
|
||||||
|
}
|
||||||
|
if(type != null) {
|
||||||
|
lore.add(Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_TYPE_SEARCH", player, type.name()));
|
||||||
|
}
|
||||||
|
if(item != null) {
|
||||||
|
lore.add(Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_MAT_SEARCH", player, item.name()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return lore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWItem toItemStack(Player player) {
|
||||||
|
long count = getCount();
|
||||||
|
String itemName = count != 1 ? Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_TITLE_MULTI", player, count) : Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_TITLE_SINGLE", player);
|
||||||
|
|
||||||
|
List<String> lore = getItemLore(player);
|
||||||
|
|
||||||
|
if (name != null) {
|
||||||
|
return new SWItem(Material.NAME_TAG, itemName, lore, false, click -> {});
|
||||||
|
} else if (owner != null) {
|
||||||
|
SWItem playerSkull = SWItem.getPlayerSkull(SteamwarUser.get(owner).getUserName());
|
||||||
|
playerSkull.setName(itemName);
|
||||||
|
playerSkull.setLore(lore);
|
||||||
|
return playerSkull;
|
||||||
|
} else if (type != null) {
|
||||||
|
return new SWItem(SWItem.getMaterial(type.getMaterial()), itemName, lore, false, n -> {});
|
||||||
|
} else if (item != null) {
|
||||||
|
return new SWItem(item, itemName, lore, false, click -> {});
|
||||||
|
} else {
|
||||||
|
return new SWItem(Material.BARRIER, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_TITLE_EMPTY", player), Collections.emptyList(), false, click -> {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public JsonObject toJson() {
|
||||||
|
JsonObject object = new JsonObject();
|
||||||
|
object.addProperty("name", name);
|
||||||
|
object.addProperty("owner", owner);
|
||||||
|
object.addProperty("type", type == null?null:type.toDB());
|
||||||
|
object.addProperty("item", item == null?null:item.name());
|
||||||
|
|
||||||
|
return object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PublicMode {
|
public enum PublicMode {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren