Skip to content

Commit

Permalink
allow movement prevention to be toggled
Browse files Browse the repository at this point in the history
  • Loading branch information
RoboMWM committed Oct 9, 2017
1 parent 2729976 commit 98f95a5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/to/us/tf/DeathSpectating/tasks/SpectateTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class SpectateTask extends BukkitRunnable
private String unformattedTitle;
private String unformattedSubTitle;
private int score;
private boolean preventMovement = true;

public SpectateTask(Player player, long ticks, @Nullable Entity killer, DeathSpectating deathSpectating)
{
Expand Down Expand Up @@ -88,6 +89,16 @@ public void setUnformattedSubTitle(String unformattedSubTitle)
this.unformattedSubTitle = unformattedSubTitle;
}

public boolean hasPreventMovement()
{
return preventMovement;
}

public void setPreventMovement(boolean preventMovement)
{
this.preventMovement = preventMovement;
}

public void run()
{
if (player.isDead() && instance.isSpectating(player)) //A plugin (e.g. Essentials) did Player#setHealth(0)
Expand Down Expand Up @@ -124,7 +135,8 @@ public void run()
}

//player.setSpectatorTarget(player);
player.setFlySpeed(0f); //does this even work for spectators?
if (preventMovement)
player.setFlySpeed(0f);

ticks--;
}
Expand Down

0 comments on commit 98f95a5

Please sign in to comment.