mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-02 12:23:47 +07:00
Unit control null checks
This commit is contained in:
parent
e81385a8e6
commit
9470f1f99f
@ -156,6 +156,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
@Remote(targets = Loc.client, called = Loc.server)
|
||||
public static void dropItem(Player player, float angle){
|
||||
if(player == null) return;
|
||||
|
||||
if(net.server() && player.unit().stack.amount <= 0){
|
||||
throw new ValidateException(player, "Player cannot drop an item.");
|
||||
}
|
||||
@ -208,7 +210,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||
public static void tileConfig(Player player, Building tile, @Nullable Object value){
|
||||
if(tile == null) return;
|
||||
if(tile == null || player == null) return;
|
||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
||||
!netServer.admins.allowAction(player, ActionType.configure, tile.tile(), action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile.");
|
||||
tile.configured(player, value);
|
||||
@ -217,6 +219,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||
public static void unitControl(Player player, @Nullable Unit unit){
|
||||
if(player == null) return;
|
||||
|
||||
//clear player unit when they possess a core
|
||||
if((unit instanceof BlockUnitc && ((BlockUnitc)unit).tile() instanceof CoreBuild)){
|
||||
Fx.spawn.at(player);
|
||||
|
Loading…
Reference in New Issue
Block a user