Skip to content

Commit

Permalink
Merge pull request #164 from SpaceServerUniverse/dev/gun_meyason
Browse files Browse the repository at this point in the history
真紅ちゃんぬいぐるみ全人類買いなさい
  • Loading branch information
m1sk9 authored Oct 19, 2024
2 parents bd207fd + fb3e10d commit b8e48f4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package space.yurisi.universecorev2.subplugins.universeguns.command;

import org.bukkit.Sound;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
Expand All @@ -22,6 +23,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
if (!(sender instanceof Player player)) {
return false;
}
player.playSound(player.getLocation(), Sound.BLOCK_BARREL_OPEN, 1, 1);

AmmoManagerInventoryMenu ammoManagerInventoryMenu = new AmmoManagerInventoryMenu(connector);
ammoManagerInventoryMenu.sendMenu(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ public boolean startReload(int reloadTime, Player player) throws UserNotFoundExc

public void finishReload(Player player) throws UserNotFoundException, AmmoNotFoundException {
this.isReloading = false;
connector.setAmmoFromUserId(player, gun.getType(), getInventoryAmmo(player) + magazineAmmo);
if(this.inventoryAmmo <= gun.getMagazineSize()){
this.magazineAmmo = (int) this.inventoryAmmo;
long nowAllAmmo = getInventoryAmmo(player) + (long)magazineAmmo;
connector.setAmmoFromUserId(player, gun.getType(), nowAllAmmo);
if(nowAllAmmo <= gun.getMagazineSize()){
this.magazineAmmo = (int) nowAllAmmo;
setInventoryAmmo(player, 0);
} else {
setInventoryAmmo(player, this.inventoryAmmo - (gun.getMagazineSize() - magazineAmmo));
setInventoryAmmo(player, nowAllAmmo - (long)(gun.getMagazineSize()));
this.magazineAmmo = gun.getMagazineSize();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
NamespacedKey gunSerialKey = new NamespacedKey(UniverseCoreV2.getInstance(), UniverseItemKeyString.GUN_SERIAL);

if(container.has(itemKey, PersistentDataType.STRING) && Objects.equals(container.get(itemKey, PersistentDataType.STRING), "magazine_bag")){
player.playSound(player.getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0F, 1.0F);
player.playSound(player.getLocation(), Sound.BLOCK_BARREL_OPEN, 1, 1);
AmmoManagerInventoryMenu menu = new AmmoManagerInventoryMenu(connector);
menu.sendMenu(player);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public void sendMenu(Player player) {
this.connector.AmmoDataInit(player);
}

player.playSound(player.getLocation(), Sound.BLOCK_BARREL_OPEN, 1, 1);

Item border = new SimpleItem(new ItemBuilder(Material.BLACK_STAINED_GLASS_PANE));
Item iron1 = new SimpleItem(new ItemBuilder(Material.IRON_INGOT).setAmount(1));
Item iron2 = new SimpleItem(new ItemBuilder(Material.IRON_INGOT).setAmount(2));
Expand Down

0 comments on commit b8e48f4

Please sign in to comment.