Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed Jun 17, 2022
1 parent 81a89ca commit b41d6f5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/me/mindustry/rush/RushPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import arc.Core;
import arc.Events;
import arc.struct.Seq;
import arc.util.Align;
import arc.util.Interval;
import arc.util.Strings;
Expand All @@ -14,7 +15,6 @@
import mindustry.game.Team;
import mindustry.gen.Call;
import mindustry.mod.Plugin;
import mindustry.net.Administration;
import mindustry.world.Block;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -40,12 +40,18 @@ public void init() {

// Makes the player unable to destroy sources blocks
Vars.netServer.admins.addActionFilter(action -> {
return !isActive() || action.type == Administration.ActionType.configure || !isSourceBlock(action.block);
return !isActive() || switch (action.type) {
case placeBlock -> action.tile
.getLinkedTilesAs(action.block, new Seq<>())
.find(t -> isSourceBlock(t.block())) == null;
case breakBlock -> !isSourceBlock(action.block);
default -> true;
};
});

// Source block dupe
Events.on(EventType.PickupEvent.class, e -> {
if (isActive() && isSourceBlock(e.build.block())) {
if (isActive() && e.build != null && isSourceBlock(e.build.block())) {
Core.app.post(() -> Call.setTile(e.build.tile(), e.build.block(), e.build.team(), e.build.rotation()));
}
});
Expand Down

0 comments on commit b41d6f5

Please sign in to comment.