Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. package fr.DixOr51.main;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.UUID;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.GameMode;
  8. import org.bukkit.Location;
  9. import org.bukkit.Material;
  10. import org.bukkit.Sound;
  11. import org.bukkit.block.BlockFace;
  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.player.PlayerCommandPreprocessEvent;
  17. import org.bukkit.event.player.PlayerMoveEvent;
  18. import org.bukkit.plugin.Plugin;
  19. import org.bukkit.plugin.PluginManager;
  20. import org.bukkit.plugin.java.JavaPlugin;
  21. import org.bukkit.potion.PotionEffectType;
  22.  
  23. public class Main extends JavaPlugin implements Listener{
  24.  
  25. public static ArrayList<UUID> jump = new ArrayList();
  26. static int delay = 0;
  27. public static int delayUntilStart = 5;
  28. public static Plugin plugin = null;
  29.  
  30.  
  31. public void onEnable(){
  32. Bukkit.getConsoleSender().sendMessage("§c[DixOr] Le plugin est allumé !");
  33. registerEvent();
  34. plugin = this;
  35. }
  36.  
  37. private void registerEvent() {
  38. PluginManager pm = Bukkit.getPluginManager();
  39. pm.registerEvents(this, this);
  40. pm.registerEvents(new LobbyAPI(), this);
  41. }
  42. static Player p = null;
  43. public static void startend(int time) {
  44. Bukkit.getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable()
  45. {
  46. @SuppressWarnings("null")
  47. public void run()
  48. {
  49. p.teleport(new Location(p.getWorld(), -178, 74, 496));
  50. }
  51. }
  52. , time);
  53. }
  54. public static void startfall(int time) {
  55. Bukkit.getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable()
  56. {
  57. public void run()
  58. {
  59.  
  60. p.teleport(new Location(p.getWorld(), -178, 74, 496));
  61. }
  62. }
  63. , time);
  64. }
  65.  
  66. @EventHandler
  67. public void onWalk(PlayerMoveEvent e) {
  68. Player p = e.getPlayer();
  69.  
  70.  
  71. if(jump.contains(p.getUniqueId())){
  72. if(e.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.STONE || e.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR || e.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.GOLD_PLATE || e.getPlayer().getLocation().getBlock().getType() == Material.STONE_PLATE){
  73. } else {
  74. LobbyAPI.sendTitle(p, "§cVous avez", "§cperdu :(", 30);
  75. jump.remove(p.getUniqueId());
  76. }
  77.  
  78. }
  79.  
  80. if ((e.getPlayer().getLocation().getBlock().getType() == Material.STONE_PLATE) && (p.getGameMode() == GameMode.ADVENTURE)){
  81. LobbyAPI.sendTitle(p, "§aBonne chance", "§à toi :)", 30);
  82. jump.add(p.getUniqueId());
  83. p.setAllowFlight(false);
  84. p.setFlying(false);
  85. p.removePotionEffect(PotionEffectType.SPEED);
  86. }
  87.  
  88.  
  89. if ((e.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.GOLD_PLATE) && (p.getGameMode() == GameMode.ADVENTURE)&&(jump.contains(p.getUniqueId()))){
  90. if(jump.contains(p.getUniqueId())){
  91. jump.remove(p.getUniqueId());
  92. LobbyAPI.sendTitle(p, "§aBravo", "§b+15HardCoins", 30);
  93. Bukkit.broadcastMessage("§6[§bHardJump§6] §c"+ p.getName() +" §ba réussi le HardJump !");
  94. p.teleport(new Location(p.getWorld(), -178, 75, 496));
  95.  
  96.  
  97. /*MySQL.setHCoins(p.getUniqueId(), MySQL.getHCoins(p.getUniqueId())+15);
  98. jump.remove(p.getUniqueId());
  99. if(MySQL.getRank(p.getUniqueId()) <= 1){
  100. p.setAllowFlight(true);
  101. p.setFlying(true);
  102. }
  103. if (MySQL.getSetting(p.getUniqueId(), "speed") == 1) {
  104. p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 2500000, 1), true);
  105. }
  106. */
  107. }
  108. }
  109. }
  110. @EventHandler(priority=EventPriority.LOWEST)
  111. public void onPlayerCommands(PlayerCommandPreprocessEvent e)
  112. {
  113. Player p = e.getPlayer();
  114. String msg = e.getMessage();
  115. String[] args = msg.split(" ");
  116. if (args[0].equalsIgnoreCase("/getarray")) {
  117.  
  118. if(jump.contains(p.getUniqueId())){
  119. p.sendMessage("§Tu es dans l'array");
  120. }
  121. e.setCancelled(true);
  122. }
  123. }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement