3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00
(cherry picked from commit 386de52b9db1454e0fcec56ef9bfcd2c3a0f8d4a)
Dieser Commit ist enthalten in:
creeper123123321 2019-01-23 17:25:08 -02:00
Ursprung 9ba70424e8
Commit bce3593110
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1
8 geänderte Dateien mit 59 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -244,4 +244,9 @@ public class BukkitViaConfig extends Config implements ViaVersionConfig {
public boolean isSnowCollisionFix() {
return getBoolean("fix-low-snow-collision", false);
}
@Override
public int get1_13TabCompleteDelay() {
return getInt("1_13-tab-complete-delay", 0);
}
}

Datei anzeigen

@ -297,4 +297,9 @@ public class BungeeViaConfig extends Config implements ViaVersionConfig {
public boolean isSnowCollisionFix() {
return getBoolean("fix-low-snow-collision", false);
}
@Override
public int get1_13TabCompleteDelay() {
return getInt("1_13-tab-complete-delay", 0);
}
}

Datei anzeigen

@ -302,4 +302,10 @@ public interface ViaVersionConfig {
* @return True if enabled
*/
boolean isSnowCollisionFix();
/**
* When greater than 0, enables tab complete request delaying by x ticks
* @return the delay in ticks
*/
int get1_13TabCompleteDelay();
}

Datei anzeigen

@ -852,9 +852,33 @@ public class Protocol1_13To1_12_2 extends Protocol {
// Fake the end of the packet
create(new ValueCreator() {
@Override
public void write(PacketWrapper wrapper) {
public void write(PacketWrapper wrapper) throws Exception {
wrapper.write(Type.BOOLEAN, false);
wrapper.write(Type.OPTIONAL_POSITION, null);
if (!wrapper.isCancelled() && Via.getConfig().get1_13TabCompleteDelay() > 0) {
TabCompleteTracker tracker = wrapper.user().get(TabCompleteTracker.class);
if (tracker.getLastTabCompleteTask() != null) {
Via.getPlatform().cancelTask(tracker.getLastTabCompleteTask());
}
wrapper.cancel();
wrapper.resetReader();
final PacketWrapper delayedPacket = wrapper.create(0x1);
delayedPacket.write(Type.STRING, wrapper.read(Type.STRING));
delayedPacket.write(Type.BOOLEAN, false);
delayedPacket.write(Type.OPTIONAL_POSITION, null);
tracker.setLastTabCompleteTask(
Via.getPlatform().runSync(new Runnable() {
@Override
public void run() {
try {
delayedPacket.sendToServer(Protocol1_13To1_12_2.class);
} catch (Exception e) {
e.printStackTrace();
}
}
}, (long) Via.getConfig().get1_13TabCompleteDelay())
);
}
}
});
}

Datei anzeigen

@ -1,29 +1,19 @@
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage;
import lombok.Getter;
import lombok.Setter;
import us.myles.ViaVersion.api.data.StoredObject;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.platform.TaskId;
@Getter
@Setter
public class TabCompleteTracker extends StoredObject {
private int transactionId;
private String input;
private TaskId lastTabCompleteTask;
public TabCompleteTracker(UserConnection user) {
super(user);
}
public int getTransactionId() {
return transactionId;
}
public void setTransactionId(int transactionId) {
this.transactionId = transactionId;
}
public String getInput() {
return input;
}
public void setInput(String input) {
this.input = input;
}
}

Datei anzeigen

@ -114,6 +114,8 @@ team-colour-fix: true
suppress-1_13-conversion-errors: false
# 1.13 introduced new auto complete which can trigger "Kicked for spamming" for servers older than 1.13, the following option will disable it completely.
disable-1_13-auto-complete: false
# The following option will delay the tab complete request in x ticks if greater than 0, if other tab-complete is received, the previous is cancelled
1_13-tab-complete-delay: 0
# For 1.13 clients the smallest (1 layer) snow doesn't have collision, this will send these as 2 snowlayers for 1.13+ clients to prevent them bugging through them
fix-low-snow-collision: false
#

Datei anzeigen

@ -250,4 +250,9 @@ public class SpongeViaConfig extends Config implements ViaVersionConfig {
public boolean isSnowCollisionFix() {
return getBoolean("fix-low-snow-collision", false);
}
@Override
public int get1_13TabCompleteDelay() {
return getInt("1_13-tab-complete-delay", 0);
}
}

Datei anzeigen

@ -302,4 +302,9 @@ public class VelocityViaConfig extends Config implements ViaVersionConfig {
public boolean isSnowCollisionFix() {
return getBoolean("fix-low-snow-collision", false);
}
@Override
public int get1_13TabCompleteDelay() {
return getInt("1_13-tab-complete-delay", 0);
}
}