Yeehaw fix & applying changes

This commit is contained in:
Norbi Peti 2018-10-25 23:51:39 +02:00
parent 3124d41f54
commit 58d8d1276f
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
3 changed files with 6 additions and 8 deletions

View file

@ -1,12 +1,11 @@
package buttondevteam.chat.commands;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.lib.player.TBMCYEEHAWEvent;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandClass(modOnly = false)
public class YeehawCommand extends TBMCCommandBase {
@ -22,9 +21,9 @@ public class YeehawCommand extends TBMCCommandBase {
+ (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName()) + " §bYEEHAWs.";
for (Player p : Bukkit.getOnlinePlayers()) {
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
p.sendMessage(message); //Not broadcasting, so the Discord plugin can handle the event in a special way
} // Even a cmdblock could yeehaw in theory
// Or anyone from Discord
Bukkit.broadcastMessage(message);
Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender));
return true;
}

View file

@ -5,7 +5,6 @@ import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCChatAPI;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.lib.player.ChromaGamerBase;
import buttondevteam.lib.player.TBMCPlayer;
import org.bukkit.command.CommandSender;
@CommandClass(modOnly = false, excludeFromPath = true)
@ -21,7 +20,7 @@ public abstract class AppendTextCommandBase extends TBMCCommandBase {
for (String arg : args) msg.append(arg).append(" ");
msg.append(GetAppendedText());
TBMCChatAPI.SendChatMessage(ChatMessage.builder(sender,
ChromaGamerBase.getFromSender(sender, TBMCPlayer.class), msg.toString())
ChromaGamerBase.getFromSender(sender), msg.toString())
.fromCommand(true).build());
return true;
}

View file

@ -75,7 +75,7 @@ public class PlayerListener implements Listener {
if (message.length() < 2)
return false;
int index = message.indexOf(" ");
val mp = ChromaGamerBase.getFromSender(sender, TBMCPlayer.class);
val mp = ChromaGamerBase.getFromSender(sender);
String cmd;
final BiPredicate<Channel, String> checkchid = (chan, cmd1) -> cmd1.equalsIgnoreCase(chan.ID) || (chan.IDs != null && Arrays.stream(chan.IDs).anyMatch(cmd1::equalsIgnoreCase));
if (index == -1) { // Only the command is run