Skip to content

Commit

Permalink
Fixed null pointer when removing anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoDadone committed Jan 3, 2022
1 parent 8401b80 commit aafcd28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public static void cacheAllAnchors() {
* @return
*/
public static Anchor getAnchorFromLoc(Location location) {
for(Anchor anchor: Global.getAllAnchors()) {
for(Anchor anchor : Global.getAllAnchors()) {
if(anchor.getLocation().equals(location)) {
return anchor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ public void breakEv(BlockBreakEvent e) {
location.getZ() +
")");


/**
* Removes anchor from cache
*/
Global.removeAnchor(anchor);

/**
* Playing sound on anchor break.
*/
Expand Down Expand Up @@ -105,8 +99,12 @@ public void breakEv(BlockBreakEvent e) {
* Saves to the database the broken anchor.
*/
StorageManager.removeAnchor(StorageManager.getAnchorFromLoc(location));
}

/**
* Removes anchor from cache
*/
Global.removeAnchor(anchor);
}
}, 20L);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: AnchorSell
version: 1.4.1
version: 1.4.2
main: mc.nightmarephoenix.anchorsell.AnchorSell
api-version: 1.16
depend: [ Vault, Essentials ]
Expand Down

0 comments on commit aafcd28

Please sign in to comment.