mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Fix cross world radius, log exceptions in event subscribers
This commit is contained in:
1 parent
b5c7b16f8d
commit
4a71b5926e
5 files changed
+23
-10
No files matched your search
@@ -31,7 +31,7 @@ public class ItemLinkHandler {
|
||||
public ItemLinkHandler(
|
||||
final CarbonChat carbonChat
|
||||
) {
|
||||
carbonChat.eventHandler().subscribe(CarbonChatEvent.class, 1, true, event -> {
|
||||
carbonChat.eventHandler().subscribe(CarbonChatEvent.class, 1, false, event -> {
|
||||
if (!event.sender().hasPermission("carbon.itemlink")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ public class RadiusListener {
|
||||
final CarbonChat carbonChat
|
||||
) {
|
||||
carbonChat.eventHandler().subscribe(CarbonChatEvent.class, 0, false, event -> {
|
||||
if (event.chatChannel() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final double radius = event.chatChannel().radius();
|
||||
|
||||
if (radius < 0) {
|
||||
@@ -59,9 +63,11 @@ public class RadiusListener {
|
||||
}
|
||||
|
||||
if (audience instanceof CarbonPlayer carbonPlayer) {
|
||||
final double distance = carbonPlayer.distanceSquaredFrom(event.sender());
|
||||
if (event.sender().sameWorldAs(carbonPlayer)) {
|
||||
final double distance = carbonPlayer.distanceSquaredFrom(event.sender());
|
||||
|
||||
return distance > (radius * radius);
|
||||
return distance > (radius * radius);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user