Skip to content

Commit

Permalink
Prevent editing vault signs
Browse files Browse the repository at this point in the history
  • Loading branch information
GroobleDierne committed Nov 21, 2024
1 parent c848487 commit 9fd040e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/org/gestern/gringotts/event/AccountListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

import com.destroystokyo.paper.event.block.BlockDestroyEvent;

import io.papermc.paper.event.player.PlayerOpenSignEvent;

import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -149,6 +151,21 @@ public void run() {
}
}

@EventHandler
public void onSignEdit(PlayerOpenSignEvent event) {
event.getPlayer().sendMessage("non");
for (AccountChest chest : Gringotts.instance.getDao().retrieveChests()) {
if (!chest.isChestLoaded()) continue; // For a sign to be changed, it needs to be loaded

event.getPlayer().sendMessage("non1");
if (event.getSign().equals(chest.sign)) {
event.getPlayer().sendMessage("non final");
event.setCancelled(true);
return;
}
}
}

/**
* Get the AccountChest associated with this {@link InventoryHolder}
* @param holder
Expand Down

0 comments on commit 9fd040e

Please sign in to comment.