Objectification

This commit is contained in:
Anuken
2020-01-14 13:32:19 -05:00
parent 68be77fa1d
commit ae2dd5732a
8 changed files with 77 additions and 27 deletions

View File

@@ -151,19 +151,9 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
}
}
@Remote(targets = Loc.both, called = Loc.server, forward = true)
public static void onTileTapped(Player player, Tile tile){
if(tile == null || player == null) return;
if(net.server() && (!Units.canInteract(player, tile) ||
!netServer.admins.allowAction(player, ActionType.tapTile, tile, action -> {}))) throw new ValidateException(player, "Player cannot tap a tile.");
tile.block().tapped(tile, player);
Core.app.post(() -> Events.fire(new TapEvent(tile, player)));
}
@Remote(targets = Loc.both, called = Loc.both, forward = true)
public static void onTileConfig(Player player, Tile tile, int value){
public static void onTileConfig(Player player, Tile tile, @Nullable Object value){
if(tile == null) return;
if(net.server() && (!Units.canInteract(player, tile) ||
!netServer.admins.allowAction(player, ActionType.configure, tile, action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile.");
tile.block().configured(tile, player, value);
@@ -588,7 +578,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
//call tapped event
if(!consumed && tile.interactable(player.getTeam())){
Call.onTileTapped(player, tile);
Call.onTileConfig(player, tile, null);
}
//consume tap event if necessary