Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.DixOr51.main;
- import java.util.ArrayList;
- import java.util.UUID;
- import org.bukkit.Bukkit;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.block.BlockFace;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.EventPriority;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerCommandPreprocessEvent;
- import org.bukkit.event.player.PlayerMoveEvent;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.potion.PotionEffectType;
- public class Main extends JavaPlugin implements Listener{
- public static ArrayList<UUID> jump = new ArrayList();
- static int delay = 0;
- public static int delayUntilStart = 5;
- public static Plugin plugin = null;
- public void onEnable(){
- Bukkit.getConsoleSender().sendMessage("§c[DixOr] Le plugin est allumé !");
- registerEvent();
- plugin = this;
- }
- private void registerEvent() {
- PluginManager pm = Bukkit.getPluginManager();
- pm.registerEvents(this, this);
- pm.registerEvents(new LobbyAPI(), this);
- }
- static Player p = null;
- public static void startend(int time) {
- Bukkit.getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable()
- {
- @SuppressWarnings("null")
- public void run()
- {
- p.teleport(new Location(p.getWorld(), -178, 74, 496));
- }
- }
- , time);
- }
- public static void startfall(int time) {
- Bukkit.getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable()
- {
- public void run()
- {
- p.teleport(new Location(p.getWorld(), -178, 74, 496));
- }
- }
- , time);
- }
- @EventHandler
- public void onWalk(PlayerMoveEvent e) {
- Player p = e.getPlayer();
- if(jump.contains(p.getUniqueId())){
- 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){
- } else {
- LobbyAPI.sendTitle(p, "§cVous avez", "§cperdu :(", 30);
- jump.remove(p.getUniqueId());
- }
- }
- if ((e.getPlayer().getLocation().getBlock().getType() == Material.STONE_PLATE) && (p.getGameMode() == GameMode.ADVENTURE)){
- LobbyAPI.sendTitle(p, "§aBonne chance", "§à toi :)", 30);
- jump.add(p.getUniqueId());
- p.setAllowFlight(false);
- p.setFlying(false);
- p.removePotionEffect(PotionEffectType.SPEED);
- }
- if ((e.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.GOLD_PLATE) && (p.getGameMode() == GameMode.ADVENTURE)&&(jump.contains(p.getUniqueId()))){
- if(jump.contains(p.getUniqueId())){
- jump.remove(p.getUniqueId());
- LobbyAPI.sendTitle(p, "§aBravo", "§b+15HardCoins", 30);
- Bukkit.broadcastMessage("§6[§bHardJump§6] §c"+ p.getName() +" §ba réussi le HardJump !");
- p.teleport(new Location(p.getWorld(), -178, 75, 496));
- /*MySQL.setHCoins(p.getUniqueId(), MySQL.getHCoins(p.getUniqueId())+15);
- jump.remove(p.getUniqueId());
- if(MySQL.getRank(p.getUniqueId()) <= 1){
- p.setAllowFlight(true);
- p.setFlying(true);
- }
- if (MySQL.getSetting(p.getUniqueId(), "speed") == 1) {
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 2500000, 1), true);
- }
- */
- }
- }
- }
- @EventHandler(priority=EventPriority.LOWEST)
- public void onPlayerCommands(PlayerCommandPreprocessEvent e)
- {
- Player p = e.getPlayer();
- String msg = e.getMessage();
- String[] args = msg.split(" ");
- if (args[0].equalsIgnoreCase("/getarray")) {
- if(jump.contains(p.getUniqueId())){
- p.sendMessage("§Tu es dans l'array");
- }
- e.setCancelled(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement