Fixed channel scores for Discord->MC
This commit is contained in:
parent
1d1b3453b3
commit
d0a990e0f1
2 changed files with 14 additions and 7 deletions
|
@ -134,17 +134,24 @@ public class ChatProcessing {
|
|||
Objective obj = PluginMain.SB.getObjective(channel.ID);
|
||||
int score = -1;
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (PluginMain.essentials.getUser(p).isIgnoredPlayer(PluginMain.essentials.getUser(player)))
|
||||
continue;
|
||||
final int mcScore = VanillaUtils.getMCScoreIfChatOn(p, e);
|
||||
final int mcScore;
|
||||
if (player != null
|
||||
&& PluginMain.essentials.getUser(p).isIgnoredPlayer(PluginMain.essentials.getUser(player)))
|
||||
mcScore = -1; // Don't send the message to them
|
||||
else
|
||||
mcScore = VanillaUtils.getMCScoreIfChatOn(p, e);
|
||||
obj.getScore(p.getName())
|
||||
.setScore(p.getUniqueId().equals(player == null ? null : player.getUniqueId()) // p.UniqueID==player?.UniqueID
|
||||
? score = mcScore : mcScore);
|
||||
}
|
||||
if (player == null)
|
||||
if (score == -1) // Even if the player object isn't null, it may not be in OnlinePlayers
|
||||
score = e.getMCScore(sender);
|
||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console, String.format(
|
||||
"tellraw @a[score_%s=%d,score_%s_min=%d] %s", channel.ID, score, channel.ID, score, jsonstr));
|
||||
if (score < 0) // Never send messages to score below 0
|
||||
sender.sendMessage("§cYou don't have permission to send this message or something went wrong");
|
||||
else
|
||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
||||
String.format("tellraw @a[score_%s=%d,score_%s_min=%d] %s", channel.ID, score, channel.ID,
|
||||
score, jsonstr));
|
||||
} else
|
||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
||||
String.format("tellraw @a %s", jsonstr));
|
||||
|
|
|
@ -24,7 +24,7 @@ public final class UnlolCommand extends TBMCCommandBase {
|
|||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- Unlol/unlaugh ----",
|
||||
"This command is based on a joke between NorbiPeti and Ghostise",
|
||||
"It will make anyone saying one of the recognized laugh strings blind for a few seconds",
|
||||
"It will make the last person saying one of the recognized laugh strings blind for a few seconds",
|
||||
"Note that you can only unlaugh laughs that weren't unlaughed before" };
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue