Skip to content

Commit 165bc0a

Browse files
committed
Catch exceptions when trying to log to LogBlock
1 parent 2ddec82 commit 165bc0a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/pl/craftserve/paysign/LogBlockHook.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@
2424
import org.bukkit.entity.Player;
2525

2626
import java.util.Objects;
27+
import java.util.logging.Level;
28+
import java.util.logging.Logger;
2729

2830
public class LogBlockHook {
31+
static final Logger logger = Logger.getLogger(LogBlockHook.class.getName());
32+
2933
/**
3034
* Logs click action on the sign to the LogBlock {@link Consumer}.
3135
* @param player Who clicked
@@ -44,7 +48,12 @@ public void logClick(Player player, Trigger trigger, Switch fakeButton) {
4448

4549
Actor actor = Actor.actorFromEntity(player);
4650
Location location = trigger.getPaySign().getSign().getLocation();
47-
consumer.queueBlock(actor, location, this.switchOff(fakeButton), fakeButton);
51+
52+
try {
53+
consumer.queueBlock(actor, location, this.switchOff(fakeButton), fakeButton);
54+
} catch (Throwable e) {
55+
logger.log(Level.SEVERE, "Could not log click to LogBlock.", e);
56+
}
4857
}
4958

5059
private Consumer getConsumer() {

0 commit comments

Comments
 (0)