Guest User

Untitled

a guest
May 8th, 2015
27
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.yahoo.nathancat49;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.GameMode;
  8. import org.bukkit.Location;
  9. import org.bukkit.World;
  10. import org.bukkit.command.Command;
  11. import org.bukkit.command.CommandSender;
  12. import org.bukkit.entity.Player;
  13. import org.bukkit.event.EventHandler;
  14. import org.bukkit.event.EventPriority;
  15. import org.bukkit.event.Listener;
  16. import org.bukkit.event.entity.EntityDamageByEntityEvent;
  17. import org.bukkit.event.entity.PlayerDeathEvent;
  18. import org.bukkit.plugin.PluginManager;
  19. import org.bukkit.plugin.java.JavaPlugin;
  20.  
  21. public class Main extends JavaPlugin implements Listener {
  22. Logger myPluginLogger = Bukkit.getLogger();
  23. private PlayerListener PlayerListener = new PlayerListener(this);
  24.  
  25. @Override
  26. public void onEnable() {
  27.  
  28. myPluginLogger.info("Welcome To NyanNetCorpLLcGroup plugin");
  29.  
  30. }
  31.  
  32. @Override
  33. public void onDisable() {
  34. myPluginLogger.info("shutting down HardcoreNyan");
  35. }
  36. @EventHandler(priority = EventPriority.NORMAL)
  37. public void onEntityDeath(PlayerDeathEvent event) {
  38.  
  39. final Player Player = event.getEntity();
  40.  
  41.  
  42. if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
  43. Player.sendMessage(ChatColor.BLUE+ "You were killed by a living thing your death time is 5 minutes ");
  44. Player.setGameMode(GameMode.SPECTATOR);
  45.  
  46. this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  47. int i = 300;
  48.  
  49. @Override
  50. public void run() {
  51. if (i != -1) {
  52. if (i != 0) {
  53. i--;
  54.  
  55. }
  56. else {
  57.  
  58. Player.sendMessage(ChatColor.GREEN + "you have revived.");
  59. Player.setGameMode(GameMode.SURVIVAL);
  60.  
  61. i--;
  62. World w = Bukkit.getServer().getWorld(getConfig().getString("spawn.world"));
  63. double x = getConfig().getDouble("spawn.x");
  64. double y = getConfig().getDouble("spawn.y");
  65. double z = getConfig().getDouble("spawn.z");
  66. Location location = new Location(w , x, y, z);
  67. Player.teleport(location);
  68. }
  69. }
  70.  
  71. }
  72. }, 0L, 20L);
  73.  
  74. } else {
  75.  
  76. Player.sendMessage(ChatColor.BLUE+ "You were killed by nature therefore your death time is only 4 minutes");
  77. myPluginLogger.severe("killed by nature");
  78. getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  79.  
  80. @Override
  81.  
  82. public void run() {
  83. int i = 300;
  84. if (i != -1) {
  85. if (i != 0) {
  86. i--;
  87.  
  88. }
  89. else {
  90.  
  91. Player.sendMessage(ChatColor.GREEN + "you have revived.");
  92. Player.setGameMode(GameMode.SURVIVAL);
  93.  
  94. i--;
  95. World w = Bukkit.getServer().getWorld(getConfig().getString("spawn.world"));
  96. double x = getConfig().getDouble("spawn.x");
  97. double y = getConfig().getDouble("spawn.y");
  98. double z = getConfig().getDouble("spawn.z");
  99. Location location = new Location(w , x, y, z);
  100. Player.teleport(location);
  101.  
  102. }
  103. }
  104.  
  105. }
  106. }, 0L, 20L);
  107.  
  108. }
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116. }
  117. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  118. Player player = (Player) sender;
  119. if(commandLabel.equalsIgnoreCase("setDeathSpawn")) {
  120. if(!(sender instanceof Player)) {
  121. player.sendMessage(ChatColor.AQUA + "Spawn set!");
  122. int x = getConfig().getInt("spawn.x");
  123. int y = getConfig().getInt("spawn.y");
  124. int z = getConfig().getInt("spawn.z");
  125. String w = getConfig().getString("spawn.world");
  126.  
  127. }else if(player.hasPermission("NyanHardcore.setspawn")) {
  128.  
  129. }
  130. return true;
  131. }
  132. return true;
  133. }
  134. }
RAW Paste Data