Skip to content
Open

1.17 #90

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
56753fc
v4.2.0 - 1.17, Java 16 and Aikar Commands
Diet-Cola Jun 30, 2021
b85f821
Ori patch
Diet-Cola Jun 30, 2021
78761e7
Update holographic-displays version
Diet-Cola Jun 30, 2021
59bf5c0
POM fix
Diet-Cola Jun 30, 2021
60f01dd
Fix commands + Tab completion
Diet-Cola Jul 1, 2021
8456722
Add 1.17 plants & hopefully prevent moss spread to reinforced stuff
Diet-Cola Jul 2, 2021
0a07e3b
Fixes to plants
Diet-Cola Jul 2, 2021
8ff033f
Add message to moss prevention
Diet-Cola Jul 2, 2021
25da63d
Fix dripleafs
Diet-Cola Jul 2, 2021
4b32c96
Prevent candle modification
Diet-Cola Jul 2, 2021
0fe4d41
Turns out dripstone can grow
Diet-Cola Jul 3, 2021
98872b7
Handle powdered snow with citadel
Diet-Cola Jul 3, 2021
472e622
Latest CMC
Diet-Cola Jul 5, 2021
e417d3c
Fix copper waxing/stripping
Diet-Cola Jul 5, 2021
9e4ec42
Logic fix
Diet-Cola Jul 5, 2021
c76f153
Fix sweet berry and cave vines
Diet-Cola Jul 8, 2021
8dcaa59
1.17.1
Diet-Cola Jul 18, 2021
0e1853f
Fix arg order for ctar
Diet-Cola Sep 5, 2021
18ec78b
Update citadel config to handle CMC update
Diet-Cola Sep 14, 2021
4df29ca
Revert "Update citadel config to handle CMC update"
Diet-Cola Sep 14, 2021
7e6c5f3
Change parseMaterialList usage to account for CMC updates to method
Diet-Cola Sep 19, 2021
68098e9
Merge remote-tracking branch 'origin/master' into 16+17
Diet-Cola Sep 19, 2021
7d68728
Add Sweet Berry bush to plant check
Diet-Cola Sep 19, 2021
4e463b5
Merge branch 'plant-fix' into 16+17
Diet-Cola Sep 28, 2021
a05b1db
Merge remote-tracking branch 'origin/master' into 16+17
Diet-Cola Nov 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<parent>
<groupId>com.github.civclassic</groupId>
<artifactId>civclassic-parent</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>

<groupId>vg.civcraft.mc.citadel</groupId>
<groupId>com.github.civclassic</groupId>
<artifactId>Citadel</artifactId>
<packaging>jar</packaging>
<version>4.2.0</version>
Expand All @@ -19,27 +19,27 @@

<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<groupId>io.papermc.paper</groupId>
<artifactId>paper</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>vg.civcraft.mc.civmodcore</groupId>
<groupId>com.github.civclassic</groupId>
<artifactId>CivModCore</artifactId>
<version>1.8.2</version>
<version>1.9.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>vg.civcraft.mc.namelayer</groupId>
<groupId>com.github.civclassic</groupId>
<artifactId>NameLayer</artifactId>
<version>2.14.1</version>
<version>2.15.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gmail.filoghost.holographicdisplays</groupId>
<artifactId>holographicdisplays-api</artifactId>
<version>2.4.5</version>
<version>2.4.8</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand All @@ -49,6 +49,10 @@
<id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>civ-github-repo</id>
<url>https://raw.githubusercontent.com/CivClassic/artifacts/master/</url>
Expand Down
13 changes: 8 additions & 5 deletions src/main/java/vg/civcraft/mc/citadel/Citadel.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import vg.civcraft.mc.citadel.command.CitadelCommandManager;
import vg.civcraft.mc.citadel.listener.BlockListener;
import vg.civcraft.mc.citadel.listener.EntityListener;
import vg.civcraft.mc.citadel.listener.InventoryListener;
Expand All @@ -17,10 +18,10 @@
import vg.civcraft.mc.citadel.playerstate.PlayerStateManager;
import vg.civcraft.mc.citadel.reinforcementtypes.ReinforcementTypeManager;
import vg.civcraft.mc.civmodcore.ACivMod;
import vg.civcraft.mc.civmodcore.locations.chunkmeta.api.BlockBasedChunkMetaView;
import vg.civcraft.mc.civmodcore.locations.chunkmeta.api.ChunkMetaAPI;
import vg.civcraft.mc.civmodcore.locations.chunkmeta.block.table.TableBasedDataObject;
import vg.civcraft.mc.civmodcore.locations.chunkmeta.block.table.TableStorageEngine;
import vg.civcraft.mc.civmodcore.world.locations.chunkmeta.api.BlockBasedChunkMetaView;
import vg.civcraft.mc.civmodcore.world.locations.chunkmeta.api.ChunkMetaAPI;
import vg.civcraft.mc.civmodcore.world.locations.chunkmeta.block.table.TableBasedDataObject;
import vg.civcraft.mc.civmodcore.world.locations.chunkmeta.block.table.TableStorageEngine;

public class Citadel extends ACivMod {

Expand All @@ -38,6 +39,7 @@ public static Citadel getInstance() {
private HologramManager holoManager;
private CitadelSettingManager settingManager;
private CitadelDAO dao;
private CitadelCommandManager commandManager;

private PlayerStateManager stateManager;

Expand Down Expand Up @@ -114,7 +116,7 @@ public void onEnable() {
Bukkit.shutdown();
return;
}
BlockBasedChunkMetaView<CitadelChunkData, TableBasedDataObject, TableStorageEngine<Reinforcement>> chunkMetaData =
BlockBasedChunkMetaView<CitadelChunkData, TableBasedDataObject, TableStorageEngine<Reinforcement>> chunkMetaData =
ChunkMetaAPI.registerBlockBasedPlugin(this, () -> new CitadelChunkData(false, dao),dao, true);
if (chunkMetaData == null) {
logger.severe("Errors setting up chunk metadata API, shutting down");
Expand All @@ -133,6 +135,7 @@ public void onEnable() {
else {
logger.info("HolographicDisplays is not loaded, no holograms available");
}});
commandManager = new CitadelCommandManager(this);
CitadelPermissionHandler.setup();
registerListeners();
}
Expand Down
31 changes: 16 additions & 15 deletions src/main/java/vg/civcraft/mc/citadel/CitadelConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
import vg.civcraft.mc.citadel.reinforcementtypes.ReinforcementEffect;
import vg.civcraft.mc.citadel.reinforcementtypes.ReinforcementType;
import vg.civcraft.mc.civmodcore.ACivMod;
import vg.civcraft.mc.civmodcore.CoreConfigManager;
import vg.civcraft.mc.civmodcore.config.ConfigHelper;
import vg.civcraft.mc.civmodcore.config.ConfigParser;
import vg.civcraft.mc.civmodcore.dao.DatabaseCredentials;
import vg.civcraft.mc.civmodcore.dao.ManagedDatasource;
import vg.civcraft.mc.civmodcore.util.ConfigParsing;
import vg.civcraft.mc.civmodcore.util.TextUtil;
import vg.civcraft.mc.civmodcore.utilities.TextUtil;

public class CitadelConfigManager extends CoreConfigManager {
public class CitadelConfigManager extends ConfigParser {

private ManagedDatasource database;
private List<ReinforcementType> reinforcementTypes;
Expand Down Expand Up @@ -106,7 +107,7 @@ public boolean logMessages() {
}

private void parseAcidMaterials(ConfigurationSection config) {
acidMaterials = parseMaterialList(config, "acidblock_material");
acidMaterials = ConfigHelper.parseMaterialList(config, "acidblock_material");
if (acidMaterials == null) {
logger.info("No valid acid materials found in config");
acidMaterials = new LinkedList<>();
Expand All @@ -118,8 +119,8 @@ private void parseAcidMaterials(ConfigurationSection config) {

@Override
protected boolean parseInternal(ConfigurationSection config) {
database = (ManagedDatasource) config.get("database");
globalBlackList = parseMaterialList(config, "non_reinforceables");
database = ManagedDatasource.construct((ACivMod) plugin, (DatabaseCredentials) config.get("database"));
globalBlackList = ConfigHelper.parseMaterialList(config, "non_reinforceables");
parseAcidMaterials(config);
logHostileBreaks = config.getBoolean("logHostileBreaks", true);
logFriendlyBreaks = config.getBoolean("logFriendlyBreaks", true);
Expand All @@ -128,7 +129,7 @@ protected boolean parseInternal(ConfigurationSection config) {
logMessages = config.getBoolean("logMessages", true);
redstoneRange = config.getDouble("redstoneDistance", 3);
globalDecayMultiplier = config.getDouble("global_decay_multiplier", 2.0);
globalDecayTimer = ConfigParsing.parseTime(config.getString("global_decay_timer", "0"));
globalDecayTimer = ConfigHelper.parseTime(config.getString("global_decay_timer", "0"));
parseReinforcementTypes(config.getConfigurationSection("reinforcements"));
hangersInheritReinforcements = config.getBoolean("hangers_inherit_reinforcement", false);
return true;
Expand All @@ -145,18 +146,18 @@ private ReinforcementType parseReinforcementType(ConfigurationSection config) {
ReinforcementEffect damageEffect = getReinforcementEffect(config.getConfigurationSection("damage_effect"));
ReinforcementEffect destructionEffect = getReinforcementEffect(
config.getConfigurationSection("destruction_effect"));
long gracePeriod = ConfigParsing.parseTime(config.getString("grace_period", "0"), TimeUnit.MILLISECONDS);
long maturationTime = ConfigParsing.parseTime(config.getString("mature_time", "0"), TimeUnit.MILLISECONDS);
long acidTime = ConfigParsing.parseTime(config.getString("acid_time", "-1"), TimeUnit.MILLISECONDS);
long gracePeriod = ConfigHelper.parseTime(config.getString("grace_period", "0"), TimeUnit.MILLISECONDS);
long maturationTime = ConfigHelper.parseTime(config.getString("mature_time", "0"), TimeUnit.MILLISECONDS);
long acidTime = ConfigHelper.parseTime(config.getString("acid_time", "-1"), TimeUnit.MILLISECONDS);
int acidPriority = config.getInt("acid_priority", 0);
String name = config.getString("name");
double maturationScale = config.getInt("scale_amount", 1);
float health = (float) config.getDouble("hit_points", 100);
double returnChance = config.getDouble("return_chance", 1.0);
List<Material> reinforceables = parseMaterialList(config, "reinforceables");
List<Material> nonReinforceables = parseMaterialList(config, "non_reinforceables");
List<Material> reinforceables = ConfigHelper.parseMaterialList(config, "reinforceables");
List<Material> nonReinforceables = ConfigHelper.parseMaterialList(config, "non_reinforceables");
short id = (short) config.getInt("id", -1);
long decayTimer = ConfigParsing
long decayTimer = ConfigHelper
.parseTime(config.getString("decay_timer", String.valueOf(globalDecayTimer / 1000L) + "s"));
double decayMultiplier = config.getDouble("decay_multiplier", globalDecayMultiplier);
double multiplerOnDeletedGroup = config.getDouble("deleted_group_multipler", 4);
Expand All @@ -169,7 +170,7 @@ private ReinforcementType parseReinforcementType(ConfigurationSection config) {
logger.warning("Reinforcement type at " + config.getCurrentPath() + " had no id, it was ignored");
return null;
}
if (reinforceables != null && nonReinforceables != null) {
if (!reinforceables.isEmpty() && !nonReinforceables.isEmpty()) {
logger.warning("Both blacklist and whitelist specified for reinforcement type at " + config.getCurrentPath()
+ ". This does not make sense and the type will be ignored");
return null;
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/vg/civcraft/mc/citadel/CitadelUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.bukkit.entity.Player;
import vg.civcraft.mc.citadel.model.Reinforcement;
import vg.civcraft.mc.citadel.reinforcementtypes.ReinforcementType;
import vg.civcraft.mc.civmodcore.itemHandling.ItemMap;
import vg.civcraft.mc.civmodcore.inventory.items.ItemMap;
import vg.civcraft.mc.namelayer.NameAPI;
import vg.civcraft.mc.namelayer.group.Group;

Expand Down Expand Up @@ -43,6 +43,7 @@ public static boolean isPlant(Block plant) {
case JUNGLE_SAPLING:
case OAK_SAPLING:
case SPRUCE_SAPLING:
case FLOWERING_AZALEA:
case WHEAT:
case CARROTS:
case POTATOES:
Expand All @@ -65,6 +66,11 @@ public static boolean isPlant(Block plant) {
case WEEPING_VINES_PLANT:
case KELP:
case KELP_PLANT:
case BIG_DRIPLEAF:
case BIG_DRIPLEAF_STEM:
case CAVE_VINES:
case CAVE_VINES_PLANT:
case SMALL_DRIPLEAF:
case SWEET_BERRY_BUSH:
case BAMBOO:
case BAMBOO_SAPLING:
Expand Down
57 changes: 48 additions & 9 deletions src/main/java/vg/civcraft/mc/citadel/ReinforcementLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.type.AmethystCluster;
import org.bukkit.block.data.type.Bed;
import org.bukkit.block.data.type.Chest;
import org.bukkit.block.data.type.CoralWallFan;
import org.bukkit.block.data.type.PointedDripstone;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryHolder;
Expand Down Expand Up @@ -172,6 +174,7 @@ public static Block getResponsibleBlock(Block block) {
case WARPED_FUNGUS:
case CRIMSON_FUNGUS:
case BAMBOO_SAPLING:
case FLOWERING_AZALEA:
case WHEAT:
case CARROTS:
case POTATOES:
Expand Down Expand Up @@ -212,21 +215,15 @@ public static Block getResponsibleBlock(Block block) {
case DEAD_FIRE_CORAL_FAN:
case DEAD_HORN_CORAL:
case DEAD_HORN_CORAL_FAN:
case SMALL_DRIPLEAF:
case NETHER_WART: {
return block.getRelative(BlockFace.DOWN);
}
case TWISTING_VINES: {
// scan downwards for first different block
Block below = block.getRelative(BlockFace.DOWN);
while (below.getType() == block.getType() || below.getType() == Material.TWISTING_VINES_PLANT) {
below = below.getRelative(BlockFace.DOWN);
}
return below;
}
case SUGAR_CANE:
case BAMBOO:
case ROSE_BUSH:
case TWISTING_VINES_PLANT:
case BIG_DRIPLEAF_STEM:
case CACTUS:
case SUNFLOWER:
case LILAC:
Expand All @@ -242,6 +239,10 @@ public static Block getResponsibleBlock(Block block) {
}
return below;
}
case SPORE_BLOSSOM:
case HANGING_ROOTS: {
return block.getRelative(BlockFace.UP);
}
case ACACIA_DOOR:
case BIRCH_DOOR:
case DARK_OAK_DOOR:
Expand Down Expand Up @@ -292,6 +293,12 @@ public static Block getResponsibleBlock(Block block) {
CoralWallFan cwf = (CoralWallFan) block.getBlockData();
return block.getRelative(cwf.getFacing().getOppositeFace());
}
case SMALL_AMETHYST_BUD:
case MEDIUM_AMETHYST_BUD:
case LARGE_AMETHYST_BUD: {
AmethystCluster amethyst = (AmethystCluster) block.getBlockData();
return block.getRelative(amethyst.getFacing().getOppositeFace());
}
case WEEPING_VINES: {
// scan upwards
Block above = block.getRelative(BlockFace.UP);
Expand All @@ -300,14 +307,46 @@ public static Block getResponsibleBlock(Block block) {
}
return above;
}
case CAVE_VINES: {
// scan upwards for first different block
Block above = block.getRelative(BlockFace.UP);
while (above.getType() == block.getType() || above.getType() == Material.CAVE_VINES_PLANT) {
above = above.getRelative(BlockFace.UP);
}
return above;
}
case CAVE_VINES_PLANT:
case WEEPING_VINES_PLANT: {
// scan upwards
// scan upwards for first different block
Block above = block.getRelative(BlockFace.UP);
while (above.getType() == block.getType()) {
above = above.getRelative(BlockFace.UP);
}
return above;
}
case TWISTING_VINES: {
// scan downwards for first different block
Block below = block.getRelative(BlockFace.DOWN);
while (below.getType() == block.getType() || below.getType() == Material.TWISTING_VINES_PLANT) {
below = below.getRelative(BlockFace.DOWN);
}
return below;
}
case BIG_DRIPLEAF: {
// scan downwards for first different block
Block below = block.getRelative(BlockFace.DOWN);
while (below.getType() == block.getType() || below.getType() == Material.BIG_DRIPLEAF_STEM) {
below = below.getRelative(BlockFace.DOWN);
}
return below;
}
case POINTED_DRIPSTONE:
PointedDripstone dripstone = (PointedDripstone) block.getBlockData();
Block direction = block.getRelative(dripstone.getVerticalDirection().getOppositeFace());
while (direction.getType() == block.getType()) {
direction = direction.getRelative(dripstone.getVerticalDirection().getOppositeFace());
}
return direction;
default: {
return block;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.bukkit.block.Block;
import vg.civcraft.mc.citadel.model.CitadelChunkData;
import vg.civcraft.mc.citadel.model.Reinforcement;
import vg.civcraft.mc.civmodcore.locations.chunkmeta.api.BlockBasedChunkMetaView;
import vg.civcraft.mc.civmodcore.locations.chunkmeta.block.table.TableBasedDataObject;
import vg.civcraft.mc.civmodcore.locations.chunkmeta.block.table.TableStorageEngine;
import vg.civcraft.mc.civmodcore.world.locations.chunkmeta.api.BlockBasedChunkMetaView;
import vg.civcraft.mc.civmodcore.world.locations.chunkmeta.block.table.TableBasedDataObject;
import vg.civcraft.mc.civmodcore.world.locations.chunkmeta.block.table.TableStorageEngine;

public class ReinforcementManager {

Expand Down
Loading