Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Citadel

Jenkins Build Server can be found: http://192.99.169.83:8080/job/Citadel-master/
Original Citadel Jenkins Build Server can be found here: http://build.civcraft.co/job/Citadel-master/

Java Docs: http://192.99.169.83:8080/job/Citadel-master/javadoc/
Basic new player tutorial: https://www.reddit.com/r/Devoted/wiki/plugins/citadel

If you need help installing Citadel, follow this guide: https://github.com/ProgrammerDan/civcraft-vm
14 changes: 9 additions & 5 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# requirements is the amount of the material needed to create a reinforcement.
# return is the amount of material to return.
# percent_chance is the chance to return the block. Scales with damage.
# scale_amount is, if maturation is enabled, the amount extra to damage a block if it is not fully matured. The forumla for calculating the extra damage is 1/((time left of maturation) / (default amount of time for maturation)) * scale. So if a block has 5 minutes left of maturation on a 10 minute default period with a scale of 3 we do 1/(5 / 10) * 3 = 6 damage. Setting scale amount to 0 disables this function.
# scale_amount is, if maturation is enabled, the amount extra to damage a block if it is not fully matured. The forumla for calculating the extra damage is 1/(1-((time left of maturation) / (default amount of time for maturation))) * scale. So if a block has 5 minutes left of maturation on a 10 minute default period with a scale of 3 we do 1/(5 / 10) * 3 = 6 damage. Setting scale amount to 0 disables this function.
reinforcements:
diamond:
material: DIAMOND
Expand All @@ -12,7 +12,8 @@ reinforcements:
hit_points: 1800
# mature time is in minutes
mature_time: 1440
scale_amount: 0
acid_time: 1440
scale_amount: 1
lore:
# Delete the comment char to use lore. Three spaces are required
# after lore. You can add multiple lines by adding -
Expand All @@ -24,7 +25,8 @@ reinforcements:
percent_chance: 100
hit_points: 250
mature_time: 60
scale_amount: 0
acid_time: 60
scale_amount: 1
lore:
stone:
material: STONE
Expand All @@ -33,7 +35,8 @@ reinforcements:
percent_chance: 100
hit_points: 25
mature_time: 10
scale_amount: 0
acid_time: 10
scale_amount: 1
lore:
bedrock:
material: BEDROCK
Expand All @@ -42,7 +45,8 @@ reinforcements:
percent_chance: 100
hit_points: 2147483646
mature_time: 2147483646
scale_amount: 0
acid_time: 2147483646
scale_amount: 1
lore:
#natural_reinforcements:
#diamond_ore:
Expand Down
8 changes: 4 additions & 4 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ depend: [NameLayer, CivModCore]
description: Citadel allows you to make blocks difficult to break. When a block is reinforced, it must be broken many times before it is destroyed.
commands:
ctr:
aliases: [ctreinforce]
aliases: [ctreinforce, reinforce, protect, cprivate, lwc, private]
ctacid:
ctf:
aliases: [ctfortify]
aliases: [ctfortify, fortify]
ctb:
aliases: [ctbypass]
aliases: [ctbypass, bypass]
cti:
aliases: [ctinformation]
aliases: [ctinformation, info]
ctin:
aliases: [ctinsecure]
ctm:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>vg.civcraft.mc.citadel</groupId>
<artifactId>Citadel</artifactId>
<packaging>jar</packaging>
<version>3.3.9</version>
<version>3.4.0</version>
<name>Citadel</name>
<url>https://github.com/Civcraft/Citadel</url>

Expand Down
4 changes: 4 additions & 0 deletions src/vg/civcraft/mc/citadel/CitadelConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public static int getHitPoints(String type){
public static int getMaturationTime(String type){
return config.getInt("reinforcements." + type + ".mature_time");
}

public static int getAcidTime(String type) {
return config.getInt("reinforcements." + type + ".acid_time", getMaturationTime(type));
}

public static int getMaturationScale(String type){
return config.getInt("reinforcements." + type + ".scale_amount");
Expand Down
56 changes: 46 additions & 10 deletions src/vg/civcraft/mc/citadel/Utility.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ public static PlayerReinforcement createPlayerReinforcement(Player player, Group
}
// Fire the creation event
PlayerReinforcement rein = new PlayerReinforcement(block.getLocation(),
type.getHitPoints(), getIntFormofMaturation(System.currentTimeMillis(),type.getItemStack()),
type.getHitPoints(), getIntFormofMaturation(System.currentTimeMillis(),type.getItemStack()),
getIntFormofAcidMaturation(System.currentTimeMillis(),type.getItemStack()),
g, type.getItemStack(), g.getGroupId());
ReinforcementCreationEvent event = new ReinforcementCreationEvent(rein, block, player);
Bukkit.getPluginManager().callEvent(event);
Expand Down Expand Up @@ -160,7 +161,8 @@ public static PlayerReinforcement createPlayerReinforcementWithoutMaterialConsum
return null;
}
PlayerReinforcement rein = new PlayerReinforcement(block.getLocation(),
type.getHitPoints(), getIntFormofMaturation(System.currentTimeMillis(),type.getItemStack()),
type.getHitPoints(), getIntFormofMaturation(System.currentTimeMillis(),type.getItemStack()),
getIntFormofAcidMaturation(System.currentTimeMillis(),type.getItemStack()),
g, type.getItemStack(), g.getGroupId());
ReinforcementCreationEvent event = new ReinforcementCreationEvent(rein, block, player);
Bukkit.getPluginManager().callEvent(event);
Expand Down Expand Up @@ -354,6 +356,30 @@ public static int timeUntilMature(Reinforcement reinforcement) {
}
return 0;
}
/**
* Used to get the amount of time left until a reinforcement's acid component is mature.
* @param Reinforcement.
* @return Returns 0 if it is mature or the time in minutes until it is mature.
*/
public static int timeUntilAcidMature(Reinforcement reinforcement) {
// Doesn't explicitly save the updated Acid Maturation time into the cache.
// That's the responsibility of the caller.
if (reinforcement instanceof PlayerReinforcement){
int maturationTime = reinforcement.getAcidTime();
if (maturationTime > 0) {
final int curMinute = (int)(System.currentTimeMillis() / 60000L);
if (curMinute >= maturationTime) {
maturationTime = 0;
reinforcement.setAcidTime(0);
} else {
maturationTime = maturationTime - curMinute;
}
}
return (int) maturationTime; // should be small enough by now
}
return 0;
}

/**
*
* @param The Player who broke the reinforcement
Expand Down Expand Up @@ -529,8 +555,9 @@ public static PlayerReinforcement isDroppedReinforcementBlock(Player p, ItemStac
return null;
Group g = GroupManager.getSpecialCircumstanceGroup(group);
PlayerReinforcement rein = new PlayerReinforcement(loc, dur,
getIntFormofMaturation(System.currentTimeMillis(),reinType.getItemStack())
, g, reinType.getItemStack(), g.getGroupId());
getIntFormofMaturation(System.currentTimeMillis(),reinType.getItemStack()),
getIntFormofAcidMaturation(System.currentTimeMillis(),reinType.getItemStack()),
g, reinType.getItemStack(), g.getGroupId());
ReinforcementCreationEvent event =
new ReinforcementCreationEvent(rein, loc.getBlock(), p);
Bukkit.getPluginManager().callEvent(event);
Expand Down Expand Up @@ -564,15 +591,16 @@ public static boolean explodeReinforcement(Block block) {
/**
* Creates a MultiBlockReinforcement and saves it to the db. This method is to be used only be other plugins. Citadel
* will not use this anywhere.
* @param locs- The locations that make up the structure.
* @param g- The group this will belong too.
* @param dur- The durability this structure will have.
* @param mature- The amount of time until it is mature (in minutes).
* @param locs The locations that make up the structure.
* @param g The group this will belong too.
* @param dur The durability this structure will have.
* @param mature The amount of time until it is mature (in minutes).
* @param acid The amount of time until it is mature (if acid -- in minutes).
* @return
*/
public static MultiBlockReinforcement createMultiBlockReinforcement(List<Location> locs, Group g, int dur, int mature){
public static MultiBlockReinforcement createMultiBlockReinforcement(List<Location> locs, Group g, int dur, int mature, int acid){
int nextID = rm.getNextReinforcementID();
MultiBlockReinforcement rein = new MultiBlockReinforcement(locs, g, dur, mature, nextID);
MultiBlockReinforcement rein = new MultiBlockReinforcement(locs, g, dur, mature, acid, nextID);
ReinforcementCreationEvent event = new ReinforcementCreationEvent(rein, rein.getLocation().getBlock(), null);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
Expand Down Expand Up @@ -644,6 +672,14 @@ private static int getIntFormofMaturation(long creation, ItemStack stack){
return maturation;
}

private static int getIntFormofAcidMaturation(long creation, ItemStack stack) {
int maturation = (int)(creation / 60000) +
ReinforcementType.
getReinforcementType(stack)
.getAcidTime();
return maturation;
}

public static Block findPlantSoil(Block block){
final Set<Material> soilTypes = getPlantSoilTypes(block.getType());
if(soilTypes.size() <= 0){
Expand Down
7 changes: 3 additions & 4 deletions src/vg/civcraft/mc/citadel/command/commands/Acid.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public boolean execute(CommandSender sender, String[] args) {
+ "to use acid blocks.");
return true;
}
int time = Utility.timeUntilMature(pRein);
int time = Utility.timeUntilAcidMature(pRein);
if (time != 0) {
p.sendMessage(ChatColor.RED + "That block is not mature yet.");
p.sendMessage(ChatColor.RED + "That acid block is not mature yet.");
return true;
}
Block topFace = block.getRelative(BlockFace.UP);
Expand All @@ -97,8 +97,7 @@ public boolean execute(CommandSender sender, String[] args) {
.getReinforcementType(pRein.getStackRepresentation());
ReinforcementType topReinType = ReinforcementType
.getReinforcementType(pTopRein.getStackRepresentation());
if (acidBlockType.getMaturationTime() < topReinType
.getMaturationTime()) {
if (acidBlockType.getAcidTime() < topReinType.getAcidTime()) {
p.sendMessage(ChatColor.RED
+ "This acid block is too weak for that reinforcement.");
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/vg/civcraft/mc/citadel/command/commands/Bypass.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public boolean execute(CommandSender sender, String[] args) {
Player p = (Player) sender;
PlayerState state = PlayerState.get(p);
if (state.toggleBypassMode()){
p.sendMessage(ChatColor.GREEN + "Bypass mode has been enabled.");
p.sendMessage(ChatColor.GREEN + "Bypass mode has been enabled. You will be able to break reinforced blocks if you are on the group.");
}
else
p.sendMessage(ChatColor.GREEN + "Bypass mode has been disabled.");
Expand Down
11 changes: 5 additions & 6 deletions src/vg/civcraft/mc/citadel/command/commands/Fortification.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Fortification extends PlayerCommand{
public Fortification(String name) {
super(name);
setIdentifier("ctf");
setDescription("Allows you to place already reinforced blocks.");
setDescription("Allows you to place already reinforced blocks. Use /ctf groupname with a reinforcement material in your hand, then place down blocks and they will automatically be reinforced to groupname.");
setUsage("/ctf <group>");
setArguments(0,1);
}
Expand All @@ -48,7 +48,7 @@ public boolean execute(CommandSender sender, String[] args) {
if(args.length == 0){
groupName = gm.getDefaultGroup(uuid);
if(groupName == null){
p.sendMessage(ChatColor.RED + "You need to set a default group \n Use /nlsdg to do so");
p.sendMessage(ChatColor.RED + "You need to fortify to a group! Try /ctf groupname. \n Or use /nlcg groupname if you don't have a group yet.");
return true;
}
}
Expand Down Expand Up @@ -81,15 +81,14 @@ public boolean execute(CommandSender sender, String[] args) {
}
else{
if (stack.getType() == Material.AIR){
p.sendMessage(ChatColor.RED + "You need to be holding an ItemStack.");
p.sendMessage(ChatColor.RED + "You need to be holding something to fortify with, try holding a stone block in your hand.");
return true;
}
else if (reinType == null){
p.sendMessage(ChatColor.RED + "That is not a ReinforcementType.");
p.sendMessage(ChatColor.RED + "You can't use the item in your hand to reinforce. Try using a stone block.");
return true;
}
p.sendMessage(ChatColor.GREEN + "Your mode has been set to " +
ReinforcementMode.REINFOREMENT_FORTIFICATION.name() + ".");
p.sendMessage(ChatColor.GREEN + "You are now in Fortification mode, place blocks down and they will be secured with the material in your hand. \n Type /ctf or /cto to turn this off when you are done.");
state.setMode(ReinforcementMode.REINFOREMENT_FORTIFICATION);
state.setFortificationItemStack(reinType.getItemStack());
state.setGroup(g);
Expand Down
3 changes: 1 addition & 2 deletions src/vg/civcraft/mc/citadel/command/commands/Information.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public boolean execute(CommandSender sender, String[] args) {
state.reset();
}
else{
p.sendMessage(ChatColor.GREEN + "Reinforcement mode changed to "
+ ReinforcementMode.REINFORCEMENT_INFORMATION.name() + ".");
p.sendMessage(ChatColor.GREEN + "You are now in Information mode, click on blocks to see their reinforcement information! \n Type /cti or /cto to turn this off.");
state.setMode(ReinforcementMode.REINFORCEMENT_INFORMATION);
}
return true;
Expand Down
1 change: 1 addition & 0 deletions src/vg/civcraft/mc/citadel/command/commands/Materials.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public boolean execute(CommandSender sender, String[] args) {
t += "Amount: " + type.getRequiredAmount() + ".\n ";
t += "Durability: " + type.getHitPoints() + ".\n ";
t += "Material: " + type.getMaterial() + ".\n ";
t += "Maturation: " + type.maturationTime() + ".\n ";
if (type.getItemStack().getItemMeta().hasLore()){
t += "Lore: ";
for (String x: type.getItemStack().getItemMeta().getLore())
Expand Down
5 changes: 2 additions & 3 deletions src/vg/civcraft/mc/citadel/command/commands/Reinforce.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public boolean execute(CommandSender sender, String[] args) {
if(args.length == 0){
groupName = gm.getDefaultGroup(uuid);
if(groupName == null){
p.sendMessage(ChatColor.RED + "You need to set a default group \n Use /nlsdg to do so");
p.sendMessage(ChatColor.RED + "You need to reinforce to a group! Try /ctr groupname. \n Or /nlcg groupname if you don't have a group yet.");
return true;
}
}
Expand Down Expand Up @@ -72,8 +72,7 @@ public boolean execute(CommandSender sender, String[] args) {
state.reset();
}
else{
p.sendMessage(ChatColor.GREEN + "Your mode has been set to " +
ReinforcementMode.REINFORCEMENT.name() + ".");
p.sendMessage(ChatColor.GREEN + "You are now in Reinforcement mode, hit blocks with a reinforcement material to secure them. \n Type /ctr or /cto to turn this off when you are done.");
state.setMode(ReinforcementMode.REINFORCEMENT);
state.setGroup(g);
}
Expand Down
Loading