Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeTheTech committed Oct 23, 2023
1 parent 9c2d06d commit ad90dbf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/java/lee/code/pets/menus/menu/PetDeleteMenu.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package lee.code.pets.menus.menu;

import lee.code.pets.Pets;
import lee.code.pets.database.cache.CachePets;
import lee.code.pets.lang.Lang;
import lee.code.pets.menus.menu.menudata.MenuItem;
import lee.code.pets.menus.menu.menudata.PetItem;
Expand Down Expand Up @@ -34,7 +33,6 @@ public void decorate(Player player) {
}

private void addButtons(Player player) {
final CachePets cachePets = pets.getCacheManager().getCachePets();
addButton(2,
new MenuButton()
.creator(p -> MenuItem.CANCEL.createItem())
Expand All @@ -45,7 +43,7 @@ private void addButtons(Player player) {
}));
addButton(4,
new MenuButton()
.creator(p -> PetItem.valueOf(cachePets.getPetEntityType(petID).name()).getHeadWithName(cachePets.getPetName(petID)))
.creator(p -> PetItem.valueOf(pets.getCacheManager().getCachePets().getPetEntityType(petID).name()).getHeadWithName(pets.getCacheManager().getCachePets().getPetName(petID)))
.consumer(e -> {
getMenuSoundManager().playClickSound(player);
player.sendMessage(Lang.PREFIX.getComponent(null).append(Lang.MENU_DELETE_PET_CANCEL_SUCCESSFUL.getComponent(new String[]{pets.getCacheManager().getCachePets().getPetName(petID)})));
Expand All @@ -56,8 +54,9 @@ private void addButtons(Player player) {
.creator(p -> MenuItem.CONFIRM.createItem())
.consumer(e -> {
getMenuSoundManager().playClickSound(player);
final String name = cachePets.getPetName(petID);
cachePets.deletePet(petID);
pets.getPetManager().removeActivePet(player);
final String name = pets.getCacheManager().getCachePets().getPetName(petID);
pets.getCacheManager().getCachePets().deletePet(petID);
player.sendMessage(Lang.PREFIX.getComponent(null).append(Lang.MENU_DELETE_PET_CONFIRM_SUCCESSFUL.getComponent(new String[]{name})));
pets.getMenuManager().openMenu(new PetMenu(pets), player);
}));
Expand Down

0 comments on commit ad90dbf

Please sign in to comment.