2011-10-01 17:59:46 +00:00
package me.StevenLawson.TotalFreedomMod ;
2011-10-10 12:09:19 +00:00
import java.util.ArrayList ;
2011-11-08 00:29:33 +00:00
import java.util.HashMap ;
2012-11-21 00:57:53 +00:00
import java.util.Iterator ;
2011-10-10 12:09:19 +00:00
import java.util.List ;
2011-11-08 00:29:33 +00:00
import java.util.Map ;
2012-11-21 00:57:53 +00:00
import java.util.Map.Entry ;
2014-06-28 20:23:17 +00:00
import java.util.UUID ;
2014-08-12 22:25:57 +00:00
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge ;
2014-10-27 11:23:08 +00:00
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry ;
2011-10-16 06:00:37 +00:00
import org.bukkit.Bukkit ;
2013-07-02 20:31:05 +00:00
import org.bukkit.ChatColor ;
import org.bukkit.GameMode ;
2011-10-10 12:09:19 +00:00
import org.bukkit.Location ;
import org.bukkit.Material ;
2012-03-09 19:01:04 +00:00
import org.bukkit.entity.Arrow ;
import org.bukkit.entity.EntityType ;
import org.bukkit.entity.LivingEntity ;
import org.bukkit.entity.Player ;
2013-07-27 21:49:25 +00:00
import org.bukkit.scheduler.BukkitRunnable ;
2012-12-09 03:42:29 +00:00
import org.bukkit.scheduler.BukkitTask ;
2011-10-10 12:09:19 +00:00
2013-01-21 18:58:42 +00:00
public class TFM_PlayerData
2011-10-01 17:59:46 +00:00
{
2014-11-20 22:20:31 +00:00
public static final Map < Player , TFM_PlayerData > USER_INFO = new HashMap < Player , TFM_PlayerData > ( ) ;
public static final long AUTO_PURGE = 20L * 60L * 5L ;
2012-09-18 21:25:37 +00:00
2013-08-14 14:01:42 +00:00
public static TFM_PlayerData getPlayerData ( Player player )
2011-10-16 06:00:37 +00:00
{
2014-11-20 22:20:31 +00:00
TFM_PlayerData playerdata = TFM_PlayerData . USER_INFO . get ( player ) ;
2012-11-21 00:57:53 +00:00
2014-06-28 20:23:17 +00:00
if ( playerdata ! = null )
2012-11-21 00:57:53 +00:00
{
2014-06-28 20:23:17 +00:00
return playerdata ;
}
2012-11-21 00:57:53 +00:00
2014-11-20 22:20:31 +00:00
Iterator < Entry < Player , TFM_PlayerData > > it = USER_INFO . entrySet ( ) . iterator ( ) ;
2014-06-28 20:23:17 +00:00
while ( it . hasNext ( ) )
{
Entry < Player , TFM_PlayerData > pair = it . next ( ) ;
TFM_PlayerData playerdataTest = pair . getValue ( ) ;
if ( playerdataTest . player . getName ( ) . equalsIgnoreCase ( player . getName ( ) ) )
{
if ( Bukkit . getOnlineMode ( ) )
{
playerdata = playerdataTest ;
break ;
}
else
2012-11-21 00:57:53 +00:00
{
2014-06-28 20:23:17 +00:00
if ( playerdataTest . ip . equalsIgnoreCase ( player . getAddress ( ) . getAddress ( ) . getHostAddress ( ) ) )
2012-11-21 00:57:53 +00:00
{
2013-08-25 16:32:01 +00:00
playerdata = playerdataTest ;
2012-11-21 00:57:53 +00:00
break ;
}
}
}
}
2014-06-28 20:23:17 +00:00
if ( playerdata ! = null )
2011-10-16 06:00:37 +00:00
{
2014-06-28 20:23:17 +00:00
return playerdata ;
2011-10-16 06:00:37 +00:00
}
2012-11-21 00:57:53 +00:00
2014-06-28 20:23:17 +00:00
playerdata = new TFM_PlayerData ( player ) ;
2014-11-20 22:20:31 +00:00
TFM_PlayerData . USER_INFO . put ( player , playerdata ) ;
2014-06-28 20:23:17 +00:00
2011-10-16 06:00:37 +00:00
return playerdata ;
}
2014-12-21 09:23:50 +00:00
//
private final Player player ;
private final String ip ;
private final UUID uuid ;
//
private BukkitTask unmuteTask ;
private BukkitTask unfreezeTask ;
private BukkitTask mp44ScheduleTask = null ;
private BukkitTask lockupScheduleTask = null ;
private boolean isHalted = false ;
private boolean isCaged = false ;
private boolean inAdminchat = false ;
private boolean allCommandsBlocked = false ;
private boolean verifiedSuperadminId = false ;
private boolean cmdspyEnabled = false ;
private boolean mp44Armed = false ;
private boolean mp44Firing = false ;
private boolean isOrbiting = false ;
private boolean mobThrowerEnabled = false ;
private int messageCount = 0 ;
private int totalBlockDestroy = 0 ;
private int totalBlockPlace = 0 ;
private int freecamDestroyCount = 0 ;
private int freecamPlaceCount = 0 ;
private int warningCount = 0 ;
private double orbitStrength = 10 . 0 ;
private double mobThrowerSpeed = 4 . 0 ;
private Location cagePosition ;
private Location freezeLocation ;
private final List < TFM_BlockData > cageHistory = new ArrayList < TFM_BlockData > ( ) ;
private final List < LivingEntity > mobThrowerQueue = new ArrayList < LivingEntity > ( ) ;
private Material cageOuterMaterial = Material . GLASS ;
private Material cageInnerMatterial = Material . AIR ;
private String lastMessage = " " ;
private String lastCommand = " " ;
private String tag = null ;
private EntityType mobThrowerEntity = EntityType . PIG ;
private TFM_PlayerData ( Player player )
{
this . player = player ;
this . uuid = TFM_UuidManager . getUniqueId ( player . getName ( ) ) ;
this . ip = player . getAddress ( ) . getAddress ( ) . getHostAddress ( ) ;
}
2012-09-18 21:25:37 +00:00
2012-11-21 01:09:24 +00:00
public String getIpAddress ( )
{
2013-08-25 16:32:01 +00:00
return this . ip ;
2012-11-21 01:09:24 +00:00
}
2014-06-28 20:23:17 +00:00
public UUID getUniqueId ( )
{
return uuid ;
}
2011-10-16 06:00:37 +00:00
public boolean isOrbiting ( )
{
2013-08-25 16:32:01 +00:00
return this . isOrbiting ;
2011-10-16 06:00:37 +00:00
}
2013-08-25 16:32:01 +00:00
public void startOrbiting ( double strength )
2011-10-16 06:00:37 +00:00
{
2013-08-25 16:32:01 +00:00
this . isOrbiting = true ;
this . orbitStrength = strength ;
2011-10-16 06:00:37 +00:00
}
2012-09-18 21:25:37 +00:00
2011-10-16 06:00:37 +00:00
public void stopOrbiting ( )
{
2013-08-25 16:32:01 +00:00
this . isOrbiting = false ;
2011-10-16 06:00:37 +00:00
}
public double orbitStrength ( )
{
2013-08-25 16:32:01 +00:00
return this . orbitStrength ;
2011-10-16 06:00:37 +00:00
}
2011-10-14 23:29:09 +00:00
2011-10-10 12:09:19 +00:00
public void setCaged ( boolean state )
{
2013-08-25 16:32:01 +00:00
this . isCaged = state ;
2011-10-10 12:09:19 +00:00
}
2011-10-14 23:29:09 +00:00
2013-08-25 16:32:01 +00:00
public void setCaged ( boolean state , Location location , Material outer , Material inner )
2011-10-10 12:09:19 +00:00
{
2013-08-25 16:32:01 +00:00
this . isCaged = state ;
this . cagePosition = location ;
this . cageOuterMaterial = outer ;
this . cageInnerMatterial = inner ;
2011-10-10 12:09:19 +00:00
}
2011-10-14 23:29:09 +00:00
2011-10-10 12:09:19 +00:00
public boolean isCaged ( )
{
2013-08-25 16:32:01 +00:00
return this . isCaged ;
2011-10-10 12:09:19 +00:00
}
2012-09-18 21:25:37 +00:00
2011-10-14 23:29:09 +00:00
public Material getCageMaterial ( CageLayer layer )
{
switch ( layer )
2011-10-10 12:09:19 +00:00
{
2011-10-14 23:29:09 +00:00
case OUTER :
2013-08-25 16:32:01 +00:00
return this . cageOuterMaterial ;
2011-10-14 23:29:09 +00:00
case INNER :
2013-08-25 16:32:01 +00:00
return this . cageInnerMatterial ;
2011-10-14 23:29:09 +00:00
default :
2013-08-25 16:32:01 +00:00
return this . cageOuterMaterial ;
2011-10-10 12:09:19 +00:00
}
}
2011-10-14 23:29:09 +00:00
2011-10-10 12:09:19 +00:00
public Location getCagePos ( )
{
2013-08-25 16:32:01 +00:00
return this . cagePosition ;
2011-10-10 12:09:19 +00:00
}
2011-10-14 23:29:09 +00:00
2011-10-10 12:09:19 +00:00
public void clearHistory ( )
{
2013-08-25 16:32:01 +00:00
this . cageHistory . clear ( ) ;
2011-10-10 12:09:19 +00:00
}
2011-10-14 23:29:09 +00:00
2011-10-10 12:09:19 +00:00
public void insertHistoryBlock ( Location location , Material material )
{
2013-08-25 16:32:01 +00:00
this . cageHistory . add ( new TFM_BlockData ( location , material ) ) ;
2011-10-10 12:09:19 +00:00
}
2011-10-14 23:29:09 +00:00
2011-10-10 12:09:19 +00:00
public void regenerateHistory ( )
{
2013-08-25 16:32:01 +00:00
for ( TFM_BlockData blockdata : this . cageHistory )
2011-10-10 12:09:19 +00:00
{
blockdata . location . getBlock ( ) . setType ( blockdata . material ) ;
}
}
2011-10-14 23:29:09 +00:00
2014-12-21 09:23:50 +00:00
public Location getFreezeLocation ( )
2011-10-10 12:09:19 +00:00
{
2014-12-21 09:23:50 +00:00
return freezeLocation ;
2011-10-10 12:09:19 +00:00
}
2011-10-14 23:29:09 +00:00
2011-10-01 17:59:46 +00:00
public boolean isFrozen ( )
{
2014-11-20 22:20:31 +00:00
return unfreezeTask ! = null ;
2011-10-01 17:59:46 +00:00
}
2011-10-02 04:18:52 +00:00
2014-12-21 09:23:50 +00:00
public void setFrozen ( boolean freeze )
2011-10-01 17:59:46 +00:00
{
2014-11-20 22:20:31 +00:00
cancel ( unfreezeTask ) ;
unfreezeTask = null ;
2014-12-21 09:23:50 +00:00
freezeLocation = null ;
2014-11-20 22:20:31 +00:00
2014-12-21 09:23:50 +00:00
if ( player . getGameMode ( ) ! = GameMode . CREATIVE )
{
player . setFlying ( false ) ;
}
if ( ! freeze )
2014-11-20 22:20:31 +00:00
{
return ;
}
2014-12-21 09:23:50 +00:00
freezeLocation = player . getLocation ( ) ; // Blockify location
player . setFlying ( true ) ; // Avoid infinite falling
2014-11-20 22:20:31 +00:00
unfreezeTask = new BukkitRunnable ( )
{
@Override
public void run ( )
{
TFM_Util . adminAction ( " TotalFreedom " , " Unfreezing " + player . getName ( ) , false ) ;
setFrozen ( false ) ;
}
} . runTaskLater ( TotalFreedomMod . plugin , AUTO_PURGE ) ;
2011-10-01 17:59:46 +00:00
}
public void resetMsgCount ( )
{
2013-08-25 16:32:01 +00:00
this . messageCount = 0 ;
2011-10-01 17:59:46 +00:00
}
2011-10-02 04:18:52 +00:00
2013-08-13 17:42:43 +00:00
public int incrementAndGetMsgCount ( )
2011-10-01 17:59:46 +00:00
{
2013-08-25 16:32:01 +00:00
return this . messageCount + + ;
2011-10-01 17:59:46 +00:00
}
2011-10-02 04:18:52 +00:00
2013-08-13 17:42:43 +00:00
public int incrementAndGetBlockDestroyCount ( )
2011-10-01 17:59:46 +00:00
{
2013-08-25 16:32:01 +00:00
return this . totalBlockDestroy + + ;
2011-10-01 17:59:46 +00:00
}
2011-10-02 04:18:52 +00:00
2011-10-01 17:59:46 +00:00
public void resetBlockDestroyCount ( )
{
2013-08-25 16:32:01 +00:00
this . totalBlockDestroy = 0 ;
2011-10-05 19:07:45 +00:00
}
2012-09-18 21:25:37 +00:00
2013-08-13 17:42:43 +00:00
public int incrementAndGetBlockPlaceCount ( )
2011-10-18 04:08:40 +00:00
{
2013-08-25 16:32:01 +00:00
return this . totalBlockPlace + + ;
2011-10-18 04:08:40 +00:00
}
public void resetBlockPlaceCount ( )
{
2013-08-25 16:32:01 +00:00
this . totalBlockPlace = 0 ;
2011-10-18 04:08:40 +00:00
}
2011-10-14 23:29:09 +00:00
2013-08-13 17:42:43 +00:00
public int incrementAndGetFreecamDestroyCount ( )
2011-10-05 19:07:45 +00:00
{
2013-08-25 16:32:01 +00:00
return this . freecamDestroyCount + + ;
2011-10-05 19:07:45 +00:00
}
public void resetFreecamDestroyCount ( )
{
2013-08-25 16:32:01 +00:00
this . freecamDestroyCount = 0 ;
2011-10-05 19:07:45 +00:00
}
2011-10-14 23:29:09 +00:00
2013-08-13 17:42:43 +00:00
public int incrementAndGetFreecamPlaceCount ( )
2011-10-05 19:07:45 +00:00
{
2013-08-25 16:32:01 +00:00
return this . freecamPlaceCount + + ;
2011-10-05 19:07:45 +00:00
}
public void resetFreecamPlaceCount ( )
{
2013-08-25 16:32:01 +00:00
this . freecamPlaceCount = 0 ;
2011-10-01 17:59:46 +00:00
}
2011-10-16 06:00:37 +00:00
2013-08-25 16:32:01 +00:00
public void enableMobThrower ( EntityType mobThrowerCreature , double mobThrowerSpeed )
2011-10-16 06:00:37 +00:00
{
2013-08-25 16:32:01 +00:00
this . mobThrowerEnabled = true ;
this . mobThrowerEntity = mobThrowerCreature ;
this . mobThrowerSpeed = mobThrowerSpeed ;
2011-10-16 06:00:37 +00:00
}
2012-09-18 21:25:37 +00:00
2011-10-16 06:00:37 +00:00
public void disableMobThrower ( )
{
2013-08-25 16:32:01 +00:00
this . mobThrowerEnabled = false ;
2011-10-16 06:00:37 +00:00
}
2012-03-03 04:29:54 +00:00
public EntityType mobThrowerCreature ( )
2011-10-16 06:00:37 +00:00
{
2013-08-25 16:32:01 +00:00
return this . mobThrowerEntity ;
2011-10-16 06:00:37 +00:00
}
public double mobThrowerSpeed ( )
{
2013-08-25 16:32:01 +00:00
return this . mobThrowerSpeed ;
2011-10-16 06:00:37 +00:00
}
2012-09-18 21:25:37 +00:00
2011-10-16 06:00:37 +00:00
public boolean mobThrowerEnabled ( )
{
2013-08-25 16:32:01 +00:00
return this . mobThrowerEnabled ;
2011-10-16 06:00:37 +00:00
}
2012-09-18 21:25:37 +00:00
2011-10-16 06:00:37 +00:00
public void enqueueMob ( LivingEntity mob )
{
2013-08-25 16:32:01 +00:00
mobThrowerQueue . add ( mob ) ;
if ( mobThrowerQueue . size ( ) > 4 )
2011-10-16 06:00:37 +00:00
{
2013-08-25 16:32:01 +00:00
LivingEntity oldmob = mobThrowerQueue . remove ( 0 ) ;
2011-10-16 06:00:37 +00:00
if ( oldmob ! = null )
{
2013-07-02 23:08:31 +00:00
oldmob . damage ( 500 . 0 ) ;
2011-10-16 06:00:37 +00:00
}
}
}
2012-09-18 21:25:37 +00:00
2011-10-21 17:02:07 +00:00
public void startArrowShooter ( TotalFreedomMod plugin )
2011-10-16 06:00:37 +00:00
{
2011-10-21 17:02:07 +00:00
this . stopArrowShooter ( ) ;
2014-11-20 22:20:31 +00:00
this . mp44ScheduleTask = new ArrowShooter ( this . player ) . runTaskTimer ( plugin , 1L , 1L ) ;
2013-08-25 16:32:01 +00:00
this . mp44Firing = true ;
2011-10-16 06:00:37 +00:00
}
2012-09-18 21:25:37 +00:00
2011-10-19 00:37:00 +00:00
public void stopArrowShooter ( )
2011-10-16 06:00:37 +00:00
{
2014-11-20 22:20:31 +00:00
if ( this . mp44ScheduleTask ! = null )
2011-10-16 06:00:37 +00:00
{
2014-11-20 22:20:31 +00:00
this . mp44ScheduleTask . cancel ( ) ;
this . mp44ScheduleTask = null ;
2011-10-16 06:00:37 +00:00
}
2013-08-25 16:32:01 +00:00
this . mp44Firing = false ;
2011-10-21 17:02:07 +00:00
}
2012-09-18 21:25:37 +00:00
2011-10-21 17:02:07 +00:00
public void armMP44 ( )
{
2013-08-25 16:32:01 +00:00
this . mp44Armed = true ;
2011-10-21 17:02:07 +00:00
this . stopArrowShooter ( ) ;
}
2012-09-18 21:25:37 +00:00
2011-10-21 17:02:07 +00:00
public void disarmMP44 ( )
{
2013-08-25 16:32:01 +00:00
this . mp44Armed = false ;
2011-10-21 17:02:07 +00:00
this . stopArrowShooter ( ) ;
}
2012-09-18 21:25:37 +00:00
2011-10-21 17:02:07 +00:00
public boolean isMP44Armed ( )
{
2013-08-25 16:32:01 +00:00
return this . mp44Armed ;
2011-10-21 17:02:07 +00:00
}
2012-09-18 21:25:37 +00:00
2011-10-21 17:02:07 +00:00
public boolean toggleMP44Firing ( )
{
2013-08-25 16:32:01 +00:00
this . mp44Firing = ! this . mp44Firing ;
return mp44Firing ;
2011-10-16 06:00:37 +00:00
}
2012-09-14 22:49:44 +00:00
public boolean isMuted ( )
{
2014-11-20 22:20:31 +00:00
return unmuteTask ! = null ;
2012-09-14 22:49:44 +00:00
}
2013-08-25 16:32:01 +00:00
public void setMuted ( boolean muted )
2012-09-14 22:49:44 +00:00
{
2014-11-20 22:20:31 +00:00
cancel ( unmuteTask ) ;
unmuteTask = null ;
if ( ! muted )
{
return ;
}
unmuteTask = new BukkitRunnable ( )
{
@Override
public void run ( )
{
2014-11-25 19:29:58 +00:00
TFM_Util . adminAction ( " TotalFreedom " , " Unmuting " + player . getName ( ) , false ) ;
2014-11-20 22:20:31 +00:00
setMuted ( false ) ;
}
} . runTaskLater ( TotalFreedomMod . plugin , AUTO_PURGE ) ;
2012-09-14 22:49:44 +00:00
}
2012-09-18 21:25:37 +00:00
2012-09-18 10:13:06 +00:00
public boolean isHalted ( )
{
2013-08-25 16:32:01 +00:00
return this . isHalted ;
2012-09-18 10:13:06 +00:00
}
2012-09-18 21:25:37 +00:00
2013-08-25 16:32:01 +00:00
public void setHalted ( boolean halted )
2012-09-18 10:13:06 +00:00
{
2013-08-25 16:32:01 +00:00
this . isHalted = halted ;
2013-07-02 20:31:05 +00:00
2013-08-25 16:32:01 +00:00
if ( halted )
2013-07-02 20:31:05 +00:00
{
player . setOp ( false ) ;
player . setGameMode ( GameMode . SURVIVAL ) ;
player . setFlying ( false ) ;
2014-08-12 22:25:57 +00:00
TFM_EssentialsBridge . setNickname ( player . getName ( ) , player . getName ( ) ) ;
2013-07-02 20:31:05 +00:00
player . closeInventory ( ) ;
player . setTotalExperience ( 0 ) ;
stopOrbiting ( ) ;
setFrozen ( true ) ;
setMuted ( true ) ;
player . sendMessage ( ChatColor . GRAY + " You have been halted, don't move! " ) ;
}
else
{
player . setOp ( true ) ;
player . setGameMode ( GameMode . CREATIVE ) ;
setFrozen ( false ) ;
setMuted ( false ) ;
player . sendMessage ( ChatColor . GRAY + " You are no longer halted. " ) ;
}
2013-07-11 01:46:29 +00:00
2012-09-18 10:13:06 +00:00
}
2012-09-19 02:21:25 +00:00
2012-12-09 03:42:29 +00:00
public BukkitTask getLockupScheduleID ( )
2012-09-19 02:21:25 +00:00
{
2014-11-20 22:20:31 +00:00
return this . lockupScheduleTask ;
2012-09-19 02:21:25 +00:00
}
2013-08-25 16:32:01 +00:00
public void setLockupScheduleID ( BukkitTask id )
2012-09-19 02:21:25 +00:00
{
2014-11-20 22:20:31 +00:00
this . lockupScheduleTask = id ;
2012-09-19 02:21:25 +00:00
}
2012-11-27 19:02:39 +00:00
2013-08-25 16:32:01 +00:00
public void setLastMessage ( String message )
2012-11-27 19:02:39 +00:00
{
2013-08-25 16:32:01 +00:00
this . lastMessage = message ;
2012-11-27 19:02:39 +00:00
}
public String getLastMessage ( )
{
2013-08-25 16:32:01 +00:00
return lastMessage ;
2012-11-27 19:02:39 +00:00
}
2012-11-28 18:31:01 +00:00
2013-08-25 16:32:01 +00:00
public void setAdminChat ( boolean inAdminchat )
2012-11-28 18:31:01 +00:00
{
2013-08-25 16:32:01 +00:00
this . inAdminchat = inAdminchat ;
2012-11-28 18:31:01 +00:00
}
public boolean inAdminChat ( )
{
2013-08-25 16:32:01 +00:00
return this . inAdminchat ;
2012-11-28 18:31:01 +00:00
}
2012-12-06 09:32:08 +00:00
2012-12-08 01:01:52 +00:00
public boolean allCommandsBlocked ( )
2012-12-06 09:32:08 +00:00
{
2013-08-25 16:32:01 +00:00
return this . allCommandsBlocked ;
2012-12-06 09:32:08 +00:00
}
2013-08-25 16:32:01 +00:00
public void setCommandsBlocked ( boolean commandsBlocked )
2012-12-06 09:32:08 +00:00
{
2013-08-25 16:32:01 +00:00
this . allCommandsBlocked = commandsBlocked ;
2012-12-06 09:32:08 +00:00
}
2012-12-20 01:25:29 +00:00
2013-08-25 16:32:01 +00:00
// If someone logs in to telnet or minecraft, and they are an admin, make sure that they are using a username that is associated with their IP.
// After the check for this is done in TFM_PlayerListener, never change it elsewhere.
2014-04-11 15:24:44 +00:00
public boolean isSuperadminIdVerified ( )
2012-12-20 01:25:29 +00:00
{
2013-08-25 16:32:01 +00:00
return this . verifiedSuperadminId ;
2012-12-20 01:25:29 +00:00
}
2013-08-25 16:32:01 +00:00
// If someone logs in to telnet or minecraft, and they are an admin, make sure that they are using a username that is associated with their IP.
// After the check for this is done in TFM_PlayerListener, never change it elsewhere.
2014-04-11 15:24:44 +00:00
public void setSuperadminIdVerified ( boolean verifiedSuperadminId )
2012-12-20 01:25:29 +00:00
{
2013-08-25 16:32:01 +00:00
this . verifiedSuperadminId = verifiedSuperadminId ;
2012-12-20 01:25:29 +00:00
}
2012-12-22 03:22:08 +00:00
public String getLastCommand ( )
{
2013-08-25 16:32:01 +00:00
return lastCommand ;
2012-12-22 03:22:08 +00:00
}
2013-08-25 16:32:01 +00:00
public void setLastCommand ( String lastCommand )
2012-12-22 03:22:08 +00:00
{
2013-08-25 16:32:01 +00:00
this . lastCommand = lastCommand ;
2012-12-22 03:22:08 +00:00
}
2013-01-21 18:58:42 +00:00
2013-08-25 16:32:01 +00:00
public void setCommandSpy ( boolean enabled )
2013-01-21 18:58:42 +00:00
{
2013-08-25 16:32:01 +00:00
this . cmdspyEnabled = enabled ;
2013-01-21 18:58:42 +00:00
}
public boolean cmdspyEnabled ( )
{
2013-08-25 16:32:01 +00:00
return cmdspyEnabled ;
2013-01-21 18:58:42 +00:00
}
2013-08-12 10:26:49 +00:00
public void setTag ( String tag )
{
if ( tag = = null )
{
this . tag = null ;
}
else
{
2013-09-21 17:58:16 +00:00
this . tag = TFM_Util . colorize ( tag ) + ChatColor . WHITE ;
2013-08-12 10:26:49 +00:00
}
}
public String getTag ( )
{
return this . tag ;
}
2014-10-27 11:23:08 +00:00
public int getWarningCount ( )
{
return this . warningCount ;
}
public void incrementWarnings ( )
{
this . warningCount + + ;
if ( this . warningCount % 2 = = 0 )
{
this . player . getWorld ( ) . strikeLightning ( this . player . getLocation ( ) ) ;
TFM_Util . playerMsg ( this . player , ChatColor . RED + " You have been warned at least twice now, make sure to read the rules at " + TFM_ConfigEntry . SERVER_BAN_URL . getString ( ) ) ;
}
}
2014-11-20 22:20:31 +00:00
public void cancel ( BukkitTask task )
{
if ( task = = null )
{
return ;
}
try
{
task . cancel ( ) ;
}
catch ( Exception ex )
{
}
}
2014-12-21 09:23:50 +00:00
public enum CageLayer
{
INNER , OUTER
}
private class TFM_BlockData
{
public Material material ;
public Location location ;
private TFM_BlockData ( Location location , Material material )
{
this . location = location ;
this . material = material ;
}
}
private class ArrowShooter extends BukkitRunnable
{
private Player player ;
private ArrowShooter ( Player player )
{
this . player = player ;
}
@Override
public void run ( )
{
Arrow shot = player . launchProjectile ( Arrow . class ) ;
shot . setVelocity ( shot . getVelocity ( ) . multiply ( 2 . 0 ) ) ;
}
}
2011-10-01 17:59:46 +00:00
}