Skip to content

Commit

Permalink
[build] Bump version
Browse files Browse the repository at this point in the history
- The fix below required preview to be only opened through left click so right click can function as for only opening the crate.
- The key check on right-clicking a crate was working, however we didn't inform the player they had no key.
  • Loading branch information
ryderbelserion committed Jul 15, 2024
1 parent 6adc177 commit 0a4e9e0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
### Changes:
- The fix below required preview to be only opened through left click so right click can function as for only opening the crate.

### Fixed:
- Issue with file manager not properly loading/reloading files.
- The key check on right-clicking a crate was working, however we didn't inform the player they had no key.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {

val buildNumber: String? = System.getenv("BUILD_NUMBER")

rootProject.version = if (buildNumber != null) "${libs.versions.minecraft.get()}-$buildNumber" else "3.5.2"
rootProject.version = if (buildNumber != null) "${libs.versions.minecraft.get()}-$buildNumber" else "3.5.3"

val isSnapshot = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public void onGroundClick(PlayerInteractEvent event) {
public void onCrateInteract(PlayerInteractEvent event) {
final Player player = event.getPlayer();

if (!event.getAction().isLeftClick()) return;

final Block clickedBlock = event.getClickedBlock();

if (clickedBlock == null) return;
Expand Down Expand Up @@ -136,7 +138,32 @@ public void onRightClick(PlayerInteractEvent event) {

final boolean isKey = event.getHand() == EquipmentSlot.OFF_HAND ? ItemUtils.isSimilar(player.getInventory().getItemInOffHand(), crate) : ItemUtils.isSimilar(player.getInventory().getItemInMainHand(), crate);

if (!isKey) return;
if (!isKey) {
final String keyName = crate.getKeyName();

final Map<String, String> placeholders = new HashMap<>() {{
put("{crate}", crate.getName());
put("{key}", keyName);
}};

if (crate.getCrateType() != CrateType.crate_on_the_go) {
if (this.config.getProperty(ConfigKeys.knock_back)) knockBack(player, clickedBlock.getLocation());

//todo() convert this to a bean property!
if (this.config.getProperty(ConfigKeys.need_key_sound_toggle)) {
net.kyori.adventure.sound.Sound sound = net.kyori.adventure.sound.Sound.sound(Key.key(this.config.getProperty(ConfigKeys.need_key_sound)), Sound.Source.PLAYER, 1f, 1f);

player.playSound(sound);
}

player.sendRichMessage(Messages.no_keys.getMessage(player, placeholders));
}

event.setUseInteractedBlock(Event.Result.DENY);
event.setUseItemInHand(Event.Result.DENY);

return;
}

event.setUseInteractedBlock(Event.Result.DENY);
event.setUseItemInHand(Event.Result.DENY);
Expand All @@ -150,8 +177,6 @@ public void onRightClick(PlayerInteractEvent event) {
boolean isPhysical = false;
boolean useQuickCrateAgain = false;

final String keyName = crate.getKeyName();

final int requiredKeys = crate.getRequiredKeys();

final int totalKeys = this.userManager.getTotalKeys(player.getUniqueId(), crate.getName());
Expand All @@ -177,11 +202,6 @@ public void onRightClick(PlayerInteractEvent event) {

if (this.config.getProperty(ConfigKeys.physical_accepts_virtual_keys) && this.userManager.getVirtualKeys(player.getUniqueId(), crate.getName()) >= 1) hasKey = true;

final Map<String, String> placeholders = new HashMap<>() {{
put("{crate}", crate.getName());
put("{key}", keyName);
}};

if (hasKey) {
// Checks if the player uses the quick crate again.
if (this.crateManager.isInOpeningList(player) && this.crateManager.getOpeningCrate(player).getCrateType() == CrateType.quick_crate && this.crateManager.isCrateInUse(player) && this.crateManager.getCrateInUseLocation(player).equals(crateLocation.getLocation())) {
Expand Down Expand Up @@ -221,19 +241,6 @@ public void onRightClick(PlayerInteractEvent event) {

return;
}

if (crate.getCrateType() != CrateType.crate_on_the_go) {
if (this.config.getProperty(ConfigKeys.knock_back)) knockBack(player, clickedBlock.getLocation());

//todo() convert this to a bean property!
if (this.config.getProperty(ConfigKeys.need_key_sound_toggle)) {
net.kyori.adventure.sound.Sound sound = net.kyori.adventure.sound.Sound.sound(Key.key(this.config.getProperty(ConfigKeys.need_key_sound)), Sound.Source.PLAYER, 1f, 1f);

player.playSound(sound);
}

player.sendRichMessage(Messages.no_keys.getMessage(player, placeholders));
}
}

@EventHandler
Expand Down

0 comments on commit 0a4e9e0

Please sign in to comment.