Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
115
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.xtechno.opjoin;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.event.player.PlayerJoinEvent;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10.  
  11. public class Mainn extends JavaPlugin implements Listener{
  12.  
  13. @Override
  14. public void onEnable() {
  15. getLogger().info("OP-Join has been successfully enabled!");
  16. saveDefaultConfig();
  17. getConfig().addDefault("message", "&b[&8Staff&b] {player} has joined!");
  18. getServer().getPluginManager().registerEvents(this, this);
  19. }
  20. @Override
  21. public void onDisable() {
  22. getLogger().info("OP-Join has been disabled!");
  23. }
  24. @EventHandler
  25. public void onJoin(PlayerJoinEvent event) {
  26. Player p = event.getPlayer();
  27. if(p.isOp()) {
  28. String message = getConfig().getString("message");
  29. String updatedmessage = message.replace("{player}", p.getName());
  30. event.setJoinMessage(null);
  31. Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', updatedmessage));
  32. }
  33. }
  34. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement