mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 15:09:23 +00:00
bump adventure platform version
This commit is contained in:
@@ -39,8 +39,11 @@ import net.momirealms.customnameplates.common.event.EventManager;
|
||||
import net.momirealms.customnameplates.common.locale.TranslationManager;
|
||||
import net.momirealms.customnameplates.common.plugin.NameplatesPlugin;
|
||||
import net.momirealms.customnameplates.common.plugin.scheduler.SchedulerTask;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
@@ -127,12 +130,12 @@ public abstract class CustomNameplates implements NameplatesPlugin {
|
||||
/**
|
||||
* A map that tracks online players by their unique UUID, allowing quick access to player data.
|
||||
*/
|
||||
protected ConcurrentHashMap<UUID, CNPlayer> onlinePlayerMap = new ConcurrentHashMap<>();
|
||||
protected Map<UUID, CNPlayer> onlinePlayerMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* A fast lookup map that associates entity IDs to player data (CNPlayer) for quick access.
|
||||
*/
|
||||
protected ConcurrentHashMap<Integer, CNPlayer> entityIDFastLookup = new ConcurrentHashMap<>();
|
||||
protected Map<Integer, CNPlayer> entityIDFastLookup = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Manages advances or progressions for players, such as achievements or level ups.
|
||||
@@ -462,4 +465,16 @@ public abstract class CustomNameplates implements NameplatesPlugin {
|
||||
public static CustomNameplates getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ApiStatus.Experimental
|
||||
public void addPlayerUnsafe(int entityId, CNPlayer player) {
|
||||
if (this.entityIDFastLookup.containsKey(entityId)) return;
|
||||
this.entityIDFastLookup.put(entityId, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ApiStatus.Experimental
|
||||
public CNPlayer removePlayerUnsafe(int entityId) {
|
||||
return this.entityIDFastLookup.remove(entityId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package net.momirealms.customnameplates.api;
|
||||
|
||||
import net.momirealms.customnameplates.api.util.Vector3;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DummyPlayer extends AbstractCNPlayer<Object> {
|
||||
private final CNPlayer target;
|
||||
private final int megEntityId;
|
||||
private final Vector3 position;
|
||||
|
||||
public DummyPlayer(CustomNameplates plugin, CNPlayer delegate, int entityId, Vector3 location) {
|
||||
super(plugin, delegate.channel());
|
||||
this.target = delegate;
|
||||
this.megEntityId = entityId;
|
||||
this.position = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int entityID() {
|
||||
return this.megEntityId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String permission) {
|
||||
return this.target.hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3 position() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String world() {
|
||||
return this.target.world();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.target.isOnline();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpectator() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double scale() {
|
||||
return this.target.scale();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCrouching() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long playerTime() {
|
||||
return this.target.playerTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlying() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int remainingAir() {
|
||||
return this.target.remainingAir();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Integer> passengers() {
|
||||
return Set.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return this.target.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID uuid() {
|
||||
return this.target.uuid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object player() {
|
||||
return this.target.player();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currentNameplate() {
|
||||
return this.target.currentNameplate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currentBubble() {
|
||||
return this.target.currentBubble();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
package net.momirealms.customnameplates.api.feature.tag;
|
||||
|
||||
import net.momirealms.customnameplates.api.CNPlayer;
|
||||
import net.momirealms.customnameplates.api.feature.JoinQuitListener;
|
||||
import net.momirealms.customnameplates.common.plugin.feature.Reloadable;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -25,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* An interface manages unlimited tags
|
||||
*/
|
||||
public interface UnlimitedTagManager extends Reloadable {
|
||||
public interface UnlimitedTagManager extends Reloadable, JoinQuitListener {
|
||||
|
||||
/**
|
||||
* Called every tick to update the state of tags.
|
||||
|
||||
Reference in New Issue
Block a user