java bukkit double jump
Java
import java.util.ArrayList;
import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
public class DoubleJump implements Listener {
private List<Player> doubleJump;
public DoubleJump() {
doubleJump = new ArrayList<>();
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
event.getPlayer().setAllowFlight(true);
}
@EventHandler
public void onQuit(PlayerQuitEvent event) {
doubleJump.remove(event.getPlayer());
}
@EventHandler
public void onToggleFlight(PlayerToggleFlightEvent event) {
Player player = event.getPlayer();
GameMode gameMode = player.getGameMode();
if(gameMode == GameMode.CREATIVE || gameMode == GameMode.SPECTATOR || player.isFlying()) {
return;
}
event.setCancelled(true);
doubleJump.add(player);
player.setAllowFlight(false);
player.setFlying(false);
player.setVelocity(player.getLocation().getDirection().multiply(1.5).setY(1));
}
@EventHandler
public void onHitGround(PlayerMoveEvent event) {
Player player = event.getPlayer();
if ((player.isOnGround() || event.getTo().getBlock().isLiquid()) && doubleJump.remove(player)) {
player.setAllowFlight(true);
}
}
}
Also in Java:
- Title
- java check for string length
- Category
- Java
- Title
- How to print in console java
- Category
- Java
- Title
- run static method java
- Category
- Java
- Title
- java hahmap
- Category
- Java
- Title
- java taking console input
- Category
- Java
- Title
- java get an int from a char
- Category
- Java
- Title
- check if string is null or empty java
- Category
- Java
- Title
- if statement java
- Category
- Java
- Title
- read csv in java in spring
- Category
- Java
- Title
- java string array to arraylist
- Category
- Java
- Title
- java display message
- Category
- Java
- Title
- how to add a number to an array in java
- Category
- Java
- Title
- hashmap get value by key java
- Category
- Java
- Title
- in java how to convert string to integer
- Category
- Java
- Title
- int to long java
- Category
- Java
- Title
- how to compare two maps in java
- Category
- Java
- Title
- how to add an object to a list of objects in java
- Category
- Java
- Title
- print arraylist java
- Category
- Java
- Title
- java list contains object with property
- Category
- Java
- Title
- caesar cipher java
- Category
- Java
- Title
- how to get witdth of window android
- Category
- Java
- Title
- android round double to 2 decimal
- Category
- Java
- Title
- determine if a given binary tree is a valid bst
- Category
- Java
- Title
- how to take space separated input in java
- Category
- Java
- Title
- how to add to a file in java
- Category
- Java
- Title
- java mockito any string import
- Category
- Java
- Title
- java boolean even number
- Category
- Java
- Title
- java random numbers in specific range
- Category
- Java
- Title
- java list of a class has a string that is equal to
- Category
- Java
- Title
- prendere valore da tastiera java
- Category
- Java
- Title
- java array copy
- Category
- Java
- Title
- character at index of string java
- Category
- Java
- Title
- recursion in java
- Category
- Java
- Title
- immagini java
- Category
- Java
- Title
- java linked list functions
- Category
- Java
- Title
- regex get string between quotes java
- Category
- Java
- Title
- arraylist to int array java
- Category
- Java
- Title
- remove extra blank spaces from string in java
- Category
- Java
- Title
- rock paper scissors java
- Category
- Java
- Title
- primitive data types in java
- Category
- Java
- Title
- sort array java
- Category
- Java
- Title
- change number into array in java
- Category
- Java
- Title
- android studio centering textview in relativelayout
- Category
- Java
- Title
- java newinstance alternative
- Category
- Java
- Title
- java cannot find file path
- Category
- Java
- Title
- searching in database using java
- Category
- Java
- Title
- priority queue in java
- Category
- Java
- Title
- difference between print and println in java
- Category
- Java
- Title
- in dom parser how to find processing instruction in java
- Category
- Java
- Title
- read a file in java and store as integer array using buffered reader
- Category
- Java
- Title
- java shortest if else statement
- Category
- Java
- Title
- java size of stack
- Category
- Java
- Title
- scanner check if int
- Category
- Java
- Title
- biginteger in java
- Category
- Java
- Title
- how to get length of integer in java
- Category
- Java
- Title
- déclarer un tableau en java
- Category
- Java
- Title
- java random number between 100 and 999
- Category
- Java
- Title
- vector length java
- Category
- Java
- Title
- eclipse does not support logback with spring boot
- Category
- Java
- Title
- android bottom navigation hiding views
- Category
- Java
- Title
- java 8 iterating and manipulating list
- Category
- Java
- Title
- java lerp
- Category
- Java
- Title
- capcitor FERR_CLEARTEXT_NOT_PERMITTED
- Category
- Java
- Title
- how to create an array with unique values
- Category
- Java
- Title
- java for
- Category
- Java
- Title
- java convert a string to char[]
- Category
- Java
- Title
- android java shared preferences remove key
- Category
- Java
- Title
- java replace all xml decoding
- Category
- Java
- Title
- create color object java
- Category
- Java
- Title
- java read from connection even if 404
- Category
- Java
- Title
- check if optional is empty java
- Category
- Java
- Title
- java how to program
- Category
- Java
- Title
- jbutton remove selection border
- Category
- Java
- Title
- socket programming in java
- Category
- Java
- Title
- convert array to list java
- Category
- Java
- Title
- Java array multidimensional hashcode
- Category
- Java
- Title
- java 8 hashmap example stackoverflow
- Category
- Java
- Title
- java list as parameter
- Category
- Java
- Title
- if en une seul ligne java
- Category
- Java
- Title
- print out value java
- Category
- Java
- Title
- java set example
- Category
- Java
- Title
- how to create a button in java
- Category
- Java
- Title
- check if list contains new line in java
- Category
- Java
- Title
- connecting to h2 database from java
- Category
- Java
- Title
- java array swap
- Category
- Java
- Title
- how to get orientation lock to portrait android stackoverflow
- Category
- Java
- Title
- @JsonSerializer spring specific field string to date
- Category
- Java
- Title
- java generic calling clone method
- Category
- Java
- Title
- random java
- Category
- Java
- Title
- eliminar fila jtable java
- Category
- Java
- Title
- how to get all of the chldren of a panel in java
- Category
- Java
- Title
- computeifabsent hashmap java
- Category
- Java
- Title
- java execute for cycle parallel thread
- Category
- Java
- Title
- java get first char
- Category
- Java
- Title
- room insert and return id
- Category
- Java
- Title
- traversal of list in java
- Category
- Java
- Title
- how to make it another player's turn java
- Category
- Java
- Title
- how to add a keylistener to a jframe
- Category
- Java
- Title
- reading string after double in java
- Category
- Java
- Title
- reverse linked list in java to get both head and tail
- Category
- Java