mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
Progress towards LP hard depend
This commit is contained in:
1 parent
d2ed3d42eb
commit
ee084c1221
14 files changed
+54
-183
No files matched your search
@@ -27,12 +27,12 @@
|
|||||||
"http://checkstyle.org/dtds/suppressions_1_2.dtd">
|
"http://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||||
<suppressions>
|
<suppressions>
|
||||||
<!-- add any necessary suppressions here -->
|
<!-- add any necessary suppressions here -->
|
||||||
<suppress files="src[\\/]main[\\/]java[\\/]net[\\/]draycia[\\/]carbon[\\/](bukkit|sponge|common|velocity)[\\/].*"
|
<suppress files="src[\\/]main[\\/]java[\\/]net[\\/]draycia[\\/]carbon[\\/](bukkit|sponge|common|velocity|fabric)[\\/].*"
|
||||||
checks="FilteringWriteTag"/>
|
checks="FilteringWriteTag"/>
|
||||||
<suppress files="src[\\/]main[\\/]java[\\/]net[\\/]draycia[\\/]carbon[\\/](bukkit|sponge|common|velocity)[\\/].*"
|
<suppress files="src[\\/]main[\\/]java[\\/]net[\\/]draycia[\\/]carbon[\\/](bukkit|sponge|common|velocity|fabric)[\\/].*"
|
||||||
checks="MissingJavadocMethod"/>
|
checks="MissingJavadocMethod"/>
|
||||||
<suppress files="src[\\/]main[\\/]java[\\/]net[\\/]draycia[\\/]carbon[\\/](bukkit|sponge|common|velocity)[\\/].*"
|
<suppress files="src[\\/]main[\\/]java[\\/]net[\\/]draycia[\\/]carbon[\\/](bukkit|sponge|common|velocity|fabric)[\\/].*"
|
||||||
checks="MissingJavadocPackage"/>
|
checks="MissingJavadocPackage"/>
|
||||||
<suppress files="src[\\/]main[\\/]java[\\/]net[\\/]draycia[\\/]carbon[\\/](bukkit|sponge|common|velocity)[\\/].*"
|
<suppress files="src[\\/]main[\\/]java[\\/]net[\\/]draycia[\\/]carbon[\\/](bukkit|sponge|common|velocity|fabric)[\\/].*"
|
||||||
checks="MissingJavadocType"/>
|
checks="MissingJavadocType"/>
|
||||||
</suppressions>
|
</suppressions>
|
||||||
@@ -1,20 +1,15 @@
|
|||||||
package net.draycia.carbon.bukkit.users;
|
package net.draycia.carbon.bukkit.users;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import net.draycia.carbon.api.channels.ChatChannel;
|
import net.draycia.carbon.api.channels.ChatChannel;
|
||||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
|
||||||
import net.draycia.carbon.api.util.InventorySlot;
|
import net.draycia.carbon.api.util.InventorySlot;
|
||||||
import net.draycia.carbon.api.util.InventorySlots;
|
import net.draycia.carbon.api.util.InventorySlots;
|
||||||
import net.draycia.carbon.bukkit.util.BukkitCapabilities;
|
|
||||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||||
import net.draycia.carbon.common.users.WrappedCarbonPlayer;
|
import net.draycia.carbon.common.users.WrappedCarbonPlayer;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.kyori.adventure.audience.ForwardingAudience;
|
import net.kyori.adventure.audience.ForwardingAudience;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.EntityEquipment;
|
import org.bukkit.inventory.EntityEquipment;
|
||||||
@@ -129,45 +124,6 @@ public final class CarbonPlayerBukkit extends WrappedCarbonPlayer implements For
|
|||||||
return itemStack.displayName();
|
return itemStack.displayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(final String permission) {
|
|
||||||
final @Nullable Player player = this.player();
|
|
||||||
|
|
||||||
if (player != null) {
|
|
||||||
return player.hasPermission(permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String primaryGroup() {
|
|
||||||
if (!BukkitCapabilities.vaultEnabled()) {
|
|
||||||
return "default";
|
|
||||||
}
|
|
||||||
|
|
||||||
final Permission permission = Objects.requireNonNull(BukkitCapabilities.permission());
|
|
||||||
final String group = permission.getPrimaryGroup(this.player());
|
|
||||||
|
|
||||||
return Objects.requireNonNullElse(group, "default");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> groups() {
|
|
||||||
if (!BukkitCapabilities.vaultEnabled()) {
|
|
||||||
return List.of("default");
|
|
||||||
}
|
|
||||||
|
|
||||||
final Permission permission = Objects.requireNonNull(BukkitCapabilities.permission());
|
|
||||||
final String[] groups = permission.getPlayerGroups(this.player());
|
|
||||||
|
|
||||||
if (groups != null && groups.length != 0) {
|
|
||||||
return Arrays.asList(groups);
|
|
||||||
}
|
|
||||||
|
|
||||||
return List.of("default"); // TODO: implement
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable Locale locale() {
|
public @Nullable Locale locale() {
|
||||||
final @Nullable Player player = this.player();
|
final @Nullable Player player = this.player();
|
||||||
@@ -207,15 +163,6 @@ public final class CarbonPlayerBukkit extends WrappedCarbonPlayer implements For
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean awareOf(final CarbonPlayer other) {
|
|
||||||
if (other.vanished()) {
|
|
||||||
return this.hasPermission("carbon.seevanished");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable ChatChannel selectedChannel() {
|
public @Nullable ChatChannel selectedChannel() {
|
||||||
return this.carbonPlayerCommon.selectedChannel();
|
return this.carbonPlayerCommon.selectedChannel();
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ dependencies {
|
|||||||
// Other
|
// Other
|
||||||
api(libs.guice)
|
api(libs.guice)
|
||||||
api(libs.cloudMinecraftExtras)
|
api(libs.cloudMinecraftExtras)
|
||||||
|
api(libs.luckPerms)
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,33 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
|
|||||||
|
|
||||||
public abstract CarbonPlayerCommon carbonPlayerCommon();
|
public abstract CarbonPlayerCommon carbonPlayerCommon();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean awareOf(final CarbonPlayer other) {
|
||||||
|
if (other.vanished()) {
|
||||||
|
return this.hasPermission("carbon.seevanished");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPermission(String permission) {
|
||||||
|
// TODO: LuckPerms
|
||||||
|
return this.carbonPlayerCommon().hasPermission(permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String primaryGroup() {
|
||||||
|
// TODO: LuckPerms
|
||||||
|
return this.carbonPlayerCommon().primaryGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> groups() {
|
||||||
|
// TODO: LuckPerms
|
||||||
|
return this.carbonPlayerCommon().groups();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String username() {
|
public String username() {
|
||||||
return this.carbonPlayerCommon().username();
|
return this.carbonPlayerCommon().username();
|
||||||
@@ -81,26 +108,10 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectedChannel(ChatChannel chatChannel) {
|
public void selectedChannel(@Nullable ChatChannel chatChannel) {
|
||||||
this.carbonPlayerCommon().selectedChannel(chatChannel);
|
this.carbonPlayerCommon().selectedChannel(chatChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move to Permissible class or one similarly named?
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(String permission) {
|
|
||||||
return this.carbonPlayerCommon().hasPermission(permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String primaryGroup() {
|
|
||||||
return this.carbonPlayerCommon().primaryGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> groups() {
|
|
||||||
return this.carbonPlayerCommon().groups();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MuteEntry> muteEntries() {
|
public List<MuteEntry> muteEntries() {
|
||||||
return this.carbonPlayerCommon().muteEntries();
|
return this.carbonPlayerCommon().muteEntries();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
include(libs.adventurePlatformFabric)
|
include(libs.adventurePlatformFabric)
|
||||||
|
|
||||||
modImplementation("me.lucko", "fabric-permissions-api", "0.1-SNAPSHOT")
|
modImplementation(libs.luckPerms)
|
||||||
}
|
}
|
||||||
|
|
||||||
carbonPlatform {
|
carbonPlatform {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public final class CarbonChatFabric implements ModInitializer, CarbonChat {
|
|||||||
|
|
||||||
// Platform Listeners
|
// Platform Listeners
|
||||||
FabricChatCallback.setup();
|
FabricChatCallback.setup();
|
||||||
FabricChatCallback.INSTANCE.registerListener(new FabricChatListener(this, channelRegistry));
|
FabricChatCallback.INSTANCE.registerListener(new FabricChatListener(this, this.channelRegistry));
|
||||||
ServerLifecycleEvents.SERVER_STARTING.register(server -> {
|
ServerLifecycleEvents.SERVER_STARTING.register(server -> {
|
||||||
this.minecraftServer = server;
|
this.minecraftServer = server;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.net.http.HttpClient;
|
import java.net.http.HttpClient;
|
||||||
import java.net.http.HttpRequest;
|
import java.net.http.HttpRequest;
|
||||||
import java.net.http.HttpResponse;
|
import java.net.http.HttpResponse;
|
||||||
@@ -22,7 +21,6 @@ import net.draycia.carbon.api.users.CarbonPlayer;
|
|||||||
import net.draycia.carbon.api.users.ComponentPlayerResult;
|
import net.draycia.carbon.api.users.ComponentPlayerResult;
|
||||||
import net.draycia.carbon.api.users.UserManager;
|
import net.draycia.carbon.api.users.UserManager;
|
||||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||||
import net.draycia.carbon.common.util.FastUuidSansHyphens;
|
|
||||||
import net.draycia.carbon.fabric.users.CarbonPlayerFabric;
|
import net.draycia.carbon.fabric.users.CarbonPlayerFabric;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.kyori.adventure.audience.ForwardingAudience;
|
import net.kyori.adventure.audience.ForwardingAudience;
|
||||||
@@ -91,7 +89,7 @@ public final class CarbonServerFabric implements CarbonServer, ForwardingAudienc
|
|||||||
final ComponentPlayerResult<CarbonPlayerCommon> result = this.userManager.carbonPlayer(uuid).join();
|
final ComponentPlayerResult<CarbonPlayerCommon> result = this.userManager.carbonPlayer(uuid).join();
|
||||||
|
|
||||||
if (result.player() != null) {
|
if (result.player() != null) {
|
||||||
final CarbonPlayerFabric carbonPlayerFabric = new CarbonPlayerFabric(result.player(), carbonChatFabric);
|
final CarbonPlayerFabric carbonPlayerFabric = new CarbonPlayerFabric(result.player(), this.carbonChatFabric);
|
||||||
|
|
||||||
this.userCache.put(uuid, carbonPlayerFabric);
|
this.userCache.put(uuid, carbonPlayerFabric);
|
||||||
|
|
||||||
@@ -102,7 +100,7 @@ public final class CarbonServerFabric implements CarbonServer, ForwardingAudienc
|
|||||||
|
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
final CarbonPlayerCommon player = new CarbonPlayerCommon(name, uuid);
|
final CarbonPlayerCommon player = new CarbonPlayerCommon(name, uuid);
|
||||||
final CarbonPlayerFabric carbonPlayerFabric = new CarbonPlayerFabric(player, carbonChatFabric);
|
final CarbonPlayerFabric carbonPlayerFabric = new CarbonPlayerFabric(player, this.carbonChatFabric);
|
||||||
|
|
||||||
this.userCache.put(uuid, carbonPlayerFabric);
|
this.userCache.put(uuid, carbonPlayerFabric);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package net.draycia.carbon.fabric;
|
package net.draycia.carbon.fabric;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import net.draycia.carbon.api.util.RenderedMessage;
|
import net.draycia.carbon.api.util.RenderedMessage;
|
||||||
import net.draycia.carbon.api.util.SourcedAudience;
|
import net.draycia.carbon.api.util.SourcedAudience;
|
||||||
import net.draycia.carbon.common.util.ChatType;
|
import net.draycia.carbon.common.util.ChatType;
|
||||||
@@ -13,12 +18,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@DefaultQualifier(NonNull.class)
|
@DefaultQualifier(NonNull.class)
|
||||||
public class FabricMessageRenderer implements IMessageRenderer<SourcedAudience, String, RenderedMessage, Component> {
|
public class FabricMessageRenderer implements IMessageRenderer<SourcedAudience, String, RenderedMessage, Component> {
|
||||||
|
|
||||||
@@ -48,4 +47,5 @@ public class FabricMessageRenderer implements IMessageRenderer<SourcedAudience,
|
|||||||
|
|
||||||
return new RenderedMessage(message, messageType);
|
return new RenderedMessage(message, messageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,6 @@ public enum FabricChatCallback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void registerListener(final Consumer<Chat> listener) {
|
public void registerListener(final Consumer<Chat> listener) {
|
||||||
this.listeners.add(listener);
|
this.listeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class FabricChatListener implements Consumer<FabricChatCallback.Chat> {
|
|||||||
private final CarbonChatFabric carbonChatFabric;
|
private final CarbonChatFabric carbonChatFabric;
|
||||||
private final ChannelRegistry channelRegistry;
|
private final ChannelRegistry channelRegistry;
|
||||||
|
|
||||||
public FabricChatListener(CarbonChatFabric carbonChatFabric, ChannelRegistry channelRegistry) {
|
public FabricChatListener(final CarbonChatFabric carbonChatFabric, final ChannelRegistry channelRegistry) {
|
||||||
this.carbonChatFabric = carbonChatFabric;
|
this.carbonChatFabric = carbonChatFabric;
|
||||||
this.channelRegistry = channelRegistry;
|
this.channelRegistry = channelRegistry;
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ public class FabricChatListener implements Consumer<FabricChatCallback.Chat> {
|
|||||||
chat.identity(Identity.nil());
|
chat.identity(Identity.nil());
|
||||||
}
|
}
|
||||||
|
|
||||||
chat.formatter(((sender1, message, viewer) -> {
|
chat.formatter((sender1, message, viewer) -> {
|
||||||
var renderedMessage = new RenderedMessage(chatEvent.message(), MessageType.CHAT);
|
var renderedMessage = new RenderedMessage(chatEvent.message(), MessageType.CHAT);
|
||||||
|
|
||||||
for (final var renderer : chatEvent.renderers()) {
|
for (final var renderer : chatEvent.renderers()) {
|
||||||
@@ -99,7 +99,7 @@ public class FabricChatListener implements Consumer<FabricChatCallback.Chat> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return renderedMessage.component();
|
return renderedMessage.component();
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
package net.draycia.carbon.fabric.users;
|
package net.draycia.carbon.fabric.users;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
|
||||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
|
||||||
import net.draycia.carbon.api.util.InventorySlot;
|
import net.draycia.carbon.api.util.InventorySlot;
|
||||||
import net.draycia.carbon.api.util.InventorySlots;
|
import net.draycia.carbon.api.util.InventorySlots;
|
||||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||||
@@ -28,7 +25,7 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
|
|||||||
private final CarbonPlayerCommon carbonPlayerCommon;
|
private final CarbonPlayerCommon carbonPlayerCommon;
|
||||||
private final CarbonChatFabric carbonChatFabric;
|
private final CarbonChatFabric carbonChatFabric;
|
||||||
|
|
||||||
public CarbonPlayerFabric(CarbonPlayerCommon carbonPlayerCommon, CarbonChatFabric carbonChatFabric) {
|
public CarbonPlayerFabric(final CarbonPlayerCommon carbonPlayerCommon, final CarbonChatFabric carbonChatFabric) {
|
||||||
this.carbonPlayerCommon = carbonPlayerCommon;
|
this.carbonPlayerCommon = carbonPlayerCommon;
|
||||||
this.carbonChatFabric = carbonChatFabric;
|
this.carbonChatFabric = carbonChatFabric;
|
||||||
}
|
}
|
||||||
@@ -52,11 +49,6 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean awareOf(final CarbonPlayer other) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable Locale locale() {
|
public @Nullable Locale locale() {
|
||||||
return this.player().map(PlayerLocales::locale).orElse(null);
|
return this.player().map(PlayerLocales::locale).orElse(null);
|
||||||
@@ -72,16 +64,6 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
|
|||||||
return this.carbonPlayerCommon;
|
return this.carbonPlayerCommon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String primaryGroup() {
|
|
||||||
return "default"; // TODO: implement
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> groups() {
|
|
||||||
return List.of("default"); // TODO: implement
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable Component createItemHoverComponent(final InventorySlot slot) {
|
public @Nullable Component createItemHoverComponent(final InventorySlot slot) {
|
||||||
final Optional<ServerPlayer> playerOptional = this.player();
|
final Optional<ServerPlayer> playerOptional = this.player();
|
||||||
@@ -117,11 +99,4 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
|
|||||||
return FabricServerAudiences.of(player.server).toAdventure(item.getDisplayName());
|
return FabricServerAudiences.of(player.server).toAdventure(item.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(final String permission) {
|
|
||||||
return this.player()
|
|
||||||
.map(value -> Permissions.check(value, permission, value.server.getOperatorUserPermissionLevel()))
|
|
||||||
.orElse(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,7 @@ versions:
|
|||||||
fabricMinecraft: 1.17.1
|
fabricMinecraft: 1.17.1
|
||||||
fabricLoader: 0.12.5
|
fabricLoader: 0.12.5
|
||||||
adventurePlatformFabric: 4.1.0-SNAPSHOT
|
adventurePlatformFabric: 4.1.0-SNAPSHOT
|
||||||
|
luckPerms: 5.3
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
adventureBom:
|
adventureBom:
|
||||||
@@ -201,4 +202,9 @@ dependencies:
|
|||||||
name: shadow
|
name: shadow
|
||||||
version: { ref: shadow }
|
version: { ref: shadow }
|
||||||
|
|
||||||
|
luckPerms:
|
||||||
|
group: net.luckperms
|
||||||
|
name: api
|
||||||
|
version: { ref: luckPerms }
|
||||||
|
|
||||||
bundles:
|
bundles:
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
package net.draycia.carbon.sponge.users;
|
package net.draycia.carbon.sponge.users;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
|
||||||
import net.draycia.carbon.api.util.InventorySlot;
|
import net.draycia.carbon.api.util.InventorySlot;
|
||||||
import net.draycia.carbon.api.util.InventorySlots;
|
import net.draycia.carbon.api.util.InventorySlots;
|
||||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||||
@@ -52,28 +50,6 @@ public final class CarbonPlayerSponge extends WrappedCarbonPlayer implements For
|
|||||||
return Sponge.server().player(this.carbonPlayerCommon.uuid());
|
return Sponge.server().player(this.carbonPlayerCommon.uuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public void displayName(final @Nullable Component displayName) {
|
|
||||||
// this.carbonPlayer.displayName(displayName);
|
|
||||||
//
|
|
||||||
// this.player().ifPresent(player -> {
|
|
||||||
// if (displayName != null) {
|
|
||||||
// player.offer(Keys.CUSTOM_NAME, displayName);
|
|
||||||
// } else {
|
|
||||||
// player.remove(Keys.CUSTOM_NAME);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(final String permission) {
|
|
||||||
final var player = this.player();
|
|
||||||
|
|
||||||
// Ignore inspection. Don't make code harder to read, IntelliJ.
|
|
||||||
return player.map(serverPlayer -> serverPlayer.hasPermission(permission))
|
|
||||||
.orElse(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessageAsPlayer(final String message) {
|
public void sendMessageAsPlayer(final String message) {
|
||||||
this.player().ifPresent(player -> player.simulateChat(Component.text(message), Cause.builder().build()));
|
this.player().ifPresent(player -> player.simulateChat(Component.text(message), Cause.builder().build()));
|
||||||
@@ -81,8 +57,7 @@ public final class CarbonPlayerSponge extends WrappedCarbonPlayer implements For
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean online() {
|
public boolean online() {
|
||||||
final var player = this.player();
|
return this.player().map(ServerPlayer::isOnline).orElse(false);
|
||||||
return player.isPresent() && player.get().isOnline();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -153,28 +128,9 @@ public final class CarbonPlayerSponge extends WrappedCarbonPlayer implements For
|
|||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String primaryGroup() {
|
|
||||||
return "default";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> groups() {
|
|
||||||
return List.of("default"); // TODO: implement
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean vanished() {
|
public boolean vanished() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean awareOf(final CarbonPlayer other) {
|
|
||||||
if (other.vanished()) {
|
|
||||||
return this.hasPermission("carbon.seevanished");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,8 @@ package net.draycia.carbon.velocity.users;
|
|||||||
|
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
|
||||||
import net.draycia.carbon.api.util.InventorySlot;
|
import net.draycia.carbon.api.util.InventorySlot;
|
||||||
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
import net.draycia.carbon.common.users.CarbonPlayerCommon;
|
||||||
import net.draycia.carbon.common.users.WrappedCarbonPlayer;
|
import net.draycia.carbon.common.users.WrappedCarbonPlayer;
|
||||||
@@ -33,26 +31,11 @@ public final class CarbonPlayerVelocity extends WrappedCarbonPlayer implements F
|
|||||||
return this.player().map(value -> (Audience) value).orElse(Audience.empty());
|
return this.player().map(value -> (Audience) value).orElse(Audience.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String primaryGroup() {
|
|
||||||
return "default"; // TODO: implement
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> groups() {
|
|
||||||
return List.of("default"); // TODO: implement
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean vanished() {
|
public boolean vanished() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean awareOf(final CarbonPlayer other) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Optional<Player> player() {
|
private Optional<Player> player() {
|
||||||
return this.server.getPlayer(this.uuid());
|
return this.server.getPlayer(this.uuid());
|
||||||
}
|
}
|
||||||
@@ -72,11 +55,6 @@ public final class CarbonPlayerVelocity extends WrappedCarbonPlayer implements F
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(final String permission) {
|
|
||||||
return this.player().map(value -> value.hasPermission(permission)).orElse(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean online() {
|
public boolean online() {
|
||||||
return this.player().isPresent();
|
return this.player().isPresent();
|
||||||
|
|||||||
Reference in new issue
Block a user