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 #669 from UnicacityAddon/develop
Browse files Browse the repository at this point in the history
Release v1.10.3
  • Loading branch information
rettichlp authored Jun 16, 2023
2 parents 5c971a4 + 5fe7bb5 commit 7e1be9b
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 57 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.10.2`
Addon Version: `1.10.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.10.2'
version = '1.10.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 @@ -36,7 +36,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.10.2";
public static final String VERSION = "1.10.3";
public static final Minecraft MINECRAFT = Minecraft.getMinecraft();
public static UnicacityAddon ADDON;
public static final Logger LOGGER = LogManager.getLogger();
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/rettichlp/unicacityaddon/base/api/Syncer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.rettichlp.unicacityaddon.base.api.request.APIRequest;
import com.rettichlp.unicacityaddon.base.enums.api.AddonGroup;
import com.rettichlp.unicacityaddon.base.enums.faction.Faction;
import com.rettichlp.unicacityaddon.base.models.BlackMarketLocation;
import com.rettichlp.unicacityaddon.base.models.BlacklistReason;
import com.rettichlp.unicacityaddon.base.models.Broadcast;
import com.rettichlp.unicacityaddon.base.models.HouseBan;
Expand All @@ -30,6 +31,7 @@ public class Syncer {
public static final Map<String, Faction> PLAYERFACTIONMAP = new HashMap<>();
public static final Map<String, Integer> PLAYERRANKMAP = new HashMap<>();
public static List<BlacklistReason> BLACKLISTREASONLIST = new ArrayList<>();
public static List<BlackMarketLocation> BLACKMARKETLOCATIONLIST = new ArrayList<>();
public static List<HouseBan> HOUSEBANLIST = new ArrayList<>();
public static List<HouseBanReason> HOUSEBANREASONLIST = new ArrayList<>();
public static List<ManagementUser> MANAGEMENTUSERLIST = new ArrayList<>();
Expand Down Expand Up @@ -77,6 +79,11 @@ public static void syncAll() {
LabyMod.getInstance().notifyMessageRaw(ColorCode.AQUA.getCode() + "Synchronisierung", "Blacklist-Gründe aktualisiert.");
}).start();

new Thread(() -> {
if (!(BLACKMARKETLOCATIONLIST = getBlackMarketLocationList()).isEmpty())
LabyMod.getInstance().notifyMessageRaw(ColorCode.AQUA.getCode() + "Synchronisierung", "Schwarzmarkt-Orte aktualisiert.");
}).start();

new Thread(() -> {
if (!(WANTEDREASONLIST = getWantedReasonList()).isEmpty())
LabyMod.getInstance().notifyMessageRaw(ColorCode.AQUA.getCode() + "Synchronisierung", "Wanted-Gründe aktualisiert.");
Expand Down Expand Up @@ -139,6 +146,25 @@ public static List<BlacklistReason> getBlacklistReasonList() {
return blacklistReasonList;
}

public static List<BlackMarketLocation> getBlackMarketLocationList() {
List<BlackMarketLocation> blackMarketLocationList = new ArrayList<>();
try {
APIRequest.sendBlackMarketLocationRequest().forEach(jsonElement -> {
JsonObject o = jsonElement.getAsJsonObject();

String name = o.get("name").getAsString();
int x = o.get("x").getAsInt();
int y = o.get("y").getAsInt();
int z = o.get("z").getAsInt();

blackMarketLocationList.add(new BlackMarketLocation(name, x, y, z));
});
} catch (APIResponseException e) {
e.sendInfo();
}
return blackMarketLocationList;
}

public static List<Broadcast> getBroadcastList() {
List<Broadcast> broadcastList = new ArrayList<>();
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.rettichlp.unicacityaddon.base.api.checks;

import com.rettichlp.unicacityaddon.UnicacityAddon;
import com.rettichlp.unicacityaddon.base.abstraction.AbstractionLayer;
import com.rettichlp.unicacityaddon.base.abstraction.UPlayer;
import com.rettichlp.unicacityaddon.base.api.Syncer;
Expand Down Expand Up @@ -32,20 +33,22 @@ public static void checkForBroadcast() {
timer.schedule(new TimerTask() {
@Override
public void run() {
p.sendEmptyMessage();
p.sendEmptyMessage();

p.sendMessage(Message.getBuilder()
.of("BROADCAST BY ").color(ColorCode.DARK_AQUA).bold().advance().space()
.of(broadcast.getIssuerName().toUpperCase()).color(ColorCode.DARK_AQUA).bold().advance()
.createComponent());

p.sendMessage(Message.getBuilder()
.of(broadcast.getBroadcast()).color(ColorCode.AQUA).advance()
.createComponent());

p.sendEmptyMessage();
p.sendEmptyMessage();
if (!UnicacityAddon.isUnicacity()) {
p.sendEmptyMessage();
p.sendEmptyMessage();

p.sendMessage(Message.getBuilder()
.of("BROADCAST BY ").color(ColorCode.DARK_AQUA).bold().advance().space()
.of(broadcast.getIssuerName().toUpperCase()).color(ColorCode.DARK_AQUA).bold().advance()
.createComponent());

p.sendMessage(Message.getBuilder()
.of(broadcast.getBroadcast()).color(ColorCode.AQUA).advance()
.createComponent());

p.sendEmptyMessage();
p.sendEmptyMessage();
}
}
}, new Date(broadcast.getSendTime()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public static JsonObject sendBlacklistReasonRemoveRequest(String reason) throws
.getAsJsonObject();
}

public static JsonArray sendBlackMarketLocationRequest() throws APIResponseException {
return RequestBuilder.getBuilder()
.nonProd(NON_PROD)
.applicationPath(ApplicationPath.BLACKMARKETLOCATION)
.getAsJsonArray();
}

public static JsonArray sendBroadcastQueueRequest() throws APIResponseException {
return RequestBuilder.getBuilder()
.nonProd(NON_PROD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,18 @@ public static String getLockPickPrice() {
: "4500";
}

public static String getWinePrice() {
return UnicacityAddon.ADDON.getConfig().has("EQUIP_WINE_SETTING") && !UnicacityAddon.ADDON.getConfig().get("EQUIP_WINE_SETTING").getAsString().isEmpty() && !UnicacityAddon.ADDON.getConfig().get("EQUIP_WINE_SETTING").getAsString().startsWith("-")
? UnicacityAddon.ADDON.getConfig().get("EQUIP_WINE_SETTING").getAsString()
: "2";
}

public static String getCoffeePrice() {
return UnicacityAddon.ADDON.getConfig().has("EQUIP_COFFEE_SETTING") && !UnicacityAddon.ADDON.getConfig().get("EQUIP_COFFEE_SETTING").getAsString().isEmpty() && !UnicacityAddon.ADDON.getConfig().get("EQUIP_COFFEE_SETTING").getAsString().startsWith("-")
? UnicacityAddon.ADDON.getConfig().get("EQUIP_COFFEE_SETTING").getAsString()
: "2";
}

public static boolean getRemoveResourcePackMessage() {
return !UnicacityAddon.ADDON.getConfig().has("REMOVE_RESOURCEPACK_MESSAGE_SETTINGS") || UnicacityAddon.ADDON.getConfig().get("REMOVE_RESOURCEPACK_MESSAGE_SETTINGS")
.getAsBoolean(); // default = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ static Settings getChurchEquipSettings(UnicacityAddon unicacityAddon) {
StringElement waterSettings = new StringElement(Equip.WATER.getName(), unicacityAddon, new ControlElement.IconData(Material.GLASS_BOTTLE), "EQUIP_WATER_SETTING", ConfigElements.getWaterPrice());
settings.add(waterSettings);

StringElement wineSettings = new StringElement(Equip.WINE.getName(), unicacityAddon, new ControlElement.IconData(Material.POTION), "EQUIP_WINE_SETTING", ConfigElements.getWinePrice());
settings.add(wineSettings);

return settings;
}

Expand All @@ -220,6 +223,9 @@ static Settings getNewsEquipSettings(UnicacityAddon unicacityAddon) {
StringElement notepadSettings = new StringElement(Equip.NOTEPAD.getName(), unicacityAddon, new ControlElement.IconData(Material.BOOK_AND_QUILL), "EQUIP_NOTEPAD_SETTING", ConfigElements.getNotePadPrice());
settings.add(notepadSettings);

StringElement coffeeSettings = new StringElement(Equip.COFFEE.getName(), unicacityAddon, new ControlElement.IconData(Material.POTION), "EQUIP_COFFEE_SETTING", ConfigElements.getCoffeePrice());
settings.add(coffeeSettings);

return settings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public enum ApplicationPath {

BANNER("/banner"),
BLACKLISTREASON("/blacklistreason"),
BLACKMARKETLOCATION("/blackmarket"),
BROADCAST("/broadcast"),
EVENT("/event"),
HOUSEBAN("/houseban"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public enum Equip {
RPG7("RPG-7", "RPG-7", ConfigElements.getRPG7Price()),
NOTEPAD("Notizblock", "Notizblock", ConfigElements.getNotePadPrice()), // UnicaCity Bug (Nachricht gibt es noch nicht)
GLASSCUTTER("Glasschneider", "Glasschneider", ConfigElements.getGlassCutterPrice()), // TODO: Equipname
LOCKPICK("Dietrich", "Dietrich", ConfigElements.getLockPickPrice()); // TODO: Equipname
LOCKPICK("Dietrich", "Dietrich", ConfigElements.getLockPickPrice()), // TODO: Equipname
WINE("Wein", "Wein", ConfigElements.getWinePrice()),
COFFEE("Kaffee", "Kaffee", ConfigElements.getCoffeePrice()); // TODO: Equipname

private final String equipName;
private final String messageName;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.rettichlp.unicacityaddon.base.models;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public class BlackMarketLocation {

private final String name;
private final int x;
private final int y;
private final int z;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* @author RettichLP
*/
@UCCommand
@Deprecated // deactivated
public class TopListCommand implements IClientCommand {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.rettichlp.unicacityaddon.commands.faction.badfaction;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.rettichlp.unicacityaddon.base.abstraction.AbstractionLayer;
import com.rettichlp.unicacityaddon.base.abstraction.UPlayer;
import com.rettichlp.unicacityaddon.base.api.Syncer;
import com.rettichlp.unicacityaddon.base.builder.TabCompletionBuilder;
import com.rettichlp.unicacityaddon.base.registry.annotation.UCCommand;
import com.rettichlp.unicacityaddon.base.text.ColorCode;
Expand All @@ -20,7 +19,6 @@
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.Map;


/**
Expand Down Expand Up @@ -72,35 +70,19 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen
.of("Positionen aller möglichen Schwarzmärkte").color(ColorCode.GRAY).advance()
.sendTo(p.getPlayer());

for (Map.Entry<String, String> blackMarket : BLACK_MARKET_LIST) {
String coords = blackMarket.getValue();

Syncer.getBlackMarketLocationList().forEach(blackMarketLocation -> {
String naviCommand = "/navi " + blackMarketLocation.getX() + "/" + blackMarketLocation.getY() + "/" + blackMarketLocation.getZ();
p.sendMessage(Message.getBuilder()
.of("» ").color(ColorCode.DARK_GRAY).advance()
.of(blackMarket.getKey()).color(ColorCode.GRAY).advance().space()
.of(blackMarketLocation.getName()).color(ColorCode.GRAY).advance().space()
.of("-").color(ColorCode.DARK_GRAY).advance().space()
.of("Route anzeigen").color(ColorCode.RED).bold()
.clickEvent(ClickEvent.Action.RUN_COMMAND, "/navi " + coords)
.hoverEvent(HoverEvent.Action.SHOW_TEXT, Message.getBuilder().of(coords).color(ColorCode.GRAY).advance().createComponent())
.hoverEvent(HoverEvent.Action.SHOW_TEXT, Message.getBuilder().of("Route anzeigen").color(ColorCode.RED).advance().createComponent())
.clickEvent(ClickEvent.Action.RUN_COMMAND, naviCommand)
.advance().createComponent());

}
});
}

private static final List<Map.Entry<String, String>> BLACK_MARKET_LIST = Lists.newArrayList(
Maps.immutableEntry("Psychiatrie", "1689/66/-390"),
Maps.immutableEntry("Hafen (Chinatown)", "1172/69/-464"),
Maps.immutableEntry("Haus 472 (Chinatown)", "1205/69/-118"),
Maps.immutableEntry("Mex U-Bahn", "-92/52/-33"),
Maps.immutableEntry("Kino (Ruine)", "743/69/315"),
Maps.immutableEntry("Fußballplatz (Gang)", "-468/69/425"),
Maps.immutableEntry("SH Park (Höhle)", "64/67/347"),
Maps.immutableEntry("Alcatraz", "1154/83/695"),
Maps.immutableEntry("Flughafen Las Unicas", "1694/69/557"),
Maps.immutableEntry("Shishabar", "-136/74/-74"),
Maps.immutableEntry("Freibad", "-269/69/-521")
);

@Override
public boolean allowUsageWithoutPrefix(ICommandSender sender, String message) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.rettichlp.unicacityaddon.base.text.ColorCode;
import com.rettichlp.unicacityaddon.base.text.Message;
import com.rettichlp.unicacityaddon.base.text.PatternHandler;
import com.rettichlp.unicacityaddon.base.utils.MathUtils;
import com.rettichlp.unicacityaddon.base.utils.UpdateUtils;
import com.rettichlp.unicacityaddon.commands.MaskInfoCommand;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
Expand Down Expand Up @@ -97,7 +96,6 @@ public void run() {
JsonObject gameplayJsonObject = APIRequest.sendStatisticRequest().getAsJsonObject("gameplay");
int deaths = gameplayJsonObject.get("deaths").getAsInt();
int kills = gameplayJsonObject.get("kills").getAsInt();
float kd = gameplayJsonObject.get("kd").getAsFloat();
int playTime = gameplayJsonObject.get("playTime").getAsInt();

p.sendMessage(Message.getBuilder()
Expand All @@ -116,14 +114,6 @@ public void run() {
.of(kills + " Kills").color(ColorCode.RED).advance()
.createComponent());

p.sendMessage(Message.getBuilder()
.space().space()
.of("-").color(ColorCode.DARK_GRAY).advance().space()
.of("K/D").color(ColorCode.GOLD).advance()
.of(":").color(ColorCode.DARK_GRAY).advance().space()
.of(MathUtils.DECIMAL_FORMAT.format(kd)).color(ColorCode.RED).advance()
.createComponent());

p.sendMessage(Message.getBuilder()
.space().space()
.of("-").color(ColorCode.DARK_GRAY).advance().space()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public void onTick(TickEvent.ClientTickEvent event) {

// 30 SECONDS
if (currentTick % 600 == 0) {
BroadcastChecker.checkForBroadcast();
if (!UnicacityAddon.isUnicacity()) {
BroadcastChecker.checkForBroadcast();
}
GangwarEventHandler.sendData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* @author RettichLP
*/
@UCEvent
@Deprecated // deactivated
public class FireEventHandler {

/**
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.10.2",
"version": "1.10.3",
"mcversion": "1.12.2",
"url": "",
"updateUrl": "",
Expand Down

0 comments on commit 7e1be9b

Please sign in to comment.