mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2024-11-25 11:35:36 +01:00
Don't truncate linked messages.
Tokenize smsg response correctly.
This commit is contained in:
parent
5728d279e7
commit
d5d3f02a9d
@ -82,7 +82,7 @@ public class SMsg implements IRCCommandInterface {
|
||||
String targetMsg = plugin.tokenizer.gameChatTokenizer(player, template, msg);
|
||||
String responseTemplate = plugin.getMsgTemplate("MAIN", "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
if (!responseTemplate.isEmpty()) {
|
||||
String responseMsg = plugin.tokenizer.gameChatTokenizer(player, responseTemplate, msg);
|
||||
String responseMsg = plugin.tokenizer.msgChatResponseTokenizer(player.getName(), responseTemplate, msg);
|
||||
sender.sendMessage(responseMsg);
|
||||
}
|
||||
plugin.logDebug("Tokenized message: " + targetMsg);
|
||||
@ -120,12 +120,12 @@ public class SMsg implements IRCCommandInterface {
|
||||
if (ircBot.botLinkingEnabled) {
|
||||
final String template = plugin.getMsgTemplate(ircBot.botNick, "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
if (sender instanceof Player) {
|
||||
ircBot.msgRemotePlayer((Player) sender, remoteBot, remotePlayer, msg.substring(1));
|
||||
ircBot.msgRemotePlayer((Player) sender, remoteBot, remotePlayer, msg);
|
||||
} else {
|
||||
ircBot.msgRemotePlayer(sender, remoteBot, remotePlayer, msg.substring(1));
|
||||
ircBot.msgRemotePlayer(sender, remoteBot, remotePlayer, msg);
|
||||
}
|
||||
if (!template.isEmpty()) {
|
||||
sender.sendMessage(plugin.tokenizer.msgChatResponseTokenizer(target, msg.substring(1), template));
|
||||
sender.sendMessage(plugin.tokenizer.msgChatResponseTokenizer(target, msg, template));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Chris Naude This thread checks each for users and updates the
|
||||
* internal lists.
|
||||
* @author Chris Naude This thread sends player info to linked bots.
|
||||
*/
|
||||
public class LinkUpdater {
|
||||
|
||||
|
@ -3055,7 +3055,7 @@ public final class PurpleBot {
|
||||
for (String remoteBot : botLinks.keySet()) {
|
||||
String code = botLinks.get(remoteBot);
|
||||
String clearText = "PLAYER_INFO:" + code + ":"
|
||||
+ plugin.getServer().getOnlinePlayers().size()
|
||||
+ plugin.getOnlinePlayerCount()
|
||||
+ ":" + plugin.getServer().getMaxPlayers();
|
||||
List<String> players = new ArrayList<>();
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
|
@ -1604,4 +1604,15 @@ public class PurpleIRC extends JavaPlugin {
|
||||
return String.format("%s:%s", cmd, encodedText);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic player counter. CB uses Player[] and Spigot uses List<>().
|
||||
*/
|
||||
public int getOnlinePlayerCount() {
|
||||
int count = 0;
|
||||
for (Player player : getServer().getOnlinePlayers()) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user