mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-24 07:13:17 +02:00
[Fix] Reset walk/fly speed on login.
[Permission] essentials.speed.<fly|walk> - If a player only has one of these, they will only be able to toggle the given state.
This commit is contained in:
@@ -262,6 +262,9 @@ public class EssentialsPlayerListener implements Listener
|
|||||||
user.sendMessage(_("flyMode", _("enabled"), user.getDisplayName()));
|
user.sendMessage(_("flyMode", _("enabled"), user.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
user.setFlySpeed(0.1f);
|
||||||
|
user.setWalkSpeed(0.2f);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -397,7 +400,7 @@ public class EssentialsPlayerListener implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerChangedWorldHack(final PlayerChangedWorldEvent event)
|
public void onPlayerChangedWorldFlyReset(final PlayerChangedWorldEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
if (user.getGameMode() != GameMode.CREATIVE && !user.isAuthorized("essentials.fly"))
|
if (user.getGameMode() != GameMode.CREATIVE && !user.isAuthorized("essentials.fly"))
|
||||||
|
@@ -39,12 +39,12 @@ public class Commandspeed extends EssentialsCommand
|
|||||||
boolean isBypass = user.isAuthorized("essentials.speed.bypass");
|
boolean isBypass = user.isAuthorized("essentials.speed.bypass");
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
{
|
{
|
||||||
isFly = user.isFlying();
|
isFly = flyPermCheck(user, user.isFlying());
|
||||||
speed = getMoveSpeed(args[0]);
|
speed = getMoveSpeed(args[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isFly = isFlyMode(args[0]);
|
isFly = flyPermCheck(user, isFlyMode(args[0]));
|
||||||
speed = getMoveSpeed(args[1]);
|
speed = getMoveSpeed(args[1]);
|
||||||
if (args.length > 2 && user.isAuthorized("essentials.speed.others"))
|
if (args.length > 2 && user.isAuthorized("essentials.speed.others"))
|
||||||
{
|
{
|
||||||
@@ -82,6 +82,19 @@ public class Commandspeed extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Boolean flyPermCheck(User user, boolean input) throws Exception
|
||||||
|
{
|
||||||
|
boolean canFly = user.isAuthorized("essentials.speed.fly");
|
||||||
|
boolean canWalk = user.isAuthorized("essentials.speed.walk");
|
||||||
|
if (input && canFly || !input && canWalk || !canFly && !canWalk) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
else if (canWalk) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isFlyMode(final String modeString) throws NotEnoughArgumentsException
|
private boolean isFlyMode(final String modeString) throws NotEnoughArgumentsException
|
||||||
{
|
{
|
||||||
boolean isFlyMode;
|
boolean isFlyMode;
|
||||||
|
Reference in New Issue
Block a user