-
Notifications
You must be signed in to change notification settings - Fork 20
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
Changes from 6 commits
47cd73c
282f4b2
921b9e1
00a8ab0
1f17838
3df48fb
b578fee
c14b55d
be30415
baa942f
9693fb7
4003993
1ca7f94
c387f45
0b84b59
bcf7496
82b3f62
f08d5de
4d68c0a
6c60beb
3adbda6
3652094
bf0a261
b41ad23
86e8fc5
c82c5c4
2ca45ed
7617a31
9b50e5e
1301bf3
ee941b2
e08d6ce
1b84ebd
a976c3a
4d2a755
4e82785
d2b9764
81e607e
b8f2342
2311e28
77c942c
6bc3b93
beba7a9
bb1d3b9
4f03437
c8ca4b2
898eb4d
fdbd9b7
0f61260
8c6dbf2
991419f
ad0517e
59e7dd7
975b67f
39e707b
a54de44
0a3a163
c7a1e5b
85d7f64
5128823
0f8cc90
8068b72
8e78ea7
17396c7
a40c395
d0c0587
91f5ead
50505cd
4d03fb3
3dfda39
8aeb7de
b334808
cca345b
b4de51e
1dfd3e1
b463df5
2379982
55b65b4
b5be2a1
c642e80
5c20e33
5dff6a3
a427cf3
db289c2
2889df8
6bcde1e
6a55070
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
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:\n", "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
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. I suggest that you include the "greeting" part in a new player event so "greeting" does not message when you run the command again. |
||
|
||
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; | ||
} | ||
jasonappah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Player player = (Player) sender; | ||
jasonappah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for (String i : TutorialCommand.message) { | ||
jasonappah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sender.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + i); | ||
} | ||
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. Indentation |
||
|
||
return true; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"); | ||
} | ||
|
||
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. 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"); | ||
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. You should make a function called |
||
} | ||
} | ||
|
||
@EventHandler | ||
public void onPlayerLogin(final PlayerLoginEvent event) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,7 @@ commands: | |
tableflip: | ||
description: Appends a tableflip to your message | ||
usage: /tableflip [message] | ||
tutorial: | ||
description: Greets new users to the server | ||
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. fix description. the command itself does not greet new users.
|
||
usage: /tutorial | ||
|
||
jasonappah marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Can you use the Java code linter? It'll automatically split it into multiple lines.