Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Enoughsdv committed Sep 5, 2023
1 parent 8e83009 commit 78ebb13
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target/
/.idea/
/.idea/
Refill.iml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Refill

It's a basic Refill plugin with cooldown that I was going to make for a network but it closed
A super basic refill code that is based with signs

### Config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.bukkit.block.Sign;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -40,7 +39,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
}

Sign sign = (Sign) block.getState();
short id = 0;
int id = 0;

for (String lines : config.getStringList("SIGN_SETTINGS.LINES")) {
if (sign.getLine(id).equalsIgnoreCase(MessageUtil.translate(lines))) {
Expand All @@ -62,8 +61,8 @@ public void onPlayerInteract(PlayerInteractEvent event) {
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();

if (!event.getInventory().getTitle()
.equalsIgnoreCase(MessageUtil.translate(config.getString("INVENTORY_SETTINGS.OPTIONS.TITLE")))) {
if (!event.getView().getTitle()
.equals(MessageUtil.translate(config.getString("INVENTORY_SETTINGS.OPTIONS.TITLE")))) {
return;
}

Expand Down Expand Up @@ -97,13 +96,14 @@ public void onSignChange(SignChangeEvent event) {
@EventHandler
public void onBlockBreakEvent(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();

if (!(event.getBlock().getState() instanceof Sign)) {
if (!(block.getState() instanceof Sign)) {
return;
}

Sign sign = (Sign) event.getBlock().getState();
short id = 0;
Sign sign = (Sign) block.getState();
int id = 0;

for (String lines : config.getStringList("SIGN_SETTINGS.LINES")) {
if (sign.getLine(id).equalsIgnoreCase(MessageUtil.translate(lines))) {
Expand All @@ -115,7 +115,6 @@ public void onBlockBreakEvent(BlockBreakEvent event) {

if (!event.isCancelled()) {
player.sendMessage(MessageUtil.translate(config.getString("MESSAGES.BREAK_SUCCESSFULLY")));
event.setCancelled(true);
}
return;
}
Expand Down

0 comments on commit 78ebb13

Please sign in to comment.