Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Merge pull request #1208 from KennyTV/dev
Add option to truncate edited books with more than 50 pages on 1.14
Dieser Commit ist enthalten in:
Commit
ad1cd2c993
@ -249,4 +249,9 @@ public class BukkitViaConfig extends Config implements ViaVersionConfig {
|
|||||||
public int get1_13TabCompleteDelay() {
|
public int get1_13TabCompleteDelay() {
|
||||||
return getInt("1_13-tab-complete-delay", 0);
|
return getInt("1_13-tab-complete-delay", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean truncate1_14Books() {
|
||||||
|
return getBoolean("truncate-1_14-books", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,4 +302,9 @@ public class BungeeViaConfig extends Config implements ViaVersionConfig {
|
|||||||
public int get1_13TabCompleteDelay() {
|
public int get1_13TabCompleteDelay() {
|
||||||
return getInt("1_13-tab-complete-delay", 0);
|
return getInt("1_13-tab-complete-delay", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean truncate1_14Books() {
|
||||||
|
return getBoolean("truncate-1_14-books", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,15 @@ public interface ViaVersionConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* When greater than 0, enables tab complete request delaying by x ticks
|
* When greater than 0, enables tab complete request delaying by x ticks
|
||||||
|
*
|
||||||
* @return the delay in ticks
|
* @return the delay in ticks
|
||||||
*/
|
*/
|
||||||
int get1_13TabCompleteDelay();
|
int get1_13TabCompleteDelay();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When activated, edited books with more than 50 pages will be shortened to 50.
|
||||||
|
*
|
||||||
|
* @return True if enabled
|
||||||
|
*/
|
||||||
|
boolean truncate1_14Books();
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ public class InventoryPackets {
|
|||||||
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
||||||
}
|
}
|
||||||
} else if (channel.equals("minecraft:book_open") || channel.equals("book_open")) {
|
} else if (channel.equals("minecraft:book_open") || channel.equals("book_open")) {
|
||||||
wrapper.passthrough(Type.REMAINING_BYTES);
|
wrapper.read(Type.REMAINING_BYTES);
|
||||||
int hand = wrapper.read(Type.VAR_INT);
|
int hand = wrapper.read(Type.VAR_INT);
|
||||||
wrapper.clearPacket();
|
wrapper.clearPacket();
|
||||||
wrapper.setId(0x2C);
|
wrapper.setId(0x2C);
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets;
|
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets;
|
||||||
|
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.minecraft.Position;
|
import us.myles.ViaVersion.api.minecraft.Position;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
@ -36,7 +41,23 @@ public class PlayerPackets {
|
|||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
final Item item = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);
|
||||||
|
InventoryPackets.toServer(item);
|
||||||
|
|
||||||
|
// Client limit when editing a book was upped from 50 to 100 in 1.14, but some anti-exploit plugins ban with a size higher than the old client limit
|
||||||
|
if (Via.getConfig().truncate1_14Books()) {
|
||||||
|
if (item == null) return;
|
||||||
|
CompoundTag tag = item.getTag();
|
||||||
|
|
||||||
|
if (tag == null) return;
|
||||||
|
Tag pages = tag.get("pages");
|
||||||
|
|
||||||
|
if (!(pages instanceof ListTag)) return;
|
||||||
|
|
||||||
|
ListTag listTag = (ListTag) pages;
|
||||||
|
if (listTag.size() <= 50) return;
|
||||||
|
listTag.setValue(listTag.getValue().subList(0, 50));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,8 @@ disable-1_13-auto-complete: false
|
|||||||
1_13-tab-complete-delay: 0
|
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
|
# 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
|
fix-low-snow-collision: false
|
||||||
|
# In 1.14 the client page limit has been upped to 100 (from 50). Some anti-exploit plugins ban when clients go higher than 50. This option cuts edited books to 50 pages.
|
||||||
|
truncate-1_14-books: false
|
||||||
#
|
#
|
||||||
# Enable serverside block-connections for 1.13+ clients
|
# Enable serverside block-connections for 1.13+ clients
|
||||||
serverside-blockconnections: false
|
serverside-blockconnections: false
|
||||||
|
@ -255,4 +255,9 @@ public class SpongeViaConfig extends Config implements ViaVersionConfig {
|
|||||||
public int get1_13TabCompleteDelay() {
|
public int get1_13TabCompleteDelay() {
|
||||||
return getInt("1_13-tab-complete-delay", 0);
|
return getInt("1_13-tab-complete-delay", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean truncate1_14Books() {
|
||||||
|
return getBoolean("truncate-1_14-books", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,4 +307,9 @@ public class VelocityViaConfig extends Config implements ViaVersionConfig {
|
|||||||
public int get1_13TabCompleteDelay() {
|
public int get1_13TabCompleteDelay() {
|
||||||
return getInt("1_13-tab-complete-delay", 0);
|
return getInt("1_13-tab-complete-delay", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean truncate1_14Books() {
|
||||||
|
return getBoolean("truncate-1_14-books", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren