Add config for quick move action patch

This commit is contained in:
mmxw11 2017-10-05 22:05:53 +03:00
parent 2703e849cb
commit a27808ade1
7 changed files with 35 additions and 5 deletions

View File

@ -164,6 +164,11 @@ public class BukkitConfigAPI extends Config implements ViaVersionConfig {
public boolean is1_12NBTArrayFix() { public boolean is1_12NBTArrayFix() {
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() {

View File

@ -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());
Via.getManager().getProviders().use(InvContainerItemProvider.class, new BukkitInvContainerItemProvider()); if (plugin.getConf().is1_12QuickMoveActionFix()) {
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) {

View File

@ -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"));
@ -203,6 +203,11 @@ public class BungeeConfigAPI extends Config implements ViaVersionConfig {
public boolean is1_12NBTArrayFix() { public boolean is1_12NBTArrayFix() {
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() {

View File

@ -209,7 +209,14 @@ public interface ViaVersionConfig {
* @return True if enabled * @return True if enabled
*/ */
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
* *

View File

@ -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);

View File

@ -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 #

View File

@ -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) {
@ -185,6 +185,11 @@ public class SpongeConfigAPI extends Config implements ViaVersionConfig {
public boolean is1_12NBTArrayFix() { public boolean is1_12NBTArrayFix() {
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() {