TimerHolder cancel task NPE check.
This commit is contained in:
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otheriwse
|
* @return {@code true} if timer for the given event, npc, player were stopped, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean cancelTimer()
|
public boolean cancelTimer()
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
TimersManager.getInstance().unregisterTimer(_player.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,7 @@ public class TimerHolder<T> implements Runnable
|
|||||||
*/
|
*/
|
||||||
public long getRemainingTime()
|
public long getRemainingTime()
|
||||||
{
|
{
|
||||||
if (_task == null)
|
if ((_task == null) || _task.isCancelled() || _task.isDone())
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_task.isCancelled() || _task.isDone())
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user