RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Yell.java
1
package
com.osroyale.content;
2
3
import
com.osroyale.game.world.World;
4
import
com.osroyale.game.world.entity.mob.player.Player;
5
import
com.osroyale.game.world.entity.mob.player.PlayerRight;
6
import
com.osroyale.net.packet.out.SendMessage;
7
import
com.osroyale.util.Utility;
8
9
import
java.util.Arrays;
10
39
40
public
class
Yell
{
41
43
public
static
final
String[]
INVALID
= {
44
".com"
,
"@cr"
,
"<img="
,
"</col"
,
"<col="
,
45
"@whi@"
,
"@blu@"
,
"@gre@"
,
"@red@"
,
46
"@mag@"
,
"@cya@"
47
};
48
50
public
static
void
yell
(
Player
player, String message) {
51
if
(!
PlayerRight
.
isDonator
(player) && !
PlayerRight
.
isHelper
(player) && !
PlayerRight
.isOwner(player)) {
52
player.send(
new
SendMessage
(
"You must be a donator to use this command!"
));
53
return
;
54
}
55
56
if
(!player.settings.
yell
) {
57
player.send(
new
SendMessage
(
"You can not send a yell message as you have the yell setting disabled!"
));
58
return
;
59
}
60
61
if
(player.punishment.isMuted()) {
62
player.message(
"You are muted and can not yell!"
);
63
return
;
64
}
65
66
if
(player.punishment.isJailed()) {
67
player.message(
"You are jailed and can not yell!"
);
68
return
;
69
}
70
71
72
if
(Arrays.stream(
INVALID
).anyMatch(message::contains)) {
73
player.send(
new
SendMessage
(
"Your message contains invalid characters."
));
74
return
;
75
}
76
final
String prefix =
"[<col="
+ player.right.getColor() +
">"
+ player.right.
getName
() +
"</col>] <col="
+ player.right.getColor() +
">"
+ player.
getName
();
77
final
String formatted_message = prefix +
"</col>: "
+
Utility
.
capitalizeSentence
(message);
78
World
.
sendMessage
(formatted_message, exception -> exception.settings.yell);
79
System.out.println(
"Yell"
+formatted_message);
80
}
81
}
com.osroyale.content.Yell
Definition
Yell.java:40
com.osroyale.content.Yell.yell
static void yell(Player player, String message)
Definition
Yell.java:50
com.osroyale.content.Yell.INVALID
static final String[] INVALID
Definition
Yell.java:43
com.osroyale.game.world.World
Definition
World.java:83
com.osroyale.game.world.World.sendMessage
static void sendMessage(String... messages)
Definition
World.java:433
com.osroyale.game.world.entity.mob.player.Player
Definition
Player.java:162
com.osroyale.game.world.entity.mob.player.Player.getName
String getName()
Definition
Player.java:794
com.osroyale.game.world.entity.mob.player.Settings.yell
boolean yell
Definition
Settings.java:59
com.osroyale.net.packet.out.SendMessage
Definition
SendMessage.java:38
com.osroyale.util.Utility
Definition
Utility.java:64
com.osroyale.util.Utility.capitalizeSentence
static String capitalizeSentence(final String string)
Definition
Utility.java:136
com.osroyale.game.world.entity.mob.player.PlayerRight
Definition
PlayerRight.java:52
com.osroyale.game.world.entity.mob.player.PlayerRight.isHelper
static boolean isHelper(Player player)
Definition
PlayerRight.java:145
com.osroyale.game.world.entity.mob.player.PlayerRight.isDonator
static boolean isDonator(Player player)
Definition
PlayerRight.java:152
com.osroyale.game.world.entity.mob.player.PlayerRight.getName
String getName()
Definition
PlayerRight.java:316