From 2861be5cbb301588207c087a6dd67437a526c6bd Mon Sep 17 00:00:00 2001 From: Ivan Mishin Date: Tue, 9 Jul 2024 21:48:20 +0200 Subject: [PATCH 1/7] Added allow-nether-portals in config.yml --- .../galactifun/core/managers/WorldManager.java | 8 ++++---- src/main/resources/config.yml | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java b/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java index 7f2c1f13..17a3731a 100644 --- a/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java +++ b/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java @@ -188,16 +188,16 @@ public Collection alienWorlds() { return Collections.unmodifiableCollection(this.alienWorlds.values()); } - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.HIGHEST) public void onPortalCreate(PortalCreateEvent e) { - if (e.getWorld().getName().contains("world_galactifun")) { + if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && e.getWorld().getName().contains("world_galactifun")) { e.setCancelled(true); } } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void portal(PlayerPortalEvent e){ - if (e.getFrom().getWorld().getName().contains("world_galactifun")){ + if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && e.getFrom().getWorld().getName().contains("world_galactifun")){ e.setCancelled(true); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 98c3200d..8a0d2504 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -7,6 +7,9 @@ worlds: # This should be the name main world where people work on stuff and make bases. earth-name: world + # If set to true, players can use Nether portals in Galactifun planet worlds. + allow-nether-portals: false + aliens: # How often aliens tick in Minecraft ticks - there are 20 ticks in 1 second From 3ab260c765d3c07727761c63d51ac717632703ba Mon Sep 17 00:00:00 2001 From: Ivan Mishin <88932074+IvanMishin1@users.noreply.github.com> Date: Tue, 9 Jul 2024 22:04:34 +0200 Subject: [PATCH 2/7] Update src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java Co-authored-by: Seggan --- .../addoncommunity/galactifun/core/managers/WorldManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java b/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java index 17a3731a..61daaf8f 100644 --- a/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java +++ b/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java @@ -190,7 +190,7 @@ public Collection alienWorlds() { @EventHandler(priority = EventPriority.HIGHEST) public void onPortalCreate(PortalCreateEvent e) { - if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && e.getWorld().getName().contains("world_galactifun")) { + if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && getAlienWorld(e.getWorld()) != null) { e.setCancelled(true); } } From fcd96d5cf33c01d919bd25b4ca50e45fef529a2a Mon Sep 17 00:00:00 2001 From: Ivan Mishin <88932074+IvanMishin1@users.noreply.github.com> Date: Tue, 9 Jul 2024 22:04:42 +0200 Subject: [PATCH 3/7] Update src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java Co-authored-by: Seggan --- .../addoncommunity/galactifun/core/managers/WorldManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java b/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java index 61daaf8f..0c227805 100644 --- a/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java +++ b/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java @@ -197,7 +197,7 @@ public void onPortalCreate(PortalCreateEvent e) { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void portal(PlayerPortalEvent e){ - if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && e.getFrom().getWorld().getName().contains("world_galactifun")){ + if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && getAlienWorld(e.getWorld()) != null){ e.setCancelled(true); } } From dabb23e72cb466c74b7f1b6da30ecf7aa9d9c97c Mon Sep 17 00:00:00 2001 From: Ivan Mishin Date: Tue, 9 Jul 2024 22:06:57 +0200 Subject: [PATCH 4/7] Added getFrom() --- .../addoncommunity/galactifun/core/managers/WorldManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java b/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java index 0c227805..ecad88f7 100644 --- a/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java +++ b/src/main/java/io/github/addoncommunity/galactifun/core/managers/WorldManager.java @@ -197,7 +197,7 @@ public void onPortalCreate(PortalCreateEvent e) { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void portal(PlayerPortalEvent e){ - if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && getAlienWorld(e.getWorld()) != null){ + if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && getAlienWorld(e.getFrom().getWorld()) != null){ e.setCancelled(true); } } From 32617f5358fb1835523b7cf442b35090fe90cbd4 Mon Sep 17 00:00:00 2001 From: Ivan Mishin Date: Wed, 10 Jul 2024 11:04:32 +0200 Subject: [PATCH 5/7] Fixed Freezer 3 --- .../galactifun/api/universe/attributes/atmosphere/Gas.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/io/github/addoncommunity/galactifun/api/universe/attributes/atmosphere/Gas.java b/src/main/java/io/github/addoncommunity/galactifun/api/universe/attributes/atmosphere/Gas.java index 32d971a3..e1b5ecb1 100644 --- a/src/main/java/io/github/addoncommunity/galactifun/api/universe/attributes/atmosphere/Gas.java +++ b/src/main/java/io/github/addoncommunity/galactifun/api/universe/attributes/atmosphere/Gas.java @@ -47,6 +47,9 @@ public enum Gas { if (SlimefunItems.FREEZER_2.getItem() instanceof Freezer freezer) { freezer.registerRecipe(10, NITROGEN.item(), SlimefunItems.REACTOR_COOLANT_CELL.asQuantity(4)); } + if (SlimefunItems.FREEZER_3.getItem() instanceof Freezer freezer) { + freezer.registerRecipe(7, NITROGEN.item(), SlimefunItems.REACTOR_COOLANT_CELL.asQuantity(4)); + } if (SlimefunItems.COMBUSTION_REACTOR.getItem() instanceof CombustionGenerator generator) { generator.registerFuel(new MachineFuel(15, HYDROGEN.item())); From df382ae525b90aaf1d76cb6c31d718ad19b4e53e Mon Sep 17 00:00:00 2001 From: Ivan Mishin Date: Wed, 10 Jul 2024 14:58:27 +0200 Subject: [PATCH 6/7] Updated SealedCommand --- .../core/commands/SealedCommand.java | 25 +++++++++++++++++-- src/main/resources/config.yml | 9 +++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/addoncommunity/galactifun/core/commands/SealedCommand.java b/src/main/java/io/github/addoncommunity/galactifun/core/commands/SealedCommand.java index 0114746a..8a87976c 100644 --- a/src/main/java/io/github/addoncommunity/galactifun/core/commands/SealedCommand.java +++ b/src/main/java/io/github/addoncommunity/galactifun/core/commands/SealedCommand.java @@ -6,6 +6,9 @@ import javax.annotation.Nonnull; +import io.github.addoncommunity.galactifun.Galactifun; + +import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -22,10 +25,28 @@ public SealedCommand() { @Override public void execute(@Nonnull CommandSender commandSender, @Nonnull String[] strings) { if (!(commandSender instanceof Player p)) return; - if (strings.length != 1) return; + if (strings.length != 1) { + p.sendMessage(ChatColor.RED + "Usage: /galactifun sealed "); + return; + } + + int range; + + try { + range = Integer.parseInt(strings[0]); + } catch (NumberFormatException e) { + p.sendMessage(ChatColor.RED + "Range must be an integer between 1 and " + Galactifun.instance().getConfig().getInt("other.sealed-command-max-range")); + return; + } + + if (range < 1 || range > Galactifun.instance().getConfig().getInt("other.sealed-command-max-range")) { + p.sendMessage(ChatColor.RED + "Range must be an integer between 1 and " + Galactifun.instance().getConfig().getInt("other.sealed-command-max-range")); + return; + } double time = System.nanoTime(); - Optional> filled = Util.floodFill(p.getLocation(), Integer.parseInt(strings[0])); + Optional> filled = Util.floodFill(p.getLocation(), range); + if (filled.isPresent()) { p.sendMessage("Sealed"); } else { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 8a0d2504..7717eeef 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -37,8 +37,10 @@ rockets: - Not going home other: + # The range that the automatic door checks for players auto-door-range: 2 + # Blocks prohibited to be used by the automatic door auto-door-banned-types: - BEDROCK @@ -47,3 +49,10 @@ other: - COMMAND_BLOCK - END_PORTAL - STRUCTURE_BLOCK + + # The maximum range that the sealed command can be executed with + # Setting this to a high value can cause performance issues + # # Setting this to a low value may limit the sealed command, causing it to miss larger sealed areas. + # Set to 0 to disable the range limit + # See https://github.com/Slimefun-Addon-Community/Galactifun/wiki/Sealing#Range for more info + sealed-command-max-range: 300000 From c6654547e6f72916b4c978e81812f5a799f475fe Mon Sep 17 00:00:00 2001 From: Ivan Mishin Date: Wed, 10 Jul 2024 15:19:49 +0200 Subject: [PATCH 7/7] Fixed comment --- src/main/resources/config.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 7717eeef..a5a16b81 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -50,9 +50,6 @@ other: - END_PORTAL - STRUCTURE_BLOCK - # The maximum range that the sealed command can be executed with - # Setting this to a high value can cause performance issues - # # Setting this to a low value may limit the sealed command, causing it to miss larger sealed areas. - # Set to 0 to disable the range limit - # See https://github.com/Slimefun-Addon-Community/Galactifun/wiki/Sealing#Range for more info + # Max range for sealed command. High values may impact performance, low values may miss sealed areas. + # More info: https://github.com/Slimefun-Addon-Community/Galactifun/wiki/Sealing#Range sealed-command-max-range: 300000