RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Yell.java
1package com.osroyale.content;
2
3import com.osroyale.game.world.World;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.game.world.entity.mob.player.PlayerRight;
6import com.osroyale.net.packet.out.SendMessage;
7import com.osroyale.util.Utility;
8
9import java.util.Arrays;
10
39
40public 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}
static void yell(Player player, String message)
Definition Yell.java:50
static final String[] INVALID
Definition Yell.java:43
static void sendMessage(String... messages)
Definition World.java:433
static String capitalizeSentence(final String string)
Definition Utility.java:136