mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-24 17:11:58 +01:00
Added Item#getUuid
This commit is contained in:
parent
debf21927b
commit
3ba74639bf
@ -6,12 +6,14 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.IntUnaryOperator;
|
import java.util.function.IntUnaryOperator;
|
||||||
import java.util.function.UnaryOperator;
|
import java.util.function.UnaryOperator;
|
||||||
|
|
||||||
public class Item {
|
public class Item {
|
||||||
|
|
||||||
|
private final UUID uuid = UUID.randomUUID();
|
||||||
private final Material material;
|
private final Material material;
|
||||||
private final int amount;
|
private final int amount;
|
||||||
private final ItemMeta meta;
|
private final ItemMeta meta;
|
||||||
@ -27,6 +29,16 @@ public class Item {
|
|||||||
return new ItemBuilder(material);
|
return new ItemBuilder(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Contract(pure = true)
|
||||||
|
public @NotNull UUID getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Contract(pure = true)
|
||||||
|
public @NotNull Material getMaterial() {
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
@Contract(value = "_, -> new", pure = true)
|
@Contract(value = "_, -> new", pure = true)
|
||||||
public @NotNull Item with(@NotNull Consumer<@NotNull ItemBuilder> builderConsumer) {
|
public @NotNull Item with(@NotNull Consumer<@NotNull ItemBuilder> builderConsumer) {
|
||||||
var builder = builder();
|
var builder = builder();
|
||||||
|
@ -6,6 +6,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class ItemMeta implements Cloneable {
|
public class ItemMeta implements Cloneable {
|
||||||
|
|
||||||
@ -19,6 +20,13 @@ public class ItemMeta implements Cloneable {
|
|||||||
this.lore = metaBuilder.lore;
|
this.lore = metaBuilder.lore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Contract(value = "_, -> new", pure = true)
|
||||||
|
public @NotNull ItemMeta with(@NotNull Consumer<@NotNull ItemMetaBuilder> builderConsumer) {
|
||||||
|
var builder = builder();
|
||||||
|
builderConsumer.accept(builder);
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
@Contract(pure = true)
|
@Contract(pure = true)
|
||||||
public @Nullable Component getDisplayName() {
|
public @Nullable Component getDisplayName() {
|
||||||
return displayName;
|
return displayName;
|
||||||
|
Loading…
Reference in New Issue
Block a user