Add config option for tablist expire movement
This commit is contained in:
parent
f3390be91e
commit
fd9c4cdad7
@ -264,6 +264,9 @@ public class DisguiseConfig {
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private static String nameAboveDisguise;
|
private static String nameAboveDisguise;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private static int playerDisguisesSkinExpiresMove;
|
||||||
|
|
||||||
public static boolean isArmorstandsName() {
|
public static boolean isArmorstandsName() {
|
||||||
return getPlayerNameType() == PlayerNameType.ARMORSTANDS;
|
return getPlayerNameType() == PlayerNameType.ARMORSTANDS;
|
||||||
@ -694,6 +697,7 @@ public class DisguiseConfig {
|
|||||||
setOverrideCustomNames(config.getBoolean("OverrideCustomNames"));
|
setOverrideCustomNames(config.getBoolean("OverrideCustomNames"));
|
||||||
setRandomDisguises(config.getBoolean("RandomDisguiseOptions"));
|
setRandomDisguises(config.getBoolean("RandomDisguiseOptions"));
|
||||||
setSaveUserPreferences(config.getBoolean("SaveUserPreferences"));
|
setSaveUserPreferences(config.getBoolean("SaveUserPreferences"));
|
||||||
|
setPlayerDisguisesSkinExpiresMove(config.getInt("PlayerDisguisesTablistExpiresMove"));
|
||||||
|
|
||||||
if (!LibsPremium.isPremium() && (isSavePlayerDisguises() || isSaveEntityDisguises())) {
|
if (!LibsPremium.isPremium() && (isSavePlayerDisguises() || isSaveEntityDisguises())) {
|
||||||
DisguiseUtilities.getLogger().warning("You must purchase the plugin to use saved disguises!");
|
DisguiseUtilities.getLogger().warning("You must purchase the plugin to use saved disguises!");
|
||||||
|
@ -58,7 +58,7 @@ public class PlayerSkinHandler implements Listener {
|
|||||||
|
|
||||||
public boolean canRemove(boolean onMoved) {
|
public boolean canRemove(boolean onMoved) {
|
||||||
return firstPacketSent + (DisguiseConfig.getTablistRemoveDelay() * 50) +
|
return firstPacketSent + (DisguiseConfig.getTablistRemoveDelay() * 50) +
|
||||||
(onMoved ? 0 : TimeUnit.SECONDS.toMillis(5)) < System.currentTimeMillis();
|
(onMoved ? 0 : DisguiseConfig.getPlayerDisguisesSkinExpiresMove() * 50) < System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -75,8 +75,9 @@ public class PlayerSkinHandler implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Cache<Player, List<PlayerSkin>> cache =
|
private final Cache<Player, List<PlayerSkin>> cache = CacheBuilder.newBuilder().weakKeys()
|
||||||
CacheBuilder.newBuilder().weakKeys().expireAfterWrite(30, TimeUnit.SECONDS).removalListener((event) -> {
|
.expireAfterWrite(DisguiseConfig.getPlayerDisguisesSkinExpiresMove() * 50, TimeUnit.MILLISECONDS)
|
||||||
|
.removalListener((event) -> {
|
||||||
if (event.getCause() != RemovalCause.EXPIRED) {
|
if (event.getCause() != RemovalCause.EXPIRED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -291,6 +291,11 @@ ShowPlayerDisguisesInTab: false
|
|||||||
# 3 ticks should easily be enough.
|
# 3 ticks should easily be enough.
|
||||||
PlayerDisguisesTablistExpires: 3
|
PlayerDisguisesTablistExpires: 3
|
||||||
|
|
||||||
|
# To prevent skins from defaulting to alex/steve, there is a timer that only expires after X ticks or when the player moves
|
||||||
|
# You shouldn't actually touch this, but eh. Your server.
|
||||||
|
# Default is 5 seconds
|
||||||
|
PlayerDisguisesTablistExpiresMove: 100
|
||||||
|
|
||||||
# Don't like players able to set themselves invisible when using the disguise commands? Toggle this to true and no one can use setInvisible! Plugins can still use this however.
|
# Don't like players able to set themselves invisible when using the disguise commands? Toggle this to true and no one can use setInvisible! Plugins can still use this however.
|
||||||
DisableInvisibility: false
|
DisableInvisibility: false
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user