Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
7ae525391e
Commit
09c69e4b3c
@ -931,6 +931,9 @@ NAVIGATION_WAND=§eNavigation Wand
|
|||||||
NAVIGATION_WAND_LEFT_CLICK=§eLeft click: jump to location
|
NAVIGATION_WAND_LEFT_CLICK=§eLeft click: jump to location
|
||||||
NAVIGATION_WAND_RIGHT_CLICK=§eRight click: pass through walls
|
NAVIGATION_WAND_RIGHT_CLICK=§eRight click: pass through walls
|
||||||
# Material
|
# Material
|
||||||
|
MATERIAL_SEARCH_PROPERTY_TRUE = §aShould have
|
||||||
|
MATERIAL_SEARCH_PROPERTY_FALSE = §cShould not have
|
||||||
|
MATERIAL_SEARCH_PROPERTY_IGNORE = §eIgnore
|
||||||
MATERIAL_INV_NAME=§eMaterial {0}/{1}
|
MATERIAL_INV_NAME=§eMaterial {0}/{1}
|
||||||
MATERIAL_SEARCH=§eSearch
|
MATERIAL_SEARCH=§eSearch
|
||||||
MATERIAL_BACK=§eBack
|
MATERIAL_BACK=§eBack
|
||||||
@ -944,9 +947,6 @@ MATERIAL_SEARCH_FLAMMABLE=§eFlammable
|
|||||||
MATERIAL_SEARCH_BURNABLE=§eBurnable
|
MATERIAL_SEARCH_BURNABLE=§eBurnable
|
||||||
MATERIAL_SEARCH_WATERLOGGABLE=§eWaterloggable
|
MATERIAL_SEARCH_WATERLOGGABLE=§eWaterloggable
|
||||||
MATERIAL_SEARCH_BLASTRESISTANCE=§eBlast resistance
|
MATERIAL_SEARCH_BLASTRESISTANCE=§eBlast resistance
|
||||||
MATERIAL_SEARCH_BLASTRESISTANCE_MIN=§eBlast resistance minimum
|
|
||||||
MATERIAL_SEARCH_BLASTRESISTANCE_MAX=§eBlast resistance maximum
|
|
||||||
MATERIAL_SEARCH_BLASTRESISTANCE_EXACT=§eBlast resistance
|
|
||||||
MATERIAL_SEARCH_VALUE=§8: §e{0}
|
MATERIAL_SEARCH_VALUE=§8: §e{0}
|
||||||
MATERIAL_BLAST_RESISTANCE=§8- §eBlast resistance§8: §7{0}
|
MATERIAL_BLAST_RESISTANCE=§8- §eBlast resistance§8: §7{0}
|
||||||
MATERIAL_HARDNESS=§8- §eHardness§8: §7{0}
|
MATERIAL_HARDNESS=§8- §eHardness§8: §7{0}
|
||||||
|
@ -911,6 +911,9 @@ NAVIGATION_WAND=§eNavigation Wand
|
|||||||
NAVIGATION_WAND_LEFT_CLICK=§eLeft click: jump to location
|
NAVIGATION_WAND_LEFT_CLICK=§eLeft click: jump to location
|
||||||
NAVIGATION_WAND_RIGHT_CLICK=§eRight click: pass through walls
|
NAVIGATION_WAND_RIGHT_CLICK=§eRight click: pass through walls
|
||||||
# Material
|
# Material
|
||||||
|
MATERIAL_SEARCH_PROPERTY_TRUE = §aHat
|
||||||
|
MATERIAL_SEARCH_PROPERTY_FALSE = §cHat nicht
|
||||||
|
MATERIAL_SEARCH_PROPERTY_IGNORE = §eEgal
|
||||||
MATERIAL_INV_NAME=§eMaterial {0}/{1}
|
MATERIAL_INV_NAME=§eMaterial {0}/{1}
|
||||||
MATERIAL_SEARCH=§eSuchen
|
MATERIAL_SEARCH=§eSuchen
|
||||||
MATERIAL_BACK=§eZurück
|
MATERIAL_BACK=§eZurück
|
||||||
@ -924,9 +927,6 @@ MATERIAL_SEARCH_FLAMMABLE=§eFlammbar
|
|||||||
MATERIAL_SEARCH_BURNABLE=§eBrennbar
|
MATERIAL_SEARCH_BURNABLE=§eBrennbar
|
||||||
MATERIAL_SEARCH_WATERLOGGABLE=§eWasserspeicherbar
|
MATERIAL_SEARCH_WATERLOGGABLE=§eWasserspeicherbar
|
||||||
MATERIAL_SEARCH_BLASTRESISTANCE=§eBlast Resistance
|
MATERIAL_SEARCH_BLASTRESISTANCE=§eBlast Resistance
|
||||||
MATERIAL_SEARCH_BLASTRESISTANCE_MIN=§eBlast Resistance mindestens
|
|
||||||
MATERIAL_SEARCH_BLASTRESISTANCE_MAX=§eBlast Resistance maximal
|
|
||||||
MATERIAL_SEARCH_BLASTRESISTANCE_EXACT=§eBlast Resistance
|
|
||||||
MATERIAL_SEARCH_VALUE=§8: §e{0}
|
MATERIAL_SEARCH_VALUE=§8: §e{0}
|
||||||
MATERIAL_BLAST_RESISTANCE=§8- §eBlast Resistance§8: §7{0}
|
MATERIAL_BLAST_RESISTANCE=§8- §eBlast Resistance§8: §7{0}
|
||||||
MATERIAL_HARDNESS=§8- §eHärte§8: §7{0}
|
MATERIAL_HARDNESS=§8- §eHärte§8: §7{0}
|
||||||
|
@ -22,12 +22,14 @@ package de.steamwar.bausystem.features.util;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import de.steamwar.bausystem.shared.EnumDisplay;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.command.TypeMapper;
|
import de.steamwar.command.TypeMapper;
|
||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SWListInv;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -41,6 +43,9 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -141,101 +146,126 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
|
|
||||||
public boolean is(Search search) {
|
public boolean is(Search search) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
if (search.transparent) {
|
result &= search.transparent.test(transparent);
|
||||||
result &= transparent;
|
result &= search.solid.test(solid);
|
||||||
}
|
result &= search.gravity.test(gravity);
|
||||||
if (search.solid) {
|
result &= search.occluding.test(occluding);
|
||||||
result &= solid;
|
result &= search.interacteable.test(interacteable);
|
||||||
}
|
result &= search.flammable.test(flammable);
|
||||||
if (search.gravity) {
|
result &= search.burnable.test(burnable);
|
||||||
result &= gravity;
|
result &= search.waterloggable.test(waterloggable);
|
||||||
}
|
|
||||||
if (search.occluding) {
|
|
||||||
result &= occluding;
|
|
||||||
}
|
|
||||||
if (search.interacteable) {
|
|
||||||
result &= interacteable;
|
|
||||||
}
|
|
||||||
if (search.flammable) {
|
|
||||||
result &= flammable;
|
|
||||||
}
|
|
||||||
if (search.burnable) {
|
|
||||||
result &= burnable;
|
|
||||||
}
|
|
||||||
if (search.waterloggable) {
|
|
||||||
result &= waterloggable;
|
|
||||||
}
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(blastResistance >= search.blastResistanceMin && blastResistance < search.blastResistanceMax)) {
|
if (!search.blastResistance.isEmpty()) {
|
||||||
return false;
|
String[] strings = search.blastResistance.split(" ");
|
||||||
|
for (String string : strings) {
|
||||||
|
string = string.replace(",", ".");
|
||||||
|
if (string.startsWith("=")) {
|
||||||
|
if (blastResistance != Double.parseDouble(string.substring(1))) return false;
|
||||||
|
} else if (string.startsWith(">")) {
|
||||||
|
if (blastResistance <= Double.parseDouble(string.substring(1))) return false;
|
||||||
|
} else if (string.startsWith("<")) {
|
||||||
|
if (blastResistance >= Double.parseDouble(string.substring(1))) return false;
|
||||||
|
} else if (string.startsWith("!")) {
|
||||||
|
if (blastResistance == Double.parseDouble(string.substring(1))) return false;
|
||||||
|
} else if (string.startsWith(">=")) {
|
||||||
|
if (blastResistance < Double.parseDouble(string.substring(2))) return false;
|
||||||
|
} else if (string.startsWith("<=")) {
|
||||||
|
if (blastResistance > Double.parseDouble(string.substring(2)))return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (search.name.isEmpty()) {
|
if (search.name.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return Pattern.compile(".*" + search.name.toLowerCase().replace(' ', '.') + ".*").asPredicate().test(name.toLowerCase());
|
return Pattern.compile(search.name.toLowerCase().replace(".", ".+").replace(" ", ".")).asPredicate().test(name.toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private static class Search {
|
private static class Search {
|
||||||
private boolean transparent = false;
|
private SearchType transparent = SearchType.IGNORE;
|
||||||
private boolean solid = false;
|
private SearchType solid = SearchType.IGNORE;
|
||||||
private boolean gravity = false;
|
private SearchType gravity = SearchType.IGNORE;
|
||||||
private boolean occluding = false;
|
private SearchType occluding = SearchType.IGNORE;
|
||||||
private boolean interacteable = false;
|
private SearchType interacteable = SearchType.IGNORE;
|
||||||
private boolean flammable = false;
|
private SearchType flammable = SearchType.IGNORE;
|
||||||
private boolean burnable = false;
|
private SearchType burnable = SearchType.IGNORE;
|
||||||
private boolean waterloggable = false;
|
private SearchType waterloggable = SearchType.IGNORE;
|
||||||
|
|
||||||
private double blastResistanceMin = 0;
|
private String blastResistance = "";
|
||||||
private double blastResistanceMax = 5000000;
|
|
||||||
private String name = "";
|
private String name = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
private enum SearchType implements EnumDisplay {
|
||||||
|
TRUE("MATERIAL_SEARCH_PROPERTY_TRUE", b -> b),
|
||||||
|
FALSE("MATERIAL_SEARCH_PROPERTY_FALSE", b -> !b),
|
||||||
|
IGNORE("MATERIAL_SEARCH_PROPERTY_IGNORE", b -> true);
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private String chatValue;
|
||||||
|
private Predicate<Boolean> predicate;
|
||||||
|
|
||||||
|
public boolean test(boolean b) {
|
||||||
|
return predicate.test(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SearchType next() {
|
||||||
|
switch (this) {
|
||||||
|
case TRUE:
|
||||||
|
return FALSE;
|
||||||
|
case FALSE:
|
||||||
|
return IGNORE;
|
||||||
|
case IGNORE:
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return IGNORE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void materialGUI(Player p) {
|
public void materialGUI(Player p) {
|
||||||
materialGUI(p, searchMap.get(p));
|
materialGUI(p, searchMap.get(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Map<String, BiConsumer<Search, SearchType>> elements = new HashMap<>();
|
||||||
|
static {
|
||||||
|
elements.put("-transparent", (search, searchType) -> search.transparent = searchType);
|
||||||
|
elements.put("-solid", (search, searchType) -> search.solid = searchType);
|
||||||
|
elements.put("-gravity", (search, searchType) -> search.gravity = searchType);
|
||||||
|
elements.put("-occluding", (search, searchType) -> search.occluding = searchType);
|
||||||
|
elements.put("-interacteable", (search, searchType) -> search.interacteable = searchType);
|
||||||
|
elements.put("-flammable", (search, searchType) -> search.flammable = searchType);
|
||||||
|
elements.put("-burnable", (search, searchType) -> search.burnable = searchType);
|
||||||
|
elements.put("-waterloggable", (search, searchType) -> search.waterloggable = searchType);
|
||||||
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void search(Player p, @Mapper("search") String... searches) {
|
public void search(Player p, @Mapper("search") String... searches) {
|
||||||
Search search = new Search();
|
Search search = new Search();
|
||||||
for (String s : searches) {
|
for (String s : searches) {
|
||||||
|
boolean has = false;
|
||||||
|
for (Map.Entry<String, BiConsumer<Search, SearchType>> element: elements.entrySet()) {
|
||||||
|
if (s.startsWith(element.getKey() + ":")) {
|
||||||
|
element.getValue().accept(search, SearchType.valueOf(s.substring(element.getKey().length() + 1).toUpperCase()));
|
||||||
|
has = true;
|
||||||
|
} else if (s.startsWith(element.getKey().substring(0, 2) + ":")) {
|
||||||
|
element.getValue().accept(search, SearchType.valueOf(s.substring(element.getKey().substring(0, 2).length() + 1).toUpperCase()));
|
||||||
|
has = true;
|
||||||
|
}
|
||||||
|
if (has) break;
|
||||||
|
}
|
||||||
|
if (has) continue;
|
||||||
switch (s.toLowerCase()) {
|
switch (s.toLowerCase()) {
|
||||||
case "-t":
|
case "-br:":
|
||||||
case "-transparent":
|
case "-blastresistance:":
|
||||||
search.transparent = true;
|
s = s.substring(s.indexOf(':') + 1).replace('_', ' ');
|
||||||
break;
|
if (s.isEmpty() || s.matches("((([><]=?)|!|=)\\d+(\\.|,\\d+)?)( ((([><]=?)|!|=)\\d+(\\.|,\\d+)?))*")) {
|
||||||
case "-s":
|
search.blastResistance = s;
|
||||||
case "-solid":
|
}
|
||||||
search.solid = true;
|
|
||||||
break;
|
|
||||||
case "-g":
|
|
||||||
case "-gravity":
|
|
||||||
search.gravity = true;
|
|
||||||
break;
|
|
||||||
case "-o":
|
|
||||||
case "-occluding":
|
|
||||||
search.occluding = true;
|
|
||||||
break;
|
|
||||||
case "-i":
|
|
||||||
case "-interacteable":
|
|
||||||
search.interacteable = true;
|
|
||||||
break;
|
|
||||||
case "-f":
|
|
||||||
case "-flammable":
|
|
||||||
search.flammable = true;
|
|
||||||
break;
|
|
||||||
case "-b":
|
|
||||||
case "-burnable":
|
|
||||||
search.burnable = true;
|
|
||||||
break;
|
|
||||||
case "-w":
|
|
||||||
case "-waterloggable":
|
|
||||||
search.waterloggable = true;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
search.name = s;
|
search.name = s;
|
||||||
@ -247,15 +277,17 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
|
|
||||||
@Mapper(value = "search", local = true)
|
@Mapper(value = "search", local = true)
|
||||||
private TypeMapper<String> searchMapper() {
|
private TypeMapper<String> searchMapper() {
|
||||||
List<List<String>> results = new ArrayList<>();
|
List<String> results = new ArrayList<>();
|
||||||
results.add(Arrays.asList("-t", "-transparent"));
|
for (String s : Arrays.asList("-transparent", "-solid", "-gravity", "-occluding", "-interacteable", "-flammable", "-burnable", "-waterloggable")) {
|
||||||
results.add(Arrays.asList("-s", "-solid"));
|
results.add(s + ":true");
|
||||||
results.add(Arrays.asList("-g", "-gravity"));
|
results.add(s + ":false");
|
||||||
results.add(Arrays.asList("-o", "-occluding"));
|
results.add(s + ":ignore");
|
||||||
results.add(Arrays.asList("-i", "-interacteable"));
|
|
||||||
results.add(Arrays.asList("-f", "-flammable"));
|
s = s.substring(0, 2);
|
||||||
results.add(Arrays.asList("-b", "-burnable"));
|
results.add(s + ":true");
|
||||||
results.add(Arrays.asList("-w", "-waterloggable"));
|
results.add(s + ":false");
|
||||||
|
results.add(s + ":ignore");
|
||||||
|
}
|
||||||
|
|
||||||
return new TypeMapper<String>() {
|
return new TypeMapper<String>() {
|
||||||
@Override
|
@Override
|
||||||
@ -265,14 +297,10 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||||
List<String> result = results.stream().filter(current -> {
|
List<String> tabCompletes = new ArrayList<>();
|
||||||
for (String t : strings) {
|
tabCompletes.addAll(results);
|
||||||
if (current.contains(t)) return false;
|
tabCompletes.add(s);
|
||||||
}
|
return tabCompletes;
|
||||||
return true;
|
|
||||||
}).flatMap(Collection::stream).collect(Collectors.toList());
|
|
||||||
result.add(s);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -306,80 +334,43 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
});
|
});
|
||||||
swAnvilInv.open();
|
swAnvilInv.open();
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(19, new SWItem(Material.GLASS, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_TRANSPARENT", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.transparent), clickType -> {
|
swInventory.setItem(19, new SWItem(Material.GLASS, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_TRANSPARENT", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.transparent.getChatValue(), p)), clickType -> {
|
||||||
search.transparent = !search.transparent;
|
search.transparent = search.transparent.next();
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(20, new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_SOLID", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.solid), clickType -> {
|
swInventory.setItem(20, new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_SOLID", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.solid.getChatValue(), p)), clickType -> {
|
||||||
search.solid = !search.solid;
|
search.solid = search.solid.next();
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(21, new SWItem(Material.BLACK_CONCRETE_POWDER, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_GRAVITY", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.gravity), clickType -> {
|
swInventory.setItem(21, new SWItem(Material.BLACK_CONCRETE_POWDER, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_GRAVITY", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.gravity.getChatValue(), p)), clickType -> {
|
||||||
search.gravity = !search.gravity;
|
search.gravity = search.gravity.next();
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(22, new SWItem(Material.BIRCH_LOG, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_OCCLUDING", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.occluding), clickType -> {
|
swInventory.setItem(22, new SWItem(Material.BIRCH_LOG, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_OCCLUDING", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.occluding.getChatValue(), p)), clickType -> {
|
||||||
search.occluding = !search.occluding;
|
search.occluding = search.occluding.next();
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(23, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_INTERACTEABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.interacteable), clickType -> {
|
swInventory.setItem(23, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_INTERACTEABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.interacteable.getChatValue(), p)), clickType -> {
|
||||||
search.interacteable = !search.interacteable;
|
search.interacteable = search.interacteable.next();
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(24, new SWItem(Material.FLINT_AND_STEEL, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_FLAMMABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.flammable), clickType -> {
|
swInventory.setItem(24, new SWItem(Material.FLINT_AND_STEEL, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_FLAMMABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.flammable.getChatValue(), p)), clickType -> {
|
||||||
search.flammable = !search.flammable;
|
search.flammable = search.flammable.next();
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(25, new SWItem(Material.LAVA_BUCKET, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BURNABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.burnable), clickType -> {
|
swInventory.setItem(25, new SWItem(Material.LAVA_BUCKET, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BURNABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.burnable.getChatValue(), p)), clickType -> {
|
||||||
search.burnable = !search.burnable;
|
search.burnable = search.burnable.next();
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(28, new SWItem(Material.WATER_BUCKET, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_WATERLOGGABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.waterloggable), clickType -> {
|
swInventory.setItem(28, new SWItem(Material.WATER_BUCKET, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_WATERLOGGABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.waterloggable.getChatValue(), p)), clickType -> {
|
||||||
search.waterloggable = !search.waterloggable;
|
search.waterloggable = search.waterloggable.next();
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(30, new SWItem(Material.FIRE_CHARGE, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE_MIN", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.blastResistanceMin), clickType -> {
|
swInventory.setItem(30, new SWItem(Material.NETHER_BRICK, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.blastResistance), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p), search.blastResistanceMin + "");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p), search.blastResistance);
|
||||||
swAnvilInv.setCallback(s -> {
|
swAnvilInv.setCallback(s -> {
|
||||||
try {
|
if (s.isEmpty() || s.matches("((([><]=?)|!|=)\\d+(\\.|,\\d+)?)( ((([><]=?)|!|=)\\d+(\\.|,\\d+)?))*")) {
|
||||||
search.blastResistanceMin = Double.parseDouble(s);
|
search.blastResistance = s;
|
||||||
if (search.blastResistanceMin < 0) search.blastResistanceMin = 0;
|
|
||||||
if (search.blastResistanceMin > 5000000) search.blastResistanceMin = 5000000;
|
|
||||||
if (search.blastResistanceMin > search.blastResistanceMax)
|
|
||||||
search.blastResistanceMin = search.blastResistanceMax;
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
// Ignored
|
|
||||||
}
|
|
||||||
searchGUI(p);
|
|
||||||
});
|
|
||||||
swAnvilInv.open();
|
|
||||||
}));
|
|
||||||
swInventory.setItem(31, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE_MAX", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.blastResistanceMax), clickType -> {
|
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p), search.blastResistanceMax + "");
|
|
||||||
swAnvilInv.setCallback(s -> {
|
|
||||||
try {
|
|
||||||
search.blastResistanceMax = Double.parseDouble(s);
|
|
||||||
if (search.blastResistanceMax > 5000000) search.blastResistanceMax = 5000000;
|
|
||||||
if (search.blastResistanceMax < 0) search.blastResistanceMax = 0;
|
|
||||||
if (search.blastResistanceMax < search.blastResistanceMin)
|
|
||||||
search.blastResistanceMax = search.blastResistanceMin;
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
// Ignored
|
|
||||||
}
|
|
||||||
searchGUI(p);
|
|
||||||
});
|
|
||||||
swAnvilInv.open();
|
|
||||||
}));
|
|
||||||
swInventory.setItem(32, new SWItem(Material.NETHER_BRICK, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE_EXACT", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.blastResistanceMin + "-" + search.blastResistanceMax), clickType -> {
|
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p), search.blastResistanceMax + "");
|
|
||||||
swAnvilInv.setCallback(s -> {
|
|
||||||
try {
|
|
||||||
search.blastResistanceMax = Double.parseDouble(s);
|
|
||||||
if (search.blastResistanceMax > 5000000) search.blastResistanceMax = 5000000;
|
|
||||||
if (search.blastResistanceMax < 0) search.blastResistanceMax = 0;
|
|
||||||
search.blastResistanceMin = search.blastResistanceMax;
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
// Ignored
|
|
||||||
}
|
}
|
||||||
searchGUI(p);
|
searchGUI(p);
|
||||||
});
|
});
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren