3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00

Add config for quick move action patch

Dieser Commit ist enthalten in:
mmxw11 2017-10-05 22:05:53 +03:00
Ursprung 2703e849cb
Commit a27808ade1
7 geänderte Dateien mit 35 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -165,6 +165,11 @@ public class BukkitConfigAPI extends Config implements ViaVersionConfig {
return getBoolean("chat-nbt-fix", true); return getBoolean("chat-nbt-fix", true);
} }
@Override
public boolean is1_12QuickMoveActionFix() {
return getBoolean("quick-move-action-fix", true);
}
@Override @Override
public List<Integer> getBlockedProtocols() { public List<Integer> getBlockedProtocols() {
return getIntegerList("block-protocols"); return getIntegerList("block-protocols");

Datei anzeigen

@ -64,7 +64,9 @@ public class BukkitViaLoader implements ViaPlatformLoader {
/* Providers */ /* Providers */
Via.getManager().getProviders().use(BulkChunkTranslatorProvider.class, new BukkitViaBulkChunkTranslator()); Via.getManager().getProviders().use(BulkChunkTranslatorProvider.class, new BukkitViaBulkChunkTranslator());
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BukkitViaMovementTransmitter()); Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BukkitViaMovementTransmitter());
if (plugin.getConf().is1_12QuickMoveActionFix()) {
Via.getManager().getProviders().use(InvContainerItemProvider.class, new BukkitInvContainerItemProvider()); Via.getManager().getProviders().use(InvContainerItemProvider.class, new BukkitInvContainerItemProvider());
}
Via.getManager().getProviders().use(HandItemProvider.class, new HandItemProvider() { Via.getManager().getProviders().use(HandItemProvider.class, new HandItemProvider() {
@Override @Override
public Item getHandItem(final UserConnection info) { public Item getHandItem(final UserConnection info) {

Datei anzeigen

@ -10,7 +10,7 @@ import java.net.URL;
import java.util.*; import java.util.*;
public class BungeeConfigAPI extends Config implements ViaVersionConfig { public class BungeeConfigAPI extends Config implements ViaVersionConfig {
private static List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch"); private static List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix");
public BungeeConfigAPI(File configFile) { public BungeeConfigAPI(File configFile) {
super(new File(configFile, "config.yml")); super(new File(configFile, "config.yml"));
@ -204,6 +204,11 @@ public class BungeeConfigAPI extends Config implements ViaVersionConfig {
return getBoolean("chat-nbt-fix", true); return getBoolean("chat-nbt-fix", true);
} }
@Override
public boolean is1_12QuickMoveActionFix() {
return false;
}
@Override @Override
public List<Integer> getBlockedProtocols() { public List<Integer> getBlockedProtocols() {
return getIntegerList("block-protocols"); return getIntegerList("block-protocols");

Datei anzeigen

@ -210,6 +210,13 @@ public interface ViaVersionConfig {
*/ */
boolean is1_12NBTArrayFix(); boolean is1_12NBTArrayFix();
/**
* Should we fix shift quick move action for 1.12 clients
*
* @return True if enabled
*/
boolean is1_12QuickMoveActionFix();
/** /**
* Get the blocked protocols * Get the blocked protocols
* *

Datei anzeigen

@ -120,9 +120,13 @@ public class InventoryPackets {
handler(new PacketHandler() { handler(new PacketHandler() {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
Item item = wrapper.get(Type.ITEM, 0);
if (!Via.getConfig().is1_12QuickMoveActionFix()) {
BedRewriter.toServerItem(item);
return;
}
byte button = wrapper.get(Type.BYTE, 0); byte button = wrapper.get(Type.BYTE, 0);
int mode = wrapper.get(Type.VAR_INT, 0); int mode = wrapper.get(Type.VAR_INT, 0);
Item item = wrapper.get(Type.ITEM, 0);
// QUICK_MOVE PATCH (Shift + (click/double click)) // QUICK_MOVE PATCH (Shift + (click/double click))
if (mode == 1 && button == 0 && item == null) { if (mode == 1 && button == 0 && item == null) {
short windowId = wrapper.get(Type.UNSIGNED_BYTE, 0); short windowId = wrapper.get(Type.UNSIGNED_BYTE, 0);

Datei anzeigen

@ -84,6 +84,8 @@ hologram-y: -0.96
piston-animation-patch: false piston-animation-patch: false
# Should we fix nbt for 1.12 and above clients in chat messages (causes invalid item) # Should we fix nbt for 1.12 and above clients in chat messages (causes invalid item)
chat-nbt-fix: true chat-nbt-fix: true
# Should we fix shift quick move action for 1.12 clients (causes shift + double click not to work when moving items) (only works on 1.8-1.11.2 bukkit based servers)
quick-move-action-fix: true
# #
#----------------------------------------------------------# #----------------------------------------------------------#
# 1.9 & 1.10 CLIENTS ON 1.8 SERVERS OPTIONS # # 1.9 & 1.10 CLIENTS ON 1.8 SERVERS OPTIONS #

Datei anzeigen

@ -13,7 +13,7 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
public class SpongeConfigAPI extends Config implements ViaVersionConfig { public class SpongeConfigAPI extends Config implements ViaVersionConfig {
private static List<String> UNSUPPORTED = Arrays.asList("anti-xray-patch", "bungee-ping-interval", "bungee-ping-save", "bungee-servers"); private static List<String> UNSUPPORTED = Arrays.asList("anti-xray-patch", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "quick-move-action-fix");
private final PluginContainer pluginContainer; private final PluginContainer pluginContainer;
public SpongeConfigAPI(PluginContainer pluginContainer, File configFile) { public SpongeConfigAPI(PluginContainer pluginContainer, File configFile) {
@ -186,6 +186,11 @@ public class SpongeConfigAPI extends Config implements ViaVersionConfig {
return getBoolean("chat-nbt-fix", true); return getBoolean("chat-nbt-fix", true);
} }
@Override
public boolean is1_12QuickMoveActionFix() {
return false;
}
@Override @Override
public List<Integer> getBlockedProtocols() { public List<Integer> getBlockedProtocols() {
return getIntegerList("block-protocols"); return getIntegerList("block-protocols");