Skip to content

Commit

Permalink
Fix keybind not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Fesaa committed Aug 6, 2024
1 parent 007b47a commit b474463
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import art.ameliah.laby.addons.cubepanion.core.config.subconfig.GameMapInfoSubConfig;
import art.ameliah.laby.addons.cubepanion.core.utils.Colours;
import art.ameliah.laby.addons.cubepanion.core.utils.CubeGame;
import art.ameliah.laby.addons.cubepanion.core.utils.gamemaps.base.LoadedGameMap;
import art.ameliah.laby.addons.cubepanion.core.versionlinkers.QOLMapSelectorLink;
import art.ameliah.laby.addons.cubepanion.core.weave.GameMapAPI;
import net.labymod.api.client.component.Component;
Expand Down Expand Up @@ -57,8 +58,8 @@ public void onKeyEvent(KeyEvent keyEvent) {
if (keyEvent.key().equals(subConfig.getKey().get()) && subConfig.isEnabled().get()
&& GameMapAPI.getInstance().hasMaps(this.addon.getManager().getDivision())) {
if (keyEvent.state() == State.PRESS) {
this.addon.getManager().getGameMapInfoManager()
.doGameMapLayout(this.addon.getManager().getMapName());
LoadedGameMap map = GameMapAPI.getInstance().getCurrentMap();
this.addon.getManager().getGameMapInfoManager().displayGameMapLayout(map);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public GameMapInfoManager(Cubepanion addon) {
this.gameMapInfoSubConfig = addon.configuration().getGameMapInfoSubConfig();
}

private void displayGameMapLayout(LoadedGameMap map) {
public void displayGameMapLayout(LoadedGameMap map) {
if (map == null || !this.gameMapInfoSubConfig.isEnabled().get()) {
return;
}
ChatExecutor chat = this.addon.labyAPI().minecraft().chatExecutor();

if (addon.getManager().getMapName().equals(map.getName())) {
Expand Down Expand Up @@ -53,9 +56,9 @@ private void displayGameMapLayout(LoadedGameMap map) {
chat.displayClientMessage(display.append(Component.newline()));
}

// Force map layout, regardless of config
public boolean doGameMapLayout(String mapName) {
LoadedGameMap map = GameMapAPI.getInstance().getGameMapFromCache(this.addon.getManager().getDivision(), mapName);
GameMapInfoSubConfig config = this.addon.configuration().getGameMapInfoSubConfig();
if (map == null) {
return false;
}
Expand Down

0 comments on commit b474463

Please sign in to comment.