-
-
Save The-Zip/1f8b16a9fad65734adad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Message Request | |
public void request(String message) { | |
Connect c = getBukkitConnect(); | |
MessageRequest request = null; | |
try { | |
request = new MessageRequest("name", "ch", message); //Server name, channel make sure its less than 5 characters, message. | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
FutureResult<MessageResult> futureResult = null; | |
try { | |
futureResult = c.request(request); | |
} catch (RequestException e) { | |
e.printStackTrace(); | |
} | |
} | |
//Message Event | |
public class MessageListener { | |
@EventListener | |
public void onMessage(MessageEvent me) { | |
if (!me.getChannel().equals("ch")) { //name of channel | |
return; | |
} | |
String sender = me.getSender(); //gets the server it was sent from | |
String message = "Error"; | |
try { | |
message = me.getMessageAsString(); //set string message to the message sent | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment