-
Notifications
You must be signed in to change notification settings - Fork 1
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
palsmo
wants to merge
15
commits into
ModularSoftAU:staging
Choose a base branch
from
palsmo:zander-hub-event-playerjoin-improved
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6c4f0df
version number prints at server startup instead of ${plugin.version} …
palsmo d28121f
Code quality, enhancments and better maintainability
palsmo cff0dfd
join message should not be delayed
palsmo 9a23f5b
Extracted welcome sounds into its own class & wrote a friendly welcom…
palsmo f387bdd
Utility class should not be instantiated
palsmo 841390b
Better exception message.
palsmo 6388477
Fixed good integration with PremiumVanish, server will have uniform j…
palsmo f19ee38
Uncomment dependencies
palsmo b41d678
Using 'isConnected()' is most appropriate here, would correcly solve …
palsmo 0c15e01
Added check for if the firework would have been despawned etc. before…
palsmo 82eb9c6
Moved fields to top of class, as is standard.
palsmo f2649af
Small simplifications, added checks for functions that require their …
palsmo 98183d0
Fixed proper integration 'config.yml' + spilled out to a few other fi…
palsmo 0440e83
Removed debug code accidentally left behind
palsmo a07194f
Proper mirroring of resource files, new configs 'slot_hub_compass' & …
palsmo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.