Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
d0d902786e
Commit
0ad94d9716
@ -527,7 +527,7 @@ SIMULATOR_WAND_LORE_2 = §eSneaking §8- §7Free movement
|
||||
SIMULATOR_WAND_LORE_3 = §eLeft click §8- §7Start the simulation
|
||||
SIMULATOR_WAND_LORE_4 = §eRight click in air §8- §7Opens the gui
|
||||
|
||||
SIMULATOR_REGION_FREEZED = §cSimulator cannot be used inside freezed regions
|
||||
SIMULATOR_REGION_FROZEN = §cSimulator cannot be used inside frozen regions
|
||||
|
||||
## Other
|
||||
SIMULATOR_PLUS_ONE = §7+1
|
||||
|
@ -528,7 +528,7 @@ SIMULATOR_WAND_LORE_2 = §eSneaken §8- §7Freie Bewegung
|
||||
SIMULATOR_WAND_LORE_3 = §eLinksklick §8- §7Starte die Simulation
|
||||
SIMULATOR_WAND_LORE_4 = §eRechtsklick Luft §8- §7Öffne die GUI
|
||||
|
||||
SIMULATOR_REGION_FREEZED = §cSimulator kann nicht in eingefrorenen Regionen genutzt werden
|
||||
SIMULATOR_REGION_FROZEN = §cSimulator kann nicht in eingefrorenen Regionen genutzt werden
|
||||
|
||||
## Other
|
||||
SIMULATOR_PLUS_ONE = §7+1
|
||||
|
@ -29,8 +29,6 @@ import de.steamwar.bausystem.features.simulator.tnt.TNTElement;
|
||||
import de.steamwar.bausystem.features.simulator.tnt.TNTGroup;
|
||||
import de.steamwar.bausystem.features.tracer.record.RecordStateMachine;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||
import de.steamwar.bausystem.shared.Pair;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -213,26 +211,15 @@ public class TNTSimulator {
|
||||
}
|
||||
|
||||
public void start(Player p) {
|
||||
for (SimulatorElement element : tntElementList) {
|
||||
if (element instanceof TNTElement) {
|
||||
if (Region.getRegion(element.getPosition().toLocation(SimulatorStorage.WORLD)).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
BauSystem.MESSAGE.send("SIMULATOR_REGION_FREEZED", p);
|
||||
return;
|
||||
}
|
||||
} else if (element instanceof TNTGroup) {
|
||||
for (TNTElement tntElement : ((TNTGroup) element).getElements()) {
|
||||
if (Region.getRegion(tntElement.getPosition().toLocation(SimulatorStorage.WORLD)).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
BauSystem.MESSAGE.send("SIMULATOR_REGION_FREEZED", p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
Map<Integer, Map<Integer, Set<Pair<Runnable, Integer>>>> result = new HashMap<>();
|
||||
boolean regionFrozen = false;
|
||||
for (SimulatorElement element : tntElementList) {
|
||||
element.locations(result, region, p.getLocation());
|
||||
regionFrozen |= element.locations(result, region, p.getLocation());
|
||||
}
|
||||
if (regionFrozen) {
|
||||
BauSystem.MESSAGE.send("SIMULATOR_REGION_FROZEN", p);
|
||||
return;
|
||||
}
|
||||
|
||||
playerShowMode.forEach((player, simulatorEntityShowMode) -> {
|
||||
|
@ -49,7 +49,7 @@ public interface SimulatorElement {
|
||||
void hide(SimulatorEntityShowMode showMode);
|
||||
|
||||
SWItem menu(Player p);
|
||||
void locations(Map<Integer, Map<Integer, Set<Pair<Runnable, Integer>>>> result, Region region, Location location); // Ticks to subtick order to spawning runnable to count of activations
|
||||
boolean locations(Map<Integer, Map<Integer, Set<Pair<Runnable, Integer>>>> result, Region region, Location location); // Ticks to subtick order to spawning runnable to count of activations
|
||||
|
||||
// Observer
|
||||
default void change() {
|
||||
|
@ -25,6 +25,8 @@ import de.steamwar.bausystem.features.simulator.OrderUtils;
|
||||
import de.steamwar.bausystem.features.simulator.SimulatorStorage;
|
||||
import de.steamwar.bausystem.features.simulator.show.SimulatorEntityShowMode;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.shared.Pair;
|
||||
@ -167,11 +169,15 @@ public class TNTElement implements SimulatorElement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void locations(Map<Integer, Map<Integer, Set<Pair<Runnable, Integer>>>> result, Region region, Location radius) {
|
||||
if (disabled) return;
|
||||
public boolean locations(Map<Integer, Map<Integer, Set<Pair<Runnable, Integer>>>> result, Region region, Location radius) {
|
||||
if (disabled) return false;
|
||||
Location location = getPosition().toLocation(SimulatorStorage.WORLD);
|
||||
if (location.distanceSquared(radius) > 10000 || !region.inRegion(location, RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
Region thisRegion = Region.getRegion(location);
|
||||
if (thisRegion.getFlagStorage().get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
result.computeIfAbsent(getTickOffset(), ignore -> new HashMap<>())
|
||||
@ -184,6 +190,7 @@ public class TNTElement implements SimulatorElement {
|
||||
if (!zVelocity) tntPrimed.setVelocity(tntPrimed.getVelocity().setZ(0));
|
||||
});
|
||||
}, count));
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
|
@ -139,11 +139,14 @@ public class TNTGroup implements SimulatorElement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void locations(Map<Integer, Map<Integer, Set<Pair<Runnable, Integer>>>> result, Region region, Location location) {
|
||||
if (disabled) return;
|
||||
elements.forEach(tntElement -> {
|
||||
tntElement.locations(result, region, location);
|
||||
});
|
||||
public boolean locations(Map<Integer, Map<Integer, Set<Pair<Runnable, Integer>>>> result, Region region, Location location) {
|
||||
if (disabled) return false;
|
||||
for (TNTElement element : elements) {
|
||||
if (element.locations(result, region, location)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setTickOffset(int tickOffset) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren