diff --git a/1todos/server/minecraft-patches/features/0019-I18n-support.patch b/lophine-server/minecraft-patches/features/0001-Server-I18n.patch similarity index 60% rename from 1todos/server/minecraft-patches/features/0019-I18n-support.patch rename to lophine-server/minecraft-patches/features/0001-Server-I18n.patch index e3ad4cb..0664b18 100644 --- a/1todos/server/minecraft-patches/features/0019-I18n-support.patch +++ b/lophine-server/minecraft-patches/features/0001-Server-I18n.patch @@ -1,35 +1,35 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Helvetica Volubi Date: Thu, 12 Jun 2025 04:44:24 +0800 -Subject: [PATCH] I18n support +Subject: [PATCH] Server I18n diff --git a/net/minecraft/locale/Language.java b/net/minecraft/locale/Language.java -index 7b9e2a1a208b46a69c16e6afd8b502259893574f..c300ae4363298fecef8fa9bf739f01c0a11e145f 100644 +index 49c7f8194be8222e329fc3215a6aa6db0b221b11..c6c968d28e0d14a4c50e66bdd5176a000944b707 100644 --- a/net/minecraft/locale/Language.java +++ b/net/minecraft/locale/Language.java -@@ -36,6 +36,7 @@ public abstract class Language { - Map map = new HashMap<>(); - BiConsumer biConsumer = map::put; - parseTranslations(biConsumer, "/assets/minecraft/lang/en_us.json"); -+ fun.bm.lophine.utils.ServerI18nUtil.loadLophineI18nDefault(biConsumer); - deprecatedTranslationsInfo.applyToMap(map); - final Map map1 = Map.copyOf(map); +@@ -37,6 +37,7 @@ public abstract class Language { + Map loadedData = new HashMap<>(); + BiConsumer output = loadedData::put; + parseTranslations(output, "/assets/minecraft/lang/en_us.json"); ++ fun.bm.lophine.utils.ServerI18nUtil.loadLophineI18nDefault(output); // Lophine - Server I18n + deprecatedInfo.applyToMap(loadedData); + final Map storage = Map.copyOf(loadedData); return new Language() { -@@ -65,7 +66,7 @@ public abstract class Language { +@@ -66,7 +67,7 @@ public abstract class Language { }; } -- private static void parseTranslations(BiConsumer output, String languagePath) { -+ public static void parseTranslations(BiConsumer output, String languagePath) { // Lophine - private -> public - try (InputStream resourceAsStream = Language.class.getResourceAsStream(languagePath)) { - loadFromJson(resourceAsStream, output); +- private static void parseTranslations(final BiConsumer output, final String path) { ++ public static void parseTranslations(final BiConsumer output, final String path) { // Lophine - private -> public + try (InputStream stream = Language.class.getResourceAsStream(path)) { + loadFromJson(stream, output); } catch (JsonParseException | IOException var7) { diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java -index f41c70c6cb2e9fae43bad9dd66546417fe38f14a..0bb0877011cac3184b881bfa35f10ef83d7341de 100644 +index 5b46b224bb0fea3a7e0f721ce9770657ffe0c71d..44d594da98615a8bbfb2560e0a63d2e7aab3cc7e 100644 --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java -@@ -151,6 +151,8 @@ public class Main { +@@ -154,6 +154,8 @@ public class Main { return; } @@ -39,10 +39,10 @@ index f41c70c6cb2e9fae43bad9dd66546417fe38f14a..0bb0877011cac3184b881bfa35f10ef8 String awtException = io.papermc.paper.util.ServerEnvironment.awtDependencyCheck(); if (awtException != null) { diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index 4abfcaae4fe024296961987704e2a11a03ee518b..5fbcb5eac1d5449247da77b6120edbe2f2dd1d58 100644 +index 0905b1c0a0e9954c8fc68649b5721c975febf777..5ef4da46445e6caff4025baf079457348b0d5801 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -262,6 +262,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -283,6 +283,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Paper end - initialize global and world-defaults configuration me.earthme.luminol.config.ConfigManager.loadConfigFiles(); // Luminol - load config file diff --git a/1todos/server/minecraft-patches/features/0008-Fix-datapack-command-save-function.patch b/lophine-server/minecraft-patches/features/0002-Fix-datapack-command-save-function.patch similarity index 51% rename from 1todos/server/minecraft-patches/features/0008-Fix-datapack-command-save-function.patch rename to lophine-server/minecraft-patches/features/0002-Fix-datapack-command-save-function.patch index 685af71..406524a 100644 --- a/1todos/server/minecraft-patches/features/0008-Fix-datapack-command-save-function.patch +++ b/lophine-server/minecraft-patches/features/0002-Fix-datapack-command-save-function.patch @@ -5,16 +5,16 @@ Subject: [PATCH] Fix datapack command save function diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 504f21c5f1e3101e7164b97059aecce630d18cee..d5b680fc6e13ec26d0db2448009e4cbe59933e22 100644 +index 35c1b7f40563823401ca204ec41ef57220b5ad55..f993a4de22558e7b9598aa7500cd3cc1225e4c5b 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -2437,6 +2437,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop selectedIds) { -+ this.packRepository.setSelected(selectedIds, false); // Paper - add pendingReload flag to determine required pack loading - false as this is *after* a reload (see above) ++ public void saveDatapacks(Collection selectedPacks) { ++ this.packRepository.setSelected(selectedPacks, false); // Paper - add pendingReload flag to determine required pack loading - false as this is *after* a reload (see above) + WorldDataConfiguration worldDataConfiguration = new WorldDataConfiguration( + getSelectedPacks(this.packRepository, true), this.worldData.enabledFeatures() + ); @@ -22,11 +22,11 @@ index 504f21c5f1e3101e7164b97059aecce630d18cee..d5b680fc6e13ec26d0db2448009e4cbe + } + // Lophine end - region thread skip reload // TODO - add reload support + - public CompletableFuture reloadResources(Collection selectedIds, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) { - // Paper end - Add ServerResourcesReloadedEvent - CompletableFuture completableFuture = CompletableFuture.supplyAsync( + public CompletableFuture reloadResources( + final Collection packsToEnable, final io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause + ) { diff --git a/net/minecraft/server/commands/DataPackCommand.java b/net/minecraft/server/commands/DataPackCommand.java -index bb36fa4559cdfe82079af1c39516239119ff06f4..8c530eef0e416d8b96f190ada358d77d34dbc8ac 100644 +index 0c7c829270d3cd3dd05a3dc7dfe82ee01d5c6bd8..04fa1c5bb1c0b025a56941aae7d2151d1087e257 100644 --- a/net/minecraft/server/commands/DataPackCommand.java +++ b/net/minecraft/server/commands/DataPackCommand.java @@ -98,7 +98,7 @@ public class DataPackCommand { @@ -38,51 +38,42 @@ index bb36fa4559cdfe82079af1c39516239119ff06f4..8c530eef0e416d8b96f190ada358d77d Commands.literal("enable") .then( Commands.argument("name", StringArgumentType.string()) -@@ -160,11 +160,11 @@ public class DataPackCommand { +@@ -145,11 +145,11 @@ public class DataPackCommand { .suggests(SELECTED_PACKS) - .executes(commandContext -> disablePack(commandContext.getSource(), getPack(commandContext, "name", false))) + .executes(c -> disablePack(c.getSource(), getPack(c, "name", false))) ) - )*/ // Luminol - Add back read-only datapack command + ) .then( Commands.literal("list") - .executes(commandContext -> listPacks(commandContext.getSource())) -- // .then(Commands.literal("available").executes(commandContext -> listAvailablePacks(commandContext.getSource()))) // Luminol - Add back read-only datapack command -+ .then(Commands.literal("available").executes(commandContext -> listAvailablePacks(commandContext.getSource()))) - .then(Commands.literal("enabled").executes(commandContext -> listEnabledPacks(commandContext.getSource()))) + .executes(c -> listPacks(c.getSource())) +- //.then(Commands.literal("available").executes(c -> listAvailablePacks(c.getSource()))) // Luminol - Add back read-only datapack command ++ .then(Commands.literal("available").executes(c -> listAvailablePacks(c.getSource()))) // Luminol - Add back read-only datapack command + .then(Commands.literal("enabled").executes(c -> listEnabledPacks(c.getSource()))) ) .then( -@@ -252,7 +252,7 @@ public class DataPackCommand { +@@ -235,7 +235,7 @@ public class DataPackCommand { } - private static int listPacks(CommandSourceStack source) { + private static int listPacks(final CommandSourceStack source) { - return listEnabledPacks(source) ;// + listAvailablePacks(source); // Luminol - Add back read-only datapack command + return listEnabledPacks(source) + listAvailablePacks(source); } - private static int listAvailablePacks(CommandSourceStack source) { -@@ -280,7 +280,7 @@ public class DataPackCommand { - - private static int listEnabledPacks(CommandSourceStack source) { - PackRepository packRepository = source.getServer().getPackRepository(); -- // packRepository.reload(); // Luminol - Add back read-only datapack command -+ packRepository.reload(); - Collection selectedPacks = packRepository.getSelectedPacks(); - if (selectedPacks.isEmpty()) { - source.sendSuccess(() -> Component.translatable("commands.datapack.list.enabled.none"), false); + private static int listAvailablePacks(final CommandSourceStack source) { diff --git a/net/minecraft/server/commands/ReloadCommand.java b/net/minecraft/server/commands/ReloadCommand.java -index fcca0babb4e7929cc168fc8b9ad47619e6feb1a5..bac5f4e023f8b73eebea0f31fd253e04c8809918 100644 +index 80fef4277b9e986c17a4cb895e130726bdb63229..4bed8d0432508cbe5c0d1fc7d68052ec2af7260f 100644 --- a/net/minecraft/server/commands/ReloadCommand.java +++ b/net/minecraft/server/commands/ReloadCommand.java @@ -16,11 +16,17 @@ public class ReloadCommand { private static final Logger LOGGER = LogUtils.getLogger(); - public static void reloadPacks(Collection selectedIds, CommandSourceStack source) { + public static void reloadPacks(final Collection selectedPacks, final CommandSourceStack source) { + // Lophine start - region thread skip reload // TODO - add reload support -+ source.getServer().saveDatapacks(selectedIds); ++ source.getServer().saveDatapacks(selectedPacks); + source.getSender().sendMessage("You need to restart server to load datapacks update."); + if (false) { - source.getServer().reloadResources(selectedIds, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally(throwable -> { // Paper - Add ServerResourcesReloadedEvent + source.getServer().reloadResources(selectedPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally(throwable -> { // Paper - Add ServerResourcesReloadedEvent LOGGER.warn("Failed to execute reload", throwable); source.sendFailure(Component.translatable("commands.reload.failure")); return null; @@ -91,4 +82,4 @@ index fcca0babb4e7929cc168fc8b9ad47619e6feb1a5..bac5f4e023f8b73eebea0f31fd253e04 + // Lophine end - region thread skip reload // TODO - add reload support } - private static Collection discoverNewPacks(PackRepository packRepository, WorldData worldData, Collection selectedIds) { + private static Collection discoverNewPacks(final PackRepository packRepository, final WorldData worldData, final Collection currentPacks) { diff --git a/1todos/server/minecraft-patches/features/0018-Purpur-Barrels-and-enderchests-6-rows.patch b/lophine-server/minecraft-patches/features/0003-Purpur-Barrels-and-enderchests-6-rows.patch similarity index 59% rename from 1todos/server/minecraft-patches/features/0018-Purpur-Barrels-and-enderchests-6-rows.patch rename to lophine-server/minecraft-patches/features/0003-Purpur-Barrels-and-enderchests-6-rows.patch index 7324fbe..a1221bf 100644 --- a/1todos/server/minecraft-patches/features/0018-Purpur-Barrels-and-enderchests-6-rows.patch +++ b/lophine-server/minecraft-patches/features/0003-Purpur-Barrels-and-enderchests-6-rows.patch @@ -3,15 +3,15 @@ From: Helvetica Volubi Date: Thu, 20 Feb 2025 01:00:28 +0800 Subject: [PATCH] Purpur: Barrels and enderchests 6 rows -Co-authored by: William Blake Galbreath -As part of: Purpur (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/purpur-server/minecraft-patches/features/0003-Barrels-and-enderchests-6-rows.patch) -Licensed under: MIT (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/LICENSE) +Co-authored by: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur/blob/dc46f46d28dcdcaf33bb533f9571a107db98c1d7/purpur-server/minecraft-patches/features/0003-Barrels-and-enderchests-6-rows.patch) +Licensed under: MIT (https://github.com/PurpurMC/Purpur/blob/dc46f46d28dcdcaf33bb533f9571a107db98c1d7/LICENSE) diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 2eb551390aa66d89988df9ca23cf0dd7ccfd6577..0d322ef4aa3e70c9edbb9fa8ba368bef916eb93d 100644 +index 63b81f30b8d813a7986ae72842fdc2d3097fa103..527c495bb4f6007aee760b99cc0e9aa589931f4b 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -963,6 +963,10 @@ public abstract class PlayerList { +@@ -961,6 +961,10 @@ public abstract class PlayerList { player.getBukkitEntity().recalculatePermissions(); // CraftBukkit this.server.getCommands().sendCommands(player); } // Paper - Add sendOpLevel API @@ -23,11 +23,11 @@ index 2eb551390aa66d89988df9ca23cf0dd7ccfd6577..0d322ef4aa3e70c9edbb9fa8ba368bef // Paper start - whitelist verify event / login event diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java -index 0f6e1428cc71c370af45db3e2a4f47c66e5d8628..83612969b6058f444fc17e360cdcc4a8846f79aa 100644 +index 57be1c239209414c6a9d9f96dd16d8fc109833f9..1b9fca50508a77f2b835edcdce153935b566d143 100644 --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -179,6 +179,7 @@ public abstract class Player extends Avatar implements ContainerUser { - private int currentImpulseContextResetGraceTime = 0; +@@ -174,6 +174,7 @@ public abstract class Player extends Avatar implements ContainerUser { + public float hurtDir; public boolean affectsSpawning = true; // Paper - Affects Spawning API public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage + public int enderChestSlotCount = -1; // Purpur - Barrels and enderchests 6 rows @@ -35,42 +35,42 @@ index 0f6e1428cc71c370af45db3e2a4f47c66e5d8628..83612969b6058f444fc17e360cdcc4a8 // CraftBukkit start public boolean fauxSleeping; diff --git a/net/minecraft/world/inventory/ChestMenu.java b/net/minecraft/world/inventory/ChestMenu.java -index 1fb3a34ea872dec73658fac59743e46ef8db5151..41ebe774edfe3c37afecda514a6eb7db978d5aa8 100644 +index e77bfcd31cdcfd5836dc5db561e3fe2bc552a4b1..297657f38ce4c4bfa58cca27d440595246200d94 100644 --- a/net/minecraft/world/inventory/ChestMenu.java +++ b/net/minecraft/world/inventory/ChestMenu.java @@ -66,10 +66,30 @@ public class ChestMenu extends AbstractContainerMenu { - return new ChestMenu(MenuType.GENERIC_9x6, containerId, playerInventory, 6); + return new ChestMenu(MenuType.GENERIC_9x6, containerId, inventory, 6); } + // Purpur start - Barrels and enderchests 6 rows -+ public static ChestMenu oneRow(int syncId, Inventory playerInventory, Container inventory) { -+ return new ChestMenu(MenuType.GENERIC_9x1, syncId, playerInventory, inventory, 1); ++ public static ChestMenu oneRow(final int containerId, final Inventory inventory, final Container container) { ++ return new ChestMenu(MenuType.GENERIC_9x3, containerId, inventory, container, 1); + } + -+ public static ChestMenu twoRows(int syncId, Inventory playerInventory, Container inventory) { -+ return new ChestMenu(MenuType.GENERIC_9x2, syncId, playerInventory, inventory, 2); ++ public static ChestMenu twoRows(final int containerId, final Inventory inventory, final Container container) { ++ return new ChestMenu(MenuType.GENERIC_9x3, containerId, inventory, container, 2); + } + // Purpur end - Barrels and enderchests 6 rows + - public static ChestMenu threeRows(int containerId, Inventory playerInventory, Container container) { - return new ChestMenu(MenuType.GENERIC_9x3, containerId, playerInventory, container, 3); + public static ChestMenu threeRows(final int containerId, final Inventory inventory, final Container container) { + return new ChestMenu(MenuType.GENERIC_9x3, containerId, inventory, container, 3); } + // Purpur start - Barrels and enderchests 6 rows -+ public static ChestMenu fourRows(int syncId, Inventory playerInventory, Container inventory) { -+ return new ChestMenu(MenuType.GENERIC_9x4, syncId, playerInventory, inventory, 4); ++ public static ChestMenu fourRows(final int containerId, final Inventory inventory, final Container container) { ++ return new ChestMenu(MenuType.GENERIC_9x3, containerId, inventory, container, 4); + } + -+ public static ChestMenu fiveRows(int syncId, Inventory playerInventory, Container inventory) { -+ return new ChestMenu(MenuType.GENERIC_9x5, syncId, playerInventory, inventory, 5); ++ public static ChestMenu fiveRows(final int containerId, final Inventory inventory, final Container container) { ++ return new ChestMenu(MenuType.GENERIC_9x3, containerId, inventory, container, 5); + } + // Purpur end - Barrels and enderchests 6 rows + - public static ChestMenu sixRows(int containerId, Inventory playerInventory, Container container) { - return new ChestMenu(MenuType.GENERIC_9x6, containerId, playerInventory, container, 6); + public static ChestMenu sixRows(final int containerId, final Inventory inventory, final Container container) { + return new ChestMenu(MenuType.GENERIC_9x6, containerId, inventory, container, 6); } diff --git a/net/minecraft/world/inventory/PlayerEnderChestContainer.java b/net/minecraft/world/inventory/PlayerEnderChestContainer.java -index 9749909b8253b432bb2f7fba2cd8ff17a8579b30..42df617d7b62af45bd56e9594689974f790f6c19 100644 +index 4df3a32faf85595372f4b250482d852c985ea3ab..101b3711bfb98888837ebed323561cac6efb274d 100644 --- a/net/minecraft/world/inventory/PlayerEnderChestContainer.java +++ b/net/minecraft/world/inventory/PlayerEnderChestContainer.java @@ -26,11 +26,18 @@ public class PlayerEnderChestContainer extends SimpleContainer { @@ -90,35 +90,35 @@ index 9749909b8253b432bb2f7fba2cd8ff17a8579b30..42df617d7b62af45bd56e9594689974f + } + // Purpur end - Barrels and enderchests 6 rows + - public void setActiveChest(EnderChestBlockEntity enderChestBlockEntity) { - this.activeChest = enderChestBlockEntity; + public void setActiveChest(final EnderChestBlockEntity activeChest) { + this.activeChest = activeChest; } diff --git a/net/minecraft/world/level/block/EnderChestBlock.java b/net/minecraft/world/level/block/EnderChestBlock.java -index 383e8285d366c7f594b0b4ff55b367970c9b69e4..202a986762794da9440365953fcb950c6eefa774 100644 +index 24a2c411da0ebbb7f97d621bb76ff686621f9aae..a9f511a549681a76a962855c26b9af5980f36df7 100644 --- a/net/minecraft/world/level/block/EnderChestBlock.java +++ b/net/minecraft/world/level/block/EnderChestBlock.java -@@ -85,8 +85,14 @@ public class EnderChestBlock extends AbstractChestBlock i - enderChestInventory.setActiveChest(enderChestBlockEntity); // Needs to happen before ChestMenu.threeRows as it is required for opening animations +@@ -88,7 +88,15 @@ public class EnderChestBlock extends AbstractChestBlock i + // Paper start - Fix InventoryOpenEvent cancellation - moved up; + container.setActiveChest(enderChest); // Needs to happen before ChestMenu.threeRows as it is required for opening animations if (level instanceof ServerLevel serverLevel && player.openMenu( - new SimpleMenuProvider( -- (containerId, playerInventory, player1) -> ChestMenu.threeRows(containerId, playerInventory, enderChestInventory), CONTAINER_TITLE -- ) -+ (containerId, playerInventory, player1) -> switch (fun.bm.lophine.config.modules.function.ContainerExpansionConfig.enderchestRows) { -+ case 6 -> ChestMenu.sixRows(containerId, playerInventory, enderChestInventory); -+ case 5 -> ChestMenu.fiveRows(containerId, playerInventory, enderChestInventory); -+ case 4 -> ChestMenu.fourRows(containerId, playerInventory, enderChestInventory); -+ case 2 -> ChestMenu.twoRows(containerId, playerInventory, enderChestInventory); -+ case 1 -> ChestMenu.oneRow(containerId, playerInventory, enderChestInventory); -+ default -> ChestMenu.threeRows(containerId, playerInventory, enderChestInventory); +- new SimpleMenuProvider((containerId, inventory, p) -> ChestMenu.threeRows(containerId, inventory, container), CONTAINER_TITLE) ++ new SimpleMenuProvider( ++ (containerId, inventory, p) -> switch (fun.bm.lophine.config.modules.function.ContainerExpansionConfig.enderchestRows) { ++ case 6 -> ChestMenu.sixRows(containerId, inventory, container); ++ case 5 -> ChestMenu.fiveRows(containerId, inventory, container); ++ case 4 -> ChestMenu.fourRows(containerId, inventory, container); ++ case 2 -> ChestMenu.twoRows(containerId, inventory, container); ++ case 1 -> ChestMenu.oneRow(containerId, inventory, container); ++ default -> ChestMenu.threeRows(containerId, inventory, container); + }, CONTAINER_TITLE) // Purpur - Barrels and enderchests 6 rows ).isPresent()) { // Paper end - Fix InventoryOpenEvent cancellation - moved up; player.awardStat(Stats.OPEN_ENDERCHEST); diff --git a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java -index dcec63c1c2634a3e83ee3cac26f6e51441c37f6d..e5cfbf41525b0d454bb83691354afb4513723571 100644 +index 61e39a18c0fba22699750e5c0187d19a0433b9a2..98c48426fcbb4aeba479e87ab27b03e17b50d7f5 100644 --- a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java -@@ -59,7 +59,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -60,7 +60,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity implemen } // CraftBukkit end private static final Component DEFAULT_NAME = Component.translatable("container.barrel"); @@ -135,9 +135,9 @@ index dcec63c1c2634a3e83ee3cac26f6e51441c37f6d..e5cfbf41525b0d454bb83691354afb45 + // Purpur end - Barrels and enderchests 6 rows + public final ContainerOpenersCounter openersCounter = new ContainerOpenersCounter() { - @Override - protected void onOpen(Level level, BlockPos pos, BlockState state) { -@@ -111,7 +121,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity implemen + { + Objects.requireNonNull(BarrelBlockEntity.this); +@@ -123,7 +133,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity implemen @Override public int getContainerSize() { @@ -155,19 +155,19 @@ index dcec63c1c2634a3e83ee3cac26f6e51441c37f6d..e5cfbf41525b0d454bb83691354afb45 } @Override -@@ -132,7 +151,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -144,7 +163,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity implemen @Override - protected AbstractContainerMenu createMenu(int id, Inventory player) { -- return ChestMenu.threeRows(id, player, this); + protected AbstractContainerMenu createMenu(final int containerId, final Inventory inventory) { +- return ChestMenu.threeRows(containerId, inventory, this); + // Purpur start - Barrels and enderchests 6 rows + return switch (fun.bm.lophine.config.modules.function.ContainerExpansionConfig.barrelRows) { -+ case 6 -> ChestMenu.sixRows(id, player, this); -+ case 5 -> ChestMenu.fiveRows(id, player, this); -+ case 4 -> ChestMenu.fourRows(id, player, this); -+ case 2 -> ChestMenu.twoRows(id, player, this); -+ case 1 -> ChestMenu.oneRow(id, player, this); -+ default -> ChestMenu.threeRows(id, player, this); ++ case 6 -> ChestMenu.sixRows(containerId, inventory, this); ++ case 5 -> ChestMenu.fiveRows(containerId, inventory, this); ++ case 4 -> ChestMenu.fourRows(containerId, inventory, this); ++ case 2 -> ChestMenu.twoRows(containerId, inventory, this); ++ case 1 -> ChestMenu.oneRow(containerId, inventory, this); ++ default -> ChestMenu.threeRows(containerId, inventory, this); + }; + // Purpur end - Barrels and enderchests 6 rows } diff --git a/1todos/server/minecraft-patches/features/0001-Add-config-to-disable-some-check-for-operators.patch b/lophine-server/minecraft-patches/features/0004-Add-config-to-disable-some-check-for-operators.patch similarity index 75% rename from 1todos/server/minecraft-patches/features/0001-Add-config-to-disable-some-check-for-operators.patch rename to lophine-server/minecraft-patches/features/0004-Add-config-to-disable-some-check-for-operators.patch index 3b28401..2713782 100644 --- a/1todos/server/minecraft-patches/features/0001-Add-config-to-disable-some-check-for-operators.patch +++ b/lophine-server/minecraft-patches/features/0004-Add-config-to-disable-some-check-for-operators.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add config to disable some check for operators diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 90e044ab3476d91819dddf14054d4626358da363..5c5dfcefd9ce6c9d7f69fb6d03216805b9e63822 100644 +index aa9e99358e5f3a5d07d9902708bcfa6255d26b97..47beff71ed33e7fbd6fe6cd47aa955233af41f04 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -392,7 +392,7 @@ public class ServerGamePacketListenerImpl +@@ -399,7 +399,7 @@ public class ServerGamePacketListenerImpl this.tickCount++; this.knownMovePacketCount = this.receivedMovePacketCount; if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) { @@ -17,7 +17,7 @@ index 90e044ab3476d91819dddf14054d4626358da363..5c5dfcefd9ce6c9d7f69fb6d03216805 // LOGGER.warn("{} was kicked for floating too long!", this.player.getPlainTextName()); // Paper - Logging moved to net.minecraft.server.network.ServerCommonPacketListenerImpl.disconnect() this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause return true; -@@ -411,7 +411,7 @@ public class ServerGamePacketListenerImpl +@@ -418,7 +418,7 @@ public class ServerGamePacketListenerImpl this.vehicleLastGoodY = this.lastVehicle.getY(); this.vehicleLastGoodZ = this.lastVehicle.getZ(); if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) { @@ -26,28 +26,28 @@ index 90e044ab3476d91819dddf14054d4626358da363..5c5dfcefd9ce6c9d7f69fb6d03216805 // LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getPlainTextName()); // Paper - Logging moved to net.minecraft.server.network.ServerCommonPacketListenerImpl.disconnect() this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause return true; -@@ -662,7 +662,7 @@ public class ServerGamePacketListenerImpl - d5 = d2 - rootVehicle.getZ(); - d7 = d3 * d3 + d4 * d4 + d5 * d5; - boolean flag1 = false; -- if (!me.earthme.luminol.config.modules.misc.DisableWarningConfig.disableMovedWronglyThresholdWarning && d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot -+ if (!me.earthme.luminol.config.modules.misc.DisableWarningConfig.disableMovedWronglyThresholdWarning && d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !(fun.bm.lophine.config.modules.misc.DisableCheckConfig.disableOpMoveCheck && MinecraftServer.getServer().getPlayerList().isOp(this.player.nameAndId()))) { // Spigot // Lophine - disable move check for operator - flag1 = true; // Paper - diff on change, this should be moved wrongly - LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getPlainTextName(), this.player.getPlainTextName(), Math.sqrt(d7)); +@@ -671,7 +671,7 @@ public class ServerGamePacketListenerImpl + zDist = targetZ - vehicle.getZ(); + movedDist = xDist * xDist + yDist * yDist + zDist * zDist; + boolean fail = false; +- if (!me.earthme.luminol.config.modules.misc.DisableWarningConfig.disableMovedWronglyThresholdWarning && movedDist > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot // Leaves - disable can ++ if (!me.earthme.luminol.config.modules.misc.DisableWarningConfig.disableMovedWronglyThresholdWarning && movedDist > org.spigotmc.SpigotConfig.movedWronglyThreshold && !(fun.bm.lophine.config.modules.misc.DisableCheckConfig.disableOpMoveCheck && MinecraftServer.getServer().getPlayerList().isOp(this.player.nameAndId()))) { // Spigot // Leaves - disable can // Lophine - disable move check for operator + fail = true; + LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", vehicle.getPlainTextName(), this.player.getPlainTextName(), Math.sqrt(movedDist)); } -@@ -1564,7 +1564,7 @@ public class ServerGamePacketListenerImpl +@@ -1603,7 +1603,7 @@ public class ServerGamePacketListenerImpl // Paper start - Add fail move event io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, - toX, toY, toZ, toYaw, toPitch, true); + targetX, targetY, targetZ, targetYRot, targetXRot, true); - if (!event.isAllowed()) { + if (!event.isAllowed() && !(fun.bm.lophine.config.modules.misc.DisableCheckConfig.disableOpMoveCheck && MinecraftServer.getServer().getPlayerList().isOp(this.player.nameAndId()))) { // Lophine - disable move check for operator if (event.getLogWarning()) { - LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getPlainTextName(), d3, d4, d5); + LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getPlainTextName(), xDist, yDist, zDist); } -@@ -1643,7 +1643,7 @@ public class ServerGamePacketListenerImpl +@@ -1682,7 +1682,7 @@ public class ServerGamePacketListenerImpl // Paper start - Add fail move event io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_WRONGLY, - toX, toY, toZ, toYaw, toPitch, true); + targetX, targetY, targetZ, targetYRot, targetXRot, true); - if (!event.isAllowed()) { + if (!event.isAllowed() && !(fun.bm.lophine.config.modules.misc.DisableCheckConfig.disableOpMoveCheck && MinecraftServer.getServer().getPlayerList().isOp(this.player.nameAndId()))) { // Lophine - disable move check for operator movedWrongly = true; diff --git a/1todos/server/minecraft-patches/features/0005-Add-config-to-enable-save-all-command.patch b/lophine-server/minecraft-patches/features/0005-Add-config-to-enable-save-all-command.patch similarity index 81% rename from 1todos/server/minecraft-patches/features/0005-Add-config-to-enable-save-all-command.patch rename to lophine-server/minecraft-patches/features/0005-Add-config-to-enable-save-all-command.patch index 806f6a5..8495422 100644 --- a/1todos/server/minecraft-patches/features/0005-Add-config-to-enable-save-all-command.patch +++ b/lophine-server/minecraft-patches/features/0005-Add-config-to-enable-save-all-command.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add config to enable save-all command diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java -index 17108636a5728efe98a064001e00e3ca098b1f51..7748e9ac04fbd3f5259d92fc908d90889cba86c8 100644 +index 3416445888860746c15a978f401c87245609b64a..fc6402dd0a47f5b2792aa8a21703bfee18dd2388 100644 --- a/io/papermc/paper/threadedregions/RegionizedServer.java +++ b/io/papermc/paper/threadedregions/RegionizedServer.java -@@ -350,6 +350,8 @@ public final class RegionizedServer { +@@ -359,6 +359,8 @@ public final class RegionizedServer { // tick player ping sample this.tickPlayerSample(); @@ -31,10 +31,10 @@ index 02c004bc7f9a0203523ce4b27cd766d6bdc478c0..3d86e21198f2888422330b6f7c27712f private final Reference2ReferenceOpenHashMap, Object> regionizedData = new Reference2ReferenceOpenHashMap<>(); diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index 6cb0d4daf0f275b95d5ca09275e40ab32258eb39..48628174299f8f18170198df1834d6174bd1fafa 100644 +index bcb1a5ec17269529ef0f9556043a7183df846eab..4503e62a72e67d35db5b091c91e903058157bdbd 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -294,7 +294,11 @@ public class Commands { +@@ -295,7 +295,11 @@ public class Commands { PardonCommand.register(this.dispatcher); PardonIpCommand.register(this.dispatcher); //PerfCommand.register(this.dispatcher); // Folia - region threading - TODO later @@ -48,13 +48,13 @@ index 6cb0d4daf0f275b95d5ca09275e40ab32258eb39..48628174299f8f18170198df1834d617 SaveOnCommand.register(this.dispatcher); SetPlayerIdleTimeoutCommand.register(this.dispatcher); diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 8ce5cdda24d63b33b39e32f9712fafa3917f27c5..25324d81bbe876dbe47b33bd5749b72e4283bf80 100644 +index f993a4de22558e7b9598aa7500cd3cc1225e4c5b..82315368d5580563fc77548f22a65d04ec73b622 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1656,6 +1656,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop Component.translatable("commands.save.saving"), false); + // Lophine start - save all + fun.bm.lophine.utils.SaveAllUtil.preSaveAll(source, flush); +/* source.sendSuccess(() -> Component.translatable("commands.save.saving"), false); MinecraftServer server = source.getServer(); - boolean flag = server.saveEverything(true, flush, true); - if (!flag) { + boolean success = server.saveEverything(true, flush, true); + if (!success) { @@ -29,6 +31,12 @@ public class SaveAllCommand { } else { source.sendSuccess(() -> Component.translatable("commands.save.success"), true); diff --git a/1todos/server/config-files/experiment/CommandConfig.java b/lophine-server/src/main/java/fun/bm/lophine/config/modules/experiment/CommandConfig.java similarity index 65% rename from 1todos/server/config-files/experiment/CommandConfig.java rename to lophine-server/src/main/java/fun/bm/lophine/config/modules/experiment/CommandConfig.java index 6618653..45f5aa0 100644 --- a/1todos/server/config-files/experiment/CommandConfig.java +++ b/lophine-server/src/main/java/fun/bm/lophine/config/modules/experiment/CommandConfig.java @@ -7,20 +7,20 @@ import me.earthme.luminol.enums.EnumConfigCategory; @ConfigClassInfo(category = EnumConfigCategory.EXPERIMENT, name = "command") public class CommandConfig implements IConfigModule { - @ConfigInfo(name = "tick_command_enabled", comments = - """ - Allow to use tick command""") - public static boolean tick = false; - - @ConfigInfo(name = "function_command_enabled", comments = - """ - Allow to use function command""") - public static boolean function = false; - - @ConfigInfo(name = "scoreboard_command_enabled", comments = - """ - Allow to use scoreboard command""") - public static boolean scoreboard = false; +// @ConfigInfo(name = "tick_command_enabled", comments = +// """ +// Allow to use tick command""") +// public static boolean tick = false; +// +// @ConfigInfo(name = "function_command_enabled", comments = +// """ +// Allow to use function command""") +// public static boolean function = false; +// +// @ConfigInfo(name = "scoreboard_command_enabled", comments = +// """ +// Allow to use scoreboard command""") +// public static boolean scoreboard = false; @ConfigInfo(name = "enabled", directory = {"save_all_command"}, comments = """ diff --git a/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/ContainerExpansionConfig.java b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/ContainerExpansionConfig.java index 9cf11d8..acee30f 100644 --- a/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/ContainerExpansionConfig.java +++ b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/ContainerExpansionConfig.java @@ -23,12 +23,12 @@ public class ContainerExpansionConfig implements IConfigModule { range: 1~6""") public static int enderchestRows = 3; - @CommandSuggestions(suggest = {"1", "2", "32", "64"}) - @ConfigInfo(name = "shulker_stackable_count", directory = {"shulker_box"}, comments = - """ - range: 1~64""") - public static int shulkerCount = 1; - - @ConfigInfo(name = "same_nbt_shulker_stackable", directory = {"shulker_box"}) - public static boolean nbtShulkerStackable = false; +// @CommandSuggestions(suggest = {"1", "2", "32", "64"}) +// @ConfigInfo(name = "shulker_stackable_count", directory = {"shulker_box"}, comments = +// """ +// range: 1~64""") +// public static int shulkerCount = 1; +// +// @ConfigInfo(name = "same_nbt_shulker_stackable", directory = {"shulker_box"}) +// public static boolean nbtShulkerStackable = false; } \ No newline at end of file diff --git a/1todos/server/config-files/function/LanguageConfig.java b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/LanguageConfig.java similarity index 91% rename from 1todos/server/config-files/function/LanguageConfig.java rename to lophine-server/src/main/java/fun/bm/lophine/config/modules/function/LanguageConfig.java index cf4dc27..357a50d 100644 --- a/1todos/server/config-files/function/LanguageConfig.java +++ b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/LanguageConfig.java @@ -3,10 +3,12 @@ package fun.bm.lophine.config.modules.function; import me.earthme.luminol.config.IConfigModule; import me.earthme.luminol.config.flags.ConfigClassInfo; import me.earthme.luminol.config.flags.ConfigInfo; +import me.earthme.luminol.config.flags.HotReloadUnsupported; import me.earthme.luminol.enums.EnumConfigCategory; @ConfigClassInfo(category = EnumConfigCategory.FUNCTION, name = "language") public class LanguageConfig implements IConfigModule { + @HotReloadUnsupported @ConfigInfo(name = "lang", comments = """ Please use the key from https://minecraft.wiki/w/Language Sample of format: en_us zh_cn zh_hk zh_tw""") diff --git a/1todos/server/config-files/misc/DisableCheckConfig.java b/lophine-server/src/main/java/fun/bm/lophine/config/modules/misc/DisableCheckConfig.java similarity index 100% rename from 1todos/server/config-files/misc/DisableCheckConfig.java rename to lophine-server/src/main/java/fun/bm/lophine/config/modules/misc/DisableCheckConfig.java diff --git a/1todos/server/src/lophine/utils/SaveAllUtil.java b/lophine-server/src/main/java/fun/bm/lophine/utils/SaveAllUtil.java similarity index 100% rename from 1todos/server/src/lophine/utils/SaveAllUtil.java rename to lophine-server/src/main/java/fun/bm/lophine/utils/SaveAllUtil.java diff --git a/1todos/server/src/lophine/utils/ServerI18nUtil.java b/lophine-server/src/main/java/fun/bm/lophine/utils/ServerI18nUtil.java similarity index 100% rename from 1todos/server/src/lophine/utils/ServerI18nUtil.java rename to lophine-server/src/main/java/fun/bm/lophine/utils/ServerI18nUtil.java