Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. package org.journeyman.wurmunlimited.mods.spammod;
  2.  
  3.  
  4. import com.sun.media.jfxmedia.events.PlayerStateListener;
  5. import com.wurmonline.server.MessageServer;
  6. import com.wurmonline.server.creatures.Communicator;
  7. import org.gotti.wurmunlimited.modloader.interfaces.*;
  8.  
  9. import java.util.Properties;
  10. import java.util.logging.Level;
  11. import java.util.logging.Logger;
  12.  
  13. public class SpamMod implements WurmServerMod, Initable, PreInitable, Configurable, PlayerMessageListener {
  14. private boolean spamChat = false;
  15.  
  16. @Override
  17. public void configure (Properties properties)
  18. {
  19. this.spamChat = Boolean.valueOf(properties.getProperty("spamChat", String.valueOf(this.spamChat))).booleanValue();
  20. Logger.getLogger(SpamMod.class.getName()).log(Level.INFO, "Spamming chat: " + this.spamChat);
  21. }
  22.  
  23. @Override
  24. public void init() {
  25.  
  26. }
  27.  
  28. @Override
  29. public void preInit()
  30. {
  31.  
  32. }
  33.  
  34. @Override
  35. public MessagePolicy onPlayerMessage(Communicator communicator, String message, String title) {
  36. if (spamChat && message == "/spam")
  37. {
  38. MessageServer.broadCastSafe("Spam (stylized as SPAM) is a brand of canned cooked pork made by Hormel Foods Corporation, based in Minnesota. It was first introduced in 1937 and gained popularity worldwide after its use during World War II. By 2003, Spam was sold in 41 countries on six continents and trademarked in over 100 countries (not including the Middle East and North Africa).", (byte)1);
  39. }
  40. return null;
  41. }
  42.  
  43. @Override
  44. public boolean onPlayerMessage(Communicator communicator, String s) {
  45. if (spamChat && s == "/spam")
  46. {
  47. MessageServer.broadCastSafe("Spam (stylized as SPAM) is a brand of canned cooked pork made by Hormel Foods Corporation, based in Minnesota. It was first introduced in 1937 and gained popularity worldwide after its use during World War II. By 2003, Spam was sold in 41 countries on six continents and trademarked in over 100 countries (not including the Middle East and North Africa).", (byte)1);
  48. }
  49. return false;
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement