diff --git a/civcraft/.classpath b/civcraft/.classpath index a1ebb732a..12567160b 100644 --- a/civcraft/.classpath +++ b/civcraft/.classpath @@ -20,6 +20,6 @@ - + diff --git a/civcraft/bin/com/avrgaming/civcraft/command/town/TownInfoCommand.class b/civcraft/bin/com/avrgaming/civcraft/command/town/TownInfoCommand.class index a564c3e5a..af39a56ae 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/command/town/TownInfoCommand.class and b/civcraft/bin/com/avrgaming/civcraft/command/town/TownInfoCommand.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/main/CivGlobal.class b/civcraft/bin/com/avrgaming/civcraft/main/CivGlobal.class index 8d5525565..a3898f09b 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/main/CivGlobal.class and b/civcraft/bin/com/avrgaming/civcraft/main/CivGlobal.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/object/Town.class b/civcraft/bin/com/avrgaming/civcraft/object/Town.class index 92625701b..4b5e33cf2 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/object/Town.class and b/civcraft/bin/com/avrgaming/civcraft/object/Town.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/structure/BroadcastTower.class b/civcraft/bin/com/avrgaming/civcraft/structure/BroadcastTower.class index 3dab077af..d13b51bd9 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/structure/BroadcastTower.class and b/civcraft/bin/com/avrgaming/civcraft/structure/BroadcastTower.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/structure/Farm$1AsyncSave.class b/civcraft/bin/com/avrgaming/civcraft/structure/Farm$1AsyncSave.class index 67c491b75..72cff6074 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/structure/Farm$1AsyncSave.class and b/civcraft/bin/com/avrgaming/civcraft/structure/Farm$1AsyncSave.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/structure/Farm$1AsyncTask.class b/civcraft/bin/com/avrgaming/civcraft/structure/Farm$1AsyncTask.class index 04a9f00c7..e4bcbd905 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/structure/Farm$1AsyncTask.class and b/civcraft/bin/com/avrgaming/civcraft/structure/Farm$1AsyncTask.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/structure/Farm.class b/civcraft/bin/com/avrgaming/civcraft/structure/Farm.class index 081267b46..2ecbfe413 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/structure/Farm.class and b/civcraft/bin/com/avrgaming/civcraft/structure/Farm.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/structure/Mine.class b/civcraft/bin/com/avrgaming/civcraft/structure/Mine.class index e106e28b9..58648d5ba 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/structure/Mine.class and b/civcraft/bin/com/avrgaming/civcraft/structure/Mine.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/structure/Museum.class b/civcraft/bin/com/avrgaming/civcraft/structure/Museum.class index cdf835221..f1ae29779 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/structure/Museum.class and b/civcraft/bin/com/avrgaming/civcraft/structure/Museum.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/structure/ResearchLab.class b/civcraft/bin/com/avrgaming/civcraft/structure/ResearchLab.class index da9182930..9a1e5a074 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/structure/ResearchLab.class and b/civcraft/bin/com/avrgaming/civcraft/structure/ResearchLab.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/structure/Structure.class b/civcraft/bin/com/avrgaming/civcraft/structure/Structure.class index c12980794..70ebc47d6 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/structure/Structure.class and b/civcraft/bin/com/avrgaming/civcraft/structure/Structure.class differ diff --git a/civcraft/bin/com/avrgaming/civcraft/threading/tasks/PlayerChunkNotifyAsyncTask.class b/civcraft/bin/com/avrgaming/civcraft/threading/tasks/PlayerChunkNotifyAsyncTask.class index 9139291e5..1598c64c8 100644 Binary files a/civcraft/bin/com/avrgaming/civcraft/threading/tasks/PlayerChunkNotifyAsyncTask.class and b/civcraft/bin/com/avrgaming/civcraft/threading/tasks/PlayerChunkNotifyAsyncTask.class differ diff --git a/civcraft/bin/plugin.yml b/civcraft/bin/plugin.yml index e8d3e9b77..2a057ad40 100644 --- a/civcraft/bin/plugin.yml +++ b/civcraft/bin/plugin.yml @@ -1,7 +1,7 @@ name: CivCraft main: com.avrgaming.civcraft.main.CivCraft softdepends: [TitleAPI] -version: 1.76.3 +version: 1.76.4 commands: town: diff --git a/civcraft/data/market.yml b/civcraft/data/market.yml index 77ebbce0a..5a17b9335 100644 --- a/civcraft/data/market.yml +++ b/civcraft/data/market.yml @@ -189,7 +189,7 @@ items: - id: 31 name: 'Mossy Brick' type_id: 98 - data: 0 + data: 1 value: 1 - id: 32 diff --git a/civcraft/data/structures.yml b/civcraft/data/structures.yml index bbf0e526c..5cfb9589f 100644 --- a/civcraft/data/structures.yml +++ b/civcraft/data/structures.yml @@ -669,6 +669,8 @@ structures: type: 'direct' attribute: 'UNHAPPINESS' value: '-2.0' + - name: 'AttributeStatic' + type: 'direct' attribute: 'HAPPINESS' value: '2.0' @@ -877,7 +879,7 @@ structures: value: '0.01' - id: s_research_lab - template: school + template: research_lab template_y_shift: 0 displayName: Research Lab require_upgrade: @@ -940,7 +942,7 @@ structures: - name: 'AttributeStatic' type: 'direct' attribute: 'UNHAPPINESS' - value: '-3.0' + value: '3.0' - name: 'AttributeStatic' type: 'direct' attribute: 'GROWTH' diff --git a/civcraft/src/com/avrgaming/civcraft/command/town/TownInfoCommand.java b/civcraft/src/com/avrgaming/civcraft/command/town/TownInfoCommand.java index 2ae6f1087..71de0c1fc 100644 --- a/civcraft/src/com/avrgaming/civcraft/command/town/TownInfoCommand.java +++ b/civcraft/src/com/avrgaming/civcraft/command/town/TownInfoCommand.java @@ -277,14 +277,16 @@ public void rates_cmd() throws CivException { Town town = getSelectedTown(); CivMessage.sendHeading(sender, town.getName()+" "+CivSettings.localize.localizedString("cmd_town_info_ratesHeading")); + + DecimalFormat df = new DecimalFormat("#,###.#"); CivMessage.send(sender, - CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoGrowth")+" "+CivColor.LightGreen+(town.getGrowthRate().total*100)+ - CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoCulture")+" "+CivColor.LightGreen+(town.getCulture().total*100)+ - CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoCottage")+" "+CivColor.LightGreen+(town.getCottageRate()*100)+ - CivColor.Green+" "+CivSettings.localize.localizedString("Temple")+" "+CivColor.LightGreen+(town.getTempleRate()*100)+ - CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoTrade")+" "+CivColor.LightGreen+(town.getTradeRate()*100)+ - CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoBeaker")+" "+CivColor.LightGreen+(town.getBeakerRate().total*100) + CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoGrowth")+" "+CivColor.LightGreen+df.format(town.getGrowthRate().total*100)+ + CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoCulture")+" "+CivColor.LightGreen+df.format(town.getCultureRate().total*100)+ + CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoCottage")+" "+CivColor.LightGreen+df.format(town.getCottageRate()*100)+ + CivColor.Green+" "+CivSettings.localize.localizedString("Temple")+" "+CivColor.LightGreen+df.format(town.getTempleRate()*100)+ + CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoTrade")+" "+CivColor.LightGreen+df.format(town.getTradeRate()*100)+ + CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoBeaker")+" "+CivColor.LightGreen+df.format(town.getBeakerRate().total*100) ); } diff --git a/civcraft/src/com/avrgaming/civcraft/main/CivGlobal.java b/civcraft/src/com/avrgaming/civcraft/main/CivGlobal.java index 0e4eb555c..5ccdbf3ee 100644 --- a/civcraft/src/com/avrgaming/civcraft/main/CivGlobal.java +++ b/civcraft/src/com/avrgaming/civcraft/main/CivGlobal.java @@ -1264,7 +1264,12 @@ public static Date getNextHourlyTickDate() { } public static void removeFarmChunk(ChunkCoord coord) { - farmChunks.remove(coord); + FarmChunk fc = getFarmChunk(coord); + if (fc != null) { + CivGlobal.dequeueFarmChunk(fc); + farmGrowQueue.remove(fc); + } + farmChunks.remove(coord); } public static void addProtectedItemFrame(ItemFrameStorage framestore) { @@ -2035,6 +2040,10 @@ public static Collection getStructures() { return structures.values(); } + public static void dequeueFarmChunk(FarmChunk fc) { + farmChunkUpdateQueue.remove(fc); + } + public static void queueFarmChunk(FarmChunk fc) { farmChunkUpdateQueue.add(fc); } diff --git a/civcraft/src/com/avrgaming/civcraft/object/Town.java b/civcraft/src/com/avrgaming/civcraft/object/Town.java index a33b4db08..bf624973d 100644 --- a/civcraft/src/com/avrgaming/civcraft/object/Town.java +++ b/civcraft/src/com/avrgaming/civcraft/object/Town.java @@ -611,10 +611,16 @@ public AttrSource getCultureRate() { rates.put("Happiness", newRate - rate); rate = newRate; - double additional = this.getBuffManager().getEffectiveDouble(Buff.FINE_ART); - + double structures = 0; if (this.getBuffManager().hasBuff("buff_art_appreciation")) { - additional += this.getBuffManager().getEffectiveDouble("buff_art_appreciation"); + structures += this.getBuffManager().getEffectiveDouble("buff_art_appreciation"); + } + rates.put("Great Works", structures); + rate += structures; + + double additional = 0; + if (this.getBuffManager().hasBuff("buff_fine_art")) { + additional += this.getBuffManager().getEffectiveDouble(Buff.FINE_ART); } if (this.getBuffManager().hasBuff("buff_pyramid_culture")) { additional += this.getBuffManager().getEffectiveDouble("buff_pyramid_culture"); diff --git a/civcraft/src/com/avrgaming/civcraft/structure/BroadcastTower.java b/civcraft/src/com/avrgaming/civcraft/structure/BroadcastTower.java index 94d0ca9f8..453141f45 100644 --- a/civcraft/src/com/avrgaming/civcraft/structure/BroadcastTower.java +++ b/civcraft/src/com/avrgaming/civcraft/structure/BroadcastTower.java @@ -6,7 +6,6 @@ import org.bukkit.Location; import com.avrgaming.civcraft.exception.CivException; -import com.avrgaming.civcraft.object.Civilization; import com.avrgaming.civcraft.object.Town; public class BroadcastTower extends Structure { @@ -66,20 +65,7 @@ protected void addBuffToTown(Town town, String id) { } } - protected void addBuffToCiv(Civilization civ, String id) { - for (Town t : civ.getTowns()) { - addBuffToTown(t, id); - } - } - protected void removeBuffFromTown(Town town, String id) { town.getBuffManager().removeBuff(id); } - - protected void removeBuffFromCiv(Civilization civ, String id) { - for (Town t : civ.getTowns()) { - removeBuffFromTown(t, id); - } - } - } diff --git a/civcraft/src/com/avrgaming/civcraft/structure/Farm.java b/civcraft/src/com/avrgaming/civcraft/structure/Farm.java index 1ddfefd06..fc8393c79 100644 --- a/civcraft/src/com/avrgaming/civcraft/structure/Farm.java +++ b/civcraft/src/com/avrgaming/civcraft/structure/Farm.java @@ -57,6 +57,14 @@ public Farm(ResultSet rs) throws SQLException, CivException { build_farm(this.getCorner().getLocation()); } + public void removeFarmChunk() throws SQLException { + if (this.getCorner() != null) { + ChunkCoord coord = new ChunkCoord(this.getCorner().getLocation()); + CivGlobal.removeFarmChunk(coord); + CivGlobal.getSessionDB().delete_all(getSessionKey()); + } + } + @Override public void delete() throws SQLException { if (this.getCorner() != null) { diff --git a/civcraft/src/com/avrgaming/civcraft/structure/Mine.java b/civcraft/src/com/avrgaming/civcraft/structure/Mine.java index 3d5c513fc..18bc5d657 100644 --- a/civcraft/src/com/avrgaming/civcraft/structure/Mine.java +++ b/civcraft/src/com/avrgaming/civcraft/structure/Mine.java @@ -145,7 +145,11 @@ public int getLevel() { public double getHammersPerTile() { AttributeBiomeRadiusPerLevel attrBiome = (AttributeBiomeRadiusPerLevel)this.getComponent("AttributeBiomeRadiusPerLevel"); - double base = attrBiome.getBaseValue(); + double base = 1.0; + + if (attrBiome != null) { + base = attrBiome.getBaseValue(); + } double rate = 1; rate += this.getTown().getBuffManager().getEffectiveDouble(Buff.ADVANCED_TOOLING); diff --git a/civcraft/src/com/avrgaming/civcraft/structure/Museum.java b/civcraft/src/com/avrgaming/civcraft/structure/Museum.java index b17ff53cb..51f6129a1 100644 --- a/civcraft/src/com/avrgaming/civcraft/structure/Museum.java +++ b/civcraft/src/com/avrgaming/civcraft/structure/Museum.java @@ -6,29 +6,28 @@ import org.bukkit.Location; import com.avrgaming.civcraft.exception.CivException; -import com.avrgaming.civcraft.object.Civilization; import com.avrgaming.civcraft.object.Town; public class Museum extends Structure { - protected Museum(Location center, String id, Town town) - throws CivException { + protected Museum(Location center, String id, Town town) throws CivException { super(center, id, town); } public Museum(ResultSet rs) throws SQLException, CivException { super(rs); } - - @Override - public String getDynmapDescription() { - return null; - } @Override public String getMarkerIconName() { return "flower"; } + + @Override + public void loadSettings() { + super.loadSettings(); + } + @Override public void onLoad() { if (this.isActive()) { @@ -64,19 +63,7 @@ protected void addBuffToTown(Town town, String id) { } } - protected void addBuffToCiv(Civilization civ, String id) { - for (Town t : civ.getTowns()) { - addBuffToTown(t, id); - } - } - protected void removeBuffFromTown(Town town, String id) { town.getBuffManager().removeBuff(id); } - - protected void removeBuffFromCiv(Civilization civ, String id) { - for (Town t : civ.getTowns()) { - removeBuffFromTown(t, id); - } - } } diff --git a/civcraft/src/com/avrgaming/civcraft/structure/ResearchLab.java b/civcraft/src/com/avrgaming/civcraft/structure/ResearchLab.java index 1ab2e32da..9be5d048b 100644 --- a/civcraft/src/com/avrgaming/civcraft/structure/ResearchLab.java +++ b/civcraft/src/com/avrgaming/civcraft/structure/ResearchLab.java @@ -10,7 +10,6 @@ import com.avrgaming.civcraft.object.Town; public class ResearchLab extends Structure { - protected ResearchLab(Location center, String id, Town town) throws CivException { super(center, id, town); @@ -19,16 +18,33 @@ protected ResearchLab(Location center, String id, Town town) throws CivException public ResearchLab(ResultSet rs) throws SQLException, CivException { super(rs); } + + @Override + public String getMarkerIconName() { + return "warning"; + } @Override public void loadSettings() { super.loadSettings(); - } @Override - public String getMarkerIconName() { - return "warning"; + public void onLoad() { + if (this.isActive()) { + addBuffs(); + } + } + + @Override + public void onComplete() { + addBuffs(); + } + + @Override + public void onDestroy() { + super.onDestroy(); + removeBuffs(); } protected void removeBuffs() { diff --git a/civcraft/src/com/avrgaming/civcraft/structure/Structure.java b/civcraft/src/com/avrgaming/civcraft/structure/Structure.java index a75b4a236..d8f48b001 100644 --- a/civcraft/src/com/avrgaming/civcraft/structure/Structure.java +++ b/civcraft/src/com/avrgaming/civcraft/structure/Structure.java @@ -160,7 +160,14 @@ private static Structure _newStructure(Location center, String id, Town town, Re struct = (Structure) new Grocer(rs); } break; - + + case "s_broadcast_tower": + if (rs == null) { + struct = (BroadcastTower) new BroadcastTower(center, id, town); + } else { + struct = (BroadcastTower) new BroadcastTower(rs); + } + break; case "s_library": if (rs == null) { struct = (Structure) new Library(center, id, town); @@ -364,6 +371,13 @@ private static Structure _newStructure(Location center, String id, Town town, Re struct = (Structure) new Windmill(rs); } break; + case "s_museum": + if (rs == null) { + struct = (Museum) new Museum(center, id, town); + } else { + struct = (Museum) new Museum(rs); + } + break; case "s_market": if (rs == null) { struct = (Market) new Market(center, id, town); @@ -553,6 +567,7 @@ public void deleteSkipUndo() throws SQLException { if (!(this instanceof Wall || this instanceof FortifiedWall || this instanceof Road)) { + CivLog.debug("Delete with Undo! "+this.getDisplayName()); /* Remove StructureSigns */ for (StructureSign sign : this.getSigns()) { sign.delete(); @@ -566,7 +581,12 @@ public void deleteSkipUndo() throws SQLException { CivGlobal.removeStructure(this); this.getTown().removeStructure(this); this.unbindStructureBlocks(); + if (this instanceof Farm) { + Farm farm = (Farm)this; + farm.removeFarmChunk(); + } } else { + CivLog.debug("Delete skip Undo! "+this.getDisplayName()); CivGlobal.removeStructure(this); this.getTown().removeStructure(this); this.unbindStructureBlocks(); diff --git a/civcraft/src/com/avrgaming/civcraft/threading/tasks/PlayerChunkNotifyAsyncTask.java b/civcraft/src/com/avrgaming/civcraft/threading/tasks/PlayerChunkNotifyAsyncTask.java index be4b0cb6c..a3e02ba15 100644 --- a/civcraft/src/com/avrgaming/civcraft/threading/tasks/PlayerChunkNotifyAsyncTask.java +++ b/civcraft/src/com/avrgaming/civcraft/threading/tasks/PlayerChunkNotifyAsyncTask.java @@ -175,7 +175,10 @@ private void showPlotMoveMessage() { if (civilization == toCc.getCiv()) { subTitle += CivSettings.localize.localizedString("var_civ_border_welcomeBack", player.getName()); } else { - subTitle += CivSettings.localize.localizedString("var_civ_border_relation",civilization.getDiplomacyManager().getRelation(toCc.getCiv()).toString()); + String relationship = civilization.getDiplomacyManager().getRelation(toCc.getCiv()).toString(); + if (relationship != null && relationship.length() >= 1) { + subTitle = CivSettings.localize.localizedString("var_civ_border_relation",relationship); + } } } onCultureEnter(toCc); } else if (fromCc != null && toCc !=null && fromCc.getCiv() != toCc.getCiv()) { @@ -187,7 +190,10 @@ private void showPlotMoveMessage() { if (civilization == toCc.getCiv()) { subTitle += CivSettings.localize.localizedString("var_civ_border_welcomeBack", player.getName()); } else { - subTitle += CivSettings.localize.localizedString("var_civ_border_relation",civilization.getDiplomacyManager().getRelation(toCc.getCiv()).toString()); + String relationship = civilization.getDiplomacyManager().getRelation(toCc.getCiv()).toString(); + if (relationship != null && relationship.length() >= 1) { + subTitle = CivSettings.localize.localizedString("var_civ_border_relation",relationship); + } } } } diff --git a/civcraft/src/plugin.yml b/civcraft/src/plugin.yml index e8d3e9b77..2a057ad40 100644 --- a/civcraft/src/plugin.yml +++ b/civcraft/src/plugin.yml @@ -1,7 +1,7 @@ name: CivCraft main: com.avrgaming.civcraft.main.CivCraft softdepends: [TitleAPI] -version: 1.76.3 +version: 1.76.4 commands: town: