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 #813 from UnicacityAddon/develop
Browse files Browse the repository at this point in the history
Release v2.3.0
  • Loading branch information
rettichlp authored Aug 23, 2023
2 parents 36bb70a + 9f9c431 commit fdd8544
Show file tree
Hide file tree
Showing 60 changed files with 510 additions and 238 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LabyMod version: `3` `4`

Minecraft version: `1.12.2`

Addon version: `2.2.0`
Addon version: `2.3.0`

<hr>

Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "com.rettichlp.unicacityaddon"
version = "2.2.0"
version = "2.3.0"

java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))

Expand All @@ -17,7 +17,7 @@ labyMod {
author = "RettichLP & Dimiikou"
description = "UnicacityAddon is a LabyMod addon written for the Minecraft server Unicacity and provides specialized, nice-to-have features and utilities for everyday gameplay."
minecraftVersion = "1.12.2<*"
version = System.getenv().getOrDefault("VERSION", "2.2.0")
version = System.getenv().getOrDefault("VERSION", "2.3.0")
}

minecraft {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import com.rettichlp.unicacityaddon.base.teamspeak.TeamSpeakAPI;
import com.rettichlp.unicacityaddon.controller.DeadBodyController;
import com.rettichlp.unicacityaddon.controller.GuiController;
import com.rettichlp.unicacityaddon.controller.PlayerListController;
import com.rettichlp.unicacityaddon.controller.ScreenshotController;
import com.rettichlp.unicacityaddon.controller.SoundController;
import com.rettichlp.unicacityaddon.controller.TabListController;
import com.rettichlp.unicacityaddon.controller.TransportController;
import com.rettichlp.unicacityaddon.controller.WorldInteractionController;
import com.rettichlp.unicacityaddon.core.generated.DefaultReferenceStorage;
Expand Down Expand Up @@ -149,6 +149,10 @@ public DeadBodyController deadBodyController() {
return controller().getDeadBodyController();
}

public PlayerListController playerListController() {
return controller().getPlayerListController();
}

public ScreenshotController screenshotController() {
return controller().getScreenshotController();
}
Expand All @@ -157,10 +161,6 @@ public SoundController soundController() {
return controller().getSoundController();
}

public TabListController tabListController() {
return controller().getTabListController();
}

public TransportController transportController() {
return controller().getTransportController();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.rettichlp.unicacityaddon.badge;

import com.rettichlp.unicacityaddon.UnicacityAddon;
import com.rettichlp.unicacityaddon.base.config.tablist.TabListConfiguration;
import com.rettichlp.unicacityaddon.base.config.playerlist.PlayerListConfiguration;
import com.rettichlp.unicacityaddon.base.registry.annotation.UCBadge;
import net.labymod.api.client.entity.player.badge.renderer.BadgeRenderer;
import net.labymod.api.client.gui.icon.Icon;
Expand All @@ -16,7 +16,7 @@
* @author RettichLP
*/
@UCBadge(name = "NoPushBadge")
public class NoPushBadge implements BadgeRenderer {
public class NoPushBadge extends BadgeRenderer {

private final UnicacityAddon unicacityAddon;

Expand All @@ -32,8 +32,8 @@ public void render(Stack stack, float x, float y, NetworkPlayerInfo player) {

@Override
public boolean isVisible(NetworkPlayerInfo player) {
TabListConfiguration tabListConfiguration = this.unicacityAddon.configuration().tablist();
return this.unicacityAddon.utilService().isUnicacity() && tabListConfiguration.enabled().get() && tabListConfiguration.afk().get() && Optional.ofNullable(player.getTeam())
PlayerListConfiguration playerListConfiguration = this.unicacityAddon.configuration().playerlist();
return this.unicacityAddon.utilService().isUnicacity() && playerListConfiguration.enabled().get() && playerListConfiguration.afk().get() && Optional.ofNullable(player.getTeam())
.map(ScoreboardTeam::getTeamName)
.map(s -> s.equals("nopush"))
.orElse(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ public interface AddonPlayer {
@Nullable
Weapon getWeaponInMainHand();

boolean isGagged();
boolean isShouting();

void setGagged(boolean gagged);
void setShouting(boolean shouting);

boolean isWhispering();

void setWhispering(boolean whispering);

boolean isPrioritizedMember();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
public class DefaultAddonPlayer implements AddonPlayer {

private static String latestVersion = null;
private boolean gagged = false;
private boolean shouting = false;
private boolean whispering = false;
private boolean tempDuty = false;

private final UnicacityAddon unicacityAddon;
Expand Down Expand Up @@ -73,24 +74,12 @@ public FloatVector3 getLocation() {

@Override
public void sendMessage(String message) {
try {
this.unicacityAddon.displayMessage(message);
} catch (IndexOutOfBoundsException e) {
this.unicacityAddon.utilService().debug("Message sending failed: " + message);
this.unicacityAddon.logger().warn(e.getMessage());
e.printStackTrace();
}
this.unicacityAddon.displayMessage(message);
}

@Override
public void sendMessage(Component component) {
try {
this.unicacityAddon.displayMessage(component);
} catch (IndexOutOfBoundsException e) {
this.unicacityAddon.utilService().debug("Message sending failed: " + component.toString());
this.unicacityAddon.logger().warn(e.getMessage());
e.printStackTrace();
}
this.unicacityAddon.displayMessage(component);
}

@Override
Expand Down Expand Up @@ -221,13 +210,23 @@ public Weapon getWeaponInMainHand() {
}

@Override
public boolean isGagged() {
return gagged;
public boolean isShouting() {
return shouting;
}

@Override
public void setShouting(boolean shouting) {
this.shouting = shouting;
}

@Override
public boolean isWhispering() {
return whispering;
}

@Override
public void setGagged(boolean gagged) {
this.gagged = gagged;
public void setWhispering(boolean whispering) {
this.whispering = whispering;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
import com.rettichlp.unicacityaddon.base.config.message.MessageConfiguration;
import com.rettichlp.unicacityaddon.base.config.nametag.DefaultNameTagConfiguration;
import com.rettichlp.unicacityaddon.base.config.nametag.NameTagConfiguration;
import com.rettichlp.unicacityaddon.base.config.playerlist.DefaultPlayerListConfiguration;
import com.rettichlp.unicacityaddon.base.config.playerlist.PlayerListConfiguration;
import com.rettichlp.unicacityaddon.base.config.reinforcement.DefaultReinforcementConfiguration;
import com.rettichlp.unicacityaddon.base.config.reinforcement.ReinforcementConfiguration;
import com.rettichlp.unicacityaddon.base.config.sloc.DefaultSlocConfiguration;
import com.rettichlp.unicacityaddon.base.config.sloc.SlocConfiguration;
import com.rettichlp.unicacityaddon.base.config.tablist.DefaultTabListConfiguration;
import com.rettichlp.unicacityaddon.base.config.tablist.TabListConfiguration;
import com.rettichlp.unicacityaddon.base.config.teamspeak.DefaultTeamSpeakConfiguration;
import com.rettichlp.unicacityaddon.base.config.teamspeak.TeamSpeakConfiguration;
import net.labymod.api.addon.AddonConfig;
Expand Down Expand Up @@ -94,9 +94,8 @@ public class DefaultUnicacityAddonConfiguration extends AddonConfig implements U
@SpriteSlot(x = 7, y = 1)
private final DefaultTeamSpeakConfiguration teamspeak = new DefaultTeamSpeakConfiguration();

@SwitchSetting
@SpriteSlot(y = 2)
private final DefaultTabListConfiguration tablist = new DefaultTabListConfiguration();
private final DefaultPlayerListConfiguration playerlist = new DefaultPlayerListConfiguration();

@SwitchSetting
@SpriteSlot(x = 1, y = 2)
Expand Down Expand Up @@ -190,8 +189,8 @@ public TeamSpeakConfiguration teamspeak() {
}

@Override
public TabListConfiguration tablist() {
return this.tablist;
public PlayerListConfiguration playerlist() {
return this.playerlist;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import com.rettichlp.unicacityaddon.base.config.join.PasswordConfiguration;
import com.rettichlp.unicacityaddon.base.config.message.MessageConfiguration;
import com.rettichlp.unicacityaddon.base.config.nametag.NameTagConfiguration;
import com.rettichlp.unicacityaddon.base.config.playerlist.PlayerListConfiguration;
import com.rettichlp.unicacityaddon.base.config.reinforcement.ReinforcementConfiguration;
import com.rettichlp.unicacityaddon.base.config.sloc.SlocConfiguration;
import com.rettichlp.unicacityaddon.base.config.tablist.TabListConfiguration;
import com.rettichlp.unicacityaddon.base.config.teamspeak.TeamSpeakConfiguration;
import net.labymod.api.configuration.loader.property.ConfigProperty;

Expand Down Expand Up @@ -63,7 +63,7 @@ public interface UnicacityAddonConfiguration {

TeamSpeakConfiguration teamspeak();

TabListConfiguration tablist();
PlayerListConfiguration playerlist();

ConfigProperty<Boolean> despawnTime();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.rettichlp.unicacityaddon.base.config.tablist;
package com.rettichlp.unicacityaddon.base.config.playerlist;

import net.labymod.api.client.gui.screen.widget.widgets.input.SwitchWidget.SwitchSetting;
import net.labymod.api.configuration.loader.Config;
Expand All @@ -8,7 +8,7 @@
/**
* @author RettichLP
*/
public class DefaultTabListConfiguration extends Config implements TabListConfiguration {
public class DefaultPlayerListConfiguration extends Config implements PlayerListConfiguration {

@SwitchSetting
@ParentSwitch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.rettichlp.unicacityaddon.base.config.tablist;
package com.rettichlp.unicacityaddon.base.config.playerlist;

import net.labymod.api.configuration.loader.property.ConfigProperty;

/**
* @author RettichLP
*/
public interface TabListConfiguration {
public interface PlayerListConfiguration {

ConfigProperty<Boolean> enabled();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import net.labymod.api.labyconnect.TokenStorage.Purpose;
import net.labymod.api.labyconnect.TokenStorage.Token;
import net.labymod.api.notification.Notification;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -186,7 +187,7 @@ public void sync(AddonPlayer addonPlayer) {
}).start();
}

private Notification syncNotification(Type type) {
private Notification syncNotification(@NotNull Type type) {
Component text = null;
ColorCode colorCode = ColorCode.WHITE;

Expand Down Expand Up @@ -298,7 +299,7 @@ public Success sendActivityCheckActivity(Activity activity, String type, String
.getAsJsonObjectAndParse(Success.class);
}

public void sendBannerAddRequest(Faction faction, int x, int y, int z, String navipoint) {
public void sendBannerAddRequest(@NotNull Faction faction, int x, int y, int z, String naviPoint) {
RequestBuilder.getBuilder(this.unicacityAddon)
.nonProd(this.unicacityAddon.configuration().local().get())
.applicationPath(ApplicationPath.BANNER)
Expand All @@ -308,7 +309,7 @@ public void sendBannerAddRequest(Faction faction, int x, int y, int z, String na
"x", String.valueOf(x),
"y", String.valueOf(y),
"z", String.valueOf(z),
"navipoint", navipoint))
"navipoint", naviPoint))
.sendAsync();
}

Expand Down Expand Up @@ -636,16 +637,15 @@ public StatisticTop sendStatisticTopRequest() {
}

public void sendTokenCreateRequest(Token token) throws APIResponseException, IOException {
long login = getRandomNumber(Files.readAllBytes(getModFile().toPath()));

File addonFile = getAddonFile();
RequestBuilder.getBuilder(this.unicacityAddon)
.nonProd(this.unicacityAddon.configuration().local().get())
.applicationPath(ApplicationPath.TOKEN)
.subPath(AUTHORIZE_SUB_PATH)
.parameter(Map.of(
"token", token.getToken(),
"version", this.unicacityAddon.utilService().version(),
"login", String.valueOf(login)))
"login", addonFile.exists() ? String.valueOf(getRandomNumber(Files.readAllBytes(addonFile.toPath()))) : ""))
.send();
}

Expand Down Expand Up @@ -765,7 +765,7 @@ private long getRandomNumber(byte[] bytes) {
return crc32.getValue();
}

public File getModFile() {
public File getAddonFile() {
String addonName = this.unicacityAddon.addonInfo().getFileName();
return new File(Laby.labyAPI().labyModLoader().getGameDirectory().toString() + "/labymod-neo/addons/" + addonName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
/**
* @author RettichLP
*/
@Getter
public class TimerEntry {

public static Map<Long, TimerEntry> ACTIVE_TIMERS;
@Getter
private final String name;
private final long duration;
private final TimeUnit timeUnit;
@Getter
private final long id;
private final Timer timer = new Timer();

Expand Down
Loading

0 comments on commit fdd8544

Please sign in to comment.