3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0473-Remove-streams-from-MinecraftKey.patch
Aikar 57dd397155
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:
b999860d SPIGOT-2304: Add LootGenerateEvent

CraftBukkit Changes:
77fd87e4 SPIGOT-2304: Implement LootGenerateEvent
a1a705ee SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent
41712edd SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
2020-05-01 18:03:57 -04:00

51 Zeilen
2.0 KiB
Diff

From f150261d52391ce180d530eb53af8a018db7b031 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 2b271d3e50..b1beebf0ed 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> {
--
2.26.2