Skip to content

Commit

Permalink
chore: update Minestom
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakShearman committed Jun 16, 2024
1 parent f097356 commit aa1eb46
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ repositories {

dependencies {
// Minestom
api("net.minestom:minestom-snapshots:17fd82a5c1")
api("net.kyori:adventure-text-minimessage:4.15.0") // Version that Minestom uses (https://github.com/Minestom/Minestom/blob/17fd82a5c1dc845d417ab2c60ae1248369e4fdff/gradle/libs.versions.toml#L7)
api("net.minestom:minestom-snapshots:80377e37d7")
api("net.kyori:adventure-text-minimessage:4.15.0")
implementation("io.pyroscope:agent:0.12.2")

// Logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
import net.minestom.server.inventory.InventoryType;
import net.minestom.server.inventory.click.ClickType;
import net.minestom.server.inventory.condition.InventoryConditionResult;
import net.minestom.server.item.ItemHideFlag;
import net.minestom.server.item.ItemComponent;
import net.minestom.server.item.ItemStack;
import net.minestom.server.item.Material;
import net.minestom.server.item.component.AttributeList;
import net.minestom.server.tag.Tag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -120,11 +121,12 @@ private void onClick(@NotNull Player clicker, int slot, @NotNull ClickType click
return;
}

boolean isUnlocked = clickedItem.meta().getTag(BADGE_UNLOCKED_TAG);
boolean isActive = clickedItem.meta().getTag(BADGE_ACTIVE_TAG);

boolean isUnlocked = clickedItem.getTag(BADGE_UNLOCKED_TAG);
boolean isActive = clickedItem.getTag(BADGE_ACTIVE_TAG);
if (!isUnlocked || isActive) return;

String badgeId = clickedItem.meta().getTag(BADGE_ID_TAG);
String badgeId = clickedItem.getTag(BADGE_ID_TAG);
try {
this.badgeService.setActiveBadge(clicker.getUuid(), badgeId);
} catch (StatusRuntimeException exception) {
Expand All @@ -133,7 +135,7 @@ private void onClick(@NotNull Player clicker, int slot, @NotNull ClickType click
return;
}

String badgeName = clickedItem.meta().getTag(BADGE_NAME_TAG);
String badgeName = clickedItem.getTag(BADGE_NAME_TAG);
clicker.sendMessage(Component.text("Set active badge to " + badgeName, NamedTextColor.GREEN));
new BadgeGui(this.badgeService, clicker); // Reopen the gui
}
Expand Down Expand Up @@ -163,14 +165,13 @@ private void onClick(@NotNull Player clicker, int slot, @NotNull ClickType click
}

return ItemStack.builder(Material.fromNamespaceId(guiItem.getMaterial()))
.displayName(MINI_MESSAGE.deserialize(guiItem.getDisplayName()))
.lore(lore)
.meta(builder -> builder.hideFlag(ItemHideFlag.HIDE_ATTRIBUTES)
.set(BADGE_ID_TAG, badge.getId())
.set(BADGE_NAME_TAG, badge.getFriendlyName())
.set(BADGE_ACTIVE_TAG, isActive)
.set(BADGE_UNLOCKED_TAG, isOwned)
)
.build();
.set(ItemComponent.ITEM_NAME, MINI_MESSAGE.deserialize(guiItem.getDisplayName()))
.set(ItemComponent.LORE, lore)
.set(BADGE_ID_TAG, badge.getId())
.set(BADGE_NAME_TAG, badge.getFriendlyName())
.set(BADGE_ACTIVE_TAG, isActive)
.set(BADGE_UNLOCKED_TAG, isOwned)
.set(ItemComponent.ATTRIBUTE_MODIFIERS, new AttributeList(List.of(), false)
).build();
}
}

0 comments on commit aa1eb46

Please sign in to comment.