Add radius/same-world/same-server to channel options

This commit is contained in:
Draycia committed 2022-06-08 15:17:20 -07:00
1 parent ddb6998bc8
commit 60285830d4
11 files changed
+259

No files matched your search

@@ -23,6 +23,7 @@ import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
import java.util.Locale;
import java.util.Optional;
import net.draycia.carbon.api.users.CarbonPlayer;
import net.draycia.carbon.api.util.InventorySlot;
import net.draycia.carbon.common.users.CarbonPlayerCommon;
import net.draycia.carbon.common.users.WrappedCarbonPlayer;
@@ -69,6 +70,27 @@ public final class CarbonPlayerVelocity extends WrappedCarbonPlayer implements F
return this.player().map(value -> value.getPlayerSettings().getLocale()).orElse(null);
}
@Override
public double distanceSquaredFrom(final CarbonPlayer other) {
return -1;
}
@Override
public boolean sameWorldAs(final CarbonPlayer other) {
final Optional<Player> player = this.player();
final Optional<Player> otherPlayer = this.server.getPlayer(other.uuid());
if (player.isEmpty() || otherPlayer.isEmpty()) {
return false;
}
if (player.get().getCurrentServer().isEmpty() || otherPlayer.get().getCurrentServer().isEmpty()) {
return false;
}
return player.get().getCurrentServer().get().equals(otherPlayer.get().getCurrentServer().get());
}
@Override
public @Nullable Component createItemHoverComponent(final InventorySlot slot) {
return null;