The methods only make sense for players. Modify them to be for players only.

This commit is contained in:
Olof Larsson 2014-12-11 10:44:11 +01:00
parent c1db14eebe
commit 42914f48a0

View File

@ -190,30 +190,22 @@ public class MassiveCoreEngineMain extends EngineAbstract
} }
// This method sets the sender reference based on it's online state. // This method sets the sender reference based on it's online state.
public static void setSenderReferences(CommandSender sender) public static void setSenderReferences(Player player)
{ {
CommandSender reference = sender; Player reference = player;
if (sender instanceof Player) if ( ! player.isOnline()) reference = null;
{ setSenderReferences(player, reference);
Player player = (Player)sender;
if ( ! player.isOnline())
{
reference = null;
}
}
setSenderReferences(sender, reference);
} }
// Same as above but next tick. // Same as above but next tick.
public static void setSenderReferencesSoon(final CommandSender sender) public static void setSenderReferencesSoon(final Player player)
{ {
Bukkit.getScheduler().scheduleSyncDelayedTask(MassiveCore.get(), new Runnable() Bukkit.getScheduler().scheduleSyncDelayedTask(MassiveCore.get(), new Runnable()
{ {
@Override @Override
public void run() public void run()
{ {
setSenderReferences(sender); setSenderReferences(player);
} }
}); });
} }
@ -223,7 +215,7 @@ public class MassiveCoreEngineMain extends EngineAbstract
{ {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
// We set the reference at LOWEST so that it's present during this event. // We set the reference at LOWEST so that it's present during this PlayerLoginEvent event.
setSenderReferences(player, player); setSenderReferences(player, player);
// And the next tick we update the reference based on it's online state. // And the next tick we update the reference based on it's online state.