diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index 08d8cdcfd..017256e67 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -15,7 +15,7 @@ LabyMod version: `3` `4` Minecraft version: `1.12.2` -Addon version: `2.2.0` +Addon version: `2.3.0`
diff --git a/build.gradle.kts b/build.gradle.kts index fb4ed3326..fba756dd0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "com.rettichlp.unicacityaddon" -version = "2.2.0" +version = "2.3.0" java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) @@ -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 { diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/UnicacityAddon.java b/core/src/main/java/com/rettichlp/unicacityaddon/UnicacityAddon.java index b4596e0b8..7b7ca99e8 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/UnicacityAddon.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/UnicacityAddon.java @@ -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; @@ -149,6 +149,10 @@ public DeadBodyController deadBodyController() { return controller().getDeadBodyController(); } + public PlayerListController playerListController() { + return controller().getPlayerListController(); + } + public ScreenshotController screenshotController() { return controller().getScreenshotController(); } @@ -157,10 +161,6 @@ public SoundController soundController() { return controller().getSoundController(); } - public TabListController tabListController() { - return controller().getTabListController(); - } - public TransportController transportController() { return controller().getTransportController(); } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/badge/NoPushBadge.java b/core/src/main/java/com/rettichlp/unicacityaddon/badge/NoPushBadge.java index e4892d85e..f664853fe 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/badge/NoPushBadge.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/badge/NoPushBadge.java @@ -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; @@ -16,7 +16,7 @@ * @author RettichLP */ @UCBadge(name = "NoPushBadge") -public class NoPushBadge implements BadgeRenderer { +public class NoPushBadge extends BadgeRenderer { private final UnicacityAddon unicacityAddon; @@ -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); diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/AddonPlayer.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/AddonPlayer.java index acd227ae3..e8db1b6fb 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/AddonPlayer.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/AddonPlayer.java @@ -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(); } \ No newline at end of file diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/DefaultAddonPlayer.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/DefaultAddonPlayer.java index 830eeec03..6fd077ac1 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/DefaultAddonPlayer.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/DefaultAddonPlayer.java @@ -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; @@ -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 @@ -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 diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/config/DefaultUnicacityAddonConfiguration.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/config/DefaultUnicacityAddonConfiguration.java index 8ed56bcd4..663d4aa03 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/config/DefaultUnicacityAddonConfiguration.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/config/DefaultUnicacityAddonConfiguration.java @@ -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; @@ -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) @@ -190,8 +189,8 @@ public TeamSpeakConfiguration teamspeak() { } @Override - public TabListConfiguration tablist() { - return this.tablist; + public PlayerListConfiguration playerlist() { + return this.playerlist; } @Override diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/config/UnicacityAddonConfiguration.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/config/UnicacityAddonConfiguration.java index d5eee2074..d74164c82 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/config/UnicacityAddonConfiguration.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/config/UnicacityAddonConfiguration.java @@ -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; @@ -63,7 +63,7 @@ public interface UnicacityAddonConfiguration { TeamSpeakConfiguration teamspeak(); - TabListConfiguration tablist(); + PlayerListConfiguration playerlist(); ConfigProperty despawnTime(); diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/config/tablist/DefaultTabListConfiguration.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/config/playerlist/DefaultPlayerListConfiguration.java similarity index 85% rename from core/src/main/java/com/rettichlp/unicacityaddon/base/config/tablist/DefaultTabListConfiguration.java rename to core/src/main/java/com/rettichlp/unicacityaddon/base/config/playerlist/DefaultPlayerListConfiguration.java index b56d42937..e1b71a2db 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/config/tablist/DefaultTabListConfiguration.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/config/playerlist/DefaultPlayerListConfiguration.java @@ -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; @@ -8,7 +8,7 @@ /** * @author RettichLP */ -public class DefaultTabListConfiguration extends Config implements TabListConfiguration { +public class DefaultPlayerListConfiguration extends Config implements PlayerListConfiguration { @SwitchSetting @ParentSwitch diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/config/tablist/TabListConfiguration.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/config/playerlist/PlayerListConfiguration.java similarity index 67% rename from core/src/main/java/com/rettichlp/unicacityaddon/base/config/tablist/TabListConfiguration.java rename to core/src/main/java/com/rettichlp/unicacityaddon/base/config/playerlist/PlayerListConfiguration.java index 244df2dc4..95c4305f1 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/config/tablist/TabListConfiguration.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/config/playerlist/PlayerListConfiguration.java @@ -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 enabled(); diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/io/api/API.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/io/api/API.java index 933cb5502..3cd2b8e70 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/io/api/API.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/io/api/API.java @@ -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; @@ -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; @@ -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) @@ -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(); } @@ -636,8 +637,7 @@ 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) @@ -645,7 +645,7 @@ public void sendTokenCreateRequest(Token token) throws APIResponseException, IOE .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(); } @@ -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); } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/io/file/TimerEntry.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/io/file/TimerEntry.java index b9d37ece5..672243272 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/io/file/TimerEntry.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/io/file/TimerEntry.java @@ -14,14 +14,13 @@ /** * @author RettichLP */ +@Getter public class TimerEntry { public static Map 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(); diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/registry/Registry.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/registry/Registry.java index 4cae59079..3a9a35de6 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/registry/Registry.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/registry/Registry.java @@ -63,11 +63,12 @@ import com.rettichlp.unicacityaddon.commands.faction.badfaction.ASetBlacklistCommand; import com.rettichlp.unicacityaddon.commands.faction.badfaction.BlackMarketCommand; import com.rettichlp.unicacityaddon.commands.faction.badfaction.BlacklistInfoCommand; -import com.rettichlp.unicacityaddon.commands.faction.badfaction.GaggedCommand; import com.rettichlp.unicacityaddon.commands.faction.badfaction.ModifyBlacklistCommand; import com.rettichlp.unicacityaddon.commands.faction.badfaction.OwnUseCommand; import com.rettichlp.unicacityaddon.commands.faction.badfaction.OwnUseGiftCommand; import com.rettichlp.unicacityaddon.commands.faction.badfaction.SellDrugCommand; +import com.rettichlp.unicacityaddon.commands.faction.badfaction.ToggleShoutCommand; +import com.rettichlp.unicacityaddon.commands.faction.badfaction.ToggleWhisperCommand; import com.rettichlp.unicacityaddon.commands.faction.chat.DForceCommand; import com.rettichlp.unicacityaddon.commands.faction.chat.FForceCommand; import com.rettichlp.unicacityaddon.commands.faction.chat.SFForceCommand; @@ -142,8 +143,8 @@ import com.rettichlp.unicacityaddon.listener.faction.ReinforcementListener; import com.rettichlp.unicacityaddon.listener.faction.ShareLocationListener; import com.rettichlp.unicacityaddon.listener.faction.badfaction.BannerListener; -import com.rettichlp.unicacityaddon.listener.faction.badfaction.GaggedListener; import com.rettichlp.unicacityaddon.listener.faction.badfaction.PlantListener; +import com.rettichlp.unicacityaddon.listener.faction.badfaction.PronunciationListener; import com.rettichlp.unicacityaddon.listener.faction.badfaction.blacklist.BlacklistListener; import com.rettichlp.unicacityaddon.listener.faction.badfaction.blacklist.BlacklistModifyListener; import com.rettichlp.unicacityaddon.listener.faction.kirche.PrayListener; @@ -246,7 +247,6 @@ public class Registry { FDoorListener.class, FishermanListener.class, FirstAidListener.class, - GaggedListener.class, GangwarListener.class, HouseDataListener.class, HouseInteractionListener.class, @@ -265,6 +265,7 @@ public class Registry { // NewbieChatListener.class, deactivated because Unicacity guidelines PlantListener.class, PrayListener.class, + PronunciationListener.class, ReinforcementListener.class, ReportListener.class, ReviveListener.class, @@ -320,7 +321,6 @@ public class Registry { ExplosiveBeltCommand.class, FForceCommand.class, FactionBankDepositCommand.class, - GaggedCommand.class, GetGunPatternCommand.class, HouseBankCommand.class, HouseBankDropGetAllCommand.class, @@ -370,6 +370,8 @@ public class Registry { TSJoinCommand.class, TimerCommand.class, TodoListCommand.class, + ToggleShoutCommand.class, + ToggleWhisperCommand.class, TokenCommand.class, TopListCommand.class, WantedReasonCommand.class, @@ -401,7 +403,7 @@ public void registerBadges() { } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | InstantiationException e) { this.unicacityAddon.logger().warn("Can't register Badge: {}", badgeClass.getSimpleName()); - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } }); this.unicacityAddon.logger().info("Registered {}/{} Badges", registeredBadgeCount, badgeClassSet.size()); @@ -427,7 +429,7 @@ public void registerTags() { } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | InstantiationException e) { this.unicacityAddon.logger().warn("Can't register NameTag: {}", nameTagClass.getSimpleName()); - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } }); this.unicacityAddon.logger().info("Registered {}/{} NameTags", registeredNameTagCount, nameTagClassSet.size()); @@ -450,7 +452,7 @@ public void registerHudWidgets() { } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | InstantiationException e) { this.unicacityAddon.logger().warn("Can't register HudWidget: {}", hudWidgetClass.getSimpleName()); - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } }); this.unicacityAddon.logger().info("Registered {}/{} HudWidgets", registeredHudWidgetCount, hudWidgetClassSet.size()); @@ -472,7 +474,7 @@ public void registerListeners() { } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | InstantiationException e) { this.unicacityAddon.logger().warn("Can't register Listener: {}", listenerClass.getSimpleName()); - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } }); this.unicacityAddon.logger().info("Registered {}/{} Listeners", registeredListenerCount, listenerClassSet.size()); @@ -501,7 +503,7 @@ public void registerCommands() { } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | InstantiationException e) { this.unicacityAddon.logger().warn("Can't register Command: {}", commandClass.getSimpleName()); - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } } }); diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/services/UtilService.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/services/UtilService.java index 21001b00c..58d2f9294 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/services/UtilService.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/services/UtilService.java @@ -52,7 +52,7 @@ public UtilService(UnicacityAddon unicacityAddon) { @SuppressWarnings("SameReturnValue") public String version() { - return "2.2.0"; + return "2.3.0"; } public boolean isUnicacity() { @@ -97,7 +97,7 @@ public Set> getAllClassesFromPackage(String packageName) { .map(ClassPath.ClassInfo::load) .collect(Collectors.toSet()); } catch (IOException exception) { - exception.printStackTrace(); + this.unicacityAddon.logger().error(exception.getMessage()); } return new HashSet<>(); } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/services/WebService.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/services/WebService.java index 1e743f126..d9c030b93 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/services/WebService.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/services/WebService.java @@ -67,7 +67,7 @@ public String getParamsString(Map params) { result.append("&"); } String resultString = result.toString(); - return resultString.length() > 0 + return !resultString.isEmpty() ? "?" + resultString.substring(0, resultString.length() - 1) : resultString; } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/TeamSpeakAPI.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/TeamSpeakAPI.java index 348575aeb..c2c5a3f1e 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/TeamSpeakAPI.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/TeamSpeakAPI.java @@ -62,6 +62,7 @@ public class TeamSpeakAPI { private Socket socket; private PrintWriter outputStream; + @Getter private boolean connected; @Getter @@ -117,7 +118,7 @@ public void initialize() { this.reconnectController.start(); return; } catch (IOException e) { - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } new Thread(() -> { @@ -130,7 +131,7 @@ public void initialize() { try { this.socket.close(); } catch (IOException e) { - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } this.unicacityAddon.logger().warn("3Connection to TeamSpeak client lost."); this.reconnectController.start(); @@ -141,7 +142,7 @@ public void initialize() { try { Thread.sleep(5000L); } catch (InterruptedException e) { - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } } @@ -151,7 +152,7 @@ public void initialize() { try { this.socket.close(); } catch (IOException e) { - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } this.unicacityAddon.logger().warn("1Connection to TeamSpeak client lost."); this.reconnectController.start(); @@ -185,7 +186,7 @@ public void initialize() { Thread.sleep(100L); } catch (Exception e) { - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } } @@ -195,7 +196,7 @@ public void initialize() { try { this.socket.close(); } catch (IOException e) { - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } this.unicacityAddon.logger().warn("2Connection to TeamSpeak client lost."); @@ -249,10 +250,6 @@ private void messageReceived(String line) { } } - public boolean isConnected() { - return this.connected; - } - public void clientNotifyRegister(int id) { //this.outputStream.println("clientnotifyregister schandlerid=" + id + " event=any"); for (Listener listener : this.listeners) { diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/TeamSpeakAuthenticator.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/TeamSpeakAuthenticator.java index cf7fa1291..7a54e82f8 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/TeamSpeakAuthenticator.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/TeamSpeakAuthenticator.java @@ -37,10 +37,12 @@ */ public class TeamSpeakAuthenticator { + private final UnicacityAddon unicacityAddon; private final TeamSpeakAPI teamSpeakAPI; private final List possibleDirectories; public TeamSpeakAuthenticator(UnicacityAddon unicacityAddon, TeamSpeakAPI teamSpeakAPI) { + this.unicacityAddon = unicacityAddon; this.teamSpeakAPI = teamSpeakAPI; this.possibleDirectories = new ArrayList<>(); @@ -52,7 +54,7 @@ public TeamSpeakAuthenticator(UnicacityAddon unicacityAddon, TeamSpeakAPI teamSp } else if (platform == OperatingSystem.LINUX) { this.loadLinuxDirectories(); } else { - unicacityAddon.logger().warn("Cannot automatically resolve the Auth Key on " + platform + "!"); + this.unicacityAddon.logger().warn("Cannot automatically resolve the Auth Key on " + platform + "!"); } } @@ -76,7 +78,7 @@ public void authenticate() { this.teamSpeakAPI.authenticate(apiKey); } } catch (IOException e) { - e.printStackTrace(); + this.unicacityAddon.logger().error(e.getMessage()); } } } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/listener/Listener.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/listener/Listener.java index ceb1358bd..c1db315fd 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/listener/Listener.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/listener/Listener.java @@ -18,6 +18,7 @@ import com.rettichlp.unicacityaddon.base.teamspeak.TeamSpeakAPI; import com.rettichlp.unicacityaddon.base.teamspeak.util.ArgumentParser; +import lombok.Getter; /** * This code was modified. The original code is available at: https://github.com/labymod-addons/teamspeak. @@ -29,6 +30,7 @@ */ public abstract class Listener { + @Getter private final String identifier; private boolean register = true; @@ -46,10 +48,6 @@ protected T get(String argument, String identifier, Class clazz) { return ArgumentParser.parse(argument, identifier, clazz); } - public String getIdentifier() { - return this.identifier; - } - public boolean needsToBeRegistered() { return this.register; } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/util/Request.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/util/Request.java index 15ed02088..427b58132 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/util/Request.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/teamspeak/util/Request.java @@ -16,6 +16,8 @@ package com.rettichlp.unicacityaddon.base.teamspeak.util; +import lombok.Getter; + import java.util.function.Consumer; import java.util.function.Predicate; @@ -29,6 +31,7 @@ */ public class Request { + @Getter private final String query; private final Predicate responsePredicate; @@ -78,10 +81,6 @@ public boolean handle(String firstArgument, String response) { return false; } - public String getQuery() { - return this.query; - } - public boolean isFinished() { return this.remainingAnswers <= 0; } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/text/Message.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/text/Message.java index 7cbeb266b..38ad59b37 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/text/Message.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/text/Message.java @@ -1,5 +1,6 @@ package com.rettichlp.unicacityaddon.base.text; +import lombok.Getter; import net.labymod.api.client.component.Component; import net.labymod.api.client.component.format.Style; import net.labymod.api.client.component.format.TextDecoration; @@ -14,16 +15,13 @@ */ public class Message { + @Getter private final List messageParts; private Message(Builder builder) { this.messageParts = builder.messageParts; } - public List getMessageParts() { - return messageParts; - } - public static Builder getBuilder() { return new Builder(); } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/base/text/MessagePart.java b/core/src/main/java/com/rettichlp/unicacityaddon/base/text/MessagePart.java index 812c85cc9..cfb44d44c 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/base/text/MessagePart.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/base/text/MessagePart.java @@ -1,5 +1,6 @@ package com.rettichlp.unicacityaddon.base.text; +import lombok.Getter; import net.labymod.api.client.component.ComponentService; import net.labymod.api.client.component.event.ClickEvent; import net.labymod.api.client.component.event.HoverEvent; @@ -11,6 +12,7 @@ * @author RettichLP * @see UCUtils by paulzhng */ +@Getter public class MessagePart { private final List formattingCodes; @@ -27,26 +29,6 @@ private MessagePart(Builder builder) { this.hoverEvent = builder.hoverEvent; } - public String getMessage() { - return message; - } - - public ColorCode getColorCode() { - return colorCode; - } - - public List getFormattingCodes() { - return formattingCodes; - } - - public ClickEvent getClickEvent() { - return clickEvent; - } - - public HoverEvent getHoverEvent() { - return hoverEvent; - } - public static Builder getBuilder() { return new Builder(); } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/commands/ChatLogCommand.java b/core/src/main/java/com/rettichlp/unicacityaddon/commands/ChatLogCommand.java index 0d587c215..0c60ce4b6 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/commands/ChatLogCommand.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/commands/ChatLogCommand.java @@ -13,6 +13,7 @@ import com.rettichlp.unicacityaddon.base.text.Message; import net.labymod.api.client.component.event.ClickEvent; import net.labymod.api.client.component.event.HoverEvent; +import org.jetbrains.annotations.NotNull; import java.io.BufferedReader; import java.io.DataOutputStream; @@ -101,18 +102,7 @@ private String createChatLog(int i) { private String upload(String content) { try { byte[] postData = content.getBytes(StandardCharsets.UTF_8); - int postDataLength = postData.length; - String request = "https://paste.labymod.net/documents"; - URL url = new URL(request); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setDoOutput(true); - conn.setInstanceFollowRedirects(false); - conn.setRequestMethod("POST"); - conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); - conn.setRequestProperty("Content-Type", "text/plain"); - conn.setRequestProperty("charset", "utf-8"); - conn.setRequestProperty("Content-Length", Integer.toString(postDataLength)); - conn.setUseCaches(false); + HttpURLConnection conn = getHttpURLConnection(postData); DataOutputStream wr = new DataOutputStream(conn.getOutputStream()); wr.write(postData); Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); @@ -131,4 +121,21 @@ private String upload(String content) { return null; } } + + @NotNull + private static HttpURLConnection getHttpURLConnection(byte[] postData) throws IOException { + int postDataLength = postData.length; + String request = "https://paste.labymod.net/documents"; + URL url = new URL(request); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setDoOutput(true); + conn.setInstanceFollowRedirects(false); + conn.setRequestMethod("POST"); + conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); + conn.setRequestProperty("Content-Type", "text/plain"); + conn.setRequestProperty("charset", "utf-8"); + conn.setRequestProperty("Content-Length", Integer.toString(postDataLength)); + conn.setUseCaches(false); + return conn; + } } \ No newline at end of file diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/commands/api/HousebanCommand.java b/core/src/main/java/com/rettichlp/unicacityaddon/commands/api/HousebanCommand.java index 528e1fb6f..4bb90af2f 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/commands/api/HousebanCommand.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/commands/api/HousebanCommand.java @@ -11,6 +11,7 @@ import com.rettichlp.unicacityaddon.base.text.ColorCode; import com.rettichlp.unicacityaddon.base.text.Message; import net.labymod.api.client.component.event.HoverEvent; +import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.concurrent.TimeUnit; @@ -54,20 +55,7 @@ public boolean execute(String[] arguments) { .replace("s", ColorCode.DARK_AQUA.getCode() + "s")) .create(); - ColorCode colorCode = ColorCode.AQUA; - int days = (int) TimeUnit.MILLISECONDS.toDays(durationInMillis); - if (days == 0) - colorCode = ColorCode.DARK_GREEN; - else if (days > 0 && days <= 5) - colorCode = ColorCode.GREEN; - else if (days > 5 && days <= 14) - colorCode = ColorCode.YELLOW; - else if (days > 14 && days <= 25) - colorCode = ColorCode.GOLD; - else if (days > 25 && days <= 50) - colorCode = ColorCode.RED; - else if (days > 50) - colorCode = ColorCode.DARK_RED; + ColorCode colorCode = getColorCode(durationInMillis); Message.Builder builder = Message.getBuilder(); houseBanEntry.getHouseBanReasonList().forEach(houseBanReason -> builder @@ -111,4 +99,23 @@ public List complete(String[] arguments) { .addAtIndex(3, "all") .build(); } + + @NotNull + private static ColorCode getColorCode(long durationInMillis) { + ColorCode colorCode = ColorCode.AQUA; + int days = (int) TimeUnit.MILLISECONDS.toDays(durationInMillis); + if (days == 0) + colorCode = ColorCode.DARK_GREEN; + else if (days > 0 && days <= 5) + colorCode = ColorCode.GREEN; + else if (days > 5 && days <= 14) + colorCode = ColorCode.YELLOW; + else if (days > 14 && days <= 25) + colorCode = ColorCode.GOLD; + else if (days > 25 && days <= 50) + colorCode = ColorCode.RED; + else if (days > 50) + colorCode = ColorCode.DARK_RED; + return colorCode; + } } \ No newline at end of file diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/commands/faction/badfaction/ToggleShoutCommand.java b/core/src/main/java/com/rettichlp/unicacityaddon/commands/faction/badfaction/ToggleShoutCommand.java new file mode 100644 index 000000000..162750b1d --- /dev/null +++ b/core/src/main/java/com/rettichlp/unicacityaddon/commands/faction/badfaction/ToggleShoutCommand.java @@ -0,0 +1,41 @@ +package com.rettichlp.unicacityaddon.commands.faction.badfaction; + +import com.rettichlp.unicacityaddon.UnicacityAddon; +import com.rettichlp.unicacityaddon.base.AddonPlayer; +import com.rettichlp.unicacityaddon.base.builder.TabCompletionBuilder; +import com.rettichlp.unicacityaddon.base.registry.UnicacityCommand; +import com.rettichlp.unicacityaddon.base.registry.annotation.UCCommand; + +import java.util.List; + +/** + * @author RettichLP + */ +@UCCommand(prefix = "toggleshout", aliases = {"toggles", "toggleschreien", "sonorus"}) // Sonorus = Harry Potter Anspielung +public class ToggleShoutCommand extends UnicacityCommand { + + private final UnicacityAddon unicacityAddon; + + public ToggleShoutCommand(UnicacityAddon unicacityAddon, UCCommand ucCommand) { + super(unicacityAddon, ucCommand); + this.unicacityAddon = unicacityAddon; + } + + @Override + public boolean execute(String[] arguments) { + AddonPlayer p = this.unicacityAddon.player(); + p.setShouting(!p.isShouting()); + + if (p.isShouting()) { + p.sendInfoMessage("Ab sofort schreist du jede Nachricht."); + } else { + p.sendInfoMessage("Ab sofort redest du wieder normal."); + } + return true; + } + + @Override + public List complete(String[] arguments) { + return TabCompletionBuilder.getBuilder(this.unicacityAddon, arguments).build(); + } +} \ No newline at end of file diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/commands/faction/badfaction/GaggedCommand.java b/core/src/main/java/com/rettichlp/unicacityaddon/commands/faction/badfaction/ToggleWhisperCommand.java similarity index 66% rename from core/src/main/java/com/rettichlp/unicacityaddon/commands/faction/badfaction/GaggedCommand.java rename to core/src/main/java/com/rettichlp/unicacityaddon/commands/faction/badfaction/ToggleWhisperCommand.java index e953cb6ca..aeb79e4c8 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/commands/faction/badfaction/GaggedCommand.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/commands/faction/badfaction/ToggleWhisperCommand.java @@ -11,12 +11,12 @@ /** * @author Dimiikou */ -@UCCommand(prefix = "geknebelt") -public class GaggedCommand extends UnicacityCommand { +@UCCommand(prefix = "togglewhisper", aliases = {"togglew", "toggleflüstern", "geknebelt"}) +public class ToggleWhisperCommand extends UnicacityCommand { private final UnicacityAddon unicacityAddon; - public GaggedCommand(UnicacityAddon unicacityAddon, UCCommand ucCommand) { + public ToggleWhisperCommand(UnicacityAddon unicacityAddon, UCCommand ucCommand) { super(unicacityAddon, ucCommand); this.unicacityAddon = unicacityAddon; } @@ -24,12 +24,12 @@ public GaggedCommand(UnicacityAddon unicacityAddon, UCCommand ucCommand) { @Override public boolean execute(String[] arguments) { AddonPlayer p = this.unicacityAddon.player(); - p.setGagged(!p.isGagged()); + p.setWhispering(!p.isWhispering()); - if (p.isGagged()) { - p.sendInfoMessage("Ab sofort kannst du nur noch flüstern."); + if (p.isWhispering()) { + p.sendInfoMessage("Ab sofort flüsterst du jede Nachricht."); } else { - p.sendInfoMessage("Ab sofort kannst du wieder normal reden."); + p.sendInfoMessage("Ab sofort redest du wieder normal."); } return true; } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/commands/supporter/PunishCommand.java b/core/src/main/java/com/rettichlp/unicacityaddon/commands/supporter/PunishCommand.java index 9f4e5d3a5..d8562bcf7 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/commands/supporter/PunishCommand.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/commands/supporter/PunishCommand.java @@ -46,8 +46,8 @@ public boolean execute(String[] arguments) { StringBuilder reasonStringBuilder = new StringBuilder(); int checkpoints = 0; int banDuration = 0; - int warnAmmount = 0; - boolean loyalityPointReset = false; + int warnAmount = 0; + boolean loyaltyPointReset = false; boolean kick = false; int weaponLock = 0; int factionLock = 0; @@ -57,8 +57,8 @@ public boolean execute(String[] arguments) { reasonStringBuilder.append(punishment.getReason()).append(" + "); checkpoints = checkpoints + punishment.getCheckpoints(); banDuration = banDuration < 0 || punishment.getBanDuration() < 0 ? -1 : banDuration + punishment.getBanDuration(); - warnAmmount = warnAmmount + punishment.getWarnAmmount(); - loyalityPointReset = loyalityPointReset || punishment.isLoyalityPointReset(); + warnAmount = warnAmount + punishment.getWarnAmmount(); + loyaltyPointReset = loyaltyPointReset || punishment.isLoyalityPointReset(); kick = kick || punishment.isKick(); weaponLock = weaponLock + punishment.getWeaponLock(); factionLock = factionLock + punishment.getFactionLock(); @@ -73,8 +73,8 @@ public boolean execute(String[] arguments) { p.sendServerMessage("/tban " + arguments[0] + " 0 0 " + banDuration + " " + reason); if (banDuration == -1) p.sendServerMessage("/ban " + arguments[0] + " " + reason); - if (loyalityPointReset) - p.sendServerMessage("/resettreuebonus " + arguments[0]); +// if (loyaltyPointReset) +// p.sendServerMessage("/resettreuebonus " + arguments[0]); if (weaponLock > 0) p.sendServerMessage("/waffensperre " + arguments[0] + " 0 0 " + weaponLock * 24 * 60 + " " + reason); if (factionLock > 0) @@ -83,20 +83,20 @@ public boolean execute(String[] arguments) { p.sendServerMessage("/adsperre " + arguments[0] + " " + adLock + " " + reason); if (kick) p.sendServerMessage("/kick " + arguments[0] + " " + reason); - if (warnAmmount > 0) - for (int i = 0; i < warnAmmount; i++) { + if (warnAmount > 0) + for (int i = 0; i < warnAmount; i++) { p.sendServerMessage("/warn " + arguments[0] + " " + reason); } String debugString = "Punished " + arguments[0] + " for " + reason + ": " + "Checkpoints=" + checkpoints + ", " + (banDuration < 0 ? "Permanenter-Ban=true, Temporärer-Ban=false" : "Permanenter-Ban=false, Temporärer-Ban=" + banDuration) + ", " + - "Treuebonus-Reset=" + loyalityPointReset + ", " + + "Treuebonus-Reset=" + loyaltyPointReset + " (not executed), " + "Waffensperre=" + weaponLock + ", " + "Fraktionssperre=" + factionLock + ", " + "Ad-Sperre=" + adLock + ", " + "Kick=" + kick + ", " + - "Warns=" + warnAmmount; + "Warns=" + warnAmount; this.unicacityAddon.utilService().debug(debugString); this.unicacityAddon.logger().info(debugString); diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/controller/TabListController.java b/core/src/main/java/com/rettichlp/unicacityaddon/controller/PlayerListController.java similarity index 60% rename from core/src/main/java/com/rettichlp/unicacityaddon/controller/TabListController.java rename to core/src/main/java/com/rettichlp/unicacityaddon/controller/PlayerListController.java index 3d4763100..436772b06 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/controller/TabListController.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/controller/PlayerListController.java @@ -9,7 +9,9 @@ */ @Nullable @Referenceable -public abstract class TabListController { +public abstract class PlayerListController { - public abstract void orderTabList(UnicacityAddon unicacityAddon); + public abstract boolean isKeyPlayerListDown(); + + public abstract void orderPlayerList(UnicacityAddon unicacityAddon); } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/controller/SoundController.java b/core/src/main/java/com/rettichlp/unicacityaddon/controller/SoundController.java index a8005de64..8de7c1483 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/controller/SoundController.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/controller/SoundController.java @@ -10,6 +10,8 @@ @Referenceable public abstract class SoundController { + public abstract void playBankRobStartedSound(); + public abstract void playBombPlantedSound(); public abstract void playContractSetSound(); diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/listener/CarListener.java b/core/src/main/java/com/rettichlp/unicacityaddon/listener/CarListener.java index d19d33f77..53cb4905f 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/listener/CarListener.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/listener/CarListener.java @@ -62,14 +62,14 @@ public void onChatReceive(ChatReceiveEvent e) { // modify message Map.Entry nearestNaviPoint = this.unicacityAddon.navigationService().getNearestNaviPoint(x, y, z); - NaviPoint navipoint = nearestNaviPoint.getValue(); + NaviPoint naviPoint = nearestNaviPoint.getValue(); e.setMessage(Message.getBuilder() .of("[").color(ColorCode.DARK_GRAY).advance() .of("Car").color(ColorCode.GOLD).advance() .of("]").color(ColorCode.DARK_GRAY).advance().space() .of("Das Fahrzeug befindet sich in der Nähe von").color(ColorCode.GRAY).advance().space() - .of(navipoint != null ? navipoint.getDisplayName() : "unbekannter Ort").color(ColorCode.AQUA) + .of(naviPoint != null ? naviPoint.getDisplayName() : "unbekannter Ort").color(ColorCode.AQUA) .hoverEvent(HoverEvent.Action.SHOW_TEXT, this.unicacityAddon.utilService().command().locationHoverMessage(x, y, z)) .advance() .of(".").color(ColorCode.GRAY).advance() diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/listener/EventRegistrationListener.java b/core/src/main/java/com/rettichlp/unicacityaddon/listener/EventRegistrationListener.java index 03c4c7af8..cfe7f89df 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/listener/EventRegistrationListener.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/listener/EventRegistrationListener.java @@ -75,9 +75,10 @@ public void onKey(KeyEvent e) { UnicacityAddonConfiguration configuration = this.unicacityAddon.configuration(); if (state.equals(KeyEvent.State.PRESS) && this.unicacityAddon.utilService().isUnicacity()) { - if (key.equals(Key.TAB) && !Laby.references().chatAccessor().isChatOpen() && configuration.tablist().enabled().get() && configuration.tablist().sorted().get()) { + boolean isKeyPlayerListDown = this.unicacityAddon.playerListController().isKeyPlayerListDown(); + if (isKeyPlayerListDown && !Laby.references().chatAccessor().isChatOpen() && configuration.playerlist().enabled().get() && configuration.playerlist().sorted().get()) { this.unicacityAddon.utilService().debug("Sorting tab list"); - this.unicacityAddon.tabListController().orderTabList(this.unicacityAddon); + this.unicacityAddon.playerListController().orderPlayerList(this.unicacityAddon); return; } diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/MajorEventListener.java b/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/MajorEventListener.java index 200e1735d..f13bcb142 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/MajorEventListener.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/MajorEventListener.java @@ -101,7 +101,7 @@ public void onChatReceive(ChatReceiveEvent e) { Matcher bankRobStartedMatcher = PatternHandler.BANK_ROB_STARTED_PATTERN.matcher(msg); if (bankRobStartedMatcher.find()) { Laby.labyAPI().eventBus().fire(new BankRobStartedEvent()); -// this.unicacityAddon.soundController().playBankRobStartedSound(); + this.unicacityAddon.soundController().playBankRobStartedSound(); if (p.getFaction().equals(Faction.POLIZEI)) { this.unicacityAddon.api().sendEventBankRobRequest(System.currentTimeMillis()); diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/ReinforcementListener.java b/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/ReinforcementListener.java index 8a41884f9..5a2ce6187 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/ReinforcementListener.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/ReinforcementListener.java @@ -64,14 +64,14 @@ public void onChatReceive(ChatReceiveEvent e) { } Map.Entry nearestNaviPoint = this.unicacityAddon.navigationService().getNearestNaviPoint(posX, posY, posZ); - NaviPoint navipoint = nearestNaviPoint.getValue(); + NaviPoint naviPoint = nearestNaviPoint.getValue(); - String navipointString; - if (navipoint == null) { - navipointString = "unbekannter Ort"; + String naviPointString; + if (naviPoint == null) { + naviPointString = "unbekannter Ort"; p.sendErrorMessage("Navipunkte wurden nicht geladen. Versuche /sync um diese neu zu laden!"); } else { - navipointString = navipoint.getDisplayName(); + naviPointString = naviPoint.getDisplayName(); } p.sendMessage(this.unicacityAddon.configuration().reinforcement().reinforcement().getOrDefault(DefaultReinforcementConfiguration.REINFORCEMENT) @@ -81,7 +81,7 @@ public void onChatReceive(ChatReceiveEvent e) { .replace("%x%", String.valueOf(posX)) .replace("%y%", String.valueOf(posY)) .replace("%z%", String.valueOf(posZ)) - .replace("%navipoint%", navipointString) + .replace("%navipoint%", naviPointString) .replace("%distance%", String.valueOf(distance))); p.sendMessage(Message.getBuilder() diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/ShareLocationListener.java b/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/ShareLocationListener.java index c5178269f..219d7230b 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/ShareLocationListener.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/ShareLocationListener.java @@ -49,19 +49,19 @@ public void onChatReceive(ChatReceiveEvent e) { Map.Entry doubleNaviPointEntry = this.unicacityAddon.navigationService().getNearestNaviPoint(posX, posY, posZ); - String navipointString; + String naviPointString; if (doubleNaviPointEntry.getValue() == null) { - navipointString = "unbekannter Ort"; + naviPointString = "unbekannter Ort"; p.sendErrorMessage("Navipunkte wurden nicht geladen. Versuche /sync um diese neu zu laden!"); } else { - navipointString = doubleNaviPointEntry.getValue().getDisplayName(); + naviPointString = doubleNaviPointEntry.getValue().getDisplayName(); } FloatVector3 location = this.unicacityAddon.player().getLocation(); p.sendMessage(this.unicacityAddon.configuration().sloc().sloc().getOrDefault(DefaultSlocConfiguration.SLOC) .replace("&", "§") .replace("%sender%", senderName) - .replace("%navipoint%", navipointString) + .replace("%navipoint%", naviPointString) .replace("%distance%", String.valueOf(location != null ? (int) location.distance(new FloatVector3(posX, posY, posZ)) : 0))); p.sendMessage(Message.getBuilder() diff --git a/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/badfaction/GaggedListener.java b/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/badfaction/PronunciationListener.java similarity index 54% rename from core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/badfaction/GaggedListener.java rename to core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/badfaction/PronunciationListener.java index 549764bfb..4098bf758 100644 --- a/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/badfaction/GaggedListener.java +++ b/core/src/main/java/com/rettichlp/unicacityaddon/listener/faction/badfaction/PronunciationListener.java @@ -1,6 +1,7 @@ package com.rettichlp.unicacityaddon.listener.faction.badfaction; import com.rettichlp.unicacityaddon.UnicacityAddon; +import com.rettichlp.unicacityaddon.base.AddonPlayer; import com.rettichlp.unicacityaddon.base.registry.annotation.UCEvent; import net.labymod.api.event.Subscribe; import net.labymod.api.event.client.chat.ChatMessageSendEvent; @@ -10,17 +11,22 @@ * @author RettichLP */ @UCEvent -public class GaggedListener { +public class PronunciationListener { private final UnicacityAddon unicacityAddon; - public GaggedListener(UnicacityAddon unicacityAddon) { + public PronunciationListener(UnicacityAddon unicacityAddon) { this.unicacityAddon = unicacityAddon; } @Subscribe public void onChatMessageSend(ChatMessageSendEvent e) { - if (this.unicacityAddon.player().isGagged() && !e.getMessage().startsWith("/")) - e.changeMessage("/w " + e.getMessage()); + if (!e.getMessage().startsWith("/")) { + AddonPlayer p = this.unicacityAddon.player(); + if (p.isWhispering()) + e.changeMessage("/w " + e.getMessage()); + else if (p.isShouting()) + e.changeMessage("/s " + e.getMessage()); + } } } diff --git a/core/src/main/resources/assets/unicacityaddon/i18n/de_de.json b/core/src/main/resources/assets/unicacityaddon/i18n/de_de.json index b3b042403..d72f395a3 100644 --- a/core/src/main/resources/assets/unicacityaddon/i18n/de_de.json +++ b/core/src/main/resources/assets/unicacityaddon/i18n/de_de.json @@ -551,14 +551,14 @@ "name": "Support-Channel-betreten Nachricht" } }, - "tablist": { - "name": "Tabliste", + "playerlist": { + "name": "Spieler-Liste", "sorted": { - "name": "Sortierte Tabliste", - "description": "Sortiert die Tabliste nach Duty-Fraktionen, UC's, Buildern und aktiven Reports" + "name": "Sortierte Spieler-Liste", + "description": "Sortiert die Spieler-Liste nach Duty-Fraktionen, UC's, Buildern und aktiven Reports" }, "afk": { - "name": "AFK Tag in Tabliste", + "name": "AFK Tag in Spieler-Liste", "description": "Zeugt hinter AFK Spielern ein Icon an" } }, diff --git a/core/src/main/resources/assets/unicacityaddon/i18n/en_gb.json b/core/src/main/resources/assets/unicacityaddon/i18n/en_gb.json index a6a7dc203..222902999 100644 --- a/core/src/main/resources/assets/unicacityaddon/i18n/en_gb.json +++ b/core/src/main/resources/assets/unicacityaddon/i18n/en_gb.json @@ -551,11 +551,11 @@ "name": "Join support channel message" } }, - "tablist": { - "name": "Tab list", + "playerlist": { + "name": "Player List", "sorted": { - "name": "Sorted Tab List", - "description": "Sorts the tab list by duty factions, UC's, builders and active reports" + "name": "Sorted Player List", + "description": "Sorts the player list by duty factions, UC's, builders and active reports" }, "afk": { "name": "AFK Tag", diff --git a/core/src/main/resources/assets/unicacityaddon/i18n/en_us.json b/core/src/main/resources/assets/unicacityaddon/i18n/en_us.json index a0b4bdbc5..222902999 100644 --- a/core/src/main/resources/assets/unicacityaddon/i18n/en_us.json +++ b/core/src/main/resources/assets/unicacityaddon/i18n/en_us.json @@ -551,11 +551,11 @@ "name": "Join support channel message" } }, - "tablist": { - "name": "Tab List", + "playerlist": { + "name": "Player List", "sorted": { - "name": "Sorted Tab List", - "description": "Sorts the tab list by duty factions, UC's, builders and active reports" + "name": "Sorted Player List", + "description": "Sorts the player list by duty factions, UC's, builders and active reports" }, "afk": { "name": "AFK Tag", diff --git a/game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedTabListController.java b/game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedPlayerListController.java similarity index 86% rename from game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedTabListController.java rename to game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedPlayerListController.java index 69502af3c..6a3f0c9a6 100644 --- a/game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedTabListController.java +++ b/game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedPlayerListController.java @@ -2,8 +2,9 @@ import com.rettichlp.unicacityaddon.UnicacityAddon; import com.rettichlp.unicacityaddon.base.tab.TabPrefix; -import com.rettichlp.unicacityaddon.controller.TabListController; +import com.rettichlp.unicacityaddon.controller.PlayerListController; import net.labymod.api.Laby; +import net.labymod.api.client.gui.screen.key.Key; import net.labymod.api.client.network.ClientPacketListener; import net.labymod.api.client.network.NetworkPlayerInfo; import net.labymod.api.models.Implements; @@ -17,20 +18,28 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Optional; /** * @author RettichLP */ @Singleton -@Implements(TabListController.class) -public class VersionedTabListController extends TabListController { +@Implements(PlayerListController.class) +public class VersionedPlayerListController extends PlayerListController { @Inject - public VersionedTabListController() { + public VersionedPlayerListController() { } @Override - public void orderTabList(UnicacityAddon unicacityAddon) { + public boolean isKeyPlayerListDown() { + int playerListKeyCode = Minecraft.getMinecraft().gameSettings.keyBindPlayerList.getKeyCode(); + return Optional.ofNullable(Laby.references().keyMapper().getKeyByKeyCode(playerListKeyCode)) + .map(Key::isPressed).orElse(false); + } + + @Override + public void orderPlayerList(UnicacityAddon unicacityAddon) { ClientPacketListener clientPacketListener = Laby.labyAPI().minecraft().getClientPacketListener(); Collection networkPlayerInfos = clientPacketListener != null ? clientPacketListener.getNetworkPlayerInfos() : Collections.emptyList(); assert Minecraft.getMinecraft().world != null; diff --git a/game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedSoundController.java b/game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedSoundController.java index 37226d85a..590921053 100644 --- a/game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedSoundController.java +++ b/game-runner/src/v1_12_2/java/com/rettichlp/unicacityaddon/v1_12_2/VersionedSoundController.java @@ -20,10 +20,33 @@ public class VersionedSoundController extends SoundController { public VersionedSoundController() { } + @Override + public void playBankRobStartedSound() { + new Thread(() -> { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(this.create("block.note.chime"), 0.6F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(this.create("block.note.chime"), 0.9F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(this.create("block.note.chime"), 0.6F)); + }).start(); + } + @Override public void playBombPlantedSound() { new Thread(() -> { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(this.create("block.note.bit"), 1.0F)); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(this.create("block.note.chime"), 1.0F)); try { Thread.sleep(100); @@ -31,7 +54,7 @@ public void playBombPlantedSound() { throw new RuntimeException(e); } - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(this.create("block.note.bit"), 0.8F)); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(this.create("block.note.chime"), 0.8F)); try { Thread.sleep(100); @@ -39,7 +62,7 @@ public void playBombPlantedSound() { throw new RuntimeException(e); } - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(this.create("block.note.bit"), 1.4F)); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(this.create("block.note.chime"), 1.4F)); }).start(); } diff --git a/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedDeadBodyController.java b/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedDeadBodyController.java index e4e324da0..b5c4a9485 100644 --- a/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedDeadBodyController.java +++ b/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedDeadBodyController.java @@ -68,7 +68,7 @@ public void updateDisplayName(UnicacityAddon unicacityAddon) { // get player name and revivable status String playerName; boolean nonRevivable; - if (siblings.size() > 0) { // sibling size only by not formatted corpses greater than 0 + if (!siblings.isEmpty()) { // sibling size only by not formatted corpses greater than 0 Component originalCorpseName = siblings.get(0); playerName = originalCorpseName.getContents().substring(1); nonRevivable = Objects.equals(originalCorpseName.getStyle().getColor(), TextColor.fromLegacyFormat(ChatFormatting.DARK_GRAY)); diff --git a/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedTabListController.java b/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedPlayerListController.java similarity index 92% rename from game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedTabListController.java rename to game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedPlayerListController.java index 55c0f6365..bfc604606 100644 --- a/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedTabListController.java +++ b/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedPlayerListController.java @@ -2,7 +2,7 @@ import com.rettichlp.unicacityaddon.UnicacityAddon; import com.rettichlp.unicacityaddon.base.tab.TabPrefix; -import com.rettichlp.unicacityaddon.controller.TabListController; +import com.rettichlp.unicacityaddon.controller.PlayerListController; import net.labymod.api.Laby; import net.labymod.api.client.network.ClientPacketListener; import net.labymod.api.client.network.NetworkPlayerInfo; @@ -22,15 +22,20 @@ * @author RettichLP */ @Singleton -@Implements(TabListController.class) -public class VersionedTabListController extends TabListController { +@Implements(PlayerListController.class) +public class VersionedPlayerListController extends PlayerListController { @Inject - public VersionedTabListController() { + public VersionedPlayerListController() { } @Override - public void orderTabList(UnicacityAddon unicacityAddon) { + public boolean isKeyPlayerListDown() { + return Minecraft.getInstance().options.keyPlayerList.isDown(); + } + + @Override + public void orderPlayerList(UnicacityAddon unicacityAddon) { ClientPacketListener clientPacketListener = Laby.labyAPI().minecraft().getClientPacketListener(); Collection networkPlayerInfos = clientPacketListener != null ? clientPacketListener.getNetworkPlayerInfos() : Collections.emptyList(); assert Minecraft.getInstance().level != null; diff --git a/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedSoundController.java b/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedSoundController.java index fe04f0608..ea9e9bf71 100644 --- a/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedSoundController.java +++ b/game-runner/src/v1_16_5/java/com/rettichlp/unicacityaddon/v1_16_5/VersionedSoundController.java @@ -20,6 +20,29 @@ public class VersionedSoundController extends SoundController { public VersionedSoundController() { } + @Override + public void playBankRobStartedSound() { + new Thread(() -> { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.9F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + }).start(); + } + @Override public void playBombPlantedSound() { new Thread(() -> { diff --git a/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedDeadBodyController.java b/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedDeadBodyController.java index 00f2426c1..73042e259 100644 --- a/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedDeadBodyController.java +++ b/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedDeadBodyController.java @@ -68,7 +68,7 @@ public void updateDisplayName(UnicacityAddon unicacityAddon) { // get player name and revivable status String playerName; boolean nonRevivable; - if (siblings.size() > 0) { // sibling size only by not formatted corpses greater than 0 + if (!siblings.isEmpty()) { // sibling size only by not formatted corpses greater than 0 Component originalCorpseName = siblings.get(0); playerName = originalCorpseName.getContents().substring(1); nonRevivable = Objects.equals(originalCorpseName.getStyle().getColor(), TextColor.fromLegacyFormat(ChatFormatting.DARK_GRAY)); diff --git a/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedTabListController.java b/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedPlayerListController.java similarity index 92% rename from game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedTabListController.java rename to game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedPlayerListController.java index b70a277b6..e4a8c4695 100644 --- a/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedTabListController.java +++ b/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedPlayerListController.java @@ -2,7 +2,7 @@ import com.rettichlp.unicacityaddon.UnicacityAddon; import com.rettichlp.unicacityaddon.base.tab.TabPrefix; -import com.rettichlp.unicacityaddon.controller.TabListController; +import com.rettichlp.unicacityaddon.controller.PlayerListController; import net.labymod.api.Laby; import net.labymod.api.client.network.ClientPacketListener; import net.labymod.api.client.network.NetworkPlayerInfo; @@ -22,15 +22,20 @@ * @author RettichLP */ @Singleton -@Implements(TabListController.class) -public class VersionedTabListController extends TabListController { +@Implements(PlayerListController.class) +public class VersionedPlayerListController extends PlayerListController { @Inject - public VersionedTabListController() { + public VersionedPlayerListController() { } @Override - public void orderTabList(UnicacityAddon unicacityAddon) { + public boolean isKeyPlayerListDown() { + return Minecraft.getInstance().options.keyPlayerList.isDown(); + } + + @Override + public void orderPlayerList(UnicacityAddon unicacityAddon) { ClientPacketListener clientPacketListener = Laby.labyAPI().minecraft().getClientPacketListener(); Collection networkPlayerInfos = clientPacketListener != null ? clientPacketListener.getNetworkPlayerInfos() : Collections.emptyList(); assert Minecraft.getInstance().level != null; diff --git a/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedSoundController.java b/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedSoundController.java index d42381c8c..91bc2d0b0 100644 --- a/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedSoundController.java +++ b/game-runner/src/v1_17_1/java/com/rettichlp/unicacityaddon/v1_17_1/VersionedSoundController.java @@ -20,6 +20,29 @@ public class VersionedSoundController extends SoundController { public VersionedSoundController() { } + @Override + public void playBankRobStartedSound() { + new Thread(() -> { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.9F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + }).start(); + } + @Override public void playBombPlantedSound() { new Thread(() -> { @@ -46,7 +69,6 @@ public void playBombPlantedSound() { @Override public void playContractSetSound() { Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_CHIME, 0.5F)); - } @Override diff --git a/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedDeadBodyController.java b/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedDeadBodyController.java index 8a694fe89..95ad3c6da 100644 --- a/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedDeadBodyController.java +++ b/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedDeadBodyController.java @@ -68,7 +68,7 @@ public void updateDisplayName(UnicacityAddon unicacityAddon) { // get player name and revivable status String playerName; boolean nonRevivable; - if (siblings.size() > 0) { // sibling size only by not formatted corpses greater than 0 + if (!siblings.isEmpty()) { // sibling size only by not formatted corpses greater than 0 Component originalCorpseName = siblings.get(0); playerName = originalCorpseName.getContents().substring(1); nonRevivable = Objects.equals(originalCorpseName.getStyle().getColor(), TextColor.fromLegacyFormat(ChatFormatting.DARK_GRAY)); diff --git a/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedTabListController.java b/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedPlayerListController.java similarity index 92% rename from game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedTabListController.java rename to game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedPlayerListController.java index 460bfe413..8ebd3d808 100644 --- a/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedTabListController.java +++ b/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedPlayerListController.java @@ -2,7 +2,7 @@ import com.rettichlp.unicacityaddon.UnicacityAddon; import com.rettichlp.unicacityaddon.base.tab.TabPrefix; -import com.rettichlp.unicacityaddon.controller.TabListController; +import com.rettichlp.unicacityaddon.controller.PlayerListController; import net.labymod.api.Laby; import net.labymod.api.client.network.ClientPacketListener; import net.labymod.api.client.network.NetworkPlayerInfo; @@ -22,15 +22,20 @@ * @author RettichLP */ @Singleton -@Implements(TabListController.class) -public class VersionedTabListController extends TabListController { +@Implements(PlayerListController.class) +public class VersionedPlayerListController extends PlayerListController { @Inject - public VersionedTabListController() { + public VersionedPlayerListController() { } @Override - public void orderTabList(UnicacityAddon unicacityAddon) { + public boolean isKeyPlayerListDown() { + return Minecraft.getInstance().options.keyPlayerList.isDown(); + } + + @Override + public void orderPlayerList(UnicacityAddon unicacityAddon) { ClientPacketListener clientPacketListener = Laby.labyAPI().minecraft().getClientPacketListener(); Collection networkPlayerInfos = clientPacketListener != null ? clientPacketListener.getNetworkPlayerInfos() : Collections.emptyList(); assert Minecraft.getInstance().level != null; diff --git a/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedSoundController.java b/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedSoundController.java index 8ad3a95f9..41a032f4a 100644 --- a/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedSoundController.java +++ b/game-runner/src/v1_18_2/java/com/rettichlp/unicacityaddon/v1_18_2/VersionedSoundController.java @@ -20,6 +20,29 @@ public class VersionedSoundController extends SoundController { public VersionedSoundController() { } + @Override + public void playBankRobStartedSound() { + new Thread(() -> { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.9F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + }).start(); + } + @Override public void playBombPlantedSound() { new Thread(() -> { diff --git a/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedDeadBodyController.java b/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedDeadBodyController.java index 6d29b55af..ce9ec98bc 100644 --- a/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedDeadBodyController.java +++ b/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedDeadBodyController.java @@ -68,7 +68,7 @@ public void updateDisplayName(UnicacityAddon unicacityAddon) { // get player name and revivable status String playerName; boolean nonRevivable; - if (siblings.size() > 0) { // sibling size only by not formatted corpses greater than 0 + if (!siblings.isEmpty()) { // sibling size only by not formatted corpses greater than 0 Component originalCorpseName = siblings.get(0); playerName = originalCorpseName.getContents().toString().substring(1); nonRevivable = Objects.equals(originalCorpseName.getStyle().getColor(), TextColor.fromLegacyFormat(ChatFormatting.DARK_GRAY)); diff --git a/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedTabListController.java b/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedPlayerListController.java similarity index 92% rename from game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedTabListController.java rename to game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedPlayerListController.java index 2164224de..462d59aa8 100644 --- a/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedTabListController.java +++ b/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedPlayerListController.java @@ -2,7 +2,7 @@ import com.rettichlp.unicacityaddon.UnicacityAddon; import com.rettichlp.unicacityaddon.base.tab.TabPrefix; -import com.rettichlp.unicacityaddon.controller.TabListController; +import com.rettichlp.unicacityaddon.controller.PlayerListController; import net.labymod.api.Laby; import net.labymod.api.client.network.ClientPacketListener; import net.labymod.api.client.network.NetworkPlayerInfo; @@ -22,15 +22,20 @@ * @author RettichLP */ @Singleton -@Implements(TabListController.class) -public class VersionedTabListController extends TabListController { +@Implements(PlayerListController.class) +public class VersionedPlayerListController extends PlayerListController { @Inject - public VersionedTabListController() { + public VersionedPlayerListController() { } @Override - public void orderTabList(UnicacityAddon unicacityAddon) { + public boolean isKeyPlayerListDown() { + return Minecraft.getInstance().options.keyPlayerList.isDown(); + } + + @Override + public void orderPlayerList(UnicacityAddon unicacityAddon) { ClientPacketListener clientPacketListener = Laby.labyAPI().minecraft().getClientPacketListener(); Collection networkPlayerInfos = clientPacketListener != null ? clientPacketListener.getNetworkPlayerInfos() : Collections.emptyList(); assert Minecraft.getInstance().level != null; diff --git a/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedSoundController.java b/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedSoundController.java index 9e7f7e332..a3db1ac80 100644 --- a/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedSoundController.java +++ b/game-runner/src/v1_19_2/java/com/rettichlp/unicacityaddon/v1_19_2/VersionedSoundController.java @@ -20,6 +20,29 @@ public class VersionedSoundController extends SoundController { public VersionedSoundController() { } + @Override + public void playBankRobStartedSound() { + new Thread(() -> { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.9F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + }).start(); + } + @Override public void playBombPlantedSound() { new Thread(() -> { diff --git a/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedDeadBodyController.java b/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedDeadBodyController.java index e72372ecb..21f1bd25d 100644 --- a/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedDeadBodyController.java +++ b/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedDeadBodyController.java @@ -68,7 +68,7 @@ public void updateDisplayName(UnicacityAddon unicacityAddon) { // get player name and revivable status String playerName; boolean nonRevivable; - if (siblings.size() > 0) { // sibling size only by not formatted corpses greater than 0 + if (!siblings.isEmpty()) { // sibling size only by not formatted corpses greater than 0 Component originalCorpseName = siblings.get(0); playerName = originalCorpseName.getContents().toString().substring(1); nonRevivable = Objects.equals(originalCorpseName.getStyle().getColor(), TextColor.fromLegacyFormat(ChatFormatting.DARK_GRAY)); diff --git a/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedTabListController.java b/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedPlayerListController.java similarity index 92% rename from game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedTabListController.java rename to game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedPlayerListController.java index 8a5894fae..9db3a48b2 100644 --- a/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedTabListController.java +++ b/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedPlayerListController.java @@ -2,7 +2,7 @@ import com.rettichlp.unicacityaddon.UnicacityAddon; import com.rettichlp.unicacityaddon.base.tab.TabPrefix; -import com.rettichlp.unicacityaddon.controller.TabListController; +import com.rettichlp.unicacityaddon.controller.PlayerListController; import net.labymod.api.Laby; import net.labymod.api.client.network.ClientPacketListener; import net.labymod.api.client.network.NetworkPlayerInfo; @@ -22,15 +22,20 @@ * @author RettichLP */ @Singleton -@Implements(TabListController.class) -public class VersionedTabListController extends TabListController { +@Implements(PlayerListController.class) +public class VersionedPlayerListController extends PlayerListController { @Inject - public VersionedTabListController() { + public VersionedPlayerListController() { } @Override - public void orderTabList(UnicacityAddon unicacityAddon) { + public boolean isKeyPlayerListDown() { + return Minecraft.getInstance().options.keyPlayerList.isDown(); + } + + @Override + public void orderPlayerList(UnicacityAddon unicacityAddon) { ClientPacketListener clientPacketListener = Laby.labyAPI().minecraft().getClientPacketListener(); Collection networkPlayerInfos = clientPacketListener != null ? clientPacketListener.getNetworkPlayerInfos() : Collections.emptyList(); assert Minecraft.getInstance().level != null; diff --git a/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedSoundController.java b/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedSoundController.java index 4cd0f9821..a6f0eb2a5 100644 --- a/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedSoundController.java +++ b/game-runner/src/v1_19_3/java/com/rettichlp/unicacityaddon/v1_19_3/VersionedSoundController.java @@ -20,6 +20,29 @@ public class VersionedSoundController extends SoundController { public VersionedSoundController() { } + @Override + public void playBankRobStartedSound() { + new Thread(() -> { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.9F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + }).start(); + } + @Override public void playBombPlantedSound() { new Thread(() -> { diff --git a/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedDeadBodyController.java b/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedDeadBodyController.java index 95906c84a..b78369554 100644 --- a/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedDeadBodyController.java +++ b/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedDeadBodyController.java @@ -68,7 +68,7 @@ public void updateDisplayName(UnicacityAddon unicacityAddon) { // get player name and revivable status String playerName; boolean nonRevivable; - if (siblings.size() > 0) { // sibling size only by not formatted corpses greater than 0 + if (!siblings.isEmpty()) { // sibling size only by not formatted corpses greater than 0 Component originalCorpseName = siblings.get(0); playerName = originalCorpseName.getContents().toString().substring(1); nonRevivable = Objects.equals(originalCorpseName.getStyle().getColor(), TextColor.fromLegacyFormat(ChatFormatting.DARK_GRAY)); diff --git a/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedTabListController.java b/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedPlayerListController.java similarity index 92% rename from game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedTabListController.java rename to game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedPlayerListController.java index 1fd577408..95b64d6dc 100644 --- a/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedTabListController.java +++ b/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedPlayerListController.java @@ -2,7 +2,7 @@ import com.rettichlp.unicacityaddon.UnicacityAddon; import com.rettichlp.unicacityaddon.base.tab.TabPrefix; -import com.rettichlp.unicacityaddon.controller.TabListController; +import com.rettichlp.unicacityaddon.controller.PlayerListController; import net.labymod.api.Laby; import net.labymod.api.client.network.ClientPacketListener; import net.labymod.api.client.network.NetworkPlayerInfo; @@ -22,15 +22,20 @@ * @author RettichLP */ @Singleton -@Implements(TabListController.class) -public class VersionedTabListController extends TabListController { +@Implements(PlayerListController.class) +public class VersionedPlayerListController extends PlayerListController { @Inject - public VersionedTabListController() { + public VersionedPlayerListController() { } @Override - public void orderTabList(UnicacityAddon unicacityAddon) { + public boolean isKeyPlayerListDown() { + return Minecraft.getInstance().options.keyPlayerList.isDown(); + } + + @Override + public void orderPlayerList(UnicacityAddon unicacityAddon) { ClientPacketListener clientPacketListener = Laby.labyAPI().minecraft().getClientPacketListener(); Collection networkPlayerInfos = clientPacketListener != null ? clientPacketListener.getNetworkPlayerInfos() : Collections.emptyList(); assert Minecraft.getInstance().level != null; diff --git a/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedSoundController.java b/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedSoundController.java index e95e6954b..ee9325d7e 100644 --- a/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedSoundController.java +++ b/game-runner/src/v1_19_4/java/com/rettichlp/unicacityaddon/v1_19_4/VersionedSoundController.java @@ -20,6 +20,29 @@ public class VersionedSoundController extends SoundController { public VersionedSoundController() { } + @Override + public void playBankRobStartedSound() { + new Thread(() -> { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.9F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + }).start(); + } + @Override public void playBombPlantedSound() { new Thread(() -> { diff --git a/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedDeadBodyController.java b/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedDeadBodyController.java index cbbf615b8..284116457 100644 --- a/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedDeadBodyController.java +++ b/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedDeadBodyController.java @@ -68,7 +68,7 @@ public void updateDisplayName(UnicacityAddon unicacityAddon) { // get player name and revivable status String playerName; boolean nonRevivable; - if (siblings.size() > 0) { // sibling size only by not formatted corpses greater than 0 + if (!siblings.isEmpty()) { // sibling size only by not formatted corpses greater than 0 Component originalCorpseName = siblings.get(0); playerName = originalCorpseName.getContents().toString().substring(1); nonRevivable = Objects.equals(originalCorpseName.getStyle().getColor(), TextColor.fromLegacyFormat(ChatFormatting.DARK_GRAY)); diff --git a/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedTabListController.java b/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedPlayerListController.java similarity index 92% rename from game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedTabListController.java rename to game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedPlayerListController.java index 6aee19419..5bfeb25bb 100644 --- a/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedTabListController.java +++ b/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedPlayerListController.java @@ -2,7 +2,7 @@ import com.rettichlp.unicacityaddon.UnicacityAddon; import com.rettichlp.unicacityaddon.base.tab.TabPrefix; -import com.rettichlp.unicacityaddon.controller.TabListController; +import com.rettichlp.unicacityaddon.controller.PlayerListController; import net.labymod.api.Laby; import net.labymod.api.client.network.ClientPacketListener; import net.labymod.api.client.network.NetworkPlayerInfo; @@ -22,15 +22,20 @@ * @author RettichLP */ @Singleton -@Implements(TabListController.class) -public class VersionedTabListController extends TabListController { +@Implements(PlayerListController.class) +public class VersionedPlayerListController extends PlayerListController { @Inject - public VersionedTabListController() { + public VersionedPlayerListController() { } @Override - public void orderTabList(UnicacityAddon unicacityAddon) { + public boolean isKeyPlayerListDown() { + return Minecraft.getInstance().options.keyPlayerList.isDown(); + } + + @Override + public void orderPlayerList(UnicacityAddon unicacityAddon) { ClientPacketListener clientPacketListener = Laby.labyAPI().minecraft().getClientPacketListener(); Collection networkPlayerInfos = clientPacketListener != null ? clientPacketListener.getNetworkPlayerInfos() : Collections.emptyList(); assert Minecraft.getInstance().level != null; diff --git a/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedSoundController.java b/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedSoundController.java index 190f9954a..152f63b03 100644 --- a/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedSoundController.java +++ b/game-runner/src/v1_20_1/java/com/rettichlp/unicacityaddon/v1_20_1/VersionedSoundController.java @@ -20,6 +20,29 @@ public class VersionedSoundController extends SoundController { public VersionedSoundController() { } + @Override + public void playBankRobStartedSound() { + new Thread(() -> { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.9F)); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.NOTE_BLOCK_BIT, 0.6F)); + }).start(); + } + @Override public void playBombPlantedSound() { new Thread(() -> {