Less error messages, channel and command changes applied #66

Merged
NorbiPeti merged 6 commits from dev into master 2017-05-15 00:38:33 +00:00
2 changed files with 8 additions and 11 deletions
Showing only changes of commit 28aeb35573 - Show all commits

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);