Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
61aaf1287c
Commit
92c4d7a7e2
@ -10,6 +10,7 @@ import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
|
|||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -26,7 +27,8 @@ public class Constants {
|
|||||||
private static class ConstantDoubleValue extends Value.DoubleValue {
|
private static class ConstantDoubleValue extends Value.DoubleValue {
|
||||||
|
|
||||||
private Supplier<Double> doubleSupplier;
|
private Supplier<Double> doubleSupplier;
|
||||||
private Consumer<Double> doubleConsumer = ignored -> {};
|
private Consumer<Double> doubleConsumer = ignored -> {
|
||||||
|
};
|
||||||
|
|
||||||
public ConstantDoubleValue(Supplier<Double> doubleSupplier) {
|
public ConstantDoubleValue(Supplier<Double> doubleSupplier) {
|
||||||
super(doubleSupplier.get());
|
super(doubleSupplier.get());
|
||||||
@ -73,7 +75,8 @@ public class Constants {
|
|||||||
private static class ConstantLongValue extends Value.LongValue {
|
private static class ConstantLongValue extends Value.LongValue {
|
||||||
|
|
||||||
private Supplier<Long> longSupplier;
|
private Supplier<Long> longSupplier;
|
||||||
private Consumer<Long> longConsumer = ignored -> {};
|
private Consumer<Long> longConsumer = ignored -> {
|
||||||
|
};
|
||||||
|
|
||||||
public ConstantLongValue(Supplier<Long> longSupplier) {
|
public ConstantLongValue(Supplier<Long> longSupplier) {
|
||||||
super(longSupplier.get());
|
super(longSupplier.get());
|
||||||
@ -120,7 +123,8 @@ public class Constants {
|
|||||||
private static class ConstantBooleanValue extends Value.BooleanValue {
|
private static class ConstantBooleanValue extends Value.BooleanValue {
|
||||||
|
|
||||||
private Supplier<Boolean> booleanSupplier;
|
private Supplier<Boolean> booleanSupplier;
|
||||||
private Consumer<Boolean> booleanConsumer = ignored -> {};
|
private Consumer<Boolean> booleanConsumer = ignored -> {
|
||||||
|
};
|
||||||
|
|
||||||
public ConstantBooleanValue(Supplier<Boolean> booleanSupplier) {
|
public ConstantBooleanValue(Supplier<Boolean> booleanSupplier) {
|
||||||
super(booleanSupplier.get());
|
super(booleanSupplier.get());
|
||||||
@ -167,7 +171,8 @@ public class Constants {
|
|||||||
private static class ConstantStringValue extends Value.StringValue {
|
private static class ConstantStringValue extends Value.StringValue {
|
||||||
|
|
||||||
private Supplier<String> stringSupplier;
|
private Supplier<String> stringSupplier;
|
||||||
private Consumer<String> stringConsumer = ignored -> {};
|
private Consumer<String> stringConsumer = ignored -> {
|
||||||
|
};
|
||||||
|
|
||||||
public ConstantStringValue(Supplier<String> stringSupplier) {
|
public ConstantStringValue(Supplier<String> stringSupplier) {
|
||||||
super(stringSupplier.get());
|
super(stringSupplier.get());
|
||||||
@ -281,10 +286,22 @@ public class Constants {
|
|||||||
return new ConstantStringValue(() -> player.getInventory().getItemInOffHand().getType().name());
|
return new ConstantStringValue(() -> player.getInventory().getItemInOffHand().getType().name());
|
||||||
});
|
});
|
||||||
CONSTANTS.put("materialname", player -> {
|
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 -> {
|
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 -> {
|
CONSTANTS.put("region-type", player -> {
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren