mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
vanish support and suggestions overhaul
This commit is contained in:
1 parent
de118017eb
commit
12b40f8150
10 files changed
+126
-19
No files matched your search
@@ -3,6 +3,7 @@ package net.draycia.carbon.bukkit;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -50,7 +51,7 @@ public final class CarbonServerBukkit implements CarbonServer, ForwardingAudienc
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends CarbonPlayer> players() {
|
||||
public List<? extends CarbonPlayer> players() {
|
||||
final var players = new ArrayList<CarbonPlayer>();
|
||||
|
||||
for (final var player : this.chatBukkitEntry.getServer().getOnlinePlayers()) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.bukkit.util.BukkitCapabilities;
|
||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||
import net.draycia.carbon.common.users.WrappedCarbonPlayer;
|
||||
@@ -15,6 +16,7 @@ import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
@@ -179,6 +181,31 @@ public final class CarbonPlayerBukkit extends WrappedCarbonPlayer implements For
|
||||
return this.player() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean vanished() {
|
||||
return this.hasVanishMeta();
|
||||
}
|
||||
|
||||
// Supported by PremiumVanish, SuperVanish, VanishNoPacket
|
||||
private boolean hasVanishMeta() {
|
||||
for (final MetadataValue meta : this.player().getMetadata("vanished")) {
|
||||
if (meta.asBoolean()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean awareOf(final CarbonPlayer other) {
|
||||
if (other.vanished()) {
|
||||
return this.hasPermission("carbon.seevanished");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable ChatChannel selectedChannel() {
|
||||
return this.carbonPlayerCommon.selectedChannel();
|
||||
|
||||
Reference in new issue
Block a user