Fixed Ignite Flag

Fixed Formating

Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
Dieser Commit ist enthalten in:
D4rkr34lm 2024-04-17 21:49:47 +02:00
Ursprung ed799b2937
Commit d5d8c52862
10 geänderte Dateien mit 38 neuen und 398 gelöschten Zeilen

Datei anzeigen

@ -1,115 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.portablehole;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
// @Linked
public class PortableHoleListener implements Listener {
private Map<Long, List<BlockState>> toReplace = new HashMap<>();
{
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
List<BlockState> blockStates = toReplace.remove(TPSUtils.currentRealTick.get());
if (blockStates == null) return;
blockStates.forEach(blockState -> {
blockState.update(true, false);
});
}, 1, 1);
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!event.hasItem()) return;
if (event.getItem().getType() != Material.FIREWORK_STAR) return;
BlockFace blockFace;
if (event.getPlayer().getLocation().getPitch() < -45) {
blockFace = BlockFace.UP;
} else if (event.getPlayer().getLocation().getPitch() > 45) {
blockFace = BlockFace.DOWN;
} else if (event.getPlayer().getLocation().getYaw() > 135) {
blockFace = BlockFace.NORTH;
} else if (event.getPlayer().getLocation().getYaw() > 45) {
blockFace = BlockFace.WEST;
} else if (event.getPlayer().getLocation().getYaw() > -45) {
blockFace = BlockFace.SOUTH;
} else if (event.getPlayer().getLocation().getYaw() > -135) {
blockFace = BlockFace.EAST;
} else {
blockFace = BlockFace.NORTH;
}
for (int i = 0; i < 10; i++) {
Location source = event.getPlayer().getLocation().getBlock().getLocation().clone();
source.add(blockFace.getDirection().clone().multiply(i + 1 + (blockFace == BlockFace.UP ? 1 : 0)));
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
long reappearTime = TPSUtils.currentRealTick.get() + 100;
if (blockFace == BlockFace.UP || blockFace == BlockFace.DOWN) {
for (int dx = -1; dx <= 1; dx++) {
for (int dz = -1; dz <= 1; dz++) {
Block block = source.clone().add(dx, 0, dz).getBlock();
BlockState blockState = block.getState();
if (blockState.getType().isAir()) continue;
toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState);
block.setType(Material.AIR);
}
}
} else if (blockFace == BlockFace.NORTH || blockFace == BlockFace.SOUTH) {
for (int dx = -1; dx <= 1; dx++) {
for (int dy = 0; dy <= 2; dy++) {
Block block = source.clone().add(dx, dy, 0).getBlock();
BlockState blockState = block.getState();
if (blockState.getType().isAir()) continue;
toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState);
block.setType(Material.AIR);
}
}
} else {
for (int dy = 0; dy <= 2; dy++) {
for (int dz = -1; dz <= 1; dz++) {
Block block = source.clone().add(0, dy, dz).getBlock();
BlockState blockState = block.getState();
if (blockState.getType().isAir()) continue;
toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState);
block.setType(Material.AIR);
}
}
}
}, i);
}
}
}

Datei anzeigen

@ -179,8 +179,13 @@ public class TNTPoint implements Externalizable {
@Override
public String toString() {
return "TNTRecord{" +
"explosion=" + explosion +
return "TNTPoint{" +
"tntId=" + tntId +
", explosion=" + explosion +
", inWater=" + inWater +
", afterFirstExplosion=" + afterFirstExplosion +
", destroyedBuildArea=" + destroyedBuildArea +
", destroyedTestBlock=" + destroyedTestBlock +
", ticksSinceStart=" + ticksSinceStart +
", fuse=" + fuse +
", location=" + location +

Datei anzeigen

@ -279,8 +279,6 @@ public class Trace {
records.add((TNTPoint) inputStream.readObject());
}
System.out.println("Loaded... " + records);
Map<Integer, List<TNTPoint>> histories = new HashMap<>();
for (TNTPoint record : records) {
int tntId = record.getTntId();

Datei anzeigen

@ -68,24 +68,24 @@ public class TraceCommand extends SWCommand {
@Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW")
public void show(@Validator Player player, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) {
showInternal(player, 0, Integer.MAX_VALUE, bundleFilter, flags);
showInternal(player, bundleFilter, flags);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player);
}
@Register(value = { "show", "at" }, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH")
@Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH")
public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) {
showInternal(player, time, time, bundleFilter, flags);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time);
}
@Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH")
@Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH")
public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with,
@OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) {
@OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) {
showInternal(player, from, Integer.MAX_VALUE, bundleFilter, flags);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from);
}
@Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH")
@Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH")
public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) {
if (to < from) {
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_TO_SMALLER", player);
@ -95,30 +95,36 @@ public class TraceCommand extends SWCommand {
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to);
}
private void showInternal(Player player, int from, int to, BundleFilter bundleFilter, ViewFlag... flags) {
PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags);
playerTraceShowData.addViewFlag(new AtFlag(from, to));
TraceManager.instance.show(player, playerTraceShowData);
}
@Register(value = { "show", "at" }, description = "TRACE_COMMAND_HELP_SHOW_AT")
@Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT")
public void showAt(@Validator Player player, @Min(intValue = 0) int time) {
TraceManager.instance.renderAt(player, time, time);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time);
}
@Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM")
@Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM")
public void showFrom(@Validator Player player, @Min(intValue = 0) int from) {
TraceManager.instance.renderAt(player, from, Integer.MAX_VALUE);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from);
}
@Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO")
@Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO")
public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to) {
TraceManager.instance.renderAt(player, from, to);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to);
}
private void showInternal(Player player, BundleFilter bundleFilter, ViewFlag... flags) {
PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags);
TraceManager.instance.show(player, playerTraceShowData);
}
private void showInternal(Player player, int from, int to, BundleFilter bundleFilter, ViewFlag... flags) {
PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags);
playerTraceShowData.addViewFlag(new AtFlag(from, to));
TraceManager.instance.show(player, playerTraceShowData);
}
@Register(value = "hide", description = "TRACE_COMMAND_HELP_HIDE")
public void hide(@Validator Player player) {
TraceManager.instance.hide(player);

Datei anzeigen

@ -202,8 +202,7 @@ public class TraceManager implements Listener {
unfollow(player);
Region region = Region.getRegion(player.getLocation());
PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap())
.remove(player);
PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()).remove(player);
if (previous == null) return;
tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> {
trace.hide(player);
@ -221,9 +220,7 @@ public class TraceManager implements Listener {
showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> {
if (playerPlayerTraceShowDataMap.containsKey(follower)) {
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> {
trace.hide(follower);
});
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> trace.hide(follower));
}
PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(following);

Datei anzeigen

@ -168,8 +168,7 @@ public class TraceRecorder implements Listener {
}
boolean afterFirstExplosion = wrappedTrace.isExplosionRecorded();
TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion,
TPSUtils.currentTick.get() - wrappedTrace.getStartTick(), history, destroyedBlocks);
TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - wrappedTrace.getStartTick(), history, destroyedBlocks);
history.add(record);
return record;
@ -199,8 +198,7 @@ public class TraceRecorder implements Listener {
trackedTNT.get(region).add((TNTPrimed) event.getEntity());
tntSpawnRegion.put((TNTPrimed) event.getEntity(), region);
activeTraces.get(region).addRecord(
record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList()));
activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList()));
}
}
@ -219,7 +217,6 @@ public class TraceRecorder implements Listener {
trackedTNT.get(region).remove((TNTPrimed) event.getEntity());
tntSpawnRegion.remove((TNTPrimed) event.getEntity());
activeTraces.get(region)
.addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()));
activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()));
}
}

Datei anzeigen

@ -38,7 +38,7 @@ public class TraceRecordingWrapper {
private final long startTick;
private final List<TNTPoint> recordsToAdd;
private final List<TNTPoint> recordList;
private ObjectOutputStream recordsOutputStream;
private final ObjectOutputStream recordsOutputStream;
private int nextOpenRecordId = 0;
@Getter
private boolean explosionRecorded = false;

Datei anzeigen

@ -30,7 +30,7 @@ public class PlayerTraceShowData {
@Setter
private BundleFilter bundleFilter;
private Map<Class<? extends ViewFlag>, ViewFlag> viewFlags = new HashMap<>();
private final Map<Class<? extends ViewFlag>, ViewFlag> viewFlags = new HashMap<>();
public PlayerTraceShowData(BundleFilter bundleFilter, ViewFlag... viewFlags) {
this.bundleFilter = bundleFilter;
@ -49,6 +49,8 @@ public class PlayerTraceShowData {
}
}
System.out.println(flagList);
// Manage inverse flags
ViewFlag.inverseFlags.forEach(viewFlag -> {
if (!flagList.remove(viewFlag)) {
@ -56,6 +58,8 @@ public class PlayerTraceShowData {
}
});
System.out.println(flagList);
return flagList;
}

Datei anzeigen

@ -56,7 +56,7 @@ public abstract class ViewFlag {
@Override
public List<TNTPoint> filter(List<TNTPoint> records) {
return records.stream()
.filter(record -> !record.isAfterFirstExplosion())
.filter(record -> record.isAfterFirstExplosion())
.collect(Collectors.toList());
}
};

Datei anzeigen

@ -1,252 +0,0 @@
# Mining III
Stats menu, blocks broken
Pickaxe skins? / Cosmetics (Armor)
Crystals?
Music selector
McPrison enchantments?
Legendary enchantments? -> Overdrive entchantments via prestige points
Combo Perk Enchantments?
Show proc rate enchtantment
Crystal Level increase by mining?
Keeping -> Keep an enchantment or n levels on random enchantments
Max upgrade? +5 upgrade?
Auto buy?
## Enchantments
### Efficiency
- Increases Mining speed
- id: efficiency
- max: 10
- cost_block_base: 50
- cost_block_inc: 10
- cost_shards_base: -80
- cost_shards_inc: 20
### Haste
- Gain Haste
- id: haste
- max: 10
- cost_block_base: 1000
- cost_block_inc: 0
- cost_gold_base: 100
- cost_gold_inc: 100
### Speed
- Gain Speed
- id: speed
- max: 5
- cost_blocks_base: 500
- cost_blocks_inc: -100
- cost_shards_base: 100
- cost_shards_inc: 150
### Fortune
- Increases Blocks gained
- id: fortune
- max: 50
- cost_block_base: 100
- cost_block_inc: 25
- cost_gold_base: 200
- cost_gold_inc: 50
- cost_shards_base: -40
- cost_shards_inc: 10
### Prosperity
- Rare chance to greatly increse block gain
- id: prosperity
- max: 10
- cost_block_base: 1000
- cost_block_inc: 100
- cost_gold_base: 1000
- cost_gold_inc: 100
- cost_shards_base: 100
- cost_shards_inc: 100
### Gifted
- Get luckier prosperity procs
- id: gifted
- max: 25
- cost_block_base: 10000
- cost_block_inc: 1000
- cost_shards_base: 1000
- cost_shards_inc: 250
### Shard Fusing Tome
- Chance to turn ores into shards
- id: shard_fusing_tome
- max: 10
- cost_block_base: 5000
- cost_block_inc: 500
- cost_shards_base: 1000
- cost_shards_inc: 0
### Unstable shards
- Destroy every shard created by Shard Fusing Tome
- id: unstable_shards
- max: 1
- cost_block_base: 100000
- cost_block_inc: 0
- cost_gold_base: 25000
- cost_gold_inc: 0
- cost_shards_base: 10000
- cost_shards_inc: 0
### Gatherer
- Chance to gain Gold on Block break
- id: gatherer
- max: 10
- cost_block_base: 1000
- cost_block_inc: 1000
- cost_gold_base: 1000
- cost_gold_inc: 0
### Block Shatterer
- Greatly increase Block gain
- id: block_shatterer
- max: 10
- cost_block_base: 5000
- cost_block_inc: 5000
- cost_gold_base: 1000
- cost_gold_inc: 1000
- cost_shards_base: 500
- cost_shards_inc: 500
### Gold Shatterer
- Greatly increase Gold gain
- id: gold_shatterer
- max: 10
- cost_block_base: 1000
- cost_block_inc: 1000
- cost_gold_base: 5000
- cost_gold_inc: 5000
- cost_shards_base: 500
- cost_shards_inc: 500
### Shard Shatterer
- Greatly increase Shard gain
- id: shard_shatterer
- max: 10
- cost_block_base: 5000
- cost_block_inc: 5000
- cost_gold_base: 500
- cost_gold_inc: 500
- cost_shards_base: 1000
- cost_shards_inc: 1000
### Explosive
- Chance to explode
- id: explosive
- max: 30
- cost_block_base: 200
- cost_block_inc: 50
- cost_gold_base: -700
- cost_gold_inc: 100
- cost_shards_base: -3200
- cost_shards_inc: 200
### Laser
- Chance to fire a laser
- id: laser
- max: 300
- cost_block_base: 1000
- cost_block_inc: 0
- cost_gold_base: 3000
- cost_gold_inc: -20
- cost_shards_base: 0
- cost_shards_inc: 30
### Jackhammer
- Chance to destroy 3*3*3 (100) or 5*5*5 (200) area
- id: jackhammer
- max: 200
- cost_block_base: 10000
- cost_block_inc: 100
- cost_gold_base: -12250
- cost_gold_inc: 250
- cost_shards_base: -74500
- cost_shards_inc: 500
### Corrosive Mine
- Destroy level number of blocks in the vicinity
- id: corrosive_mine
- max: 25
- cost_block_base: 5000
- cost_block_inc: 100
- cost_gold_base: 5000
- cost_gold_inc: 100
- cost_shards_base: 5000
- cost_shards_inc: 100
### Jackpot
- Chance to receive the jackpot of 1000 blocks, 1000 gold and 1000 shards
- id: jackpot
- max: 1
- cost_shards_base: 50000
- cost_shards_inc: 0
### Dual Pickaxe
- Chance to proc enchantments on another block in vicinity
- id: dual_pickaxe
- max: 10
- cost_block_base: 2500
- cost_block_inc: 500
- cost_gold_base: 2500
- cost_gold_inc: 500
- cost_shards_base: 2500
- cost_shards_inc: 500
### Luck
- Chance for laser bounces to proc any enchantment
- id: luck
- max: 10
- cost_block_base: 10000
- cost_block_inc: 10000
- cost_gold_base: 10000
- cost_gold_inc: 10000
- cost_shards_base: 10000
- cost_shards_inc: 10000
### Lumberjack
- Change to axe while looking onto Wood
- id: lumberjack
- max: 1
- cost_block_base: 5000
- cost_block_inc: 0
- cost_gold_base: 5000
- cost_gold_inc: 0
- cost_shards_base: 5000
- cost_shards_inc: 0
### Soul Remover
- Change to shovel while looking onto Wood
- id: soul_remover
- max: 1
- cost_block_base: 5000
- cost_block_inc: 0
- cost_gold_base: 5000
- cost_gold_inc: 0
- cost_shards_base: 5000
- cost_shards_inc: 0