mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 08:15:18 +00:00
Make lockup scheduler stop when someone logs off.
This commit is contained in:
parent
f2f59d2a0d
commit
8076ee822e
2 changed files with 24 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
|
@ -115,7 +116,7 @@ public class Command_lockup extends TFM_Command
|
||||||
|
|
||||||
private void startLockup(final Player p)
|
private void startLockup(final Player p)
|
||||||
{
|
{
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
final TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||||
|
|
||||||
cancelLockup(playerdata);
|
cancelLockup(playerdata);
|
||||||
|
|
||||||
|
@ -126,12 +127,19 @@ public class Command_lockup extends TFM_Command
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
p.openWorkbench(null, true);
|
if (p.isOnline())
|
||||||
|
{
|
||||||
|
p.openWorkbench(null, true);
|
||||||
|
|
||||||
Location l = p.getLocation().clone();
|
Location l = p.getLocation().clone();
|
||||||
l.setPitch(random.nextFloat() * 360.0f);
|
l.setPitch(random.nextFloat() * 360.0f);
|
||||||
l.setYaw(random.nextFloat() * 360.0f);
|
l.setYaw(random.nextFloat() * 360.0f);
|
||||||
p.teleport(l);
|
p.teleport(l);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cancelLockup(playerdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 0L, 5L));
|
}, 0L, 5L));
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,16 @@ public class TFM_UserInfo
|
||||||
return playerdata;
|
return playerdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIpAddress()
|
||||||
|
{
|
||||||
|
return ip_address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlayerName()
|
||||||
|
{
|
||||||
|
return player_name;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isOrbiting()
|
public boolean isOrbiting()
|
||||||
{
|
{
|
||||||
return this.is_orbiting;
|
return this.is_orbiting;
|
||||||
|
|
Loading…
Reference in a new issue