PaperMC/Spigot-Server-Patches/0472-Remove-streams-from-MinecraftKey.patch
Aikar 36f34f01c0
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots
3abebc9f #492: Let Tameable extend Animals rather than Entity
941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent
4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME

CraftBukkit Changes:
933e9094 #664: Add methods to get/set ItemStacks in EquipmentSlots
18722312 #662: Expose ItemStack and hand used in PlayerShearEntityEvent
2020-05-06 06:05:22 -04:00

47 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Mon, 6 Apr 2020 18:06:24 -0700
Subject: [PATCH] Remove streams from MinecraftKey
They produce a lot of garbage.
diff --git a/src/main/java/net/minecraft/server/MinecraftKey.java b/src/main/java/net/minecraft/server/MinecraftKey.java
index 2b271d3e509a5450c9136dced3ad4dc4d65af45a..b1beebf0ed5737c04875bf9138624fb2bd5dff27 100644
--- a/src/main/java/net/minecraft/server/MinecraftKey.java
+++ b/src/main/java/net/minecraft/server/MinecraftKey.java
@@ -125,15 +125,29 @@ public class MinecraftKey implements Comparable<MinecraftKey> {
}
private static boolean c(String s) {
- return s.chars().allMatch((i) -> {
- return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 47 || i == 46;
- });
+ // Paper start - remove streams
+ for (int index = 0, len = s.length(); index < len; ++index) {
+ int i = (int)s.charAt(index);
+ boolean condition = i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 47 || i == 46; // this is copied from the replaced code.
+ if (!condition) {
+ return false;
+ }
+ }
+ return true;
+ // Paper end - remove streams
}
private static boolean d(String s) {
- return s.chars().allMatch((i) -> {
- return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46;
- });
+ // Paper start - remove streams
+ for (int index = 0, len = s.length(); index < len; ++index) {
+ int i = (int)s.charAt(index);
+ boolean condition = i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46; // this is copied from the replaced code.
+ if (!condition) {
+ return false;
+ }
+ }
+ return true;
+ // Paper end - remove streams
}
public static class a implements JsonDeserializer<MinecraftKey>, JsonSerializer<MinecraftKey> {