From 601a6eb808052af3731d4d1a33a66a19d9b24841 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Tue, 21 Jul 2020 09:10:16 +0200 Subject: [PATCH] Set mapping load thread name, config comment change Closes #1922 --- .../myles/ViaVersion/AbstractViaConfig.java | 2 +- .../ViaVersion/api/ViaVersionConfig.java | 46 +++++++++---------- .../api/protocol/ProtocolRegistry.java | 5 +- .../Protocol1_16To1_15_2.java | 2 +- .../resources/assets/viaversion/config.yml | 2 +- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java index d56ae878d..a2d9e06e5 100644 --- a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java @@ -367,7 +367,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf } @Override - public boolean isIgnoreLong1_16ChannelMessages() { + public boolean isIgnoreLong1_16ChannelNames() { return ignoreLongChannelNames; } } diff --git a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java index 7a863b4ab..d4983d9d8 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java @@ -169,7 +169,7 @@ public interface ViaVersionConfig { /** * Replace extended pistons on 1.10 chunk loading. * - * @return True if to replace them + * @return true if to replace them */ boolean isReplacePistons(); @@ -183,28 +183,28 @@ public interface ViaVersionConfig { /** * Force json transform * - * @return True if enabled + * @return true if enabled */ boolean isForceJsonTransform(); /** * Should we fix nbt array's in json chat messages for 1.12 clients * - * @return True if enabled + * @return true if enabled */ boolean is1_12NBTArrayFix(); /** * Should we make team colours based on the last colour in team prefix * - * @return True if enabled + * @return true if enabled */ boolean is1_13TeamColourFix(); /** * Should we fix shift quick move action for 1.12 clients * - * @return True if enabled + * @return true if enabled */ boolean is1_12QuickMoveActionFix(); @@ -233,28 +233,28 @@ public interface ViaVersionConfig { /** * Should we hide errors that occur when trying to convert block and item data over versions? * - * @return True if enabled + * @return true if enabled */ boolean isSuppressConversionWarnings(); /** * Should we disable the 1.13 auto-complete feature to stop spam kicks? (for any server lower than 1.13) * - * @return True if enabled + * @return true if enabled */ boolean isDisable1_13AutoComplete(); /** * Tries to minimize cooldown animation. * - * @return True if enabled + * @return true if enabled */ boolean isMinimizeCooldown(); /** * Enable the serverside blockconnections for 1.13+ clients * - * @return True if enabled + * @return true if enabled */ boolean isServersideBlockConnections(); @@ -268,7 +268,7 @@ public interface ViaVersionConfig { /** * When activated, only the most important blocks are saved in the BlockStorage. * - * @return True if enabled + * @return true if enabled */ boolean isReduceBlockStorageMemory(); @@ -276,28 +276,28 @@ public interface ViaVersionConfig { * When activated with serverside-blockconnections, flower parts with blocks above will be sent as stems. * Useful for lobbyservers where users can't build and those stems are used decoratively. * - * @return True if enabled + * @return true if enabled */ boolean isStemWhenBlockAbove(); /** * Vines not connected to any blocks will be mapped to air for 1.13+ clients to prevent them from climbing up. * - * @return True if enabled + * @return true if enabled */ boolean isVineClimbFix(); /** * When activated, the 1-layer snow will be sent as 2-layer snow to 1.13+ clients to have collision. * - * @return True if enabled + * @return true if enabled */ boolean isSnowCollisionFix(); /** * When activated, infested blocks will be mapped to their normal stone variants for 1.13+ clients. * - * @return True if enabled + * @return true if enabled */ boolean isInfestedBlocksFix(); @@ -311,35 +311,35 @@ public interface ViaVersionConfig { /** * When activated, edited books with more than 50 pages will be shortened to 50. * - * @return True if enabled + * @return true if enabled */ boolean isTruncate1_14Books(); /** * Handles left handed info by using unused bit 7 on Client Settings packet * - * @return True if enabled + * @return true if enabled */ boolean isLeftHandedHandling(); /** * Fixes velocity bugs due to different hitbox for 1.9-1.13 clients on 1.8 servers. * - * @return True if enabled + * @return true if enabled */ boolean is1_9HitboxFix(); /** * Fixes velocity bugs due to different hitbox for 1.14+ clients on sub 1.14 servers. * - * @return True if enabled + * @return true if enabled */ boolean is1_14HitboxFix(); /** * Fixes non full blocks having 0 light for 1.14+ clients on sub 1.14 servers. * - * @return True if enabled + * @return true if enabled */ boolean isNonFullBlockLightFix(); @@ -348,14 +348,14 @@ public interface ViaVersionConfig { /** * Should 1.15 clients respawn instantly / without showing the death screen. * - * @return True if enabled + * @return true if enabled */ boolean is1_15InstantRespawn(); /** - * Ignores incoming plugin channel messages of 1.16 clients with channel names longer than 32 charatcers. + * Ignores incoming plugin channel messages of 1.16+ clients with channel names longer than 32 charatcers. * - * @return True if enabled + * @return true if enabled */ - boolean isIgnoreLong1_16ChannelMessages(); + boolean isIgnoreLong1_16ChannelNames(); } diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java index d38b14954..08a519484 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java @@ -2,6 +2,7 @@ package us.myles.ViaVersion.api.protocol; import com.google.common.collect.Lists; import com.google.common.collect.Range; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.jetbrains.annotations.Nullable; @@ -50,6 +51,7 @@ import java.util.TreeSet; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -70,7 +72,8 @@ public class ProtocolRegistry { private static boolean mappingsLoaded; static { - mappingLoaderExecutor = new ThreadPoolExecutor(5, 16, 45L, TimeUnit.SECONDS, new SynchronousQueue<>()); + ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("Via-Mappingloader-%d").build(); + mappingLoaderExecutor = new ThreadPoolExecutor(5, 16, 45L, TimeUnit.SECONDS, new SynchronousQueue<>(), threadFactory); mappingLoaderExecutor.allowCoreThreadTimeOut(true); // Base Protocol diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/Protocol1_16To1_15_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/Protocol1_16To1_15_2.java index d8126d304..3a16355a1 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/Protocol1_16To1_15_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/Protocol1_16To1_15_2.java @@ -143,7 +143,7 @@ public class Protocol1_16To1_15_2 extends Protocol