SteamWar/BauSystem2.0
Archiviert
12
0

Fix Constants
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-01-20 20:52:37 +01:00
Ursprung 61aaf1287c
Commit 92c4d7a7e2

Datei anzeigen

@ -10,6 +10,7 @@ import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
import lombok.experimental.UtilityClass;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.HashMap;
import java.util.Map;
@ -26,7 +27,8 @@ public class Constants {
private static class ConstantDoubleValue extends Value.DoubleValue {
private Supplier<Double> doubleSupplier;
private Consumer<Double> doubleConsumer = ignored -> {};
private Consumer<Double> doubleConsumer = ignored -> {
};
public ConstantDoubleValue(Supplier<Double> doubleSupplier) {
super(doubleSupplier.get());
@ -73,7 +75,8 @@ public class Constants {
private static class ConstantLongValue extends Value.LongValue {
private Supplier<Long> longSupplier;
private Consumer<Long> longConsumer = ignored -> {};
private Consumer<Long> longConsumer = ignored -> {
};
public ConstantLongValue(Supplier<Long> longSupplier) {
super(longSupplier.get());
@ -120,7 +123,8 @@ public class Constants {
private static class ConstantBooleanValue extends Value.BooleanValue {
private Supplier<Boolean> booleanSupplier;
private Consumer<Boolean> booleanConsumer = ignored -> {};
private Consumer<Boolean> booleanConsumer = ignored -> {
};
public ConstantBooleanValue(Supplier<Boolean> booleanSupplier) {
super(booleanSupplier.get());
@ -167,7 +171,8 @@ public class Constants {
private static class ConstantStringValue extends Value.StringValue {
private Supplier<String> stringSupplier;
private Consumer<String> stringConsumer = ignored -> {};
private Consumer<String> stringConsumer = ignored -> {
};
public ConstantStringValue(Supplier<String> stringSupplier) {
super(stringSupplier.get());
@ -281,10 +286,22 @@ public class Constants {
return new ConstantStringValue(() -> player.getInventory().getItemInOffHand().getType().name());
});
CONSTANTS.put("materialname", player -> {
return new ConstantStringValue(() -> player.getInventory().getItemInMainHand().getItemMeta().getDisplayName());
return new ConstantStringValue(() -> {
ItemMeta itemMeta = player.getInventory().getItemInMainHand().getItemMeta();
if (itemMeta == null) {
return "";
}
return itemMeta.getDisplayName();
});
});
CONSTANTS.put("offmaterialname", player -> {
return new ConstantStringValue(() -> player.getInventory().getItemInOffHand().getItemMeta().getDisplayName());
return new ConstantStringValue(() -> {
ItemMeta itemMeta = player.getInventory().getItemInOffHand().getItemMeta();
if (itemMeta == null) {
return "";
}
return itemMeta.getDisplayName();
});
});
CONSTANTS.put("region-type", player -> {
Region region = Region.getRegion(player.getLocation());