Fixed channels a lot

Made Console be able to send messages
This commit is contained in:
Norbi Peti 2017-05-07 01:09:39 +02:00
parent 07fccda8d3
commit 28aeb35573
2 changed files with 8 additions and 11 deletions

View file

@ -124,12 +124,9 @@ public class ChatProcessing {
try {
if (channel.filteranderrormsg != null) {
Objective obj = PluginMain.SB.getObjective(channel.ID);
int score;
obj.getScore(player.getUniqueId().toString()).setScore(score = e.getMCScore(player));
int score = -1;
for (Player p : Bukkit.getOnlinePlayers()) {
if (player == p)
continue;
obj.getScore(p.getUniqueId().toString()).setScore(e.getMCScore(p));
obj.getScore(p.getUniqueId().toString()).setScore(score = e.getMCScore(p));
}
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));
@ -138,7 +135,7 @@ public class ChatProcessing {
String.format("tellraw @a %s", jsonstr));
} catch (Exception ex) {
TBMCCoreAPI.SendException("An error occured while sending a chat message!", ex);
player.sendMessage("§cAn error occured while sending the message.");
sender.sendMessage("§cAn error occured while sending the message.");
return true;
}
PluginMain.Instance.getServer().getConsoleSender().sendMessage(String.format("%s <%s> %s", channelidentifier,

View file

@ -1,14 +1,15 @@
package buttondevteam.chat.commands;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.chat.ChatPlayer;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.PlayerCommandBase;
import buttondevteam.lib.player.TBMCPlayer;
public final class ChatonlyCommand extends TBMCCommandBase { //TODO: Add annotation
@CommandClass(modOnly = false)
public final class ChatonlyCommand extends PlayerCommandBase {
@Override
public String[] GetHelpText(String alias) {
@ -20,8 +21,7 @@ public final class ChatonlyCommand extends TBMCCommandBase { //TODO: Add annotat
}
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
Player player = (Player) sender;
public boolean OnCommand(Player player, String alias, String[] args) {
ChatPlayer p = TBMCPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class);
p.ChatOnly = true;
player.setGameMode(GameMode.SPECTATOR);