Hotfix CreatingLaufState and BlockBoundingBox
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
675d0d616e
Commit
4a55af680d
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau;
|
package de.steamwar.bausystem.features.slaves.laufbau;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.blocks.SkullBlock;
|
||||||
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import de.steamwar.bausystem.linkage.LinkageUtils;
|
import de.steamwar.bausystem.linkage.LinkageUtils;
|
||||||
import de.steamwar.bausystem.utils.NMSWrapper;
|
import de.steamwar.bausystem.utils.NMSWrapper;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
@ -28,6 +30,7 @@ import lombok.ToString;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.SkullType;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Skull;
|
import org.bukkit.block.Skull;
|
||||||
@ -47,14 +50,21 @@ import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCu
|
|||||||
@Getter
|
@Getter
|
||||||
public class BlockBoundingBox {
|
public class BlockBoundingBox {
|
||||||
|
|
||||||
private static List<UUID> randomPlayerHead = new ArrayList<>();
|
private static List<String> randomPlayerHead = new ArrayList<>();
|
||||||
private static Random random = new Random();
|
private static Random random = new Random();
|
||||||
static {
|
static {
|
||||||
|
randomPlayerHead.add("zOnlyKroks");
|
||||||
|
randomPlayerHead.add("YoyoNow");
|
||||||
|
randomPlayerHead.add("Konstruktix");
|
||||||
|
randomPlayerHead.add("Merling03");
|
||||||
|
randomPlayerHead.add("Lord_Loading");
|
||||||
|
/*
|
||||||
randomPlayerHead.add(UUID.fromString("1623d4b1-b21c-41d3-93c2-eee2845b8497"));
|
randomPlayerHead.add(UUID.fromString("1623d4b1-b21c-41d3-93c2-eee2845b8497"));
|
||||||
randomPlayerHead.add(UUID.fromString("f75632be-e3ec-4069-9bec-d13ac6891177"));
|
randomPlayerHead.add(UUID.fromString("f75632be-e3ec-4069-9bec-d13ac6891177"));
|
||||||
randomPlayerHead.add(UUID.fromString("80382970-424b-4299-9296-d956beab9e7b"));
|
randomPlayerHead.add(UUID.fromString("80382970-424b-4299-9296-d956beab9e7b"));
|
||||||
randomPlayerHead.add(UUID.fromString("f395ce89-096d-48e9-b796-a2d88722c22b"));
|
randomPlayerHead.add(UUID.fromString("f395ce89-096d-48e9-b796-a2d88722c22b"));
|
||||||
randomPlayerHead.add(UUID.fromString("db516394-d999-4b77-8d13-73cceec77dfe"));
|
randomPlayerHead.add(UUID.fromString("db516394-d999-4b77-8d13-73cceec77dfe"));
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BlockBoundingBox> elements = new ArrayList<>();
|
public static List<BlockBoundingBox> elements = new ArrayList<>();
|
||||||
@ -64,7 +74,7 @@ public class BlockBoundingBox {
|
|||||||
private double volume;
|
private double volume;
|
||||||
public SWItem swItem;
|
public SWItem swItem;
|
||||||
|
|
||||||
public Consumer<Block> blockConsumer = null;
|
public Consumer<BaseBlock> blockConsumer = null;
|
||||||
|
|
||||||
public BlockBoundingBox(BlockData blockData, List<Cuboid> cuboidList, SWItem swItem) {
|
public BlockBoundingBox(BlockData blockData, List<Cuboid> cuboidList, SWItem swItem) {
|
||||||
this.blockData = blockData;
|
this.blockData = blockData;
|
||||||
@ -74,7 +84,7 @@ public class BlockBoundingBox {
|
|||||||
elements.add(this);
|
elements.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockBoundingBox(BlockData blockData, List<Cuboid> cuboidList, SWItem swItem, Consumer<Block> blockConsumer) {
|
public BlockBoundingBox(BlockData blockData, List<Cuboid> cuboidList, SWItem swItem, Consumer<BaseBlock> blockConsumer) {
|
||||||
this.blockData = blockData;
|
this.blockData = blockData;
|
||||||
this.cuboidList = cuboidList;
|
this.cuboidList = cuboidList;
|
||||||
this.swItem = swItem;
|
this.swItem = swItem;
|
||||||
@ -272,14 +282,15 @@ public class BlockBoundingBox {
|
|||||||
new BlockBoundingBox(blockData, Arrays.asList(pixelCuboid(xPixel, yPixel, zPixel, dxPixel, dyPixel, dzPixel)), swItem);
|
new BlockBoundingBox(blockData, Arrays.asList(pixelCuboid(xPixel, yPixel, zPixel, dxPixel, dyPixel, dzPixel)), swItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel, SWItem swItem, Consumer<Block> blockConsumer) {
|
private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel, SWItem swItem, Consumer<BaseBlock> blockConsumer) {
|
||||||
new BlockBoundingBox(blockData, Arrays.asList(pixelCuboid(xPixel, yPixel, zPixel, dxPixel, dyPixel, dzPixel)), swItem, blockConsumer);
|
new BlockBoundingBox(blockData, Arrays.asList(pixelCuboid(xPixel, yPixel, zPixel, dxPixel, dyPixel, dzPixel)), swItem, blockConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void randomPlayerHead(Block block) {
|
@SuppressWarnings("deprecation")
|
||||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(randomPlayerHead.get(random.nextInt(randomPlayerHead.size())));
|
private static void randomPlayerHead(BaseBlock block) {
|
||||||
Skull skull = (Skull) block.getState();
|
if (block instanceof SkullBlock) {
|
||||||
skull.setOwningPlayer(offlinePlayer);
|
SkullBlock skullBlock = (SkullBlock) block;
|
||||||
skull.update();
|
skullBlock.setOwner(randomPlayerHead.get(random.nextInt(randomPlayerHead.size())).toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -145,9 +144,9 @@ public class CreatingLaufState implements LaufbauState {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
editSession.setBlock(BukkitAdapter.asBlockVector(location), BukkitAdapter.adapt(highest.blockData));
|
BaseBlock block = BukkitAdapter.adapt(highest.blockData).toBaseBlock();
|
||||||
// location.getBlock().setBlockData(highest.blockData, false);
|
if (highest.blockConsumer != null) highest.blockConsumer.accept(block);
|
||||||
if (highest.blockConsumer != null) highest.blockConsumer.accept(location.getBlock());
|
editSession.setBlock(BukkitAdapter.asBlockVector(location), block);
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// ignored
|
// ignored
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren