3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Remove unused config option, hotfix mapping data cache

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-02-20 13:19:10 +01:00
Ursprung 7b5cb92982
Commit 1157029f23
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
13 geänderte Dateien mit 26 neuen und 66 gelöschten Zeilen

Datei anzeigen

@ -186,13 +186,6 @@ public interface ViaVersionConfig {
*/ */
String getMaxWarningsKickMessage(); String getMaxWarningsKickMessage();
/**
* Is anti-xray enabled?
*
* @return A boolean
*/
boolean isAntiXRay();
/** /**
* Send supported versions in the status response packet * Send supported versions in the status response packet
* *

Datei anzeigen

@ -41,7 +41,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
public class MappingDataLoader { public final class MappingDataLoader {
private static final Map<String, JsonObject> MAPPINGS_CACHE = new ConcurrentHashMap<>(); private static final Map<String, JsonObject> MAPPINGS_CACHE = new ConcurrentHashMap<>();
private static boolean cacheJsonMappings; private static boolean cacheJsonMappings;
@ -77,7 +77,9 @@ public class MappingDataLoader {
*/ */
public static @Nullable JsonObject loadFromDataDir(String name) { public static @Nullable JsonObject loadFromDataDir(String name) {
File file = new File(Via.getPlatform().getDataFolder(), name); File file = new File(Via.getPlatform().getDataFolder(), name);
if (!file.exists()) return loadData(name); if (!file.exists()) {
return loadData(name);
}
// Load the file from the platform's directory if present // Load the file from the platform's directory if present
try (FileReader reader = new FileReader(file)) { try (FileReader reader = new FileReader(file)) {

Datei anzeigen

@ -55,7 +55,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
private final ViaAPI<Player> api = new BukkitViaAPI(this); private final ViaAPI<Player> api = new BukkitViaAPI(this);
private final List<Runnable> queuedTasks = new ArrayList<>(); private final List<Runnable> queuedTasks = new ArrayList<>();
private final List<Runnable> asyncQueuedTasks = new ArrayList<>(); private final List<Runnable> asyncQueuedTasks = new ArrayList<>();
private final boolean protocolSupport; private boolean protocolSupport;
private boolean lateBind; private boolean lateBind;
public ViaVersionPlugin() { public ViaVersionPlugin() {
@ -66,7 +66,6 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
// Init platform // Init platform
BukkitViaInjector injector = new BukkitViaInjector(); BukkitViaInjector injector = new BukkitViaInjector();
Via.init(ViaManagerImpl.builder() Via.init(ViaManagerImpl.builder()
.platform(this) .platform(this)
.commandHandler(commandHandler) .commandHandler(commandHandler)
@ -76,17 +75,16 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
// Config magic // Config magic
conf = new BukkitViaConfig(); conf = new BukkitViaConfig();
// Check if we're using protocol support too
protocolSupport = Bukkit.getPluginManager().getPlugin("ProtocolSupport") != null;
} }
@Override @Override
public void onLoad() { public void onLoad() {
if (getServer().getPluginManager().getPlugin("ViaBackwards") != null) { if (hasPaperPluginLoader()) {
// Paper's plugin loader constructs plugin only once they're actually loaded and there's no place for VB to enable caching before the protocols are initialized
MappingDataLoader.enableMappingsCache(); MappingDataLoader.enableMappingsCache();
} }
protocolSupport = Bukkit.getPluginManager().getPlugin("ProtocolSupport") != null;
lateBind = !((BukkitViaInjector) Via.getManager().getInjector()).isBinded(); lateBind = !((BukkitViaInjector) Via.getManager().getInjector()).isBinded();
getLogger().info("ViaVersion " + getDescription().getVersion() + " is now loaded" + (lateBind ? ", waiting for boot. (late-bind)" : ", injecting!")); getLogger().info("ViaVersion " + getDescription().getVersion() + " is now loaded" + (lateBind ? ", waiting for boot. (late-bind)" : ", injecting!"));
@ -95,6 +93,15 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
} }
} }
private boolean hasPaperPluginLoader() {
try {
Class.forName("io.papermc.paper.plugin.configuration.PluginMeta");
return true;
} catch (final ClassNotFoundException e) {
return false;
}
}
@Override @Override
public void onEnable() { public void onEnable() {
if (lateBind) { if (lateBind) {
@ -104,11 +111,6 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
getCommand("viaversion").setExecutor(commandHandler); getCommand("viaversion").setExecutor(commandHandler);
getCommand("viaversion").setTabCompleter(commandHandler); getCommand("viaversion").setTabCompleter(commandHandler);
// Warn them if they have anti-xray on and they aren't using spigot
if (conf.isAntiXRay() && !isSpigot()) {
getLogger().info("You have anti-xray on in your config, since you're not using spigot it won't fix xray!");
}
// Run queued tasks // Run queued tasks
for (Runnable r : queuedTasks) { for (Runnable r : queuedTasks) {
Bukkit.getScheduler().runTask(this, r); Bukkit.getScheduler().runTask(this, r);
@ -279,15 +281,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
return protocolSupport; return protocolSupport;
} }
private boolean isSpigot() { @Deprecated/*(forRemoval = true)*/
try {
Class.forName("org.spigotmc.SpigotConfig");
} catch (ClassNotFoundException e) {
return false;
}
return true;
}
public static ViaVersionPlugin getInstance() { public static ViaVersionPlugin getInstance() {
return instance; return instance;
} }

Datei anzeigen

@ -27,7 +27,6 @@ import org.bukkit.plugin.Plugin;
public class BukkitViaConfig extends AbstractViaConfig { public class BukkitViaConfig extends AbstractViaConfig {
private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers"); private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers");
private boolean antiXRay;
private boolean quickMoveActionFix; private boolean quickMoveActionFix;
private boolean hitboxFix1_9; private boolean hitboxFix1_9;
private boolean hitboxFix1_14; private boolean hitboxFix1_14;
@ -42,7 +41,6 @@ public class BukkitViaConfig extends AbstractViaConfig {
@Override @Override
protected void loadFields() { protected void loadFields() {
super.loadFields(); super.loadFields();
antiXRay = getBoolean("anti-xray-patch", true);
quickMoveActionFix = getBoolean("quick-move-action-fix", false); quickMoveActionFix = getBoolean("quick-move-action-fix", false);
hitboxFix1_9 = getBoolean("change-1_9-hitbox", false); hitboxFix1_9 = getBoolean("change-1_9-hitbox", false);
hitboxFix1_14 = getBoolean("change-1_14-hitbox", false); hitboxFix1_14 = getBoolean("change-1_14-hitbox", false);
@ -54,11 +52,6 @@ public class BukkitViaConfig extends AbstractViaConfig {
protected void handleConfig(Map<String, Object> config) { protected void handleConfig(Map<String, Object> config) {
} }
@Override
public boolean isAntiXRay() {
return antiXRay;
}
@Override @Override
public boolean is1_12QuickMoveActionFix() { public boolean is1_12QuickMoveActionFix() {
return quickMoveActionFix; return quickMoveActionFix;

Datei anzeigen

@ -23,7 +23,6 @@ import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.ViaAPI; import com.viaversion.viaversion.api.ViaAPI;
import com.viaversion.viaversion.api.command.ViaCommandSender; import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.api.configuration.ConfigurationProvider; import com.viaversion.viaversion.api.configuration.ConfigurationProvider;
import com.viaversion.viaversion.api.data.MappingDataLoader;
import com.viaversion.viaversion.api.platform.PlatformTask; import com.viaversion.viaversion.api.platform.PlatformTask;
import com.viaversion.viaversion.api.platform.UnsupportedSoftware; import com.viaversion.viaversion.api.platform.UnsupportedSoftware;
import com.viaversion.viaversion.api.platform.ViaServerProxyPlatform; import com.viaversion.viaversion.api.platform.ViaServerProxyPlatform;
@ -86,11 +85,6 @@ public class BungeePlugin extends Plugin implements ViaServerProxyPlatform<Proxi
@Override @Override
public void onEnable() { public void onEnable() {
if (ProxyServer.getInstance().getPluginManager().getPlugin("ViaBackwards") != null) {
MappingDataLoader.enableMappingsCache();
}
// Inject
((ViaManagerImpl) Via.getManager()).init(); ((ViaManagerImpl) Via.getManager()).init();
} }

Datei anzeigen

@ -28,7 +28,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class BungeeViaConfig extends AbstractViaConfig { public class BungeeViaConfig extends AbstractViaConfig {
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox"); private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "quick-move-action-fix", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
private int bungeePingInterval; private int bungeePingInterval;
private boolean bungeePingSave; private boolean bungeePingSave;
private Map<String, Integer> bungeeServerProtocols; private Map<String, Integer> bungeeServerProtocols;

Datei anzeigen

@ -332,11 +332,6 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
return maxPPSWarningsKickMessage; return maxPPSWarningsKickMessage;
} }
@Override
public boolean isAntiXRay() {
return false;
}
@Override @Override
public boolean isSendSupportedVersions() { public boolean isSendSupportedVersions() {
return sendSupportedVersions; return sendSupportedVersions;

Datei anzeigen

@ -150,6 +150,11 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_19_3
}); });
registerMetaTypeHandler(Types1_19_4.META_TYPES.itemType, Types1_19_4.META_TYPES.blockStateType, Types1_19_4.META_TYPES.particleType); registerMetaTypeHandler(Types1_19_4.META_TYPES.itemType, Types1_19_4.META_TYPES.blockStateType, Types1_19_4.META_TYPES.particleType);
filter().filterFamily(Entity1_19_4Types.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
filter().filterFamily(Entity1_19_4Types.ABSTRACT_HORSE).removeIndex(18); // Owner UUID filter().filterFamily(Entity1_19_4Types.ABSTRACT_HORSE).removeIndex(18); // Owner UUID
} }

Datei anzeigen

@ -210,8 +210,6 @@ use-new-effect-indicator: true
use-new-deathmessages: true use-new-deathmessages: true
# Should we cache our items, this will prevent server from being lagged out, however the cost is a constant task caching items # Should we cache our items, this will prevent server from being lagged out, however the cost is a constant task caching items
item-cache: true item-cache: true
# Patch the anti xray to work on 1.9+ (If your server is 1.8) This can cost more performance, so disable it if you don't use it.
anti-xray-patch: true
# Should we replace extended pistons to fix 1.10.1 (Only on chunk load) # Should we replace extended pistons to fix 1.10.1 (Only on chunk load)
replace-pistons: false replace-pistons: false
# What id should we replace with, default is air. (careful of players getting stuck standing on them) # What id should we replace with, default is air. (careful of players getting stuck standing on them)

Datei anzeigen

@ -22,7 +22,6 @@ import com.google.inject.Inject;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.command.ViaCommandSender; import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.api.configuration.ConfigurationProvider; import com.viaversion.viaversion.api.configuration.ConfigurationProvider;
import com.viaversion.viaversion.api.data.MappingDataLoader;
import com.viaversion.viaversion.api.platform.PlatformTask; import com.viaversion.viaversion.api.platform.PlatformTask;
import com.viaversion.viaversion.api.platform.ViaPlatform; import com.viaversion.viaversion.api.platform.ViaPlatform;
import com.viaversion.viaversion.dump.PluginInfo; import com.viaversion.viaversion.dump.PluginInfo;
@ -89,7 +88,6 @@ public class SpongePlugin implements ViaPlatform<Player> {
public void constructPlugin(ConstructPluginEvent event) { public void constructPlugin(ConstructPluginEvent event) {
// Setup Plugin // Setup Plugin
conf = new SpongeViaConfig(configDir.toFile()); conf = new SpongeViaConfig(configDir.toFile());
logger.info("ViaVersion " + getPluginVersion() + " is now loaded!");
// Init platform // Init platform
Via.init(ViaManagerImpl.builder() Via.init(ViaManagerImpl.builder()
@ -104,13 +102,6 @@ public class SpongePlugin implements ViaPlatform<Player> {
public void onServerStart(StartingEngineEvent<Server> event) { public void onServerStart(StartingEngineEvent<Server> event) {
// Can't use the command register event for raw commands... // Can't use the command register event for raw commands...
Sponge.server().commandManager().registrar(Command.Raw.class).get().register(container, (Command.Raw) Via.getManager().getCommandHandler(), "viaversion", "viaver", "vvsponge"); Sponge.server().commandManager().registrar(Command.Raw.class).get().register(container, (Command.Raw) Via.getManager().getCommandHandler(), "viaversion", "viaver", "vvsponge");
if (game.pluginManager().plugin("viabackwards").isPresent()) {
MappingDataLoader.enableMappingsCache();
}
// Inject!
logger.info("ViaVersion is injecting!");
((ViaManagerImpl) Via.getManager()).init(); ((ViaManagerImpl) Via.getManager()).init();
} }

Datei anzeigen

@ -24,7 +24,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class SpongeViaConfig extends AbstractViaConfig { public class SpongeViaConfig extends AbstractViaConfig {
private static final List<String> UNSUPPORTED = Arrays.asList("anti-xray-patch", "bungee-ping-interval", private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval",
"bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers",
"quick-move-action-fix", "change-1_9-hitbox", "change-1_14-hitbox", "blockconnection-method"); "quick-move-action-fix", "change-1_9-hitbox", "change-1_14-hitbox", "blockconnection-method");

Datei anzeigen

@ -30,7 +30,6 @@ import com.velocitypowered.api.proxy.ProxyServer;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.command.ViaCommandSender; import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.api.configuration.ConfigurationProvider; import com.viaversion.viaversion.api.configuration.ConfigurationProvider;
import com.viaversion.viaversion.api.data.MappingDataLoader;
import com.viaversion.viaversion.api.platform.PlatformTask; import com.viaversion.viaversion.api.platform.PlatformTask;
import com.viaversion.viaversion.api.platform.ViaServerProxyPlatform; import com.viaversion.viaversion.api.platform.ViaServerProxyPlatform;
import com.viaversion.viaversion.dump.PluginInfo; import com.viaversion.viaversion.dump.PluginInfo;
@ -105,10 +104,6 @@ public class VelocityPlugin implements ViaServerProxyPlatform<Player> {
.commandHandler(commandHandler) .commandHandler(commandHandler)
.loader(new VelocityViaLoader()) .loader(new VelocityViaLoader())
.injector(new VelocityViaInjector()).build()); .injector(new VelocityViaInjector()).build());
if (proxy.getPluginManager().getPlugin("viabackwards").isPresent()) {
MappingDataLoader.enableMappingsCache();
}
} }
@Subscribe(order = PostOrder.LAST) @Subscribe(order = PostOrder.LAST)

Datei anzeigen

@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class VelocityViaConfig extends AbstractViaConfig { public class VelocityViaConfig extends AbstractViaConfig {
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox"); private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "quick-move-action-fix", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
private int velocityPingInterval; private int velocityPingInterval;
private boolean velocityPingSave; private boolean velocityPingSave;
private Map<String, Integer> velocityServerProtocols; private Map<String, Integer> velocityServerProtocols;