Chat Refactor, chat suffixes and update bugfixes (#599)
This commit is contained in:
parent
6d42c5c075
commit
68e7361c00
@ -13,19 +13,30 @@ import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class UtilText
|
||||
{
|
||||
private static HashMap<Character, Integer> _characters = new HashMap<>();
|
||||
private static HashMap<Character, BufferedImage> _characterImages = new HashMap<>();
|
||||
private static Map<String, String> _leetReplace = new HashMap<>();
|
||||
private static Map<Character, Integer> _characters = new HashMap<>();
|
||||
private static Map<Character, BufferedImage> _characterImages = new HashMap<>();
|
||||
|
||||
private final static char[] VOWELS = new char[]{'a', 'e', 'i', 'o', 'u'};
|
||||
private final static char[] VOWELS = new char[]{'a', 'e', 'i', 'o', 'u'};
|
||||
|
||||
static
|
||||
{
|
||||
_leetReplace.put("4", "a");
|
||||
_leetReplace.put("3", "e");
|
||||
_leetReplace.put("6", "d");
|
||||
_leetReplace.put("1", "i");
|
||||
_leetReplace.put("0", "o");
|
||||
_leetReplace.put("5", "s");
|
||||
_leetReplace.put("7", "t");
|
||||
_leetReplace.put("_", "");
|
||||
|
||||
try
|
||||
{
|
||||
InputStream inputStream = UtilText.class.getResourceAsStream("/ascii.png");
|
||||
@ -834,6 +845,22 @@ public class UtilText
|
||||
RN_I[number % 10];
|
||||
}
|
||||
|
||||
|
||||
public static String replaceLeet(String in)
|
||||
{
|
||||
if (in.trim().isEmpty())
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> entry : _leetReplace.entrySet())
|
||||
{
|
||||
in = in.replaceAll(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
public static String capitalise(String input)
|
||||
{
|
||||
return Character.toUpperCase(input.charAt(0)) + input.toLowerCase().substring(1);
|
||||
|
@ -886,8 +886,8 @@ public class CoreClientManager extends MiniPlugin
|
||||
_loginProcessors.add(processor);
|
||||
}
|
||||
|
||||
public void loadLastLogin(int accountId, Consumer<Long> lastLogin)
|
||||
public void loadLastLogin(String name, Consumer<Long> lastLogin)
|
||||
{
|
||||
_repository.loadLastLogin(accountId, lastLogin);
|
||||
_repository.loadLastLogin(name, lastLogin);
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
@ -53,7 +52,7 @@ public class AccountRepository extends MinecraftRepository
|
||||
private static String SELECT_ACCOUNT_UUID_BY_ID = "SELECT uuid FROM accounts WHERE id=?;";
|
||||
private static String SELECT_ACCOUNT_ID_BY_UUID = "SELECT id FROM accounts WHERE accounts.uuid = ? LIMIT 1";
|
||||
|
||||
private static final String SELECT_LAST_LOGIN_BY_ID = "SELECT lastLogin FROM accounts WHERE id = ?";
|
||||
private static final String SELECT_LAST_LOGIN_BY_NAME = "SELECT lastLogin FROM accounts WHERE name = ? ORDER BY lastLogin DESC LIMIT 1;";
|
||||
|
||||
public AccountRepository()
|
||||
{
|
||||
@ -461,14 +460,14 @@ public class AccountRepository extends MinecraftRepository
|
||||
return handleSyncMSSQLCallStream("PlayerAccount/GetAccount", playerName);
|
||||
}
|
||||
|
||||
public void loadLastLogin(int accountId, Consumer<Long> lastLogin)
|
||||
public void loadLastLogin(String name, Consumer<Long> lastLogin)
|
||||
{
|
||||
UtilServer.runAsync(() ->
|
||||
{
|
||||
try (Connection connection = DBPool.getAccount().getConnection();
|
||||
PreparedStatement statement = connection.prepareStatement(SELECT_LAST_LOGIN_BY_ID))
|
||||
PreparedStatement statement = connection.prepareStatement(SELECT_LAST_LOGIN_BY_NAME))
|
||||
{
|
||||
statement.setInt(1, accountId);
|
||||
statement.setString(1, name);
|
||||
|
||||
try (ResultSet resultSet = statement.executeQuery())
|
||||
{
|
||||
|
@ -48,24 +48,15 @@ public class SeenCommand extends CommandBase<AdminCommands>
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.getCoreClientManager().getOrLoadClient(target, (client) ->
|
||||
Plugin.getCoreClientManager().loadLastLogin(target, (lastLogin) ->
|
||||
{
|
||||
if (client == null)
|
||||
if (lastLogin == null)
|
||||
{
|
||||
reply(caller, "The player " + F.name(target) + " was not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.getCoreClientManager().loadLastLogin(client.getAccountId(), (lastLogin) ->
|
||||
{
|
||||
if (lastLogin == null)
|
||||
{
|
||||
reply(caller, "Unable to load that player's last login. Try again later?");
|
||||
return;
|
||||
}
|
||||
|
||||
reply(caller, "The player " + F.name(target) + " last logged in at " + F.elem(UtilTime.when(lastLogin)));
|
||||
});
|
||||
reply(caller, "The player " + F.name(target) + " last logged in at " + F.elem(UtilTime.when(lastLogin)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.bonuses.gui.buttons.CarlSpinButton;
|
||||
import mineplex.core.bonuses.gui.buttons.ClaimTipsButton;
|
||||
import mineplex.core.bonuses.gui.buttons.DailyBonusButton;
|
||||
import mineplex.core.bonuses.gui.buttons.FacebookButton;
|
||||
import mineplex.core.bonuses.gui.buttons.DiscordButton;
|
||||
import mineplex.core.bonuses.gui.buttons.SocialMediaButton;
|
||||
import mineplex.core.bonuses.gui.buttons.LevelRewardsButton;
|
||||
import mineplex.core.bonuses.gui.buttons.PollButton;
|
||||
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
|
||||
import mineplex.core.bonuses.gui.buttons.RankBonusButton;
|
||||
import mineplex.core.bonuses.gui.buttons.TwitterButton;
|
||||
import mineplex.core.bonuses.gui.buttons.VoteButton;
|
||||
import mineplex.core.bonuses.gui.buttons.YoutubeButton;
|
||||
import mineplex.core.gui.SimpleGui;
|
||||
@ -26,12 +26,12 @@ public class BonusGui extends SimpleGui
|
||||
private static final int RANK_BONUS_SLOT = 10;
|
||||
private static final int DAILY_BONUS_SLOT = 12;
|
||||
private static final int POLL_SLOT = 28;
|
||||
private static final int FACEBOOK_SLOT = 20;
|
||||
private static final int DISCORD_SLOT = 20;
|
||||
private static final int CLAIM_TIPS_SLOT = 30;
|
||||
private static final int POWER_PLAY_SLOT = 16;
|
||||
private static final int CARL_SPINNER_SLOT = 14;
|
||||
private static final int YOUTUBE_SLOT = 24;
|
||||
private static final int TWITTER_SLOT = 34;
|
||||
private static final int SOCIAL_MEDIA_SLOT = 34;
|
||||
private static final int LEVEL_REWARDS_SLOT = 22;
|
||||
|
||||
private static final int INV_SIZE = 45;
|
||||
@ -48,11 +48,11 @@ public class BonusGui extends SimpleGui
|
||||
|
||||
setItem(POLL_SLOT, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager));
|
||||
|
||||
setItem(FACEBOOK_SLOT, new FacebookButton(player));
|
||||
setItem(SOCIAL_MEDIA_SLOT, new SocialMediaButton(player));
|
||||
|
||||
setItem(YOUTUBE_SLOT, new YoutubeButton(player, youtubeManager));
|
||||
|
||||
setItem(TWITTER_SLOT, new TwitterButton(player));
|
||||
setItem(DISCORD_SLOT, new DiscordButton(player));
|
||||
|
||||
setItem(CLAIM_TIPS_SLOT, new ClaimTipsButton(getPlugin(), player, this, manager, thankManager));
|
||||
|
||||
|
@ -1,32 +1,36 @@
|
||||
package mineplex.core.bonuses.gui.buttons;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gui.GuiItem;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class TwitterButton implements GuiItem
|
||||
public class DiscordButton implements GuiItem
|
||||
{
|
||||
private static final ItemStack ICON = new ItemBuilder(Material.EGG)
|
||||
.setTitle(C.cGreen + C.Bold + "Visit us on Twitter")
|
||||
private static final ItemStack ICON = new ItemBuilder(Material.STAINED_GLASS)
|
||||
// Cyan
|
||||
.setData((short) 9)
|
||||
.setTitle(C.cGreen + C.Bold + "Visit our Discord Server")
|
||||
.addLore(
|
||||
C.cWhite + "Check out and follow Mineplex on",
|
||||
C.cWhite + "Twitter for Giveaways, Announcements,",
|
||||
C.cWhite + "Teasers, and Tips!",
|
||||
C.cWhite + "Check our our official Discord server where",
|
||||
C.cWhite + "you will find news, changelogs, giveaways,",
|
||||
C.cWhite + "direct feedback to our admins, and more!",
|
||||
" ",
|
||||
C.cGreen + "Click to visit us on Twitter!"
|
||||
C.cGreen + "Click to visit our discord!"
|
||||
)
|
||||
.build();
|
||||
private static final String URL = "http://discord.mineplex.com";
|
||||
private final Player _player;
|
||||
|
||||
public TwitterButton(Player player)
|
||||
public DiscordButton(Player player)
|
||||
{
|
||||
this._player = player;
|
||||
}
|
||||
@ -46,9 +50,8 @@ public class TwitterButton implements GuiItem
|
||||
|
||||
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||
UtilPlayer.message(_player, "");
|
||||
|
||||
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player);
|
||||
new JsonMessage(" " + C.cGreen + C.Line + "https://www.twitter.com/Mineplex").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player);
|
||||
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, URL).sendToPlayer(_player);
|
||||
new JsonMessage(" " + C.cGreen + C.Line + URL).click(ClickEvent.OPEN_URL, URL).sendToPlayer(_player);
|
||||
UtilPlayer.message(_player, "");
|
||||
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||
}
|
@ -12,22 +12,26 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class FacebookButton implements GuiItem
|
||||
public class SocialMediaButton implements GuiItem
|
||||
{
|
||||
private static final ItemStack ICON = new ItemBuilder(Material.LAPIS_BLOCK)
|
||||
.setTitle(C.cGreen + C.Bold + "Visit us on Facebook")
|
||||
.setTitle(C.cGreen + C.Bold + "Visit our Social Media")
|
||||
.addLore(
|
||||
C.cWhite + "Be sure to \"Like\" us on",
|
||||
C.cWhite + "Facebook for Giveaways, Announcements,",
|
||||
C.cWhite + "and Much More!",
|
||||
" ",
|
||||
C.cGreen + "Click to visit us on Facebook!"
|
||||
C.cWhite + "Check out and follow Mineplex on",
|
||||
C.cWhite + "Twitter for Giveaways, Announcements,",
|
||||
C.cWhite + "Teasers, and Tips!",
|
||||
" ",
|
||||
C.cGreen + "Click to visit us on Facebook and Twitter!"
|
||||
)
|
||||
.build();
|
||||
|
||||
private final Player _player;
|
||||
|
||||
public FacebookButton(Player player)
|
||||
public SocialMediaButton(Player player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
@ -46,11 +50,17 @@ public class FacebookButton implements GuiItem
|
||||
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||
|
||||
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||
// FB
|
||||
UtilPlayer.message(_player, "");
|
||||
|
||||
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames").sendToPlayer(_player);
|
||||
new JsonMessage(" " + C.cGreen + C.Line + "https://www.facebook.com/MineplexGames").click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames").sendToPlayer(_player);
|
||||
UtilPlayer.message(_player, "");
|
||||
// Twitter
|
||||
UtilPlayer.message(_player, "");
|
||||
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player);
|
||||
new JsonMessage(" " + C.cGreen + C.Line + "https://www.twitter.com/Mineplex").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player);
|
||||
UtilPlayer.message(_player, "");
|
||||
|
||||
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||
}
|
||||
|
@ -0,0 +1,83 @@
|
||||
package mineplex.core.chat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import mineplex.core.common.util.UtilText;
|
||||
|
||||
public class BackupFilter
|
||||
{
|
||||
private static final List<String> INAPPROPRIATE_WORDS = Arrays.asList(
|
||||
"nigger", "honkey", "beaner", "chink", "anus", "anal", "ballsack",
|
||||
"nutsack", "bitch", "bastard", "cum", "jizz", "orgasm", "faggot",
|
||||
"fag", "faqq", "fuck", "fqck", "niqq", "masturbate", "wank",
|
||||
"penis", "dick", "cock", "porn", "rape", "queer", "dyke", "dildo",
|
||||
"shit", "tits", "vagina", "pussy", "twat", "cunt", "whore",
|
||||
"prostitute", "thot", "slut", "succ", "niger", "hypixel"
|
||||
);
|
||||
|
||||
private static String getFilterStars(String word)
|
||||
{
|
||||
StringBuilder stars = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < word.length(); i++)
|
||||
{
|
||||
stars.append("*");
|
||||
}
|
||||
|
||||
return stars.toString();
|
||||
}
|
||||
|
||||
public static String filterMessage(String message)
|
||||
{
|
||||
// Remove unicode and leet from the message
|
||||
String deLeeted = UtilText.replaceLeet(Chat.replaceUnicode(message));
|
||||
|
||||
if (deLeeted.trim().isEmpty())
|
||||
{
|
||||
return deLeeted;
|
||||
}
|
||||
|
||||
List<Boolean> starPositions = new ArrayList<>(Collections.nCopies(deLeeted.length(), false));
|
||||
|
||||
//Bukkit.broadcastMessage(starPositions.stream().map(v -> v ? "*" : "_").collect(Collectors.joining(",")));
|
||||
|
||||
for (String inappropriateWord : INAPPROPRIATE_WORDS)
|
||||
{
|
||||
String starred = deLeeted.replaceAll("(?i)" + inappropriateWord, getFilterStars(inappropriateWord));
|
||||
|
||||
for (int i = 0; i < starPositions.size(); i++)
|
||||
{
|
||||
if (starPositions.get(i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (starred.charAt(i) == '*')
|
||||
{
|
||||
starPositions.set(i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder(deLeeted);
|
||||
|
||||
for (int i = 0; i < starPositions.size(); i++)
|
||||
{
|
||||
if (starPositions.get(i))
|
||||
{
|
||||
builder.setCharAt(i, '*');
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static List<String> filterMessages(String... messages)
|
||||
{
|
||||
return Arrays.stream(messages).map(BackupFilter::filterMessage).collect(Collectors.toList());
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -23,22 +23,22 @@ public class SilenceCommand extends CommandBase<Chat>
|
||||
if (args.length == 0)
|
||||
{
|
||||
//Disable
|
||||
if (Plugin.Silenced() != 0)
|
||||
if (Plugin.getChatSilence() != 0)
|
||||
{
|
||||
Plugin.Silence(0, true);
|
||||
Plugin.setChatSilence(0, true);
|
||||
}
|
||||
//Enable
|
||||
else
|
||||
{
|
||||
Plugin.Silence(-1, true);
|
||||
Plugin.setChatSilence(-1, true);
|
||||
}
|
||||
}
|
||||
//Timer
|
||||
else
|
||||
{
|
||||
long time = (long) (Double.valueOf(args[0]) * 3600000);
|
||||
long time = (long) (Double.valueOf(args[0]) * 1000 * 60);
|
||||
|
||||
Plugin.Silence(time, true);
|
||||
Plugin.setChatSilence(time, true);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -0,0 +1,105 @@
|
||||
package mineplex.core.chat.command.extra;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.preferences.Preference;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
public class ChatExtraCommand extends CommandBase<Chat>
|
||||
{
|
||||
private static final long RECHARGE_TIME = 1000;
|
||||
private static final String RECHARGE_FORMAT = "ChatPrefixCmd-%s";
|
||||
private static final List<Pair<String[], String>> DEFAULT_EXTRA_COMMANDS = new ArrayList<>();
|
||||
private final String _extra;
|
||||
|
||||
static
|
||||
{
|
||||
addDefaultExtraCommand("ヽ༼ຈل͜ຈ༽ノ", "donger");
|
||||
addDefaultExtraCommand("¯\\_(ツ)_/¯", "shrug");
|
||||
addDefaultExtraCommand("༼ つ ◕_◕ ༽つ", "ameno");
|
||||
addDefaultExtraCommand("(╯°□°)╯︵ ┻━┻", "tableflip");
|
||||
addDefaultExtraCommand("┬─┬ノ(ಠ_ಠノ)", "tablesit");
|
||||
addDefaultExtraCommand("(౮⦦ʖ౮)", "lenny");
|
||||
addDefaultExtraCommand("ಠ_ಠ", "disapproval");
|
||||
addDefaultExtraCommand("(☞゚ヮ゚)☞", "same", "fingerguns", "thisguy");
|
||||
addDefaultExtraCommand("ლ(ಥ Д ಥ )ლ", "why");
|
||||
addDefaultExtraCommand("(≖_≖)", "squint");
|
||||
}
|
||||
|
||||
public ChatExtraCommand(Chat plugin, Permission permission, String extra, String... aliases)
|
||||
{
|
||||
super(plugin, permission, aliases);
|
||||
|
||||
_extra = extra;
|
||||
|
||||
CommandCenter.ALLOW_SPAM_IF_LAST.add(_extra);
|
||||
}
|
||||
|
||||
public ChatExtraCommand(Chat plugin, String extra, String... aliases)
|
||||
{
|
||||
this(plugin, Chat.Perm.CHAT_EXTRA_COMMAND, extra, aliases);
|
||||
}
|
||||
|
||||
public static void addCommands(Chat plugin)
|
||||
{
|
||||
for (Pair<String[], String> defaultCommand : DEFAULT_EXTRA_COMMANDS)
|
||||
{
|
||||
plugin.addCommand(new ChatExtraCommand(plugin, defaultCommand.getRight(), defaultCommand.getLeft()));
|
||||
}
|
||||
|
||||
plugin.addCommand(new ChatExtraCommand(plugin, Chat.Perm.MOD_CHAT_EXTRA_COMMAND, C.cGold + "›⪾", "fishy"));
|
||||
plugin.addCommand(new ChatExtraCommand(plugin, Chat.Perm.ADMIN_CHAT_EXTRA_COMMAND, C.cPurple + "(ノ◕ヮ◕)ノ*:・゚✧", "magic"));
|
||||
}
|
||||
|
||||
public static void addDefaultExtraCommand(String extra, String... aliases)
|
||||
{
|
||||
DEFAULT_EXTRA_COMMANDS.add(Pair.create(aliases, extra));
|
||||
}
|
||||
|
||||
private String getRechargeName()
|
||||
{
|
||||
return String.format(RECHARGE_FORMAT, _extra);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (!Recharge.Instance.use(caller, getRechargeName(), RECHARGE_TIME, false, false))
|
||||
{
|
||||
reply(caller, "Please wait before using that command again.");
|
||||
return;
|
||||
}
|
||||
|
||||
UtilServer.runAsync(() -> {
|
||||
String chatMessage = "";
|
||||
|
||||
if (args.length > 0)
|
||||
{
|
||||
chatMessage = Plugin.filterMessage(caller, Arrays.stream(args).collect(Collectors.joining(" "))) + " ";
|
||||
}
|
||||
|
||||
if (Plugin.getPreferencesManager().get(caller).isActive(Preference.COLOR_SUFFIXES))
|
||||
{
|
||||
chatMessage += Plugin.getClientManager().Get(caller).getPrimaryGroup().getColor() + _extra;
|
||||
}
|
||||
else
|
||||
{
|
||||
chatMessage += _extra;
|
||||
}
|
||||
|
||||
caller.chat(chatMessage.trim());
|
||||
});
|
||||
}
|
||||
}
|
@ -1,9 +1,14 @@
|
||||
package mineplex.core.command;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInTabComplete;
|
||||
@ -35,6 +40,7 @@ import mineplex.core.recharge.Recharge;
|
||||
|
||||
public class CommandCenter implements Listener, IPacketHandler
|
||||
{
|
||||
public static final List<String> ALLOW_SPAM_IF_LAST = new ArrayList<>();
|
||||
public static CommandCenter Instance;
|
||||
|
||||
protected JavaPlugin Plugin;
|
||||
@ -47,6 +53,8 @@ public class CommandCenter implements Listener, IPacketHandler
|
||||
|
||||
private static AtomicIntegerFieldUpdater<PlayerConnection> chatSpamField = null;
|
||||
|
||||
private Map<UUID, String> _playerLastCommand = new HashMap<>();
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
BLOCKED_COMMAND,
|
||||
@ -110,7 +118,9 @@ public class CommandCenter implements Listener, IPacketHandler
|
||||
args = argString.split(" ");
|
||||
}
|
||||
|
||||
ICommand command = Commands.get(commandName.toLowerCase());
|
||||
String commandLabel = commandName.toLowerCase();
|
||||
|
||||
ICommand command = Commands.get(commandLabel);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
@ -119,13 +129,24 @@ public class CommandCenter implements Listener, IPacketHandler
|
||||
if (ClientManager.Get(event.getPlayer()).hasPermission(command.getPermission())
|
||||
|| UtilPlayer.isCommandAllowed(event.getPlayer(), commandName.toLowerCase()))
|
||||
{
|
||||
// Disallow the player to spam if they have sent a command in the last 500ms,
|
||||
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast."));
|
||||
return;
|
||||
// They must have not sent a command yet,
|
||||
// or their command is not part of the whitelisted for spamming
|
||||
// and they didn't last send the same one (to prevent infinite chains)
|
||||
String lastCommand = _playerLastCommand.get(event.getPlayer().getUniqueId());
|
||||
|
||||
if (lastCommand == null || (!ALLOW_SPAM_IF_LAST.contains(lastCommand) && !lastCommand.equalsIgnoreCase(commandLabel)))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
command.SetAliasUsed(commandName.toLowerCase());
|
||||
_playerLastCommand.put(event.getPlayer().getUniqueId(), commandLabel);
|
||||
|
||||
command.SetAliasUsed(commandLabel);
|
||||
|
||||
if (command instanceof LoggedCommand)
|
||||
{
|
||||
|
@ -154,8 +154,6 @@ public class CommunityManager extends MiniDbClientPlugin<CommunityMemberData>
|
||||
_clientManager = require(CoreClientManager.class);
|
||||
_customDataManager = require(CustomDataManager.class);
|
||||
|
||||
_customDataManager.getRepository().registerKey(COMMUNITY_CHAT_KEY);
|
||||
|
||||
_clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor()
|
||||
{
|
||||
@Override
|
||||
@ -284,7 +282,7 @@ public class CommunityManager extends MiniDbClientPlugin<CommunityMemberData>
|
||||
|
||||
public boolean isNameAllowed(Player caller, String communityName)
|
||||
{
|
||||
return !Managers.get(Chat.class).getFilteredMessage(caller, communityName).contains("*");
|
||||
return !Managers.get(Chat.class).filterMessage(caller, communityName).contains("*");
|
||||
}
|
||||
|
||||
public void communityExists(String name, Consumer<Boolean> result)
|
||||
|
@ -62,7 +62,7 @@ public class CommunityDescriptionCommand extends CommandBase<CommunityManager>
|
||||
final String description = desc;
|
||||
Plugin.runAsync(() ->
|
||||
{
|
||||
if (Managers.get(Chat.class).getFilteredMessage(caller, description).contains("*"))
|
||||
if (Managers.get(Chat.class).filterMessage(caller, description).contains("*"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "That description is not allowed!"));
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.friend.FriendStatusType;
|
||||
import mineplex.core.friend.data.FriendData;
|
||||
import mineplex.core.friend.data.FriendStatus;
|
||||
import mineplex.core.ignore.IgnoreManager;
|
||||
@ -306,7 +307,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
public void DoMessageAdmin(Player from, Player to, String message)
|
||||
{
|
||||
// Inform
|
||||
UtilPlayer.message(from, C.cPurple + "-> " + _clientManager.Get(to).getRealOrDisguisedPrimaryGroup().getDisplay(true, false, false, true) + " " + to.getName() + " "
|
||||
UtilPlayer.message(from, C.cDPurple + "-> " + _clientManager.Get(to).getRealOrDisguisedPrimaryGroup().getDisplay(true, false, false, true) + " " + to.getName() + " "
|
||||
+ C.cPurple + message);
|
||||
|
||||
// Inform Admins
|
||||
@ -316,7 +317,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
{
|
||||
if (_clientManager.Get(staff).hasPermission(Perm.SEE_ADMIN))
|
||||
{
|
||||
UtilPlayer.message(staff, _clientManager.Get(from).getRealOrDisguisedPrimaryGroup().getDisplay(true, false, false, true) + " " + from.getName() + C.cPurple
|
||||
UtilPlayer.message(staff, _clientManager.Get(from).getRealOrDisguisedPrimaryGroup().getDisplay(true, false, false, true) + " " + from.getName() + C.cDPurple
|
||||
+ " -> " + _clientManager.Get(to).getRealOrDisguisedPrimaryGroup().getDisplay(true, false, false, true) + " " + to.getName() + " " + C.cPurple + message);
|
||||
}
|
||||
}
|
||||
@ -326,7 +327,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
Get(from).LastAdminTo = to.getName();
|
||||
|
||||
// Send
|
||||
UtilPlayer.message(to, C.cPurple + "<- " + _clientManager.Get(from).getRealOrDisguisedPrimaryGroup().getDisplay(true, false, false, true) + " " + from.getName() + " "
|
||||
UtilPlayer.message(to, C.cDPurple + "<- " + _clientManager.Get(from).getRealOrDisguisedPrimaryGroup().getDisplay(true, false, false, true) + " " + from.getName() + " "
|
||||
+ C.cPurple + message);
|
||||
|
||||
// Sound
|
||||
@ -421,7 +422,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
if (globalMessage.isStaffMessage())
|
||||
{
|
||||
// Message the receiver
|
||||
UtilPlayer.message(to, C.cPurple + "<- " + globalMessage.getRank() + " " + globalMessage.getSender() + " "
|
||||
UtilPlayer.message(to, C.cDPurple + "<- " + globalMessage.getRank() + " " + globalMessage.getSender() + " "
|
||||
+ C.cPurple + globalMessage.getMessage());
|
||||
|
||||
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
|
||||
@ -431,7 +432,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
// Message the sender
|
||||
RedisMessageCallback message = new RedisMessageCallback(globalMessage, true, to.getName(),
|
||||
|
||||
C.cPurple + "-> " + toRank + " " + to.getName() + " " + C.cPurple + globalMessage.getMessage(), false);
|
||||
C.cDPurple + "-> " + toRank + " " + to.getName() + " " + C.cPurple + globalMessage.getMessage(), false);
|
||||
|
||||
// Inform Admins
|
||||
for (Player staff : UtilServer.getPlayers())
|
||||
@ -544,6 +545,13 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
{
|
||||
for (FriendStatus friendInfo : friends.getFriends())
|
||||
{
|
||||
// Don't consider them "the friend" if their request has not been accepted
|
||||
// and the player doesn't want pending/prior requesting players to msg them
|
||||
if (friendInfo.Status != FriendStatusType.Accepted
|
||||
&& !_preferences.get(sender).isActive(Preference.UNCONFIRMED_FRIEND_MESSAGES))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// We don't grab this guy even if name matches because he is offline. This way, we can get a free message without
|
||||
// extra coding as we can't do anything extra with a offline friend..
|
||||
@ -566,7 +574,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
|
||||
runAsync(() ->
|
||||
{
|
||||
final String newMessage = _chat.getFilteredMessage(sender, message);
|
||||
final String newMessage = adminMessage ? message : _chat.filterMessage(sender, message);
|
||||
runSync(() -> sendMessage(sender, target, newMessage, adminMessage, isReply, friendInfo));
|
||||
});
|
||||
}
|
||||
|
@ -58,6 +58,12 @@ public enum Preference implements Permission
|
||||
|
||||
UNLOCK_KITS(true, PreferenceCategory.EXCLUSIVE, Material.IRON_DOOR, "Unlock All Kits", "Enabling this will allow you", "to have access to every kit ", "in every game for free!"),
|
||||
AUTO_QUEUE(true, PreferenceCategory.USER, Material.EMERALD, "Teleport to Game Area", "Enabling this will teleport you to the", "game area instead of opening the server", "selector when choosing a game."),
|
||||
|
||||
UNCONFIRMED_FRIEND_MESSAGES(true, PreferenceCategory.SOCIAL, Material.SKULL_ITEM, "Unconfirmed Friend Messages", "Enabling this will allow you to receive", "private messages from players who", "have a pending/prior friend request with you!"),
|
||||
|
||||
BYPASS_CHAT_FILTER(false, PreferenceCategory.EXCLUSIVE, Material.GLASS, "Bypass Chat Filter", "Enabling this will allow you", "to bypass the chat filter everywhere.", "", "Proceed with caution."),
|
||||
|
||||
COLOR_SUFFIXES(true, PreferenceCategory.USER, Material.WOOL, "Color Chat Suffixes", "Enabling this will color your", "chat suffixes like ¯\\_(ツ)_/¯", "based on your rank.")
|
||||
;
|
||||
|
||||
private static final Map<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap();
|
||||
|
@ -102,7 +102,14 @@ public class PreferencesManager extends MiniPlugin implements ILoginProcessor
|
||||
}
|
||||
else
|
||||
{
|
||||
PermissionGroup.PLAYER.setPermission(p, true, true);
|
||||
if (p == Preference.COLOR_SUFFIXES)
|
||||
{
|
||||
PermissionGroup.TITAN.setPermission(p, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
PermissionGroup.PLAYER.setPermission(p, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,9 @@ public class FileUpdater extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionGroup.MOD.setPermission(Perm.BVERSION_COMMAND, true, true);
|
||||
PermissionGroup.QA.setPermission(Perm.BVERSION_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.BVERSION_COMMAND, true, true);
|
||||
|
||||
PermissionGroup.ADMIN.setPermission(Perm.RESTART_COMMAND, true, true);
|
||||
PermissionGroup.QAM.setPermission(Perm.RESTART_COMMAND, false, true);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class Clans extends JavaPlugin
|
||||
StatsManager statsManager = new StatsManager(this, _clientManager);
|
||||
EloManager eloManager = new EloManager(this, _clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, incognito, eloManager);
|
||||
Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
||||
Chat chat = new Chat();
|
||||
new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat);
|
||||
|
||||
new MemoryFix(this);
|
||||
|
@ -948,7 +948,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
{
|
||||
for (Player cur : clan.getOnlinePlayers())
|
||||
{
|
||||
message = _chat.getFilteredMessage(player, message);
|
||||
message = _chat.filterMessage(player, message);
|
||||
|
||||
UtilPlayer.message(cur, String.format(rank + C.cAqua + "%s " + C.cDAqua + "%s", player.getName(), message));
|
||||
}
|
||||
@ -968,7 +968,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
ally.getOnlinePlayers().forEach(recipients::add);
|
||||
}
|
||||
|
||||
final String filtered = _chat.getFilteredMessage(player, message);
|
||||
final String filtered = _chat.filterMessage(player, message);
|
||||
|
||||
recipients.forEach(p -> UtilPlayer.message(p, String.format(rank + C.cDGreen + clan.getName() + " " + C.cDGreen + "%s " + C.cGreen + "%s", player.getName(), filtered)));
|
||||
|
||||
@ -993,7 +993,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
|
||||
List<Player> recipients = new ArrayList<>();
|
||||
|
||||
String message = event.getMessage();//_chat.getFilteredMessage(event.getPlayer(), event.getMessage());
|
||||
String message = event.getMessage();//_chat.filterMessage(event.getPlayer(), event.getMessage());
|
||||
|
||||
for (Player other : event.getRecipients())
|
||||
{
|
||||
|
@ -304,7 +304,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
}
|
||||
|
||||
if (Plugin.getChat().getFilteredMessage(caller, args[1]).contains("*"))
|
||||
if (Plugin.getChat().filterMessage(caller, args[1]).contains("*"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name inappropriate. Please try a different name"));
|
||||
return;
|
||||
|
@ -61,7 +61,7 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement
|
||||
|
||||
addTutorial(TutorialType.MAIN, new ClansMainTutorial(plugin, clansManager, _clansMessageManager, hologram, npcManager, taskManager));
|
||||
|
||||
chat.AddFilter(event ->
|
||||
chat.addFilter(event ->
|
||||
{
|
||||
if (inTutorial(event.getPlayer()))
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ public class ClansHub extends JavaPlugin
|
||||
|
||||
ClansTransferManager serverManager = new ClansTransferManager(this, clientManager, donationManager, partyManager, portal);
|
||||
|
||||
Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
||||
Chat chat = new Chat();
|
||||
new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
|
||||
new MemoryFix(this);
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.CLANS_HUB);
|
||||
|
@ -157,7 +157,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
|
||||
require(MineplexGameManager.class);
|
||||
|
||||
Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
||||
Chat chat = new Chat();
|
||||
new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
|
||||
new MemoryFix(this);
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB);
|
||||
|
@ -69,7 +69,8 @@ public class StaffServer extends JavaPlugin
|
||||
StatsManager statsManager = new StatsManager(this, clientManager);
|
||||
InventoryManager inventoryManager = new InventoryManager(this, clientManager);
|
||||
BonusRepository bonusRepository = new BonusRepository(this, null, donationManager);
|
||||
new Chat(this, null, clientManager, preferenceManager, new AchievementManager(statsManager, clientManager, donationManager, null, eloManager), serverStatusManager.getCurrentServerName());
|
||||
new AchievementManager(statsManager, clientManager, donationManager, null, eloManager);
|
||||
new Chat();
|
||||
new MemoryFix(this);
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB);
|
||||
|
||||
|
@ -179,7 +179,7 @@ public class Arcade extends JavaPlugin
|
||||
EloManager eloManager = new EloManager(this, _clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, incognito, eloManager);
|
||||
FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal);
|
||||
Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
||||
Chat chat = new Chat();
|
||||
new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
|
||||
|
||||
SnapshotManager snapshotManager = new SnapshotManager(this, new SnapshotRepository(serverStatusManager.getCurrentServerName(), getLogger()));
|
||||
|
@ -1106,30 +1106,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
return GetServerConfig().MaxPlayers;
|
||||
}
|
||||
|
||||
public void HubClock(Player player)
|
||||
{
|
||||
if (!IsHotbarHubClock())
|
||||
return;
|
||||
|
||||
if (_game != null && !_game.GiveClock)
|
||||
return;
|
||||
|
||||
if (player.getOpenInventory().getType() != InventoryType.CRAFTING &&
|
||||
player.getOpenInventory().getType() != InventoryType.CREATIVE)
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(player.getInventory().getItem(8), Material.WATCH) && !UtilGear.isMat(player.getInventory().getItem(8), Material.SPECKLED_MELON))
|
||||
{
|
||||
player.getInventory().setItem(
|
||||
8,
|
||||
ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, (short) 0, C.cGreen
|
||||
+ "Return to Hub", new String[]{"", ChatColor.RESET + "Click while holding this",
|
||||
ChatColor.RESET + "to return to the Hub."}));
|
||||
|
||||
UtilInv.Update(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Login(PlayerLoginEvent event)
|
||||
{
|
||||
@ -1290,8 +1266,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
for (PotionEffect potion : player.getActivePotionEffects())
|
||||
player.removePotionEffect(potion.getType());
|
||||
|
||||
HubClock(player);
|
||||
|
||||
Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.MORPH);
|
||||
if (morph != null && morph.isActive(player))
|
||||
morph.disable(player);
|
||||
|
@ -1485,7 +1485,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
AnnounceGame(player);
|
||||
|
||||
if (AnnounceSilence)
|
||||
Manager.GetChat().Silence(PrepareTime, false);
|
||||
Manager.GetChat().setChatSilence(PrepareTime, false);
|
||||
}
|
||||
|
||||
public void AnnounceGame(Player player)
|
||||
@ -1615,7 +1615,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20);
|
||||
|
||||
if (AnnounceSilence)
|
||||
Manager.GetChat().Silence(5000, false);
|
||||
Manager.GetChat().setChatSilence(5000, false);
|
||||
|
||||
endElo();
|
||||
}
|
||||
@ -1689,7 +1689,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20);
|
||||
|
||||
if (AnnounceSilence)
|
||||
Manager.GetChat().Silence(5000, false);
|
||||
Manager.GetChat().setChatSilence(5000, false);
|
||||
|
||||
endElo();
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class Draw extends SoloGame
|
||||
{
|
||||
"Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat",
|
||||
"Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper",
|
||||
"Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario",
|
||||
"Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Photo", "Quick", "Mario",
|
||||
"Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet",
|
||||
"Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi",
|
||||
"Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon",
|
||||
@ -153,7 +153,7 @@ public class Draw extends SoloGame
|
||||
"Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe",
|
||||
"Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit",
|
||||
"Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray",
|
||||
"Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club",
|
||||
"Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Batman", "Eggs", "Teapot", "Golf Club",
|
||||
"Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney",
|
||||
"Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree",
|
||||
"Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump",
|
||||
@ -162,7 +162,7 @@ public class Draw extends SoloGame
|
||||
"Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse",
|
||||
"Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time",
|
||||
"Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil",
|
||||
"Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb",
|
||||
"Bagel", "Bench", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb",
|
||||
"Tomato", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator",
|
||||
"Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party",
|
||||
"Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase",
|
||||
|
@ -61,7 +61,7 @@ public class DrawRound
|
||||
|
||||
UtilPlayer.message(Drawer, C.cWhite + C.Bold + "You must draw: " + C.cGreen + C.Bold + Word);
|
||||
|
||||
Host.Manager.GetChat().Silence(0, false);
|
||||
Host.Manager.GetChat().setChatSilence(0, false);
|
||||
}
|
||||
|
||||
public boolean Guessed(Player player)
|
||||
|
@ -1076,7 +1076,7 @@ public class EventModule extends MiniPlugin
|
||||
commandHelp(player);
|
||||
}
|
||||
|
||||
//Silence
|
||||
//setChatSilence
|
||||
public void commandSilence(Player player, String[] args)
|
||||
{
|
||||
try
|
||||
@ -1085,14 +1085,14 @@ public class EventModule extends MiniPlugin
|
||||
if (args.length == 1)
|
||||
{
|
||||
//Disable
|
||||
if (Manager.GetChat().Silenced() != 0)
|
||||
if (Manager.GetChat().getChatSilence() != 0)
|
||||
{
|
||||
Manager.GetChat().Silence(0, true);
|
||||
Manager.GetChat().setChatSilence(0, true);
|
||||
}
|
||||
//Enable
|
||||
else
|
||||
{
|
||||
Manager.GetChat().Silence(-1, true);
|
||||
Manager.GetChat().setChatSilence(-1, true);
|
||||
}
|
||||
}
|
||||
//Timer
|
||||
@ -1100,7 +1100,7 @@ public class EventModule extends MiniPlugin
|
||||
{
|
||||
long time = (long) (Double.valueOf(args[1]) * 3600000);
|
||||
|
||||
Manager.GetChat().Silence(time, true);
|
||||
Manager.GetChat().setChatSilence(time, true);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -105,8 +105,6 @@ public class HotbarEditor extends Module
|
||||
{
|
||||
if (event.GetState() == Game.GameState.Recruit)
|
||||
{
|
||||
getGame().getArcadeManager().getCustomDataManager().getRepository().registerKey(HOTBAR_DATA_KEY);
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.getInventory().setItem(0, _item);
|
||||
|
@ -1087,7 +1087,7 @@ public class Minestrike extends TeamGame
|
||||
_shopManager.leaveShop(player, false, false);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void specToTeam(PlayerJoinEvent event)
|
||||
{
|
||||
if (GetState() == GameState.Recruit || GetState() == GameState.Loading)
|
||||
|
@ -674,9 +674,9 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
private void silenceChat()
|
||||
{
|
||||
if (Manager.GetChat().Silenced() < 0)
|
||||
if (Manager.GetChat().getChatSilence() < 0)
|
||||
{
|
||||
Manager.GetChat().Silence(SILENCE_DURATION, false);
|
||||
Manager.GetChat().setChatSilence(SILENCE_DURATION, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class PrepareManager implements Listener
|
||||
}
|
||||
|
||||
_host.SetStateTime(System.currentTimeMillis());
|
||||
_host.getArcadeManager().GetChat().Silence(-1, false);
|
||||
_host.getArcadeManager().GetChat().setChatSilence(-1, false);
|
||||
_host.PrepareTime = POST_SELECTION_PREPARE_TIME;
|
||||
_host.PrepareFreeze = true;
|
||||
}
|
||||
@ -164,6 +164,6 @@ public class PrepareManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
_host.getArcadeManager().GetChat().Silence(0, true);
|
||||
_host.getArcadeManager().GetChat().setChatSilence(0, true);
|
||||
}
|
||||
}
|
||||
|
@ -1194,7 +1194,7 @@ public abstract class UHC extends Game
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
Manager.GetChat().Silence(1000 * 120, false);
|
||||
Manager.GetChat().setChatSilence(1000 * 120, false);
|
||||
|
||||
_isTeleporting = true;
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package nautilus.game.arcade.game.modules;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -13,25 +15,38 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.portal.GenericServer;
|
||||
import mineplex.core.portal.Intent;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.managers.GameSpectatorManager;
|
||||
|
||||
public class HubClockModule extends Module
|
||||
{
|
||||
private static final int HUB_CLOCK_SLOT = 8;
|
||||
private static final ItemStack HUB_CLOCK_ITEM = ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, (short) 0, C.cGreen
|
||||
+ "Return to Hub", new String[]{"", ChatColor.RESET + "Click while holding this",
|
||||
ChatColor.RESET + "to return to the Hub."});
|
||||
private static final ItemStack HUB_CLOCK_ITEM = ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, (short) 0,
|
||||
C.cGreen + "Return to Hub",
|
||||
new String[]{"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."});
|
||||
|
||||
public HubClockModule()
|
||||
{
|
||||
Player[] players = UtilServer.getPlayers();
|
||||
|
||||
if (players.length > 0)
|
||||
{
|
||||
Arrays.stream(players).forEach(this::giveClock);
|
||||
}
|
||||
}
|
||||
|
||||
public void giveClock(Player player)
|
||||
{
|
||||
if (!getGame().GiveClock)
|
||||
if (getGame() != null && !getGame().GiveClock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -39,12 +54,33 @@ public class HubClockModule extends Module
|
||||
player.getInventory().setItem(HUB_CLOCK_SLOT, HUB_CLOCK_ITEM);
|
||||
}
|
||||
|
||||
public void removeClock(Player player)
|
||||
{
|
||||
if (!player.getInventory().getItem(HUB_CLOCK_SLOT).equals(HUB_CLOCK_ITEM))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.getInventory().remove(HUB_CLOCK_ITEM);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void giveOnJoin(PlayerJoinEvent event)
|
||||
{
|
||||
giveClock(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void giveOnNextLobby(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != Game.GameState.Recruit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Arrays.stream(UtilServer.getPlayers()).forEach(this::giveClock);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void giveOnDeath(PlayerStateChangeEvent event)
|
||||
{
|
||||
@ -57,6 +93,19 @@ public class HubClockModule extends Module
|
||||
getGame().getArcadeManager().runSyncLater(() -> giveClock(event.GetPlayer()), GameSpectatorManager.ITEM_GIVE_DELAY);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void removeOnRespawn(PlayerStateChangeEvent event)
|
||||
{
|
||||
// Only handle when the player is now in.
|
||||
// This should make MS not have a persistent clock after round end
|
||||
if (event.GetState() != GameTeam.PlayerState.IN)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
removeClock(event.GetPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preventDrop(PlayerDropItemEvent event)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ public abstract class GameTutorial
|
||||
phase.setText(newText);
|
||||
}
|
||||
|
||||
Manager.GetChat().Silence(60000, false);
|
||||
Manager.GetChat().setChatSilence(60000, false);
|
||||
_started = System.currentTimeMillis();
|
||||
Manager.getPluginManager().callEvent(new GameTutorialStartEvent(this));
|
||||
onStart();
|
||||
@ -135,7 +135,7 @@ public abstract class GameTutorial
|
||||
// setting another Phase, if Tutorial hasn't stopped yet
|
||||
if (!_hasEnded)
|
||||
{
|
||||
Manager.GetChat().Silence(70000, false);
|
||||
Manager.GetChat().setChatSilence(70000, false);
|
||||
onPhaseChange(_currentPhase);
|
||||
Manager.getPluginManager().callEvent(new GameTutorialPhaseEvent(this, from, _currentPhase));
|
||||
_currentPhase.start(phaseOne);
|
||||
@ -184,7 +184,7 @@ public abstract class GameTutorial
|
||||
}
|
||||
}
|
||||
// setting the right prepare Time after the Tutorial ends
|
||||
Manager.GetChat().Silence(StartAfterTutorial, false);
|
||||
Manager.GetChat().setChatSilence(StartAfterTutorial, false);
|
||||
Manager.GetGame().PrepareTime = (System.currentTimeMillis() - Manager.GetGame().GetStateTime()) + StartAfterTutorial;
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ public class GameHostManager implements Listener
|
||||
}
|
||||
msg = msg.trim();
|
||||
|
||||
msg = Manager.GetChat().getFilteredMessage(event.getPlayer(), msg);
|
||||
msg = Manager.GetChat().filterMessage(event.getPlayer(), msg);
|
||||
|
||||
if (msg == null)
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ public class GameSpectatorManager implements Listener, IPacketHandler
|
||||
{
|
||||
// Common delay for giving items when a spectator dies,
|
||||
// to prevent them from accidentally switching servers.
|
||||
public final static long ITEM_GIVE_DELAY = 3 * 20L;
|
||||
public final static long ITEM_GIVE_DELAY = 30L;
|
||||
|
||||
// A map of a player UUID to the UUID of the entity they want to spectate
|
||||
private final Map<UUID, UUID> _pendingSpectate = Collections.synchronizedMap(new HashMap<>());
|
||||
|
@ -176,9 +176,9 @@ public class GameChatManager implements Listener
|
||||
|
||||
name = _manager.GetColor(sender) + sender.getName() + C.Reset;
|
||||
if (event.getMessage().charAt(0) == '#')
|
||||
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage().substring(1, event.getMessage().length()));
|
||||
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + event.getMessage().substring(1);
|
||||
else
|
||||
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage());
|
||||
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + event.getMessage();
|
||||
|
||||
if (_manager.GetGame() == null || _manager.GetGame().GetState() != GameState.Live)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ public class Hub extends JavaPlugin
|
||||
EloManager eloManager = new EloManager(this, _clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, incognito, eloManager);
|
||||
FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal);
|
||||
Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
||||
Chat chat = new Chat();
|
||||
new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
|
||||
|
||||
BlockRestore blockRestore = require(BlockRestore.class);
|
||||
|
@ -210,7 +210,7 @@ public class GemHunters extends JavaPlugin
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, incognito, eloManager);
|
||||
|
||||
// Chat/Messaging
|
||||
Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
||||
Chat chat = new Chat();
|
||||
new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, clientManager, preferenceManager, portal), chat);
|
||||
|
||||
// Parties
|
||||
|
@ -99,7 +99,7 @@ public class ChatModule extends MiniPlugin
|
||||
message = _progression.getTitle(_economy.getGems(player)).getTitle() + " " + message + C.cWhite;
|
||||
}
|
||||
|
||||
message += _chat.getFilteredMessage(player, event.getMessage());
|
||||
message += _chat.filterMessage(player, event.getMessage());
|
||||
|
||||
message = message.trim();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user