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

Add greeting for new players through /tutorial #88

Closed
wants to merge 87 commits into from
Closed
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
47cd73c
Created TutorialCommand.java
jasonappah Apr 30, 2020
282f4b2
Added /tutorial to plugins.yml
jasonappah Apr 30, 2020
921b9e1
Added tutorial command to PlayerListener.java
jasonappah Apr 30, 2020
00a8ab0
Finished /tutorial command
jasonappah Apr 30, 2020
1f17838
Run /tutorial when new players join
jasonappah Apr 30, 2020
3df48fb
remove extra space in plugin.yml
jasonappah May 1, 2020
b578fee
capitalized name of static array message
jasonappah May 1, 2020
c14b55d
Merge branch 'master' into master
nice6599 May 2, 2020
be30415
Get rid of unused variable player
jasonappah May 3, 2020
baa942f
Moved for loop into if else statement
jasonappah May 3, 2020
9693fb7
Simplified L26
jasonappah May 3, 2020
4003993
Removed extra spaces
jasonappah May 3, 2020
1ca7f94
Merge branch 'master' of https://github.com/jasonappah/HCCore
jasonappah May 3, 2020
c387f45
Merge branch 'master' into master
jasonappah May 9, 2020
0b84b59
Fix autocomplete for second parameter of /stats (#95)
nice6599 May 13, 2020
bcf7496
Exclude AFKed players from the sleep threshold (#92)
harbar20 May 17, 2020
82b3f62
Fix NPEs in SleepListener on player quit (#99)
ifvictr May 21, 2020
f08d5de
Disallow AFK players from sleeping (#98)
ifvictr May 21, 2020
4d68c0a
Make /spawn message clearer (#100)
ifvictr Jun 19, 2020
6c60beb
Upgrade dependencies to 1.16
ifvictr Jul 1, 2020
3adbda6
Download 1.16 Spigot JAR on Travis build
ifvictr Jul 1, 2020
3652094
Fix advancement message colors
ifvictr Jul 1, 2020
bf0a261
Use license's full name [skip ci]
ifvictr Jul 1, 2020
b41ad23
Added /upvote and /downvote (#103)
rfblock Jul 16, 2020
86e8fc5
Change /downvote from aqua to blue (#105)
rfblock Jul 16, 2020
c82c5c4
Added Pigstep to Musicophile (#107)
rfblock Jul 17, 2020
2ca45ed
Show usernames when hovering on player nickname in chat (#108)
rfblock Aug 13, 2020
7617a31
migrate to gradle
hyperupcall Nov 8, 2020
9b50e5e
fix: remove accidentally commited Justfile
hyperupcall Nov 8, 2020
1301bf3
ci: remove maven
hyperupcall Nov 12, 2020
ee941b2
ci: fix travis
hyperupcall Nov 12, 2020
e08d6ce
ci: fix gradle scan
hyperupcall Nov 12, 2020
1b84ebd
ci: travis don't daemonize
hyperupcall Nov 12, 2020
a976c3a
ci: remove gradle scan
hyperupcall Nov 12, 2020
4d2a755
ci: fix java installation
hyperupcall Nov 12, 2020
4e82785
ci: add maven central
hyperupcall Nov 12, 2020
d2b9764
Allow spaces in loc command
wei2gao Apr 15, 2020
81e607e
Use built-in functions for string joining
wei2gao Apr 15, 2020
b8f2342
Delimit location names with underscores
wei2gao Apr 15, 2020
2311e28
Replace argString with locationName
wei2gao Apr 15, 2020
77c942c
Remove getArgAsString, it's not necessary
wei2gao Apr 16, 2020
6bc3b93
Remove space
ifvictr Apr 16, 2020
beba7a9
Location sharing, first implementation attempt
wei2gao Apr 15, 2020
bb1d3b9
Bring up to date with master
wei2gao Apr 17, 2020
4f03437
Location sharing (not well tested)
wei2gao Apr 22, 2020
c8ca4b2
Implement @ifvictr's suggestions
zanedb Nov 9, 2020
898eb4d
docs: add documentation for setting up environment
hyperupcall Nov 6, 2020
fdbd9b7
Fix typos
ifvictr Nov 7, 2020
0f61260
Make heading levels descend by one
ifvictr Nov 7, 2020
8c6dbf2
Replace "l" with vertical bar in usage message
ifvictr Nov 7, 2020
991419f
Update point-of-contact
zanedb Nov 12, 2020
ad0517e
fix: modify SETUP for Gradle
hyperupcall Nov 12, 2020
59e7dd7
Download 1.16.4 server JAR on Travis builds
ifvictr Nov 7, 2020
975b67f
Depend on 1.16.4
ifvictr Nov 7, 2020
39e707b
fix: actually merge properly
hyperupcall Nov 12, 2020
a54de44
Update ping message for new joiners
faisalsayed10 Jun 26, 2021
0a3a163
Remove deploy section as that is broken because of the migration to t…
Jul 5, 2021
c7a1e5b
Added Discord integration
elinicksic May 24, 2021
85d7f64
Update to 1.17
elinicksic Jun 19, 2021
5128823
Fixed build.gradle to include JDA in the jar
elinicksic Jun 20, 2021
0f8cc90
Update the travis for 1.17
elinicksic Jul 6, 2021
8068b72
Added /tutorial to plugins.yml
jasonappah Apr 30, 2020
8e78ea7
Added tutorial command to PlayerListener.java
jasonappah Apr 30, 2020
17396c7
Created TutorialCommand.java
jasonappah Apr 30, 2020
a40c395
Added /tutorial to plugins.yml
jasonappah Apr 30, 2020
d0c0587
Added tutorial command to PlayerListener.java
jasonappah Apr 30, 2020
91f5ead
Finished /tutorial command
jasonappah Apr 30, 2020
50505cd
Run /tutorial when new players join
jasonappah Apr 30, 2020
4d03fb3
capitalized name of static array message
jasonappah May 1, 2020
3dfda39
Get rid of unused variable player
jasonappah May 3, 2020
8aeb7de
Moved for loop into if else statement
jasonappah May 3, 2020
b334808
Simplified L26
jasonappah May 3, 2020
cca345b
Removed extra spaces
jasonappah May 3, 2020
b4de51e
Added /upvote and /downvote (#103)
rfblock Jul 16, 2020
1dfd3e1
Allow spaces in loc command
wei2gao Apr 15, 2020
b463df5
Delimit location names with underscores
wei2gao Apr 15, 2020
2379982
Replace argString with locationName
wei2gao Apr 15, 2020
55b65b4
Remove getArgAsString, it's not necessary
wei2gao Apr 16, 2020
b5be2a1
Added Discord integration
elinicksic May 24, 2021
c642e80
Added /tutorial to plugins.yml
jasonappah Apr 30, 2020
5c20e33
Added tutorial command to PlayerListener.java
jasonappah Apr 30, 2020
5dff6a3
chore: undo accidental version change
jasonappah Jul 6, 2021
a427cf3
chore: merge
jasonappah Jul 6, 2021
db289c2
Update src/main/java/com/hackclub/hccore/commands/TutorialCommand.java
jasonappah Jul 6, 2021
2889df8
chore: remove broken import
jasonappah Jul 6, 2021
6bcde1e
feat+refactor: separate greeting/rules message
jasonappah Jul 14, 2021
6a55070
style: lint and format
jasonappah Jul 14, 2021
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
2 changes: 2 additions & 0 deletions src/main/java/com/hackclub/hccore/HCCorePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.hackclub.hccore.commands.SpawnCommand;
import com.hackclub.hccore.commands.StatsCommand;
import com.hackclub.hccore.commands.TableflipCommand;
import com.hackclub.hccore.commands.TutorialCommand;
import com.hackclub.hccore.listeners.AFKListener;
import com.hackclub.hccore.listeners.AdvancementListener;
import com.hackclub.hccore.listeners.BeehiveInteractionListener;
Expand Down Expand Up @@ -63,6 +64,7 @@ public void onEnable() {
this.getCommand("spawn").setExecutor(new SpawnCommand(this));
this.getCommand("stats").setExecutor(new StatsCommand(this));
this.getCommand("tableflip").setExecutor(new TableflipCommand(this));
this.getCommand("tutorial").setExecutor(new TutorialCommand(this));

// Register event listeners
this.getServer().getPluginManager().registerEvents(new AdvancementListener(this), this);
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/com/hackclub/hccore/commands/TutorialCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.hackclub.hccore.commands;

import com.hackclub.hccore.HCCorePlugin;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class TutorialCommand implements CommandExecutor {
private static final String[] MESSAGE = {ChatColor.RED + "Greetings! Welcome to the Hack Club vanilla Minecraft server!", "You can use /nick to set your nick name and /color to set your chat and name colors", ChatColor.RED + "Rules:", "Be nice.", "No griefing.", "Don't build within 1000 blocks of spawn.", "If you want to contribute to plugin development head on over to the GitHub: " + ChatColor.RED + "https://github.com/hackclub/HCCore/. ", "Type /tutorial to see this at any time."};
jasonappah marked this conversation as resolved.
Show resolved Hide resolved

private final HCCorePlugin plugin;

public TutorialCommand(HCCorePlugin plugin) {
this.plugin = plugin;
}

@Override
public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "You must be a player to use this");
return true;
} else {
for (String message : TutorialCommand.MESSAGE) {
sender.sendMessage(ChatColor.YELLOW + ChatColor.BOLD.toString() + message);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indentation

}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ public void onPlayerJoin(final PlayerJoinEvent event) {
event.getPlayer().resetTitle();
event.setJoinMessage(ChatColor.YELLOW
+ ChatColor.stripColor(event.getPlayer().getDisplayName()) + " joined the game");
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you fix the indentation here?

if (event.getPlayer().hasPlayedBefore() == false) {
jasonappah marked this conversation as resolved.
Show resolved Hide resolved
event.getPlayer().performCommand("tutorial");
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should make a function called startTutorialFlow that takes a player as the parameter. This feels a little hacky lol.

}
}

@EventHandler
public void onPlayerLogin(final PlayerLoginEvent event) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ commands:
tableflip:
description: Appends a tableflip to your message
usage: /tableflip [message]
tutorial:
description: Greets new users to the server
Copy link
Collaborator

Choose a reason for hiding this comment

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

fix description. the command itself does not greet new users.

I suggest that you include the "greeting" part in a new player event so "greeting" does not message when you run the command again.

usage: /tutorial