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

Hub: Code quality, enhancments and better maintainability #23

Open
wants to merge 15 commits into
base: staging
Choose a base branch
from
Open
Changes from 1 commit
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could make the compass slot and such a configuration option in the config yml instead of setting it static.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class HubPlayerJoin implements Listener {
// Misc settings
private static final boolean TEST_ALWAYS_FIRST_JOIN = false; // * default false
private static final int NAV_COMPASS_SLOT = 4;
private static final long ROUTINE_PLAYER_JOINED_DELAY = (long) (1.5f * 20);
private static final long ROUTINE_PLAYER_JOINED_DELAY = (long) (1.2f * 20);

// Firework settings
private static final double FIREWORK_GROUND_HEIGHT = 3; // blocks
Expand Down Expand Up @@ -107,16 +107,16 @@ public void onPlayerLogin(PlayerLoginEvent event) {
/// Best used for initial world interactions (player world state changes etc).
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
event.joinMessage(null); // * suppress default
Player player = event.getPlayer();
event.joinMessage(null); // * suppress default
chatJoinMessage(player);
setInitialState(player);
Bukkit.getScheduler().runTaskLater(plugin, () -> {
// * bukkit uses 'world/playerdata' dir for tracking
if (!player.hasPlayedBefore() || TEST_ALWAYS_FIRST_JOIN) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

player.hasPlayedBefore should always return a Boolean, not sure why the secondary test is present?

chatWelcomeMessage(player);
spawnWelcomeFirework(player);
}
chatJoinMessage(player);
playWelcomeSound(player);
}, ROUTINE_PLAYER_JOINED_DELAY);
}
Expand Down