mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
Updated Upstream (Leaves)
Upstream has released updates that appear to apply and compile correctly Leaves Changes: LeavesMC/Leaves@e3b0cf4a Fix tripwire with end platform (#542) LeavesMC/Leaves@8615b2f4 Recheck for null before handling player join (#550) LeavesMC/Leaves@093b9290 Fix protocol bugs (#537) LeavesMC/Leaves@852184c1 Vanilla Fluid Pushing (#547) (#551) LeavesMC/Leaves@911ec9b9 Fix Carpet protocol (#552) LeavesMC/Leaves@2654bf53 Fully rewrite I18n support (#545) LeavesMC/Leaves@f33f5fea Refactor command system, fix bugs (#573) LeavesMC/Leaves@6c07912d Remove Force peaceful mode switch (#265) (#579) LeavesMC/Leaves@2dcf9f85 Fix spawnInvulnerableTime (#583) LeavesMC/Leaves@6d76c1f1 Fix unexpected IOE (#582) LeavesMC/Leaves@3187d77f Fix IAE update suppression crash (#581)
This commit is contained in:
@@ -3,13 +3,10 @@ From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Tue, 26 Sep 2023 19:00:41 +0800
|
||||
Subject: [PATCH] Leaves: Protocol Core
|
||||
|
||||
TODO: Check whether Leaves's Return-nether-portal-fix.patch improves performance
|
||||
and change store way to sql maybe?
|
||||
|
||||
Original license: GPLv3
|
||||
Original project: https://github.com/LeavesMC/Leaves
|
||||
|
||||
Commit: 9d32c5bd3df7c76055aff886ed9efda02e45a45a
|
||||
Commit: 3187d77f57058a81bc04ce7eaac1224f58b03c25
|
||||
|
||||
diff --git a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
|
||||
index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..56fd1ed7ccaf96e7eedea60fbdbf7f934939d563 100644
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
package org.leavesmc.leaves.plugin;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.PluginBase;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.PluginLogger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
public class MinecraftInternalPlugin extends PluginBase {
|
||||
|
||||
public static final MinecraftInternalPlugin INSTANCE = new MinecraftInternalPlugin();
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
private final PluginDescriptionFile pdf;
|
||||
|
||||
public MinecraftInternalPlugin() {
|
||||
String pluginName = "Minecraft";
|
||||
pdf = new PluginDescriptionFile(pluginName, "1.0", "nms");
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getDataFolder() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginDescriptionFile getDescription() {
|
||||
return pdf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public io.papermc.paper.plugin.configuration.PluginMeta getPluginMeta() {
|
||||
return pdf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileConfiguration getConfig() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getResource(String filename) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfig() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDefaultConfig() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveResource(String resourcePath, boolean replace) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfig() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginLogger getLogger() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginLoader getPluginLoader() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Server getServer() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNaggable() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNaggable(boolean canNag) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BiomeProvider getDefaultBiomeProvider(@NotNull String worldName, @Nullable String id) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager<org.bukkit.plugin.Plugin> getLifecycleManager() {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -322,9 +321,8 @@ public class LeavesProtocolManager {
|
||||
if (set.isEmpty()) return;
|
||||
// Leaf end - optimize leaves protocol manager
|
||||
ProtocolUtils.sendBytebufPacket(player, ResourceLocation.fromNamespaceAndPath("minecraft", "register"), buf -> {
|
||||
ResourceLocation channel;
|
||||
for (Iterator<String> var3 = set.iterator(); var3.hasNext(); buf.writeBytes(channel.toString().getBytes(StandardCharsets.US_ASCII))) {
|
||||
channel = ResourceLocation.parse(var3.next());
|
||||
for (String channel : set) {
|
||||
buf.writeBytes(channel.getBytes(StandardCharsets.US_ASCII));
|
||||
buf.writeByte(0);
|
||||
}
|
||||
buf.writerIndex(Math.max(buf.writerIndex() - 1, 0));
|
||||
|
||||
@@ -36,10 +36,12 @@ import net.minecraft.world.level.block.entity.HopperBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.JukeboxBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.LecternBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.TrialSpawnerBlockEntity;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.dreeam.leaf.config.modules.network.ProtocolSupport;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.LeavesLogger;
|
||||
import org.leavesmc.leaves.plugin.MinecraftInternalPlugin;
|
||||
import org.leavesmc.leaves.protocol.core.LeavesProtocol;
|
||||
import org.leavesmc.leaves.protocol.core.ProtocolHandler;
|
||||
import org.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
@@ -181,7 +183,7 @@ public class JadeProtocol implements LeavesProtocol {
|
||||
|
||||
@ProtocolHandler.PayloadReceiver(payload = RequestEntityPayload.class)
|
||||
public static void requestEntityData(ServerPlayer player, RequestEntityPayload payload) {
|
||||
MinecraftServer.getServer().execute(() -> {
|
||||
Bukkit.getGlobalRegionScheduler().run(MinecraftInternalPlugin.INSTANCE, (task) -> {
|
||||
EntityAccessor accessor = payload.data().unpack(player);
|
||||
if (accessor == null) {
|
||||
return;
|
||||
@@ -217,8 +219,7 @@ public class JadeProtocol implements LeavesProtocol {
|
||||
|
||||
@ProtocolHandler.PayloadReceiver(payload = RequestBlockPayload.class)
|
||||
public static void requestBlockData(ServerPlayer player, RequestBlockPayload payload) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
server.execute(() -> {
|
||||
Bukkit.getGlobalRegionScheduler().run(MinecraftInternalPlugin.INSTANCE, (task) -> {
|
||||
BlockAccessor accessor = payload.data().unpack(player);
|
||||
if (accessor == null) {
|
||||
return;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class SyncmaticaProtocol {
|
||||
private static final FeatureSet featureSet = new FeatureSet(Arrays.asList(Feature.values()));
|
||||
private static final SyncmaticManager syncmaticManager = new SyncmaticManager();
|
||||
private static final FileStorage fileStorage = new FileStorage();
|
||||
private static final int[] ILLEGAL_CHARS = {34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47};
|
||||
private static final int[] ILLEGAL_CHARS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47, 34, 60, 62, 124};
|
||||
private static final String ILLEGAL_PATTERNS = "(^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\\..*)?$)|(^\\.\\.*$)";
|
||||
private static boolean loaded = false;
|
||||
|
||||
@@ -51,11 +51,14 @@ public class SyncmaticaProtocol {
|
||||
return fileStorage;
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
if (!loaded) {
|
||||
public static void init(boolean status) {
|
||||
if (status && !loaded) {
|
||||
litematicFolder.mkdirs();
|
||||
syncmaticManager.startup();
|
||||
loaded = true;
|
||||
} else if (!status && loaded) {
|
||||
syncmaticManager.updateServerPlacement();
|
||||
loaded = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ public class DownloadExchange extends AbstractExchange {
|
||||
MessageType.ERROR,
|
||||
"syncmatica.error.cancelled_transmit_exceed_quota"
|
||||
);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
packetBuf.readBytes(outputStream, size);
|
||||
|
||||
Reference in New Issue
Block a user