Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6599dd026a | |||
| 03052b677f | |||
| f76a6fa79d | |||
| 7fb7f46ca7 | |||
| 1269b7f00a | |||
| 91a0685724 | |||
| 72dd2ef59a | |||
| 54a1549973 | |||
| fd5f5b92b4 | |||
| 60dc5e4442 | |||
| 4cdaf759af |
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.kotlin
|
||||
steamwar.java
|
||||
widener
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ package de.steamwar.bausystem;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.bausystem.configplayer.ConfigConverter;
|
||||
import de.steamwar.bausystem.features.cannonCore.CannonCoreRegistrationKt;
|
||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
|
||||
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
|
||||
@@ -136,8 +135,6 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
String identifier = BauServerInfo.getOwnerUser().getUUID().toString().replace("-", "");
|
||||
WorldIdentifier.set("bau/" + Core.getVersion() + "/" + identifier);
|
||||
|
||||
CannonCoreRegistrationKt.register(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.cannonCore
|
||||
|
||||
import org.bukkit.Location
|
||||
|
||||
class CannonCore(val location: Location) {
|
||||
|
||||
companion object Manager {
|
||||
var activeCores: Observable<List<CannonCore>> = Observable(ArrayList())
|
||||
}
|
||||
}
|
||||
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.cannonCore
|
||||
|
||||
import de.steamwar.bausystem.SWUtils
|
||||
import de.steamwar.command.SWCommand
|
||||
import de.steamwar.linkage.Linked
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
object CannonCoreCommand : SWCommand("cannoncore") {
|
||||
|
||||
@Register
|
||||
fun giveCannonCoreWand(player: Player) {
|
||||
val wandItem = CannonCoreWand.getWandItem()
|
||||
|
||||
SWUtils.giveItemToPlayer(player, wandItem)
|
||||
}
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.cannonCore
|
||||
|
||||
import de.steamwar.entity.RBlockDisplay
|
||||
import de.steamwar.entity.REntityAction
|
||||
import de.steamwar.entity.REntityServer
|
||||
import de.steamwar.entity.RInteraction
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class CannonCoreEntity: RBlockDisplay {
|
||||
val entityMaterial = Material.COMMAND_BLOCK
|
||||
|
||||
val hitbox: RInteraction
|
||||
|
||||
constructor(server: REntityServer, location: Location, onClick: (player: Player, clickAction: REntityAction) -> Unit) : super(server, location) {
|
||||
setBlock(entityMaterial.createBlockData())
|
||||
|
||||
hitbox = RInteraction(server, location)
|
||||
hitbox.setCallback(onClick)
|
||||
}
|
||||
|
||||
override fun die() {
|
||||
super.die()
|
||||
hitbox.die()
|
||||
}
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.cannonCore
|
||||
|
||||
import org.bukkit.plugin.Plugin
|
||||
|
||||
fun register(plugin: Plugin) {
|
||||
CannonCoreCommand.register()
|
||||
|
||||
val pluginManager = plugin.server.pluginManager
|
||||
pluginManager.registerEvents(CannonCoreWand, plugin)
|
||||
}
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.cannonCore
|
||||
|
||||
import de.steamwar.bausystem.utils.ItemUtils
|
||||
import de.steamwar.core.SWPlayer
|
||||
import de.steamwar.inventory.SWItem
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
object CannonCoreWand: Listener {
|
||||
val wandId = "CANNON_CORE_WAND"
|
||||
val wandMaterial = Material.BREEZE_ROD
|
||||
|
||||
|
||||
fun getWandItem(): ItemStack {
|
||||
val title = "§eCannon Core Wand"
|
||||
val lore = listOf(
|
||||
"§eRight Click §8- §7Create a new cannon core"
|
||||
)
|
||||
|
||||
val wand = SWItem(wandMaterial, title, lore, false, null)
|
||||
val item = wand.itemStack
|
||||
return ItemUtils.setItem(item, wandId)
|
||||
}
|
||||
|
||||
fun isWandItem(itemStack: ItemStack): Boolean {
|
||||
return ItemUtils.isItem(itemStack, wandId)
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onPlayerEquip(event: PlayerItemHeldEvent) {
|
||||
val player = event.player
|
||||
val swPlayer = SWPlayer.of(event.player)
|
||||
val item = player.inventory.getItem(event.newSlot) ?: return
|
||||
|
||||
if(!isWandItem(item)) {
|
||||
swPlayer.removeComponent(EmptyCannonCoreWandDisplay::class.java)
|
||||
}
|
||||
else {
|
||||
EmptyCannonCoreWandDisplay(player)
|
||||
}
|
||||
}
|
||||
}
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.cannonCore
|
||||
|
||||
import de.steamwar.core.SWPlayer
|
||||
import de.steamwar.entity.REntityServer
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class CannonCoresDisplay: SWPlayer.Component {
|
||||
val displayServer = REntityServer()
|
||||
val unlisten: () -> Unit
|
||||
|
||||
constructor(owner: Player) {
|
||||
unlisten = CannonCore.activeCores.observe( { cores ->
|
||||
displayServer.entities.forEach { it.die() }
|
||||
cores.forEach { CannonCoreEntity(displayServer, it.location) { _, _ -> println("Handler clicked at ${it.location}") } }
|
||||
})
|
||||
}
|
||||
|
||||
override fun onMount(player: SWPlayer) {
|
||||
displayServer.addPlayer(player.player)
|
||||
}
|
||||
|
||||
override fun onUnmount(player: SWPlayer?) {
|
||||
unlisten()
|
||||
displayServer.close()
|
||||
}
|
||||
}
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.cannonCore
|
||||
|
||||
import de.steamwar.core.SWPlayer
|
||||
import de.steamwar.cursor.Cursor
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class EmptyCannonCoreWandDisplay : SWPlayer.Component {
|
||||
val coresDisplay: CannonCoresDisplay
|
||||
val cursor: Cursor
|
||||
|
||||
constructor(owner: Player) {
|
||||
coresDisplay = CannonCoresDisplay(owner)
|
||||
|
||||
cursor = Cursor(
|
||||
coresDisplay.displayServer, owner, Material.GLASS, Material.COMMAND_BLOCK,
|
||||
listOf(
|
||||
Cursor.CursorMode.BLOCK_ALIGNED
|
||||
),
|
||||
) { location, hitEntity, action ->
|
||||
print("Hello")
|
||||
}
|
||||
|
||||
SWPlayer.of(owner).setComponent(this)
|
||||
}
|
||||
|
||||
override fun onUnmount(player: SWPlayer) {
|
||||
player.removeComponent(cursor::class.java)
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.cannonCore
|
||||
|
||||
typealias Observer<T> = (currentValue: T) -> Unit
|
||||
|
||||
class Observable<T>(var value: T) {
|
||||
private val observers = ArrayList<Observer<T>>()
|
||||
|
||||
fun set(value: T) {
|
||||
val oldValue = this.value
|
||||
this.value = value
|
||||
|
||||
observers.forEach { it.invoke(value) }
|
||||
}
|
||||
|
||||
fun get(): T {
|
||||
return value
|
||||
}
|
||||
|
||||
fun observe(observer: Observer<T>): () -> Unit {
|
||||
observers.add(observer)
|
||||
observer(value)
|
||||
return {removeObserver(observer)}
|
||||
}
|
||||
|
||||
fun removeObserver(observer: Observer<T>) {
|
||||
observers.remove(observer)
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,7 @@ public class NoClipCommand extends SWCommand implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onBlock(BlockCanBuildEvent event) {
|
||||
if (event.getPlayer() == null) return;
|
||||
if (SWPlayer.of(event.getPlayer()).hasComponent(NoClipData.class)) {
|
||||
event.setBuildable(true);
|
||||
}
|
||||
|
||||
@@ -20,30 +20,28 @@
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
public final class ItemUtils {
|
||||
@UtilityClass
|
||||
public class ItemUtils {
|
||||
|
||||
private static final NamespacedKey ITEM_KEY = SWUtils.getNamespaceKey("bau_item");
|
||||
private final NamespacedKey ITEM_KEY = SWUtils.getNamespaceKey("bau_item");
|
||||
|
||||
private ItemUtils() {
|
||||
}
|
||||
|
||||
public static boolean isItem(ItemStack itemStack, String tag) {
|
||||
public boolean isItem(ItemStack itemStack, String tag) {
|
||||
String value = getTag(itemStack, ITEM_KEY);
|
||||
return value != null && value.equals(tag);
|
||||
}
|
||||
|
||||
public static ItemStack setItem(ItemStack itemStack, String tag) {
|
||||
public void setItem(ItemStack itemStack, String tag) {
|
||||
setTag(itemStack, ITEM_KEY, tag);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static String getTag(ItemStack itemStack, NamespacedKey key) {
|
||||
public String getTag(ItemStack itemStack, NamespacedKey key) {
|
||||
if (itemStack == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -58,7 +56,7 @@ public final class ItemUtils {
|
||||
return container.get(key, PersistentDataType.STRING);
|
||||
}
|
||||
|
||||
public static void setTag(ItemStack itemStack, NamespacedKey key, String value) {
|
||||
public void setTag(ItemStack itemStack, NamespacedKey key, String value) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,5 +38,4 @@ tasks.register<DevServer>("DevBau21") {
|
||||
dependsOn(":BauSystem:shadowJar")
|
||||
dependsOn(":SchematicSystem:shadowJar")
|
||||
template = "Bau21"
|
||||
debug = true
|
||||
}
|
||||
|
||||
@@ -42,7 +42,10 @@ import java.awt.image.BufferedImage;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Month;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class CustomMap implements Listener {
|
||||
|
||||
@@ -56,7 +59,7 @@ public class CustomMap implements Listener {
|
||||
new Vector(2346, 45, 1297), new Vector(2345, 45, 1297), new Vector(2344, 45, 1297), new Vector(2343, 45, 1297), new Vector(2342, 45, 1297), new Vector(2341, 45, 1297), new Vector(2340, 45, 1297)
|
||||
);
|
||||
|
||||
private static final CustomMap RIGHT = new CustomMap(new File(System.getProperty("user.home") + "/lobbyBanner/right.png"),
|
||||
private static final CustomMap RIGHT = new CustomMap(new File(System.getProperty("user.home") + "/lobbyBanner/right/"),
|
||||
new Vector(2330, 48, 1297), new Vector(2329, 48, 1297), new Vector(2328, 48, 1297), new Vector(2327, 48, 1297), new Vector(2326, 48, 1297), new Vector(2325, 48, 1297), new Vector(2324, 48, 1297),
|
||||
new Vector(2330, 47, 1297), new Vector(2329, 47, 1297), new Vector(2328, 47, 1297), new Vector(2327, 47, 1297), new Vector(2326, 47, 1297), new Vector(2325, 47, 1297), new Vector(2324, 47, 1297),
|
||||
new Vector(2330, 46, 1297), new Vector(2329, 46, 1297), new Vector(2328, 46, 1297), new Vector(2327, 46, 1297), new Vector(2326, 46, 1297), new Vector(2325, 46, 1297), new Vector(2324, 46, 1297),
|
||||
@@ -66,32 +69,51 @@ public class CustomMap implements Listener {
|
||||
private File mapFile;
|
||||
private Map<Vector, Integer> itemFrameIndex = new HashMap<>();
|
||||
private ItemFrame[] itemFrames;
|
||||
private long lastModified = Long.MAX_VALUE;
|
||||
private boolean update = true;
|
||||
|
||||
public CustomMap(File mapFile, Vector... itemFrames) {
|
||||
this.mapFile = mapFile;
|
||||
public CustomMap(File mapFileOrDirectory, Vector... itemFrames) {
|
||||
this.mapFile = mapFileOrDirectory;
|
||||
this.itemFrames = new ItemFrame[itemFrames.length];
|
||||
for (int i = 0; i < itemFrames.length; i++) {
|
||||
itemFrameIndex.put(itemFrames[i], i);
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskTimer(LobbySystem.getInstance(), () -> {
|
||||
long modified = mapFile.lastModified();
|
||||
if (modified > lastModified) {
|
||||
lastModified = modified;
|
||||
System.out.println("Updating Banner: " + mapFile.getName());
|
||||
Bukkit.getScheduler().runTaskAsynchronously(LobbySystem.getInstance(), () -> {
|
||||
try {
|
||||
run();
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 200L, 200L);
|
||||
if (mapFileOrDirectory.isDirectory()) {
|
||||
AtomicReference<Month> lastMonth = new AtomicReference<>(LocalDateTime.now().getMonth());
|
||||
Bukkit.getScheduler().runTaskTimer(LobbySystem.getInstance(), () -> {
|
||||
Month current = LocalDateTime.now().getMonth();
|
||||
if (!current.equals(lastMonth.get()) || update) {
|
||||
lastMonth.set(current);
|
||||
update = false;
|
||||
this.mapFile = new File(mapFileOrDirectory, current.getValue() + ".png");
|
||||
update();
|
||||
}
|
||||
}, 200L, 1200L);
|
||||
} else {
|
||||
AtomicReference<Long> lastModified = new AtomicReference<>(Long.MAX_VALUE);
|
||||
Bukkit.getScheduler().runTaskTimer(LobbySystem.getInstance(), () -> {
|
||||
long modified = mapFileOrDirectory.lastModified();
|
||||
if (modified > lastModified.get() || update) {
|
||||
lastModified.set(modified);
|
||||
update = false;
|
||||
update();
|
||||
}
|
||||
}, 200L, 200L);
|
||||
}
|
||||
Bukkit.getPluginManager().registerEvents(this, LobbySystem.getInstance());
|
||||
}
|
||||
|
||||
private void update() {
|
||||
System.out.println("Updating Banner: " + mapFile.getName());
|
||||
Bukkit.getScheduler().runTaskAsynchronously(LobbySystem.getInstance(), () -> {
|
||||
try {
|
||||
run();
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
for (Entity entity : event.getChunk().getEntities()) {
|
||||
@@ -101,7 +123,7 @@ public class CustomMap implements Listener {
|
||||
if (itemFrameIndex.containsKey(vector)) {
|
||||
if (itemFrames[itemFrameIndex.get(vector)] != null) continue;
|
||||
itemFrames[itemFrameIndex.get(vector)] = itemFrame;
|
||||
lastModified = 0;
|
||||
update = true;
|
||||
|
||||
ItemStack itemStack = new ItemStack(Material.FILLED_MAP, 1);
|
||||
MapMeta mapMeta = (MapMeta) itemStack.getItemMeta();
|
||||
|
||||
@@ -29,5 +29,15 @@ dependencies {
|
||||
compileOnly(libs.paperapi)
|
||||
|
||||
compileOnly(libs.nms)
|
||||
compileOnly(libs.worldedit)
|
||||
compileOnly(libs.fawe)
|
||||
}
|
||||
|
||||
tasks.register<FightServer>("MissileWars21") {
|
||||
group = "run"
|
||||
description = "Run a 1.21 Dev MissileWars"
|
||||
dependsOn(":SpigotCore:shadowJar")
|
||||
dependsOn(":MissileWars:jar")
|
||||
template = "MissileWars"
|
||||
worldName = "Great_Wall"
|
||||
jar = "/jars/paper-1.21.6.jar"
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.SideEffect;
|
||||
import com.sk89q.worldedit.util.SideEffectSet;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import de.steamwar.misslewars.MissileWars;
|
||||
@@ -109,11 +111,17 @@ public class Missile extends SpecialItem {
|
||||
v = aT.apply(v.toVector3()).toBlockPoint();
|
||||
v = v.add(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
|
||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
|
||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory()
|
||||
.getEditSession(world, -1);
|
||||
e.setSideEffectApplier(SideEffectSet.defaults()
|
||||
.with(SideEffect.NEIGHBORS, SideEffect.State.ON)
|
||||
.with(SideEffect.LIGHTING, SideEffect.State.ON)
|
||||
.with(SideEffect.UPDATE, SideEffect.State.ON));
|
||||
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
||||
ch.setTransform(aT);
|
||||
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(true).build());
|
||||
e.flushSession();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,17 +37,27 @@ public class AutoChecker {
|
||||
public static final AutoChecker impl = new AutoChecker();
|
||||
|
||||
public AutoCheckerResult check(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder().type(type).height(clipboard.getDimensions().x()).width(clipboard.getDimensions().x())
|
||||
.depth(clipboard.getDimensions().z()).blockScanResult(scan(clipboard, type))
|
||||
.entities(clipboard.getEntities().stream().map(Entity::getLocation)
|
||||
.map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ()))
|
||||
.collect(Collectors.toList()))
|
||||
return AutoCheckerResult.builder()
|
||||
.type(type)
|
||||
.height(clipboard.getDimensions().y())
|
||||
.width(clipboard.getDimensions().x())
|
||||
.depth(clipboard.getDimensions().z())
|
||||
.blockScanResult(scan(clipboard, type))
|
||||
.entities(
|
||||
clipboard.getEntities().stream()
|
||||
.map(Entity::getLocation)
|
||||
.map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ()))
|
||||
.collect(Collectors.toList()))
|
||||
.build();
|
||||
}
|
||||
|
||||
public AutoCheckerResult sizeCheck(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder().type(type).height(clipboard.getDimensions().y()).width(clipboard.getDimensions().x())
|
||||
.depth(clipboard.getDimensions().z()).build();
|
||||
return AutoCheckerResult.builder()
|
||||
.type(type)
|
||||
.height(clipboard.getDimensions().y())
|
||||
.width(clipboard.getDimensions().x())
|
||||
.depth(clipboard.getDimensions().z())
|
||||
.build();
|
||||
}
|
||||
|
||||
public AutoChecker.BlockScanResult scan(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
|
||||
@@ -201,8 +201,8 @@ public class ServerStarter {
|
||||
|
||||
private void tempWorld(String template) {
|
||||
worldDir = TEMP_WORLD_PATH;
|
||||
worldSetup = () -> copyWorld(node, template, worldDir + worldName);
|
||||
worldCleanup = () -> SubserverSystem.deleteFolder(node, worldDir + worldName);
|
||||
worldSetup = () -> copyWorld(node, template, new File(worldDir, worldName).getPath());
|
||||
worldCleanup = () -> SubserverSystem.deleteFolder(node, new File(worldDir, worldName).getPath());
|
||||
}
|
||||
|
||||
private void buildWithTemp(Player owner) {
|
||||
@@ -396,4 +396,4 @@ public class ServerStarter {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,6 @@ dependencyResolutionManagement {
|
||||
library("nms", "de.steamwar:spigot:1.21.6")
|
||||
|
||||
library("axiom", "de.steamwar:axiompaper:RELEASE")
|
||||
library("worldedit", "com.sk89q.worldedit:worldedit-bukkit:7.3.16")
|
||||
library("fawe", "de.steamwar:fastasyncworldedit:1.21")
|
||||
|
||||
library("velocity", "de.steamwar:velocity:RELEASE")
|
||||
|
||||
Reference in New Issue
Block a user