Skip to content

Commit

Permalink
Catch exceptions when trying to log to LogBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMolkaPL committed Apr 3, 2020
1 parent 2ddec82 commit 165bc0a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/pl/craftserve/paysign/LogBlockHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
import org.bukkit.entity.Player;

import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LogBlockHook {
static final Logger logger = Logger.getLogger(LogBlockHook.class.getName());

/**
* Logs click action on the sign to the LogBlock {@link Consumer}.
* @param player Who clicked
Expand All @@ -44,7 +48,12 @@ public void logClick(Player player, Trigger trigger, Switch fakeButton) {

Actor actor = Actor.actorFromEntity(player);
Location location = trigger.getPaySign().getSign().getLocation();
consumer.queueBlock(actor, location, this.switchOff(fakeButton), fakeButton);

try {
consumer.queueBlock(actor, location, this.switchOff(fakeButton), fakeButton);
} catch (Throwable e) {
logger.log(Level.SEVERE, "Could not log click to LogBlock.", e);
}
}

private Consumer getConsumer() {
Expand Down

0 comments on commit 165bc0a

Please sign in to comment.