RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.Yell Class Reference

Handles the yelling command. More...

Static Public Member Functions

static void yell (Player player, String message)
 Yells a message to the server.

Static Public Attributes

static final String[] INVALID
 Array of all invalid strings.

Detailed Description

Handles the yelling command.

Author
Daniel

Definition at line 16 of file Yell.java.

Member Function Documentation

◆ yell()

void com.runehive.content.Yell.yell ( Player player,
String message )
static

Yells a message to the server.

Definition at line 26 of file Yell.java.

26 {
27 if (!PlayerRight.isDonator(player) && !PlayerRight.isHelper(player) && !PlayerRight.isOwner(player)) {
28 player.send(new SendMessage("You must be a donator to use this command!"));
29 return;
30 }
31
32 if (!player.settings.yell) {
33 player.send(new SendMessage("You can not send a yell message as you have the yell setting disabled!"));
34 return;
35 }
36
37 if (player.punishment.isMuted()) {
38 player.message("You are muted and can not yell!");
39 return;
40 }
41
42 if (player.punishment.isJailed()) {
43 player.message("You are jailed and can not yell!");
44 return;
45 }
46
47
48 if (Arrays.stream(INVALID).anyMatch(message::contains)) {
49 player.send(new SendMessage("Your message contains invalid characters."));
50 return;
51 }
52 final String prefix = "[<col=" + player.right.getColor() + ">" + player.right.getName() + "</col>] <col=" + player.right.getColor() + ">" + player.getName();
53 final String formatted_message = prefix + "</col>: " + Utility.capitalizeSentence(message);
54 World.sendMessage(formatted_message, exception -> exception.settings.yell);
55 System.out.println("Yell" +formatted_message);
56 }

References com.runehive.util.Utility.capitalizeSentence(), com.runehive.game.world.entity.mob.player.PlayerRight.getColor(), com.runehive.game.world.entity.mob.player.Player.getName(), com.runehive.game.world.entity.mob.player.PlayerRight.getName(), INVALID, com.runehive.game.world.entity.mob.player.PlayerRight.isDonator(), com.runehive.game.world.entity.mob.player.PlayerRight.isHelper(), com.runehive.game.world.entity.mob.player.requests.PlayerPunishment.isJailed(), com.runehive.game.world.entity.mob.player.requests.PlayerPunishment.isMuted(), com.runehive.game.world.entity.mob.player.PlayerRight.isOwner(), com.runehive.game.world.entity.mob.player.Player.message(), com.runehive.game.world.entity.mob.player.Player.punishment, com.runehive.game.world.entity.mob.player.Player.right, com.runehive.game.world.entity.mob.player.Player.send(), com.runehive.game.world.World.sendMessage(), com.runehive.game.world.entity.mob.player.Player.settings, and com.runehive.game.world.entity.mob.player.Settings.yell.

Here is the call graph for this function:

Member Data Documentation

◆ INVALID

final String [] com.runehive.content.Yell.INVALID
static
Initial value:
= {
".com", "@cr", "<img=", "</col", "<col=",
"@whi@", "@blu@", "@gre@", "@red@",
"@mag@", "@cya@"
}

Array of all invalid strings.

Definition at line 19 of file Yell.java.

19 {
20 ".com", "@cr", "<img=", "</col", "<col=",
21 "@whi@", "@blu@", "@gre@", "@red@",
22 "@mag@", "@cya@"
23 };

Referenced by com.runehive.content.clanchannel.channel.ClanChannel.chat(), and yell().


The documentation for this class was generated from the following file: