Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #584 from rettichlp/hotfix/1-8-3
Browse files Browse the repository at this point in the history
hotfix/1-8-3
  • Loading branch information
rettichlp committed Feb 1, 2023
2 parents 8a4848f + 1d43b70 commit 1dedf32
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-oder-fehler.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Füge gegebenenfalls Screenshots hinzu, um das Problem zu erläutern.

**Weitere Informationen (bitte ausfüllen):**
Minecraft Version: `1.12.2`
Addon Version: `1.8.2`
Addon Version: `1.8.3`
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'idea'
apply plugin: 'maven-publish'

version = '1.8.2'
version = '1.8.3'
group = 'com.rettichlp' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'UnicacityAddon'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@Mod(name = "UnicacityAddon", modid = "unicacityaddon", version = UnicacityAddon.VERSION, clientSideOnly = true, acceptedMinecraftVersions = "[1.12,1.12.2]")
public class UnicacityAddon extends LabyModAddon {

public static final String VERSION = "1.8.2";
public static final String VERSION = "1.8.3";
public static final Minecraft MINECRAFT = Minecraft.getMinecraft();
public static UnicacityAddon ADDON;
public static final Logger LOGGER = LogManager.getLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
public class FileManager {

public static Data DATA = new Data();
public static Data DATA;

private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");

Expand Down Expand Up @@ -121,12 +121,9 @@ public static File getNewActivityImageFile(String type) throws IOException {
public static void loadData() {
try {
File dataFile = FileManager.getDataFile();
if (dataFile != null) {
Gson g = new Gson();
String jsonData = FileUtils.readFileToString(dataFile, StandardCharsets.UTF_8.toString());
DATA = g.fromJson(jsonData, Data.class);
}

assert dataFile != null;
String jsonData = FileUtils.readFileToString(dataFile, StandardCharsets.UTF_8.toString());
DATA = !jsonData.equals("") ? new Gson().fromJson(jsonData, Data.class) : new Data();
Runtime.getRuntime().addShutdownHook(new Thread(FileManager::saveData));
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
102 changes: 21 additions & 81 deletions src/main/java/com/rettichlp/unicacityaddon/base/models/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,97 +7,37 @@
import com.rettichlp.unicacityaddon.base.enums.faction.DrugType;
import com.rettichlp.unicacityaddon.base.enums.faction.Equip;
import joptsimple.internal.Strings;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import net.minecraft.util.math.BlockPos;

import java.util.Collections;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@NoArgsConstructor
@Getter
@Setter
public class Data {

private Integer bankBalance;
private String carInfo;
private Integer cashBalance;
private Map<DrugType, Map<DrugPurity, Integer>> drugInventoryMap;
private List<CoordlistEntry> coordlist;
private Map<Equip, Integer> equipMap;
private Long firstAidDate;
private Map<Integer, HouseData> houseDataMap;
private Integer jobBalance;
private Integer jobExperience;
private Integer payDayTime;
private Long plantFertilizeTime;
private Long plantWaterTime;
private Integer serviceCount;
private Integer timer;
private List<TodolistEntry> todolist;

public int getBankBalance() {
return bankBalance != null ? bankBalance : 0;
}

public String getCarInfo() {
return carInfo != null ? carInfo : Strings.EMPTY;
}

public int getCashBalance() {
return cashBalance != null ? cashBalance : 0;
}

public Map<DrugType, Map<DrugPurity, Integer>> getDrugInventoryMap() {
return drugInventoryMap != null ? drugInventoryMap : Collections.emptyMap();
}

public List<CoordlistEntry> getCoordlist() {
return coordlist != null ? coordlist : Collections.emptyList();
}

public Map<Equip, Integer> getEquipMap() {
return equipMap != null ? equipMap : Collections.emptyMap();
}

public long getFirstAidDate() {
return firstAidDate != null ? firstAidDate : 0;
}

public Map<Integer, HouseData> getHouseDataMap() {
return houseDataMap != null ? houseDataMap : Collections.emptyMap();
}

public int getJobBalance() {
return jobBalance != null ? jobBalance : 0;
}

public int getJobExperience() {
return jobExperience != null ? jobExperience : 0;
}

public int getPayDayTime() {
return payDayTime != null ? payDayTime : 0;
}

public long getPlantFertilizeTime() {
return plantFertilizeTime != null ? plantFertilizeTime : 0;
}

public long getPlantWaterTime() {
return plantWaterTime != null ? plantWaterTime : 0;
}

public int getServiceCount() {
return serviceCount != null ? serviceCount : 0;
}

public int getTimer() {
return timer != null ? timer : 0;
}

public List<TodolistEntry> getTodolist() {
return todolist != null ? todolist : Collections.emptyList();
}
private Integer bankBalance = 0;
private String carInfo = Strings.EMPTY;
private Integer cashBalance = 0;
private Map<DrugType, Map<DrugPurity, Integer>> drugInventoryMap = new HashMap<>();
private List<CoordlistEntry> coordlist = new ArrayList<>();
private Map<Equip, Integer> equipMap = new HashMap<>();
private Long firstAidDate = 0L;
private Map<Integer, HouseData> houseDataMap = new HashMap<>();
private Integer jobBalance = 0;
private Integer jobExperience = 0;
private Integer payDayTime = 0;
private Long plantFertilizeTime = 0L;
private Long plantWaterTime = 0L;
private Integer serviceCount = 0;
private Integer timer = 0;
private List<TodolistEntry> todolist = new ArrayList<>();

/**
* Adds the given value <code>i</code> to the <code>bankBalance</code>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "unicacityaddon",
"name": "UnicacityAddon",
"description": "This addon is a modification for UnicaCity providing specialized and nice-to-have features and utilities for everyday gameplay.",
"version": "1.8.2",
"version": "1.8.3",
"mcversion": "1.12.2",
"url": "",
"updateUrl": "",
Expand Down

0 comments on commit 1dedf32

Please sign in to comment.