From 21780482699bae988f76b62802849c657692e968 Mon Sep 17 00:00:00 2001 From: kickylol Date: Thu, 22 Aug 2024 20:08:07 -0230 Subject: [PATCH 1/6] Acidblock ergonomic tweaks New messages in chat and cti for when acids are going to fail with new checks for all faces of acid block. Multifaced acidblocks now choose the weakest reinforcement being acided to base its timer on. --- .../civcraft/mc/citadel/CitadelUtility.java | 23 ++++++++++ .../vg/civcraft/mc/citadel/command/Acid.java | 23 +++++++--- .../mc/citadel/listener/ModeListener.java | 28 +++++++++-- .../mc/citadel/model/AcidManager.java | 46 +++++++++++++++---- 4 files changed, 100 insertions(+), 20 deletions(-) diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java index a9abf4485..f14c6392b 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java @@ -8,9 +8,12 @@ import net.md_5.bungee.api.chat.hover.content.Text; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import vg.civcraft.mc.citadel.acidtypes.AcidType; +import vg.civcraft.mc.citadel.model.AcidManager; import vg.civcraft.mc.citadel.model.Reinforcement; import vg.civcraft.mc.citadel.reinforcementtypes.ReinforcementType; import vg.civcraft.mc.civmodcore.inventory.items.ItemMap; @@ -212,6 +215,26 @@ public class CitadelUtility { Citadel.getInstance().getLogger().info(player.getName() + " created reinforcement with " + type.getName() + " for " + block.getType().toString() + " at " + block.getLocation().toString()); } + // warn if acid cannot complete + if (Citadel.getInstance().getAcidManager().isPossibleAcidBlock(block)) { + AcidManager acidMan = Citadel.getInstance().getAcidManager(); + AcidType acidType = acidMan.getAcidTypeFromMaterial(block.getType()); + for (BlockFace blockFace : acidType.blockFaces()) { + Block relativeBlock = block.getRelative(blockFace); + Reinforcement relativeReinforcement = ReinforcementLogic.getReinforcementProtecting(relativeBlock); + if ( + relativeReinforcement == null + || !relativeReinforcement.getType().canBeReinforced(relativeBlock.getType()) + || acidMan.isPossibleAcidBlock(relativeBlock) + ) { + continue; + } + if (!acidMan.canAcidBlock(type, relativeReinforcement.getType())) { + CitadelUtility.sendAndLog(player, ChatColor.RED, + "The " + blockFace.toString() + " acid will fail as it cannot acid tougher reinforcements!"); + } + } + } ReinforcementLogic.createReinforcement(newRein); return false; } diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java index e2ff43d9b..40ef8405d 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java @@ -4,6 +4,7 @@ import co.aikar.commands.BaseCommand; import co.aikar.commands.annotation.CommandAlias; import co.aikar.commands.annotation.Description; import java.util.Iterator; +import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import org.bukkit.Bukkit; @@ -54,11 +55,21 @@ public class Acid extends BaseCommand { "You do not have sufficient permission to use acid blocks on this group."); return; } - long neededTime = acidMan.getRemainingAcidMaturationTime(reinforcement); - if (neededTime > 0) { - CitadelUtility.sendAndLog(p, ChatColor.RED, "That acid block will be mature in " - + TextUtil.formatDuration(neededTime, TimeUnit.MILLISECONDS)); - return; + Map remainingTimes = acidMan.getRemainingAcidMaturationTime(reinforcement); + for (Map.Entry entry : remainingTimes.entrySet()) { + long neededTime = entry.getValue(); + BlockFace blockFace = entry.getKey(); + Block relativeBlock = block.getRelative(blockFace); + Reinforcement relativeReinforcement = ReinforcementLogic.getReinforcementProtecting(relativeBlock); + + if (neededTime > 0) { + if (relativeReinforcement != null && !acidMan.canAcidBlock(reinforcement.getType(), relativeReinforcement.getType())) { + CitadelUtility.sendAndLog(p, ChatColor.RED, String.format("The acid facing %s will fail!", blockFace)); + } + CitadelUtility.sendAndLog(p, ChatColor.RED, String.format("%s acid will mature in %s.", + blockFace, TextUtil.formatDuration(neededTime, TimeUnit.MILLISECONDS))); + return; + } } AcidType acidType = acidMan.getAcidTypeFromMaterial(block.getType()); @@ -71,7 +82,7 @@ public class Acid extends BaseCommand { relativeReinforcement == null || !relativeReinforcement.getType().canBeReinforced(relativeBlock.getType()) || !acidMan.canAcidBlock(reinforcement.getType(), relativeReinforcement.getType()) - || acidMan.isPossibleAcidBlock(relativeBlock) + || acidMan.isPossibleAcidBlock(relativeBlock) && acidMan.isAcidOnSameGroup(reinforcement, relativeReinforcement) ) { continue; } diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/listener/ModeListener.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/listener/ModeListener.java index 4e25aa255..bfffb0018 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/listener/ModeListener.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/listener/ModeListener.java @@ -1,11 +1,14 @@ package vg.civcraft.mc.citadel.listener; import java.text.DecimalFormat; +import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -241,11 +244,26 @@ public class ModeListener implements Listener { AcidManager acidMan = Citadel.getInstance().getAcidManager(); if (acidMan.isPossibleAcidBlock(e.getClickedBlock())) { sb.append(ChatColor.GOLD); - long remainingTime = acidMan.getRemainingAcidMaturationTime(rein); - if (remainingTime == 0) { - sb.append("Acid ready"); - } else { - sb.append(String.format("%sAcid block mature in %s", ChatColor.YELLOW, TextUtil.formatDuration(remainingTime, TimeUnit.MILLISECONDS))); + Map times = acidMan.getRemainingAcidMaturationTime(rein); + Block acidBlock = rein.getLocation().getBlock(); + for (Map.Entry entry : times.entrySet()) { + Reinforcement relativeReinforcement = ReinforcementLogic.getReinforcementProtecting(acidBlock.getRelative(entry.getKey())); + if (relativeReinforcement != null) { + if (!acidMan.canAcidBlock(rein.getType(), relativeReinforcement.getType())) { + sb.append(String.format("\n%s%s acid will fail!", ChatColor.RED, entry.getKey())); + continue; + } + if (acidMan.isPossibleAcidBlock(relativeReinforcement.getLocation().getBlock()) && acidMan.isAcidOnSameGroup(rein, relativeReinforcement)) { + continue; + } + if (entry.getValue() == 0) { + sb.append(String.format("\n%s%s acid ready", ChatColor.YELLOW, entry.getKey())); + continue; + } + sb.append(String.format("\n%s%s acid will be ready in %s", + ChatColor.YELLOW, entry.getKey(), + TextUtil.formatDuration(entry.getValue(), TimeUnit.MILLISECONDS))); + } } } if (e.getPlayer().hasPermission("citadel.admin")) { diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java index 9a07e31b7..c7578c988 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java @@ -2,7 +2,9 @@ package vg.civcraft.mc.citadel.model; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -32,31 +34,57 @@ public class AcidManager { } /** - * Gets remaining time needed to mature acid block in milli seconds. If the acid + * Checks if acid faces are on the same group + * + * @param acidBlock acid Reinforcement type to check for + * @param victim victim block Reinforcement type + * @return True if victim and acid block are on the same group + */ + public boolean isAcidOnSameGroup(Reinforcement acidBlock, Reinforcement victim) { + return acidBlock.getGroup().equals(victim.getGroup()); + } + + /** + * Gets remaining time needed to mature acid in milli seconds for each block face. If the acid * is ready 0 will be returned * * @param rein Reinforcement to check for - * @return Remaining time in milli seconds or 0 if the acid is ready + * @return Current block face being checked, remaining time in milli seconds or 0 if the acid is ready */ - public long getRemainingAcidMaturationTime(Reinforcement rein) { + public Map getRemainingAcidMaturationTime(Reinforcement rein) { Block acidBlock = rein.getLocation().getBlock(); Block targetBlock = acidBlock.getRelative(BlockFace.UP); + // Get acidMultiplier for the acid type double acidMultiplier = acidTypes.stream() .filter(acidType -> acidType.material() == acidBlock.getType()) .findFirst() .map(AcidType::modifier) .orElse(1D); + // Get block faces for the acid type + List acidFaces = acidTypes.stream() + .filter(acidType -> acidType.material() == acidBlock.getType()) + .findFirst() + .map(AcidType::blockFaces) + .orElse(List.of(BlockFace.UP)); + double decayMultiplier = 1; - if (!MaterialUtils.isAir(targetBlock.getType())) { - Reinforcement targetBlockRein = ReinforcementLogic.getReinforcementAt(targetBlock.getLocation()); - if (targetBlockRein != null) { - decayMultiplier = ReinforcementLogic.getDecayDamage(targetBlockRein); + Map remainingTimes = new HashMap<>(); + for (BlockFace face : acidFaces) { + Block relativeBlock = acidBlock.getRelative(face); + Reinforcement targetBlockRein = ReinforcementLogic.getReinforcementAt(relativeBlock.getLocation()); + if (!MaterialUtils.isAir(relativeBlock.getType())) { + if (targetBlockRein != null) { + decayMultiplier = ReinforcementLogic.getDecayDamage(targetBlockRein); + } } + long targetAcidTime = (targetBlockRein != null) ? targetBlockRein.getType().getAcidTime() : rein.getType().getAcidTime(); + long totalTime = Math.round(targetAcidTime / decayMultiplier * acidMultiplier); + long remainingTime = Math.max(0, totalTime - rein.getAge()); + remainingTimes.put(face, remainingTime); } - long totalTime = Math.round(rein.getType().getAcidTime() / decayMultiplier * acidMultiplier); - return Math.max(0, totalTime - rein.getAge()); + return remainingTimes; } /** From 301f0c579bb9705fa1a88f7d3a4fbb7292d59035 Mon Sep 17 00:00:00 2001 From: kickylol Date: Fri, 23 Aug 2024 15:41:47 -0230 Subject: [PATCH 2/6] Put acidblocks in /ctdl and acidblocks now only destroy blocks when their timer is up --- .../vg/civcraft/mc/citadel/command/Acid.java | 18 ++++----- .../mc/citadel/command/ReinforcementsGUI.java | 39 +++++++++++++++++-- .../mc/citadel/model/AcidManager.java | 4 ++ 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java index 40ef8405d..06bff2a05 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java @@ -7,6 +7,7 @@ import java.util.Iterator; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.logging.Level; +import java.util.stream.Collectors; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.block.Block; @@ -55,26 +56,25 @@ public class Acid extends BaseCommand { "You do not have sufficient permission to use acid blocks on this group."); return; } + Map remainingTimes = acidMan.getRemainingAcidMaturationTime(reinforcement); - for (Map.Entry entry : remainingTimes.entrySet()) { - long neededTime = entry.getValue(); - BlockFace blockFace = entry.getKey(); + Map filteredEntries = remainingTimes.entrySet().stream() + .filter(entry -> entry.getValue() <= 0) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + for (BlockFace blockFace : remainingTimes.keySet()) { Block relativeBlock = block.getRelative(blockFace); Reinforcement relativeReinforcement = ReinforcementLogic.getReinforcementProtecting(relativeBlock); - if (neededTime > 0) { + if (filteredEntries.isEmpty()) { if (relativeReinforcement != null && !acidMan.canAcidBlock(reinforcement.getType(), relativeReinforcement.getType())) { CitadelUtility.sendAndLog(p, ChatColor.RED, String.format("The acid facing %s will fail!", blockFace)); } - CitadelUtility.sendAndLog(p, ChatColor.RED, String.format("%s acid will mature in %s.", - blockFace, TextUtil.formatDuration(neededTime, TimeUnit.MILLISECONDS))); + CitadelUtility.sendAndLog(p, ChatColor.RED, String.format("This acid block is not ready yet.")); return; } } - AcidType acidType = acidMan.getAcidTypeFromMaterial(block.getType()); - - for (BlockFace blockFace : acidType.blockFaces()) { + for (BlockFace blockFace : filteredEntries.keySet()) { Block relativeBlock = block.getRelative(blockFace); Reinforcement relativeReinforcement = ReinforcementLogic.getReinforcementProtecting(relativeBlock); diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java index b343ecc75..bd4ac572f 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java @@ -5,6 +5,7 @@ import co.aikar.commands.annotation.CommandAlias; import co.aikar.commands.annotation.Description; import java.text.DecimalFormat; import java.util.Collections; +import java.util.Comparator; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -14,9 +15,11 @@ import java.util.stream.Collectors; import net.kyori.adventure.text.Component; import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import vg.civcraft.mc.citadel.Citadel; +import vg.civcraft.mc.citadel.acidtypes.AcidType; import vg.civcraft.mc.citadel.reinforcementtypes.ReinforcementType; import vg.civcraft.mc.civmodcore.inventory.gui.DecorationStack; import vg.civcraft.mc.civmodcore.inventory.gui.IClickable; @@ -46,20 +49,33 @@ public class ReinforcementsGUI extends BaseCommand { Collections.sort(disallowedTypes, (o1, o2) -> Double.compare(o1.getHealth(), o2.getHealth())); List clicks = new LinkedList<>(); - clicks.addAll(getClicks(allowedTypes, true)); + clicks.addAll(getMaterialClicks(allowedTypes, true)); if (disallowedTypes.size() > 0) { for (int i = 0; i < 18 - (allowedTypes.size() % 9); i++) { clicks.add(new DecorationStack(Material.AIR)); } } - clicks.addAll(getClicks(disallowedTypes, false)); + clicks.addAll(getMaterialClicks(disallowedTypes, false)); + + List acidTypes = Citadel.getInstance().getAcidManager().getAcidTypes(); + // check if dimensional reinforcements + if (disallowedTypes.size() > 0) { + for (int i = 0; i < 18 - (disallowedTypes.size() % 9); i++) { + clicks.add(new DecorationStack(Material.AIR)); + } + } else { + for (int i = 0; i < 18 - (allowedTypes.size() % 9); i++) { + clicks.add(new DecorationStack(Material.AIR)); + } + } + clicks.addAll(getAcidTypeClicks(acidTypes)); MultiPageView pageView = new MultiPageView(sender, clicks, ChatColor.BLUE + "Reinforcements", true); pageView.showScreen(); } - private List getClicks(List types, boolean allowed) { + private List getMaterialClicks(List types, boolean allowed) { List clickables = new LinkedList<>(); for (ReinforcementType type : types) { @@ -92,4 +108,21 @@ public class ReinforcementsGUI extends BaseCommand { return clickables; } + + private List getAcidTypeClicks(List acidTypes) { + List clickables = new LinkedList<>(); + + for (AcidType acidType : acidTypes) { + ItemStack is = new ItemStack(acidType.material()); + String blockName = ItemUtils.getItemName(acidType.material()); + ItemUtils.setComponentDisplayName(is, Component.text(ChatColor.RED + blockName)); + ItemUtils.addLore(is, ChatColor.GOLD + "Acid Faces: " + (acidType.blockFaces().stream().map(BlockFace::toString).collect(Collectors.joining(", ")))); + ItemUtils.addLore(is, ChatColor.GOLD + "Maturation Modifier: " + format.format(acidType.modifier()) + "x"); + + IClickable click = new DecorationStack(is); + clickables.add(click); + } + + return clickables; + } } diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java index c7578c988..fe825d54c 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java @@ -107,4 +107,8 @@ public class AcidManager { .findFirst() .orElseThrow(); } + + public List getAcidTypes() { + return acidTypes; + } } From 4d3ab2be599ef4c8886d4869af61449001327497 Mon Sep 17 00:00:00 2001 From: kickylol Date: Sat, 24 Aug 2024 09:24:04 -0230 Subject: [PATCH 3/6] awoo review improvements --- .../java/vg/civcraft/mc/citadel/command/Acid.java | 2 +- .../mc/citadel/command/ReinforcementsGUI.java | 11 +++-------- .../vg/civcraft/mc/citadel/model/AcidManager.java | 13 ++++++------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java index 06bff2a05..f31ef0c1a 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/Acid.java @@ -82,7 +82,7 @@ public class Acid extends BaseCommand { relativeReinforcement == null || !relativeReinforcement.getType().canBeReinforced(relativeBlock.getType()) || !acidMan.canAcidBlock(reinforcement.getType(), relativeReinforcement.getType()) - || acidMan.isPossibleAcidBlock(relativeBlock) && acidMan.isAcidOnSameGroup(reinforcement, relativeReinforcement) + || (acidMan.isPossibleAcidBlock(relativeBlock) && acidMan.isAcidOnSameGroup(reinforcement, relativeReinforcement)) ) { continue; } diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java index bd4ac572f..241470eef 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java @@ -60,14 +60,9 @@ public class ReinforcementsGUI extends BaseCommand { List acidTypes = Citadel.getInstance().getAcidManager().getAcidTypes(); // check if dimensional reinforcements - if (disallowedTypes.size() > 0) { - for (int i = 0; i < 18 - (disallowedTypes.size() % 9); i++) { - clicks.add(new DecorationStack(Material.AIR)); - } - } else { - for (int i = 0; i < 18 - (allowedTypes.size() % 9); i++) { - clicks.add(new DecorationStack(Material.AIR)); - } + int size = disallowedTypes.size() > 0 ? disallowedTypes.size() : allowedTypes.size(); + for (int i = 0; i < 18 - (size % 9); i++) { + clicks.add(new DecorationStack(Material.AIR)); } clicks.addAll(getAcidTypeClicks(acidTypes)); diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java index fe825d54c..ec85a8032 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/model/AcidManager.java @@ -53,16 +53,13 @@ public class AcidManager { */ public Map getRemainingAcidMaturationTime(Reinforcement rein) { Block acidBlock = rein.getLocation().getBlock(); - Block targetBlock = acidBlock.getRelative(BlockFace.UP); - // Get acidMultiplier for the acid type double acidMultiplier = acidTypes.stream() .filter(acidType -> acidType.material() == acidBlock.getType()) .findFirst() .map(AcidType::modifier) .orElse(1D); - // Get block faces for the acid type List acidFaces = acidTypes.stream() .filter(acidType -> acidType.material() == acidBlock.getType()) .findFirst() @@ -74,11 +71,13 @@ public class AcidManager { for (BlockFace face : acidFaces) { Block relativeBlock = acidBlock.getRelative(face); Reinforcement targetBlockRein = ReinforcementLogic.getReinforcementAt(relativeBlock.getLocation()); - if (!MaterialUtils.isAir(relativeBlock.getType())) { - if (targetBlockRein != null) { - decayMultiplier = ReinforcementLogic.getDecayDamage(targetBlockRein); - } + if ( + targetBlockRein != null + && !MaterialUtils.isAir(relativeBlock.getType()) + ) { + decayMultiplier = ReinforcementLogic.getDecayDamage(targetBlockRein); } + long targetAcidTime = (targetBlockRein != null) ? targetBlockRein.getType().getAcidTime() : rein.getType().getAcidTime(); long totalTime = Math.round(targetAcidTime / decayMultiplier * acidMultiplier); long remainingTime = Math.max(0, totalTime - rein.getAge()); From c22ea8a32980c2192ab4449ed78ae0ccfaf08fe5 Mon Sep 17 00:00:00 2001 From: kickylol Date: Tue, 8 Oct 2024 23:40:23 -0230 Subject: [PATCH 4/6] kill linkedlist --- .../java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java index 241470eef..bd0b9b404 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java @@ -4,6 +4,7 @@ import co.aikar.commands.BaseCommand; import co.aikar.commands.annotation.CommandAlias; import co.aikar.commands.annotation.Description; import java.text.DecimalFormat; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; @@ -105,7 +106,7 @@ public class ReinforcementsGUI extends BaseCommand { } private List getAcidTypeClicks(List acidTypes) { - List clickables = new LinkedList<>(); + List clickables = new ArrayList<>(); for (AcidType acidType : acidTypes) { ItemStack is = new ItemStack(acidType.material()); From 68656341278fa31b048bf32eec4bfb2e55945201 Mon Sep 17 00:00:00 2001 From: okx-code Date: Sun, 20 Oct 2024 02:41:35 +0100 Subject: [PATCH 5/6] Consistent capitalisation --- .../vg/civcraft/mc/citadel/command/ReinforcementsGUI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java index bd0b9b404..d61e6bc28 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/command/ReinforcementsGUI.java @@ -112,8 +112,8 @@ public class ReinforcementsGUI extends BaseCommand { ItemStack is = new ItemStack(acidType.material()); String blockName = ItemUtils.getItemName(acidType.material()); ItemUtils.setComponentDisplayName(is, Component.text(ChatColor.RED + blockName)); - ItemUtils.addLore(is, ChatColor.GOLD + "Acid Faces: " + (acidType.blockFaces().stream().map(BlockFace::toString).collect(Collectors.joining(", ")))); - ItemUtils.addLore(is, ChatColor.GOLD + "Maturation Modifier: " + format.format(acidType.modifier()) + "x"); + ItemUtils.addLore(is, ChatColor.GOLD + "Acid faces: " + (acidType.blockFaces().stream().map(BlockFace::toString).collect(Collectors.joining(", ")))); + ItemUtils.addLore(is, ChatColor.GOLD + "Maturation modifier: " + format.format(acidType.modifier()) + "x"); IClickable click = new DecorationStack(is); clickables.add(click); From 8bca507bf2425dd8a3ebe12a041bcc57a637e145 Mon Sep 17 00:00:00 2001 From: kickylol Date: Fri, 15 Nov 2024 03:16:53 -0330 Subject: [PATCH 6/6] update warning to ignore acid on same group --- .../src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java index f14c6392b..3a0724ce4 100644 --- a/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java +++ b/plugins/citadel-paper/src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java @@ -225,7 +225,7 @@ public class CitadelUtility { if ( relativeReinforcement == null || !relativeReinforcement.getType().canBeReinforced(relativeBlock.getType()) - || acidMan.isPossibleAcidBlock(relativeBlock) + || (acidMan.isPossibleAcidBlock(relativeBlock) && acidMan.isAcidOnSameGroup(newRein, relativeReinforcement)) ) { continue; }