Skip to content

Commit

Permalink
Creative anchor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoDadone committed Jan 3, 2022
1 parent aafcd28 commit 21a5752
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ public static String getAnchorUUID(Location location) {
public static boolean belongsToPlayer(Anchor anchor, Player p) {
userData = new PerUserStorage(Global.plugin, p);
generalData = new GeneralStorage(Global.plugin);

try {
Player actualPlayerAnchor = Bukkit.getPlayer(UUID.fromString(
generalData.getConfig().getString("all_anchors." + getAnchorUUID(anchor.getLocation()) + ".owner"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import mc.nightmarephoenix.anchorsell.AnchorSell;
import mc.nightmarephoenix.anchorsell.inventories.AnchorScreen;
import mc.nightmarephoenix.anchorsell.api.StorageManager;
import mc.nightmarephoenix.anchorsell.models.Anchor;
import mc.nightmarephoenix.anchorsell.utils.Utils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -35,7 +36,12 @@ public void onBlockClick(PlayerInteractEvent e) {
/**
* Checks if it's my anchor and opens the inventory.
*/
if(StorageManager.belongsToPlayer(StorageManager.getAnchorFromLoc(e.getClickedBlock().getLocation()), p)) {
Anchor anchor = StorageManager.getAnchorFromLoc(e.getClickedBlock().getLocation());

// Checks creative anchor
if(anchor == null) return;

if(StorageManager.belongsToPlayer(anchor, p)) {
e.setCancelled(true);
p.openInventory(new AnchorScreen(p, plugin, e.getClickedBlock().getLocation()).getInventory());
} else {
Expand Down

0 comments on commit 21a5752

Please sign in to comment.