Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completely refactor player listener #3036

Draft
wants to merge 1 commit into
base: MV5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading