Started chat msg sending API...
This commit is contained in:
parent
c01063ccfa
commit
5b13548fa4
2 changed files with 51 additions and 1 deletions
47
src/main/java/buttondevteam/lib/TBMCChatEvent.java
Normal file
47
src/main/java/buttondevteam/lib/TBMCChatEvent.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package buttondevteam.lib;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import buttondevteam.lib.chat.Channel;
|
||||
|
||||
public class TBMCChatEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Channel channel;
|
||||
private CommandSender sender;
|
||||
private String message;
|
||||
|
||||
public TBMCChatEvent(CommandSender sender, Channel channel, String message) {
|
||||
this.sender = sender;
|
||||
this.channel = channel;
|
||||
this.message = message; // TODO: Message object with data?
|
||||
}
|
||||
|
||||
/*
|
||||
* public TBMCPlayer getPlayer() { return TBMCPlayer.getPlayer(sender); // TODO: Get Chroma user }
|
||||
*/
|
||||
|
||||
public Channel getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
public CommandSender getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.reflections.Reflections;
|
||||
|
@ -13,6 +14,7 @@ import org.reflections.scanners.SubTypesScanner;
|
|||
import org.reflections.util.ClasspathHelper;
|
||||
import org.reflections.util.ConfigurationBuilder;
|
||||
|
||||
import buttondevteam.lib.TBMCChatEvent;
|
||||
import buttondevteam.lib.TBMCCoreAPI;
|
||||
|
||||
public class TBMCChatAPI {
|
||||
|
@ -174,6 +176,7 @@ public class TBMCChatAPI {
|
|||
}
|
||||
|
||||
public static void SendChatMessage(Channel channel, CommandSender sender, String message) {
|
||||
// TODO
|
||||
TBMCChatEvent event = new TBMCChatEvent(sender, channel, message);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue