Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ArrayList<String> players = new ArrayList<>();
- @EventHandler
- public void onMoveOverPlate(PlayerMoveEvent ev) {
- final Player p = ev.getPlayer();
- if (p.getLocation().getBlock().getType() == Material.STONE_PLATE) {
- if (p.getLocation().subtract(0.0, 1.0, 0.0).getBlock().getType() == Material.REDSTONE_BLOCK) {
- if (!(players.contains(p.getName()))) {
- players.add(p.getName());
- p.setAllowFlight(true);
- Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
- @Override
- public void run() {
- players.remove(p.getName());
- if (p.getGameMode() == GameMode.CREATIVE) {
- p.setAllowFlight(true);
- } else {
- p.setAllowFlight(false);
- }
- }
- }, 20*2);
- Vector v = p.getLocation().getDirection().setY(2).multiply(20);
- p.setVelocity(v);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement