BeshoGraphix

Untitled

Jun 15th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. package me.beshographix.titansbase;
  2.  
  3.  
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.Location;
  8. import org.bukkit.Sound;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.event.EventHandler;
  11. import org.bukkit.event.Listener;
  12. import org.bukkit.event.entity.PlayerDeathEvent;
  13. import org.bukkit.event.player.PlayerGameModeChangeEvent;
  14. import org.bukkit.event.player.PlayerJoinEvent;
  15. import org.bukkit.inventory.ItemStack;
  16. import org.bukkit.plugin.java.JavaPlugin;
  17.  
  18.  
  19.  
  20. @SuppressWarnings("unused")
  21. public class Titansbase extends JavaPlugin implements Listener {
  22.  
  23.  
  24. @Override
  25. public void onEnable() {
  26. getServer().getPluginManager().registerEvents(this, this);
  27. getConfig().addDefault("join message", "&c» &7Welcome to &c&lTitansMC &7 server !");
  28. getConfig().addDefault("ID", "35:1");
  29. getConfig().options().copyDefaults(true);
  30. saveConfig();
  31. conf = getConfig().getString("ID").split(";");
  32. }
  33. //----------------------------------------------------- ID CONF
  34. public static String[] vis;
  35. public static int id;
  36. public static int damage;
  37. public static String[] conf;
  38. @SuppressWarnings("deprecation")
  39. public static ItemStack visible = new ItemStack(id, 1, (short) damage);
  40. static {
  41.  
  42. int id = Integer.parseInt(vis[0]);
  43. int damage = 0;
  44. if (vis.length == 2){
  45. damage = Integer.parseInt(vis[1]);
  46. }
  47.  
  48. }
  49. //----------------------------------------------------- ID CONF
  50. @EventHandler
  51. public void onJoin(PlayerJoinEvent e){
  52. final Player p = e.getPlayer();
  53. p.getInventory().addItem(visible);
  54. p.performCommand("spawn");
  55. p.teleport(new Location(p.getWorld(), p.getLocation().getX(), p.getLocation().getY() + 5, p.getLocation().getZ()));
  56. p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("join message")));
  57. p.playSound(p.getLocation(), Sound.ANVIL_LAND, 8, -4);
  58. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  59. public void run() {
  60. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 8, -4);
  61. }
  62. }, 14);
  63. }
  64.  
  65. @EventHandler
  66. public void onDeath(PlayerGameModeChangeEvent e){
  67. Player p = e.getPlayer();
  68. if (p.getInventory().contains(visible)){
  69. p.sendMessage("§5You have one little Boy =)");
  70. }
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment