MAJOR UPDATE !
It is important that all users who have downloaded the plugin update to version 2.4.1.1 as soon as possible. The previous version may have caused issues with the gameplay on your server, and updating to version 2.4.1 will resolve these problems. Please take a few moments to update to version 2.4.1.1 to ensure that you are able to fully benefit from all of the features and improvements of the plugin. Thank you for your cooperation and understanding.
This patch is to set a proper @EvenHandler
Code (Text):
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
// Set the player's game mode to survival if it is not already set to that
if (player.getGameMode() != GameMode.CREATIVE) {
player.setGameMode(GameMode.SURVIVAL);
player.setInvulnerable(false); // Make the player vulnerable to damage
player.setWalkSpeed(0.2f);
player.setAllowFlight(false); // Disable flight for the player
player.setFlying(false); // Make sure the player is not flying
player.setFlySpeed(1.0f);
}
if (player.isOp()) {
player.setWalkSpeed(0.2f);
player.setAllowFlight(true); // Disable flight for the player
player.setFlying(true); // Make sure the player is not flying
player.setFlySpeed(1.0f);
}
}
the old code was wrong...
Code (Text):
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
// Set the player's game mode to survival if it is not already set to that
if (player.getGameMode() != GameMode.SURVIVAL) {
player.setGameMode(GameMode.SURVIVAL);
player.setInvulnerable(false); // Make the player vulnerable to damage
player.setWalkSpeed(0.2f);
player.setAllowFlight(false); // Disable flight for the player
player.setFlying(false); // Make sure the player is not flying
player.setFlySpeed(1.0f);
}
if (player.isOp()) {
player.setWalkSpeed(0.2f);
player.setAllowFlight(true); // Disable flight for the player
player.setFlying(true); // Make sure the player is not flying
player.setFlySpeed(1.0f);
}
}