Add togglegravity command

This commit is contained in:
cswhite2000 2017-06-27 04:36:34 -07:00
parent a709aee173
commit 46d335bf0e
5 changed files with 18 additions and 0 deletions

View File

@ -54,6 +54,19 @@ public class MiscCommands implements Commands {
}
}
@Command(
aliases = { "togglegravity" },
usage = "<player>",
desc = "Toggle a player's gravity.",
min = 0,
max = 1
)
@CommandPermissions("togglegravity")
public void noGravity(final CommandContext args, final CommandSender sender) throws CommandException {
Player player = CommandUtils.getPlayerOrSelf(args, sender, 0);
player.setGravity(!player.hasGravity());
}
@Command(
aliases = { "sudo" },
usage = "<player> [command... (rand|mode|near|color|*)=value]",

View File

@ -144,6 +144,8 @@ public class LoginListener implements Listener, PluginFacet {
final Player player = event.getPlayer();
final UUID uuid = player.getUniqueId();
player.setGravity(true);
this.logins.cleanUp();
final LoginResponse response = this.logins.getIfPresent(uuid);
this.logins.invalidate(uuid);

View File

@ -54,6 +54,7 @@ public class Utils {
player.setAllowFlight(player.hasPermission("lobby.fly"));
player.setWalkSpeed(0.2f);
player.setFlySpeed(0.1f);
player.setGravity(true);
player.setPotionParticles(false);
player.hideTitle();
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 15, 0.5, 0.5, 0.5, 0);

View File

@ -69,6 +69,7 @@ public class Alive extends Participating {
player.setVisible(true);
player.refreshVisibility();
bukkit.setGameMode(GameMode.SURVIVAL);
bukkit.setGravity(true);
// Apply spawn kit
for(Kit kit : smm.getPlayerKits()) {

View File

@ -43,6 +43,7 @@ public class Observing extends State {
player.refreshVisibility();
bukkit.setGameMode(GameMode.CREATIVE);
bukkit.setAllowFlight(true);
bukkit.setGravity(true);
Spawn spawn = smm.getDefaultSpawn();