diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index dc05026b2d..ce6c8a5eea 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -228,7 +228,7 @@ public class NetServer implements ApplicationListener{ }); //duration of a a kick in seconds - int kickDuration = 10 * 60; + int kickDuration = 15 * 60; class VoteSession{ Player target; @@ -243,9 +243,9 @@ public class NetServer implements ApplicationListener{ this.task = Timer.schedule(() -> { if(!checkPass()){ Call.sendMessage(Strings.format("[lightgray]Vote failed. Not enough votes to kick[orange] {0}[lightgray].", target.name)); + map.remove(target); + task.cancel(); } - map.remove(target); - task.cancel(); }, 60 * 1.5f); } @@ -254,6 +254,8 @@ public class NetServer implements ApplicationListener{ Call.sendMessage(Strings.format("[orange]Vote passed.[scarlet] {0}[orange] will be kicked from the server.", target.name)); admins.getInfo(target.uuid).lastKicked = Time.millis() + kickDuration*1000; kick(target.con.id, KickReason.vote); + map.remove(target); + task.cancel(); return true; } return false; @@ -272,6 +274,11 @@ public class NetServer implements ApplicationListener{ return; } + if(player.isLocal){ + player.sendMessage("[scarlet]Just kick them yourself if you're the host."); + return; + } + if(currentlyKicking.values().toArray().contains(v -> v.voted.contains(player.uuid) || v.voted.contains(admins.getInfo(player.uuid).lastIP))){ player.sendMessage("[scarlet]You've already voted. Sit down."); return; @@ -296,10 +303,10 @@ public class NetServer implements ApplicationListener{ } if(found != null){ - if(player == found){ - player.sendMessage("[scarlet]If you're interested in kicking yourself, just leave."); - }else if(found.isAdmin){ + if(found.isAdmin){ player.sendMessage("[scarlet]Did you really expect to be able to kick an admin?"); + }else if(found.isLocal){ + player.sendMessage("[scarlet]Local players cannot be kicked."); }else{ if(!currentlyKicking.containsKey(found) && !vtime.get()){ player.sendMessage("[scarlet]You must wait " + voteTime/60 + " minutes between votekicks."); diff --git a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java index 82615e8a01..1c38ceb45c 100644 --- a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java @@ -58,7 +58,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{ //visual only. if(Net.client()){ Tile tile = world.tile(unit.spawner); - if(tile != null && !Net.client()){ + if(tile != null){ tile.block().unitRemoved(tile, unit); } diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index 0b481a6105..70a60ab4b1 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -37,6 +37,7 @@ import static io.anuke.mindustry.Vars.*; public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ public static final int timerSync = 2; public static final int timerAbility = 3; + public static final int timerTransfer = 4; private static final int timerShootLeft = 0; private static final int timerShootRight = 1; private static final float liftoffBoost = 0.2f; @@ -59,7 +60,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ public NetConnection con; public boolean isLocal = false; - public Interval timer = new Interval(4); + public Interval timer = new Interval(6); public TargetTrait target; public TargetTrait moveTarget; diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index 6ed371a7ec..81de174e73 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -59,7 +59,7 @@ public abstract class InputHandler implements InputProcessor{ @Remote(targets = Loc.both, forward = true, called = Loc.server) public static void transferInventory(Player player, Tile tile){ - if(Net.server() && (player.item().amount <= 0 || player.isTransferring)){ + if(Net.server() && (player.item().amount <= 0 || player.isTransferring || !player.timer.get(Player.timerTransfer, 40))){ throw new ValidateException(player, "Player cannot transfer an item."); } @@ -288,7 +288,7 @@ public abstract class InputHandler implements InputProcessor{ } public void tryDropItems(Tile tile, float x, float y){ - if(!droppingItem || player.item().amount <= 0 || canTapPlayer(x, y) || state.isPaused()){ + if(!droppingItem || player.item().amount <= 0 || canTapPlayer(x, y) || state.isPaused() || !player.timer.check(Player.timerTransfer, 40)){ droppingItem = false; return; } diff --git a/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java b/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java index 4a8b96707e..2ee2359185 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java @@ -40,7 +40,7 @@ public class BlockInventoryFragment extends Fragment{ @Remote(called = Loc.server, targets = Loc.both, forward = true) public static void requestItem(Player player, Tile tile, Item item, int amount){ - if(player == null || tile == null) return; + if(player == null || tile == null || !player.timer.get(Player.timerTransfer, 20)) return; int removed = tile.block().removeStack(tile, item, amount);