Skip to content

Commit

Permalink
Completely refactor player listener
Browse files Browse the repository at this point in the history
  • Loading branch information
benwoo1110 committed Sep 25, 2023
1 parent 454bcd3 commit b4d86ac
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,8 @@ public void setJoinDestination(String alwaysSpawnDestination) {
}

@Override
@Nullable
public String getJoinDestination() {
if (Objects.equals(configHandle.get(configNodes.JOIN_DESTINATION), "")) {
return null;
}
return configHandle.get(configNodes.JOIN_DESTINATION);
return configHandle.get(configNodes.JOIN_DESTINATION);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
public class MVChatListener implements InjectableListener {
private final MVCoreConfig config;
private final WorldManager worldManager;
private final MVPlayerListener playerListener;

@Inject
MVChatListener(
Expand All @@ -26,7 +25,6 @@ public class MVChatListener implements InjectableListener {
MVPlayerListener playerListener) {
this.config = config;
this.worldManager = worldManager;
this.playerListener = playerListener;
}

/**
Expand All @@ -46,13 +44,7 @@ public void asyncPlayerChat(AsyncPlayerChatEvent event) {
return;
}

String world = playerListener.getPlayerWorld().get(event.getPlayer().getName());
if (world == null) {
world = event.getPlayer().getWorld().getName();
playerListener.getPlayerWorld().put(event.getPlayer().getName(), world);
}

String prefix = this.worldManager.getLoadedWorld(world)
String prefix = this.worldManager.getLoadedWorld(event.getPlayer().getWorld())
.map(mvworld -> mvworld.isHidden() ? "" : mvworld.getAlias())
.getOrElse("");
String chat = event.getFormat();
Expand Down

0 comments on commit b4d86ac

Please sign in to comment.