Compare commits
43 Commits
BauSystem/
...
VelocityCo
| Author | SHA1 | Date | |
|---|---|---|---|
| 026937bc7b | |||
| 8640d43d4b | |||
| fbdb0cfaf1 | |||
| 9305ab5f91 | |||
| 34ade1de19 | |||
| 87d0df8067 | |||
|
2f8491c3f6
|
|||
|
4df92f7e5f
|
|||
|
9a78b99a75
|
|||
|
1de1bf6571
|
|||
| 771c77247a | |||
|
dfb71594b9
|
|||
|
f535e056c7
|
|||
|
e67e340707
|
|||
| a594a163f7 | |||
| 1c0146a02d | |||
|
d3fecf763c
|
|||
|
3944c011b0
|
|||
|
1f4a77e8b4
|
|||
| 4d40e52ea6 | |||
| 698e411944 | |||
|
0fd7aab86c
|
|||
| 624fe98c47 | |||
|
ede7df82f3
|
|||
|
3970f21999
|
|||
|
6f248b78b8
|
|||
|
6f4ec64ef7
|
|||
| bfc835b0dc | |||
| 2dfad9e55c | |||
| 00f5481630 | |||
| 2424bd430d | |||
| eafb469eca | |||
| 14bd38f471 | |||
| c107b741c0 | |||
| febf2c283d | |||
| 5f53ebf5b3 | |||
| f6f7b0dced | |||
|
d0c1413ea6
|
|||
|
5f7c5f0a18
|
|||
|
9e9f405e30
|
|||
| fd4d15ac5a | |||
| fa4d006dd3 | |||
| eb63381b83 |
@@ -841,7 +841,6 @@ LAUFBAU_HELP=§8/§elaufbau §8[§7smallest§8|§7blastresistant§8] §8- §7Bui
|
||||
LAUFBAU_HELP_SETTINGS=§8/§elaufbau settings §8- §7Opens the settings GUI
|
||||
LAUFBAU_PREPARE1=§71. Trace the cannons as often as necessary, in all modes.
|
||||
LAUFBAU_PREPARE2=§72. Try to delete all fails from the traces.
|
||||
LAUFBAU_NOT_LOADED=§cPlease wait a few more seconds while all Bounding Boxes are loaded.
|
||||
LAUFBAU_NO_WORLDEDIT=§cYou don't have a WorldEdit selection
|
||||
LAUFBAU_STATE_FILTERING_TRACES=Filtering traces
|
||||
LAUFBAU_STATE_PROCESSING_TRACES=Connnecting traces
|
||||
|
||||
@@ -779,7 +779,6 @@ LAUFBAU_HELP=§8/§elaufbau §8[§7smallest§8|§7blastresistant§8] §8- §7Bau
|
||||
LAUFBAU_HELP_SETTINGS=§8/§elaufbau settings §8- §7Öffnet die Settings GUI
|
||||
LAUFBAU_PREPARE1=§71. Trace die Kanonen so oft wie nötig, in allen Modi.
|
||||
LAUFBAU_PREPARE2=§72. Versuche alle Fails aus dem Trace zu löschen.
|
||||
LAUFBAU_NOT_LOADED=§cBitte warte noch einige Sekunden, bis alle Bounding Boxes geladen sind.
|
||||
LAUFBAU_NO_WORLDEDIT=§cDu hast keine WorldEdit Selection
|
||||
LAUFBAU_STATE_FILTERING_TRACES=Traces filtern
|
||||
LAUFBAU_STATE_PROCESSING_TRACES=Traces verbinden
|
||||
|
||||
@@ -110,6 +110,9 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
if (any instanceof ConfigConverter) {
|
||||
Config.addConfigConverter((ConfigConverter) any);
|
||||
}
|
||||
if (any instanceof BoundingBoxLoader) {
|
||||
((BoundingBoxLoader) any).load();
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.type.Chest;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
@@ -120,6 +121,7 @@ public class AutostartListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
||||
if (regionStartTime.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class BackupCommand extends SWCommand {
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
if (region.getFlags().get(Flag.CHANGED).isWithDefault(ChangedMode.NO_CHANGE)) {
|
||||
if (region.getRegionData().get(Flag.CHANGED).isWithDefault(ChangedMode.NO_CHANGE)) {
|
||||
BauSystem.MESSAGE.send("BACKUP_CREATE_NO_CHANGE", p);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ public class BauInfoBauGuiItem extends BauGuiItem {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
List<String> stringList = new ArrayList<>();
|
||||
for (Flag flag : Flag.getFlags()) {
|
||||
if (!region.getFlags().has(flag).isApplicable()) continue;
|
||||
FlagOptional<?> value = region.getFlags().get(flag);
|
||||
if (!region.getRegionData().has(flag).isApplicable()) continue;
|
||||
FlagOptional<?> value = region.getRegionData().get(flag);
|
||||
if (value.isPresent()) {
|
||||
stringList.add(BauSystem.MESSAGE.parse("BAU_INFO_ITEM_LORE_" + flag.name(), player, BauSystem.MESSAGE.parse(value.getWithDefault().getChatValue(), player)));
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ public class InfoCommand extends SWCommand {
|
||||
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_OWNER", p, SteamwarUser.byId(bauServer.getOwnerID()).getUserName());
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
for (Flag flag : Flag.getFlags()) {
|
||||
if (!region.getFlags().has(flag).isApplicable()) continue;
|
||||
FlagOptional<?> value = region.getFlags().get(flag);
|
||||
if (!region.getRegionData().has(flag).isApplicable()) continue;
|
||||
FlagOptional<?> value = region.getRegionData().get(flag);
|
||||
if (value.isPresent()) {
|
||||
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_FLAG", p, BauSystem.MESSAGE.parse(flag.getChatValue(), p), BauSystem.MESSAGE.parse(value.getWithDefault().getChatValue(), p));
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
@@ -156,6 +157,7 @@ public class Loadtimer implements Listener {
|
||||
}
|
||||
|
||||
public void onTntExplode(EntityExplodeEvent event) {
|
||||
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
||||
if (region.getBuildArea().inRegion(event.getLocation(), true) && stage == Stage.IGNITION) {
|
||||
stage = Stage.END;
|
||||
explode = TPSUtils.currentRealTick.get();
|
||||
|
||||
@@ -51,17 +51,17 @@ public class ColorCommand extends SWCommand {
|
||||
public void genericColorSet(@Validator Player p, ColorMode color, ColorizationType colorizationType) {
|
||||
if (colorizationType == ColorizationType.GLOBAL) {
|
||||
Region.getRegions().forEach(region -> {
|
||||
region.getFlags().set(Flag.COLOR, color);
|
||||
region.getRegionData().set(Flag.COLOR, color);
|
||||
});
|
||||
BauSystem.MESSAGE.send("REGION_COLOR_GLOBAL", p, BauSystem.MESSAGE.parse(color.getChatValue(), p));
|
||||
return;
|
||||
}
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (!region.getFlags().has(Flag.COLOR).isWritable()) {
|
||||
if (!region.getRegionData().has(Flag.COLOR).isWritable()) {
|
||||
BauSystem.MESSAGE.send("REGION_COLOR_NO_REGION", p);
|
||||
return;
|
||||
}
|
||||
region.getFlags().set(Flag.COLOR, color);
|
||||
region.getRegionData().set(Flag.COLOR, color);
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getArea().getResetFile()))
|
||||
.ignoreAir(true)
|
||||
|
||||
@@ -53,11 +53,11 @@ public class FireCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private boolean toggle(Region region) {
|
||||
if (region.getFlags().get(Flag.FIRE).isWithDefault(FireMode.ALLOW)) {
|
||||
region.getFlags().set(Flag.FIRE, FireMode.DENY);
|
||||
if (region.getRegionData().get(Flag.FIRE).isWithDefault(FireMode.ALLOW)) {
|
||||
region.getRegionData().set(Flag.FIRE, FireMode.DENY);
|
||||
return true;
|
||||
} else {
|
||||
region.getFlags().set(Flag.FIRE, FireMode.ALLOW);
|
||||
region.getRegionData().set(Flag.FIRE, FireMode.ALLOW);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,12 +36,12 @@ public class FireListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onFireDamage(BlockBurnEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFireSpread(BlockSpreadEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,7 +56,7 @@ public class FireListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getFlags().get(Flag.FIRE).isWithDefault(FireMode.DENY)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FIRE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.FIRE).getWithDefault().getChatValue(), p);
|
||||
if (region.getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FIRE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.FIRE).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ public class FreezeCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private boolean toggle(Region region) {
|
||||
if (region.getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
region.getFlags().set(Flag.FREEZE, FreezeMode.INACTIVE);
|
||||
if (region.getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
region.getRegionData().set(Flag.FREEZE, FreezeMode.INACTIVE);
|
||||
return false;
|
||||
} else {
|
||||
region.getFlags().set(Flag.FREEZE, FreezeMode.ACTIVE);
|
||||
region.getRegionData().set(Flag.FREEZE, FreezeMode.ACTIVE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||
if (Region.getRegion(e.getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
||||
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
||||
e.setCancelled(true);
|
||||
if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
@@ -60,7 +60,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
@EventHandler
|
||||
public void onBlockCanBuild(BlockCanBuildEvent e) {
|
||||
if (!e.isBuildable()) return;
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
||||
if (e.getMaterial() == Material.TNT) {
|
||||
e.setBuildable(false);
|
||||
e.getBlock().setType(Material.TNT, false);
|
||||
@@ -69,14 +69,14 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPhysicsEvent(BlockPhysicsEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (e.getSourceBlock().getType() == Material.NOTE_BLOCK) {
|
||||
BlockState state = e.getSourceBlock().getState();
|
||||
NoteBlock noteBlock = (NoteBlock) state.getBlockData();
|
||||
@@ -101,44 +101,44 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onPistonExtend(BlockPistonExtendEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPistonRetract(BlockPistonRetractEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockGrow(BlockGrowEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRedstoneEvent(BlockRedstoneEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setNewCurrent(e.getOldCurrent());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockDispense(BlockDispenseEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryMoveEvent(InventoryMoveItemEvent e) {
|
||||
if (e.getDestination().getLocation() != null && Region.getRegion(e.getDestination().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (e.getDestination().getLocation() != null && Region.getRegion(e.getDestination().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
} else if (e.getSource().getLocation() != null && Region.getRegion(e.getSource().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
} else if (e.getSource().getLocation() != null && Region.getRegion(e.getSource().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
public void onBlockBreak(BlockBreakEvent e) {
|
||||
if (Core.getVersion() < 19) return;
|
||||
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
e.getBlock().setType(Material.BARRIER, false);
|
||||
e.getBlock().setType(Material.AIR, false);
|
||||
@@ -170,35 +170,35 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onFluidLevelChange(FluidLevelChangeEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockSpread(BlockSpreadEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFromTo(BlockFromToEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpongeAbsorb(SpongeAbsorbEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockForm(BlockFormEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
if (Region.getRegion(e.getClickedBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getClickedBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
Block block = e.getClickedBlock();
|
||||
if (block.getType() == Material.LEVER) {
|
||||
Switch data = ((Switch) block.getBlockData());
|
||||
@@ -218,7 +218,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFade(BlockFadeEvent e) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FREEZE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.FREEZE).getWithDefault().getChatValue(), p);
|
||||
if (region.getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FREEZE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.FREEZE).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,11 +55,11 @@ public class ItemsCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private boolean toggle(Region region) {
|
||||
if (region.getFlags().get(Flag.ITEMS).isWithDefault(ItemMode.ACTIVE)) {
|
||||
region.getFlags().set(Flag.ITEMS, ItemMode.INACTIVE);
|
||||
if (region.getRegionData().get(Flag.ITEMS).isWithDefault(ItemMode.ACTIVE)) {
|
||||
region.getRegionData().set(Flag.ITEMS, ItemMode.INACTIVE);
|
||||
return false;
|
||||
} else {
|
||||
region.getFlags().set(Flag.ITEMS, ItemMode.ACTIVE);
|
||||
region.getRegionData().set(Flag.ITEMS, ItemMode.ACTIVE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ItemsListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onItemSpawn(ItemSpawnEvent event) {
|
||||
if (Region.getRegion(event.getLocation()).getFlags().get(Flag.ITEMS).isWithDefault(ItemMode.INACTIVE)) {
|
||||
if (Region.getRegion(event.getLocation()).getRegionData().get(Flag.ITEMS).isWithDefault(ItemMode.INACTIVE)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class ItemsListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getFlags().get(Flag.ITEMS).isWithDefault(ItemMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.ITEMS.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.ITEMS).getWithDefault().getChatValue(), p);
|
||||
if (region.getRegionData().get(Flag.ITEMS).isWithDefault(ItemMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.ITEMS.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.ITEMS).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ public class NoGravityCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private boolean toggle(Region region) {
|
||||
if (region.getFlags().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.ACTIVE)) {
|
||||
region.getFlags().set(Flag.NO_GRAVITY, NoGravityMode.INACTIVE);
|
||||
if (region.getRegionData().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.ACTIVE)) {
|
||||
region.getRegionData().set(Flag.NO_GRAVITY, NoGravityMode.INACTIVE);
|
||||
return false;
|
||||
} else {
|
||||
region.getFlags().set(Flag.NO_GRAVITY, NoGravityMode.ACTIVE);
|
||||
region.getRegionData().set(Flag.NO_GRAVITY, NoGravityMode.ACTIVE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class NoGravityListener implements Listener, ScoreboardElement {
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
if (event.getEntityType() == EntityType.PLAYER) return;
|
||||
if (Region.getRegion(event.getLocation()).getFlags().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.ACTIVE)) {
|
||||
if (Region.getRegion(event.getLocation()).getRegionData().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.ACTIVE)) {
|
||||
event.getEntity().setGravity(false);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class NoGravityListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getFlags().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.NO_GRAVITY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.NO_GRAVITY).getWithDefault().getChatValue(), p);
|
||||
if (region.getRegionData().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.NO_GRAVITY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.NO_GRAVITY).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,18 +39,18 @@ public class ProtectCommand extends SWCommand {
|
||||
public void genericProtectCommand(@Validator Player p) {
|
||||
Region region = regionCheck(p);
|
||||
if (region == null) return;
|
||||
if (region.getFlags().get(Flag.PROTECT).isWithDefault(ProtectMode.ACTIVE)) {
|
||||
region.getFlags().set(Flag.PROTECT, ProtectMode.INACTIVE);
|
||||
if (region.getRegionData().get(Flag.PROTECT).isWithDefault(ProtectMode.ACTIVE)) {
|
||||
region.getRegionData().set(Flag.PROTECT, ProtectMode.INACTIVE);
|
||||
RegionUtils.actionBar(region, "REGION_PROTECT_DISABLE");
|
||||
} else {
|
||||
region.getFlags().set(Flag.PROTECT, ProtectMode.ACTIVE);
|
||||
region.getRegionData().set(Flag.PROTECT, ProtectMode.ACTIVE);
|
||||
RegionUtils.actionBar(region, "REGION_PROTECT_ENABLE");
|
||||
}
|
||||
}
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.getFlags().has(Flag.PROTECT).isApplicable()) {
|
||||
if (!region.getRegionData().has(Flag.PROTECT).isApplicable()) {
|
||||
BauSystem.MESSAGE.send("REGION_PROTECT_FALSE_REGION", player);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ProtectListener implements Listener, ScoreboardElement {
|
||||
|
||||
private void explode(List<Block> blockList, Location location) {
|
||||
Region region = Region.getRegion(location);
|
||||
if (region.getFlags().get(Flag.PROTECT).isWithDefault(ProtectMode.INACTIVE)) return;
|
||||
if (region.getRegionData().get(Flag.PROTECT).isWithDefault(ProtectMode.INACTIVE)) return;
|
||||
Point p1 = region.getBuildArea().getMinPoint(true);
|
||||
Point p2 = region.getTestblockArea().getMinPoint(true);
|
||||
int floorLevel = Math.min(p1.getY(), p2.getY());
|
||||
@@ -70,7 +70,7 @@ public class ProtectListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getFlags().get(Flag.PROTECT).isWithDefault(ProtectMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.PROTECT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.PROTECT).getWithDefault().getChatValue(), p);
|
||||
if (region.getRegionData().get(Flag.PROTECT).isWithDefault(ProtectMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.PROTECT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.PROTECT).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class RegionCommand extends SWCommand {
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getArea().getResetFile()))
|
||||
.ignoreAir(true)
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
.color(region.getRegionData().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, false);
|
||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||
} catch (SecurityException e) {
|
||||
@@ -124,7 +124,7 @@ public class RegionCommand extends SWCommand {
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node))
|
||||
.ignoreAir(true)
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
.color(region.getRegionData().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, false);
|
||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||
} catch (SecurityException e) {
|
||||
|
||||
@@ -182,6 +182,6 @@ public class RegionListener implements Listener {
|
||||
}
|
||||
|
||||
private static void tagChangedRegion(final Location location) {
|
||||
Region.getRegion(location).getFlags().set(Flag.CHANGED, ChangedMode.HAS_CHANGE);
|
||||
Region.getRegion(location).getRegionData().set(Flag.CHANGED, ChangedMode.HAS_CHANGE);
|
||||
}
|
||||
}
|
||||
@@ -53,9 +53,8 @@ public class ResetCommand extends SWCommand {
|
||||
if (region == null) return;
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getArea().getResetFile()))
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
.color(region.getRegionData().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, false);
|
||||
region.getFlags().clear();
|
||||
region.getRegionData().clear();
|
||||
RegionUtils.message(region, "REGION_RESET_RESETED");
|
||||
} catch (SecurityException e) {
|
||||
@@ -84,7 +83,7 @@ public class ResetCommand extends SWCommand {
|
||||
}
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node))
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
.color(region.getRegionData().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, true);
|
||||
RegionUtils.message(region, "REGION_RESET_RESETED");
|
||||
} catch (SecurityException e) {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class TNTCommand extends SWCommand {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
Region region = Region.getRegion(((Player) sender).getLocation());
|
||||
if (region.getFlags().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
if (region.getRegionData().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
return new ArrayList<>(tntModeMap.keySet());
|
||||
} else {
|
||||
return new ArrayList<>(tntModeMapReduced.keySet());
|
||||
@@ -102,7 +102,7 @@ public class TNTCommand extends SWCommand {
|
||||
@Override
|
||||
public TNTMode map(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
Region region = Region.getRegion(((Player) sender).getLocation());
|
||||
if (region.getFlags().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
if (region.getRegionData().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
return tntModeMap.getOrDefault(s, null);
|
||||
} else {
|
||||
return tntModeMapReduced.getOrDefault(s, null);
|
||||
@@ -124,23 +124,23 @@ public class TNTCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) {
|
||||
if (requestedMode != null && region.getFlags().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
region.getFlags().set(Flag.TNT, requestedMode);
|
||||
if (requestedMode != null && region.getRegionData().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
region.getRegionData().set(Flag.TNT, requestedMode);
|
||||
RegionUtils.actionBar(region, requestedMessage);
|
||||
return;
|
||||
}
|
||||
switch (region.getFlags().get(Flag.TNT).getWithDefault()) {
|
||||
switch (region.getRegionData().get(Flag.TNT).getWithDefault()) {
|
||||
case ALLOW:
|
||||
case ONLY_TB:
|
||||
region.getFlags().set(Flag.TNT, TNTMode.DENY);
|
||||
region.getRegionData().set(Flag.TNT, TNTMode.DENY);
|
||||
RegionUtils.actionBar(region, getDisableMessage());
|
||||
break;
|
||||
case DENY:
|
||||
if (region.getFlags().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
region.getFlags().set(Flag.TNT, TNTMode.ONLY_TB);
|
||||
if (region.getRegionData().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) {
|
||||
region.getRegionData().set(Flag.TNT, TNTMode.ONLY_TB);
|
||||
RegionUtils.actionBar(region, getTestblockEnableMessage());
|
||||
} else {
|
||||
region.getFlags().set(Flag.TNT, TNTMode.ALLOW);
|
||||
region.getRegionData().set(Flag.TNT, TNTMode.ALLOW);
|
||||
RegionUtils.actionBar(region, getEnableMessage());
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -26,8 +26,10 @@ import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.TNTMode;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -39,11 +41,14 @@ import java.util.List;
|
||||
@Linked
|
||||
public class TNTListener implements Listener, ScoreboardElement {
|
||||
|
||||
private void explode(List<Block> blockList) {
|
||||
private void explode(List<Block> blockList, boolean destroy) {
|
||||
blockList.removeIf(block -> {
|
||||
Region region = Region.getRegion(block.getLocation());
|
||||
TNTMode value = region.getFlags().get(Flag.TNT).getWithDefault();
|
||||
TNTMode value = region.getRegionData().get(Flag.TNT).getWithDefault();
|
||||
if (value == TNTMode.ALLOW) {
|
||||
if (destroy && block.getType() != Material.TNT) {
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
return false;
|
||||
} else if (value == TNTMode.ONLY_TB) {
|
||||
if (region.getBuildArea().inRegion(block.getLocation(), true)) {
|
||||
@@ -57,12 +62,16 @@ public class TNTListener implements Listener, ScoreboardElement {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockExplode(BlockExplodeEvent event) {
|
||||
explode(event.blockList());
|
||||
explode(event.blockList(), false);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onExplode(EntityExplodeEvent event) {
|
||||
explode(event.blockList());
|
||||
if (!(event.getEntity() instanceof TNTPrimed)) {
|
||||
event.blockList().clear();
|
||||
return;
|
||||
}
|
||||
explode(event.blockList(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,7 +86,7 @@ public class TNTListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getFlags().get(Flag.TNT).isWithDefault(TNTMode.ALLOW)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.TNT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlags().get(Flag.TNT).getWithDefault().getChatValue(), p);
|
||||
if (region.getRegionData().get(Flag.TNT).isWithDefault(TNTMode.ALLOW)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.TNT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.TNT).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class TestblockCommand extends SWCommand {
|
||||
.onlyColors(onlyColors)
|
||||
.removeTNT(removeTNT)
|
||||
.removeWater(removeWater)
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
.color(region.getRegionData().get(Flag.COLOR).getWithDefault());
|
||||
region.getTestblockArea().reset(pasteBuilder, regionExtensionType == RegionExtensionType.EXTENSION);
|
||||
RegionUtils.message(region, "REGION_TB_DONE");
|
||||
} catch (SecurityException e) {
|
||||
|
||||
@@ -84,14 +84,14 @@ public class ColorBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
ColorMode mode = region.getFlags().get(Flag.COLOR).orElse(ColorMode.PINK);
|
||||
ColorMode mode = region.getRegionData().get(Flag.COLOR).orElse(ColorMode.PINK);
|
||||
return new SWItem(mapColor(mode), BauSystem.MESSAGE.parse("REGION_ITEM_COLOR", player, BauSystem.MESSAGE.parse(mode.getChatValue(), player))).getItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean click(ClickType click, Player p) {
|
||||
p.closeInventory();
|
||||
ColorMode current = Region.getRegion(p.getLocation()).getFlags().get(Flag.COLOR).orElse(ColorMode.PINK);
|
||||
ColorMode current = Region.getRegion(p.getLocation()).getRegionData().get(Flag.COLOR).orElse(ColorMode.PINK);
|
||||
List<SWListInv.SWListEntry<ColorMode>> items = new ArrayList<>();
|
||||
for (ColorMode value : ColorMode.values()) {
|
||||
items.add(new SWListInv.SWListEntry<>(new SWItem(mapColor(value), (byte) 0, "§f" + BauSystem.MESSAGE.parse(value.getChatValue(), p), Collections.emptyList(), value == current, clickType -> {
|
||||
|
||||
@@ -42,10 +42,10 @@ public class FireBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.getFlags().has(Flag.FIRE).isApplicable()) {
|
||||
if (!region.getRegionData().has(Flag.FIRE).isApplicable()) {
|
||||
return new SWItem(Material.BARRIER, "").getItemStack();
|
||||
}
|
||||
if (region.getFlags().get(Flag.FIRE).isWithDefault(FireMode.ALLOW)) {
|
||||
if (region.getRegionData().get(Flag.FIRE).isWithDefault(FireMode.ALLOW)) {
|
||||
return new SWItem(Material.FIRE_CHARGE, BauSystem.MESSAGE.parse("REGION_ITEM_FIRE_ALLOW", player)).getItemStack();
|
||||
} else {
|
||||
return new SWItem(Material.FIREWORK_STAR, BauSystem.MESSAGE.parse("REGION_ITEM_FIRE_DISALLOW", player)).getItemStack();
|
||||
|
||||
@@ -42,10 +42,10 @@ public class FreezeBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.getFlags().has(Flag.FREEZE).isApplicable()) {
|
||||
if (!region.getRegionData().has(Flag.FREEZE).isApplicable()) {
|
||||
return new SWItem(Material.BARRIER, "").getItemStack();
|
||||
}
|
||||
if (region.getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
if (region.getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||
return new SWItem(Material.GUNPOWDER, BauSystem.MESSAGE.parse("REGION_ITEM_FREEZE_ALLOW", player)).getItemStack();
|
||||
} else {
|
||||
return new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("REGION_ITEM_FREEZE_DISALLOW", player)).getItemStack();
|
||||
|
||||
@@ -43,10 +43,10 @@ public class ProtectBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.getFlags().has(Flag.PROTECT).isApplicable()) {
|
||||
if (!region.getRegionData().has(Flag.PROTECT).isApplicable()) {
|
||||
return new SWItem(Material.BARRIER, "").getItemStack();
|
||||
}
|
||||
if (region.getFlags().get(Flag.PROTECT).isWithDefault(ProtectMode.ACTIVE)) {
|
||||
if (region.getRegionData().get(Flag.PROTECT).isWithDefault(ProtectMode.ACTIVE)) {
|
||||
return SWUtils.setCustomModelData(new SWItem(Material.OBSIDIAN, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_ALLOW", player)), 1).getItemStack();
|
||||
} else {
|
||||
return SWUtils.setCustomModelData(new SWItem(Material.STONE, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_DISALLOW", player)), 1).getItemStack();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
switch (Region.getRegion(player.getLocation()).getFlags().get(Flag.TNT).getWithDefault()) {
|
||||
switch (Region.getRegion(player.getLocation()).getRegionData().get(Flag.TNT).getWithDefault()) {
|
||||
case DENY:
|
||||
return new SWItem(Material.MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_TNT_OFF", player)).getItemStack();
|
||||
case ONLY_TB:
|
||||
@@ -55,7 +55,7 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
@Override
|
||||
public boolean click(ClickType click, Player p) {
|
||||
if (click == ClickType.LEFT) {
|
||||
switch (Region.getRegion(p.getLocation()).getFlags().get(Flag.TNT).getWithDefault()) {
|
||||
switch (Region.getRegion(p.getLocation()).getRegionData().get(Flag.TNT).getWithDefault()) {
|
||||
case DENY:
|
||||
updateTntMode(TNTMode.ALLOW, p);
|
||||
break;
|
||||
|
||||
@@ -59,14 +59,14 @@ public class RegionLib implements LuaLib {
|
||||
}));
|
||||
|
||||
LuaValue tntLib = LuaValue.tableOf();
|
||||
tntLib.set("mode", getter(() -> region.get().getFlags().get(Flag.TNT).nameWithDefault()));
|
||||
tntLib.set("enabled", getter(() -> region.get().getFlags().get(Flag.TNT).orElse(null) != TNTMode.DENY));
|
||||
tntLib.set("onlyTb", getter(() -> region.get().getFlags().get(Flag.TNT).orElse(null) == TNTMode.ONLY_TB));
|
||||
tntLib.set("mode", getter(() -> region.get().getRegionData().get(Flag.TNT).nameWithDefault()));
|
||||
tntLib.set("enabled", getter(() -> region.get().getRegionData().get(Flag.TNT).orElse(null) != TNTMode.DENY));
|
||||
tntLib.set("onlyTb", getter(() -> region.get().getRegionData().get(Flag.TNT).orElse(null) == TNTMode.ONLY_TB));
|
||||
table.set("tnt", tntLib);
|
||||
|
||||
table.set("fire", getter(() -> region.get().getFlags().get(Flag.FIRE).orElse(null) == FireMode.ALLOW));
|
||||
table.set("freeze", getter(() -> region.get().getFlags().get(Flag.FREEZE).orElse(null) == FreezeMode.ACTIVE));
|
||||
table.set("protect", getter(() -> region.get().getFlags().get(Flag.PROTECT).orElse(null) == ProtectMode.ACTIVE));
|
||||
table.set("fire", getter(() -> region.get().getRegionData().get(Flag.FIRE).orElse(null) == FireMode.ALLOW));
|
||||
table.set("freeze", getter(() -> region.get().getRegionData().get(Flag.FREEZE).orElse(null) == FreezeMode.ACTIVE));
|
||||
table.set("protect", getter(() -> region.get().getRegionData().get(Flag.PROTECT).orElse(null) == ProtectMode.ACTIVE));
|
||||
|
||||
//LuaValue traceLib = LuaValue.tableOf();
|
||||
//traceLib.set("active", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof ActiveTracer));
|
||||
|
||||
@@ -65,7 +65,7 @@ public final class TNTPhase extends SimulatorPhase {
|
||||
@Override
|
||||
public void accept(World world) {
|
||||
Location location = position.toLocation(world);
|
||||
if (Region.getRegion(location).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) return;
|
||||
if (Region.getRegion(location).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) return;
|
||||
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
|
||||
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
|
||||
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
|
||||
|
||||
@@ -35,8 +35,8 @@ public class StabFinalizer extends StabStep {
|
||||
try {
|
||||
PasteBuilder.ClipboardProvider clipboardProvider = new PasteBuilder.ClipboardProviderImpl(data.clipboard);
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(clipboardProvider);
|
||||
if (data.region.getFlags().has(Flag.COLOR).isReadable()) {
|
||||
pasteBuilder.color(data.region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
if (data.region.getRegionData().has(Flag.COLOR).isReadable()) {
|
||||
pasteBuilder.color(data.region.getRegionData().get(Flag.COLOR).getWithDefault());
|
||||
}
|
||||
data.region.getTestblockArea().reset(pasteBuilder, true);
|
||||
} catch (SecurityException e) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -51,6 +52,7 @@ public class StabGenerator extends StabStep implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
||||
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
|
||||
event.blockList().forEach(block -> {
|
||||
if (!data.region.getTestblockArea().inRegion(block.getLocation(), true))
|
||||
@@ -71,8 +73,8 @@ public class StabGenerator extends StabStep implements Listener {
|
||||
try {
|
||||
PasteBuilder.ClipboardProvider clipboardProvider = new PasteBuilder.ClipboardProviderImpl(data.clipboard);
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(clipboardProvider);
|
||||
if (data.region.getFlags().has(Flag.COLOR).isReadable()) {
|
||||
pasteBuilder.color(data.region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
if (data.region.getRegionData().has(Flag.COLOR).isReadable()) {
|
||||
pasteBuilder.color(data.region.getRegionData().get(Flag.COLOR).getWithDefault());
|
||||
}
|
||||
data.region.getTestblockArea().reset(pasteBuilder, true);
|
||||
} catch (SecurityException e) {
|
||||
|
||||
@@ -21,16 +21,28 @@ package de.steamwar.bausystem.features.slaves.laufbau;
|
||||
|
||||
import com.sk89q.worldedit.blocks.SkullBlock;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import de.steamwar.bausystem.utils.NMSWrapper;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@ToString
|
||||
@Getter
|
||||
public class BlockBoundingBox {
|
||||
@@ -83,6 +95,193 @@ public class BlockBoundingBox {
|
||||
return volume;
|
||||
}
|
||||
|
||||
static {
|
||||
addPixel(Material.AIR.createBlockData(), 0, 0, 0, 0, 0, 0, null);
|
||||
// addPixel(Material.COBWEB.createBlockData(), 0, 0, 0, 0, 0, 0, createItem("LAUFBAU_BLOCK_COBWEB", Material.COBWEB));
|
||||
addPixel(Material.END_STONE.createBlockData(), 0, 0, 0, 16, 16, 16, null);
|
||||
|
||||
addPixel(NMSWrapper.impl.pathMaterial().createBlockData(), 0, 0, 0, 16, 15, 16, createItem("LAUFBAU_BLOCK_GRASS_PATH", NMSWrapper.impl.pathMaterial()));
|
||||
addPixel(Material.SOUL_SAND.createBlockData(), 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SOUL_SAND", Material.SOUL_SAND));
|
||||
|
||||
Cocoa cocoaNorth = (Cocoa) Material.COCOA.createBlockData();
|
||||
cocoaNorth.setAge(2);
|
||||
cocoaNorth.setFacing(BlockFace.NORTH);
|
||||
addPixel(cocoaNorth, 4, 3, 1, 8, 9, 8, createItem("LAUFBAU_BLOCK_COCOA", Material.COCOA_BEANS, "LAUFBAU_FACING_NORTH"));
|
||||
|
||||
Cocoa cocoaSouth = (Cocoa) Material.COCOA.createBlockData();
|
||||
cocoaSouth.setAge(2);
|
||||
cocoaSouth.setFacing(BlockFace.SOUTH);
|
||||
addPixel(cocoaSouth, 4, 3, 7, 8, 9, 8, createItem("LAUFBAU_BLOCK_COCOA", Material.COCOA_BEANS, "LAUFBAU_FACING_SOUTH"));
|
||||
|
||||
Cocoa cocoaWest = (Cocoa) Material.COCOA.createBlockData();
|
||||
cocoaWest.setAge(2);
|
||||
cocoaWest.setFacing(BlockFace.WEST);
|
||||
addPixel(cocoaWest, 1, 3, 4, 8, 9, 8, createItem("LAUFBAU_BLOCK_COCOA", Material.COCOA_BEANS, "LAUFBAU_FACING_WEST"));
|
||||
|
||||
Cocoa cocoaEast = (Cocoa) Material.COCOA.createBlockData();
|
||||
cocoaEast.setAge(2);
|
||||
cocoaEast.setFacing(BlockFace.EAST);
|
||||
addPixel(cocoaEast, 7, 3, 4, 8, 9, 8, createItem("LAUFBAU_BLOCK_COCOA", Material.COCOA_BEANS, "LAUFBAU_FACING_EAST"));
|
||||
|
||||
TurtleEgg singleTurtleEgg = (TurtleEgg) Material.TURTLE_EGG.createBlockData();
|
||||
singleTurtleEgg.setEggs(1);
|
||||
singleTurtleEgg.setHatch(0);
|
||||
addPixel(singleTurtleEgg, 4, 0, 3, 9, 7, 9, createItem("LAUFBAU_BLOCK_TURTLE_EGG", Material.TURTLE_EGG, "LAUFBAU_COUNT_1"));
|
||||
|
||||
TurtleEgg doubleTurtleEgg = (TurtleEgg) Material.TURTLE_EGG.createBlockData();
|
||||
doubleTurtleEgg.setEggs(2);
|
||||
doubleTurtleEgg.setHatch(0);
|
||||
addPixel(doubleTurtleEgg, 1, 0, 1, 14, 7, 14, createItem("LAUFBAU_BLOCK_TURTLE_EGG", Material.TURTLE_EGG, "LAUFBAU_COUNT_2"));
|
||||
|
||||
addPixel(Material.CHEST.createBlockData(), 1, 0, 1, 14, 14, 14, createItem("LAUFBAU_BLOCK_CHEST", Material.CHEST));
|
||||
|
||||
Snow snowLayers8 = (Snow) Material.SNOW.createBlockData();
|
||||
snowLayers8.setLayers(8);
|
||||
addPixel(snowLayers8, 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_8"));
|
||||
|
||||
Directional headNorth = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
||||
headNorth.setFacing(BlockFace.NORTH);
|
||||
addPixel(headNorth, 4, 4, 8, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_WALL_HEAD", Material.PLAYER_HEAD, "LAUFBAU_FACING_NORTH"), BlockBoundingBox::randomPlayerHead);
|
||||
|
||||
Directional headSouth = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
||||
headSouth.setFacing(BlockFace.SOUTH);
|
||||
addPixel(headSouth, 4, 4, 0, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_WALL_HEAD", Material.PLAYER_HEAD, "LAUFBAU_FACING_SOUTH"), BlockBoundingBox::randomPlayerHead);
|
||||
|
||||
Directional headWest = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
||||
headWest.setFacing(BlockFace.WEST);
|
||||
addPixel(headWest, 8, 4, 4, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_WALL_HEAD", Material.PLAYER_HEAD, "LAUFBAU_FACING_WEST"), BlockBoundingBox::randomPlayerHead);
|
||||
|
||||
Directional headEast = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
||||
headEast.setFacing(BlockFace.EAST);
|
||||
addPixel(headEast, 0, 4, 4, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_WALL_HEAD", Material.PLAYER_HEAD, "LAUFBAU_FACING_EAST"), BlockBoundingBox::randomPlayerHead);
|
||||
|
||||
Snow snowLayers7 = (Snow) Material.SNOW.createBlockData();
|
||||
snowLayers7.setLayers(7);
|
||||
addPixel(snowLayers7, 0, 0, 0, 16, 12, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_7"));
|
||||
|
||||
Snow snowLayers6 = (Snow) Material.SNOW.createBlockData();
|
||||
snowLayers6.setLayers(6);
|
||||
addPixel(snowLayers6, 0, 0, 0, 16, 10, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_6"));
|
||||
|
||||
addPixel(Material.STONECUTTER.createBlockData(), 0, 0, 0, 16, 9, 16, createItem("LAUFBAU_BLOCK_STONECUTTER", Material.STONECUTTER));
|
||||
|
||||
addPixel(Material.PLAYER_HEAD.createBlockData(), 4, 0, 4, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_HEAD", Material.PLAYER_HEAD), BlockBoundingBox::randomPlayerHead);
|
||||
|
||||
addPixel(Material.CAKE.createBlockData(), 1, 0, 1, 14, 8, 14, createItem("LAUFBAU_BLOCK_CAKE", Material.CAKE));
|
||||
|
||||
Slab bottomSlab = (Slab) Material.END_STONE_BRICK_SLAB.createBlockData();
|
||||
bottomSlab.setType(Slab.Type.BOTTOM);
|
||||
addPixel(bottomSlab, 0, 0, 0, 16, 8, 16, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_SLAB", Material.END_STONE_BRICK_SLAB, "LAUFBAU_TYPE_BOTTOM"));
|
||||
|
||||
Slab topSlab = (Slab) Material.END_STONE_BRICK_SLAB.createBlockData();
|
||||
topSlab.setType(Slab.Type.TOP);
|
||||
addPixel(topSlab, 0, 8, 0, 16, 8, 16, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_SLAB", Material.END_STONE_BRICK_SLAB, "LAUFBAU_TYPE_TOP"));
|
||||
|
||||
SeaPickle quadSeaPickle = (SeaPickle) Material.SEA_PICKLE.createBlockData();
|
||||
quadSeaPickle.setWaterlogged(false);
|
||||
quadSeaPickle.setPickles(4);
|
||||
addPixel(quadSeaPickle, 2, 0, 2, 12, 7, 12, createItem("LAUFBAU_BLOCK_SEA_PICKLE", Material.SEA_PICKLE, "LAUFBAU_COUNT_4"));
|
||||
|
||||
Campfire campfire = (Campfire) Material.CAMPFIRE.createBlockData();
|
||||
campfire.setSignalFire(false);
|
||||
campfire.setLit(false);
|
||||
addPixel(campfire, 0, 0, 0, 16, 7, 16, createItem("LAUFBAU_BLOCK_CAMPFIRE", Material.CAMPFIRE));
|
||||
|
||||
SeaPickle trippleSeaPickle = (SeaPickle) Material.SEA_PICKLE.createBlockData();
|
||||
trippleSeaPickle.setWaterlogged(false);
|
||||
trippleSeaPickle.setPickles(3);
|
||||
addPixel(trippleSeaPickle, 2, 0, 2, 12, 6, 12, createItem("LAUFBAU_BLOCK_SEA_PICKLE", Material.SEA_PICKLE, "LAUFBAU_COUNT_3"));
|
||||
|
||||
SeaPickle doubleSeaPickle = (SeaPickle) Material.SEA_PICKLE.createBlockData();
|
||||
doubleSeaPickle.setWaterlogged(false);
|
||||
doubleSeaPickle.setPickles(2);
|
||||
addPixel(doubleSeaPickle, 3, 0, 3, 10, 6, 10, createItem("LAUFBAU_BLOCK_SEA_PICKLE", Material.SEA_PICKLE, "LAUFBAU_COUNT_2"));
|
||||
|
||||
SeaPickle singleSeaPickle = (SeaPickle) Material.SEA_PICKLE.createBlockData();
|
||||
singleSeaPickle.setWaterlogged(false);
|
||||
singleSeaPickle.setPickles(1);
|
||||
addPixel(singleSeaPickle, 6, 0, 6, 4, 6, 4, createItem("LAUFBAU_BLOCK_SEA_PICKLE", Material.SEA_PICKLE, "LAUFBAU_COUNT_1"));
|
||||
|
||||
addPixel(Material.FLOWER_POT.createBlockData(), 5, 0, 5, 6, 6, 6, createItem("LAUFBAU_BLOCK_FLOWER_POT", Material.FLOWER_POT));
|
||||
|
||||
Snow snowLayers3 = (Snow) Material.SNOW.createBlockData();
|
||||
snowLayers3.setLayers(3);
|
||||
addPixel(snowLayers3, 0, 0, 0, 16, 4, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_3"));
|
||||
|
||||
TrapDoor bottomTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
||||
bottomTrapDoor.setHalf(Bisected.Half.BOTTOM);
|
||||
addPixel(bottomTrapDoor, 0, 0, 0, 16, 3, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_HALF_BOTTOM"));
|
||||
|
||||
TrapDoor topTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
||||
topTrapDoor.setHalf(Bisected.Half.TOP);
|
||||
addPixel(topTrapDoor, 0, 13, 0, 16, 3, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_HALF_TOP"));
|
||||
|
||||
Snow snowLayers2 = (Snow) Material.SNOW.createBlockData();
|
||||
snowLayers2.setLayers(2);
|
||||
addPixel(snowLayers2, 0, 0, 0, 16, 2, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_2"));
|
||||
|
||||
addPixel(Material.LILY_PAD.createBlockData(), 1, 0, 1, 14, 1.5, 14, createItem("LAUFBAU_BLOCK_LILY_PAD", Material.LILY_PAD));
|
||||
addPixel(Material.WHITE_CARPET.createBlockData(), 0, 0, 0, 16, 1, 16, createItem("LAUFBAU_BLOCK_WHITE_CARPET", Material.WHITE_CARPET));
|
||||
|
||||
Directional endRodBottomTop = (Directional) Material.END_ROD.createBlockData();
|
||||
endRodBottomTop.setFacing(BlockFace.UP);
|
||||
addPixel(endRodBottomTop, 6, 0, 6, 4, 16, 4, createItem("LAUFBAU_BLOCK_END_ROD", Material.END_ROD, "LAUFBAU_FACING_UP", "LAUFBAU_FACING_DOWN"));
|
||||
|
||||
Directional endRodNorthSouth = (Directional) Material.END_ROD.createBlockData();
|
||||
endRodNorthSouth.setFacing(BlockFace.NORTH);
|
||||
addPixel(endRodNorthSouth, 6, 6, 0, 4, 4, 16, createItem("LAUFBAU_BLOCK_END_ROD", Material.END_ROD, "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
||||
|
||||
Directional endRodEastWest = (Directional) Material.END_ROD.createBlockData();
|
||||
endRodEastWest.setFacing(BlockFace.EAST);
|
||||
addPixel(endRodEastWest, 0, 6, 6, 16, 4, 4, createItem("LAUFBAU_BLOCK_END_ROD", Material.END_ROD, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
||||
|
||||
if (Core.getVersion() >= 19) {
|
||||
Directional lightningRodBottomTop = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
||||
lightningRodBottomTop.setFacing(BlockFace.UP);
|
||||
addPixel(lightningRodBottomTop, 6, 0, 6, 4, 16, 4, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_UP", "LAUFBAU_FACING_DOWN"));
|
||||
|
||||
Directional lightningRodNorthSouth = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
||||
lightningRodNorthSouth.setFacing(BlockFace.NORTH);
|
||||
addPixel(lightningRodNorthSouth, 6, 6, 0, 4, 4, 16, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
||||
|
||||
Directional lightningRodEastWest = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
||||
lightningRodEastWest.setFacing(BlockFace.EAST);
|
||||
addPixel(lightningRodEastWest, 0, 6, 6, 16, 4, 4, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
Waterlogged conduit = (Waterlogged) Material.CONDUIT.createBlockData();
|
||||
conduit.setWaterlogged(false);
|
||||
addPixel(conduit, 5, 5, 5, 6, 6, 6, createItem("LAUFBAU_BLOCK_CONDUIT", Material.CONDUIT));
|
||||
|
||||
TrapDoor northTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
||||
northTrapDoor.setFacing(BlockFace.NORTH);
|
||||
northTrapDoor.setOpen(true);
|
||||
addPixel(northTrapDoor, 0, 0, 13, 16, 16, 3, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_NORTH", "LAUFBAU_OPEN"));
|
||||
|
||||
TrapDoor southTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
||||
southTrapDoor.setFacing(BlockFace.SOUTH);
|
||||
southTrapDoor.setOpen(true);
|
||||
addPixel(southTrapDoor, 0, 0, 0, 16, 16, 3, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_SOUTH", "LAUFBAU_OPEN"));
|
||||
|
||||
TrapDoor westTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
||||
westTrapDoor.setFacing(BlockFace.WEST);
|
||||
westTrapDoor.setOpen(true);
|
||||
addPixel(westTrapDoor, 13, 0, 0, 3, 16, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_WEST", "LAUFBAU_OPEN"));
|
||||
|
||||
TrapDoor eastTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
||||
eastTrapDoor.setFacing(BlockFace.EAST);
|
||||
eastTrapDoor.setOpen(true);
|
||||
addPixel(eastTrapDoor, 0, 0, 0, 3, 16, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_EAST", "LAUFBAU_OPEN"));
|
||||
}
|
||||
|
||||
private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel, SWItem 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<BaseBlock> blockConsumer) {
|
||||
new BlockBoundingBox(blockData, Arrays.asList(pixelCuboid(xPixel, yPixel, zPixel, dxPixel, dyPixel, dzPixel)), swItem, blockConsumer);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void randomPlayerHead(BaseBlock block) {
|
||||
if (block instanceof SkullBlock) {
|
||||
|
||||
@@ -19,265 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.slaves.laufbau;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import de.steamwar.linkage.api.Enable;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.*;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
import org.bukkit.util.VoxelShape;
|
||||
public interface BoundingBoxLoader {
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.util.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@MinVersion(20)
|
||||
@Linked
|
||||
public class BoundingBoxLoader implements Enable {
|
||||
|
||||
private static final World world = Bukkit.getWorlds().get(0);
|
||||
private static long total = 0;
|
||||
private static List<Material> toBeCalculated = new ArrayList<>();
|
||||
|
||||
public static boolean isDone() {
|
||||
return toBeCalculated.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
Block block = world.getBlockAt(0, 0, 0);
|
||||
BlockState blockState = block.getState();
|
||||
toBeCalculated = Arrays.stream(Material.values())
|
||||
.filter(material -> !material.isLegacy())
|
||||
.filter(material -> material.isBlock())
|
||||
.filter(material -> material.getBlastResistance() <= 9)
|
||||
.filter(material -> !(material.createBlockData() instanceof Door))
|
||||
.sorted(Comparator.comparingDouble(material -> -material.getBlastResistance()))
|
||||
.collect(Collectors.toList());
|
||||
toBeCalculated.remove(Material.PITCHER_PLANT);
|
||||
toBeCalculated.remove(Material.PITCHER_CROP);
|
||||
toBeCalculated.remove(Material.PITCHER_POD);
|
||||
toBeCalculated.remove(Material.SCAFFOLDING);
|
||||
toBeCalculated.remove(Material.CAULDRON);
|
||||
if (Core.getVersion() > 20) {
|
||||
toBeCalculated.remove(Material.CHISELED_BOOKSHELF);
|
||||
}
|
||||
total = toBeCalculated.size();
|
||||
|
||||
Map<Collection<BoundingBox>, BlockData> uniqueBoundinxBoxes = new HashMap<>();
|
||||
Sink last = new Sink() {
|
||||
@Override
|
||||
protected void sink(BlockData current) {
|
||||
try {
|
||||
if (current instanceof Cocoa) {
|
||||
if (((Cocoa) current).getAge() != ((Cocoa) current).getMaximumAge()) return;
|
||||
}
|
||||
if (current instanceof Snow) {
|
||||
if (((Snow) current).getLayers() == 2) return;
|
||||
}
|
||||
if (current instanceof Cake) {
|
||||
if (((Cake) current).getBites() != 0) return;
|
||||
}
|
||||
if (current instanceof Wall) {
|
||||
((Wall) current).setUp(true);
|
||||
}
|
||||
block.setType(Material.AIR);
|
||||
block.setBlockData(current, false);
|
||||
} catch (NullPointerException e) {
|
||||
return;
|
||||
}
|
||||
VoxelShape voxelShape = block.getCollisionShape();
|
||||
if (voxelShape.getBoundingBoxes().isEmpty()) return;
|
||||
uniqueBoundinxBoxes.putIfAbsent(voxelShape.getBoundingBoxes(), current);
|
||||
}
|
||||
};
|
||||
|
||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), bukkitTask -> {
|
||||
BauSystem.getInstance().getLogger().log(Level.INFO, () -> "Loading Bounding Boxes: " + (total - toBeCalculated.size()) + "/" + total);
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
while (!toBeCalculated.isEmpty() && System.currentTimeMillis() - time < 40) {
|
||||
Material material = toBeCalculated.remove(0);
|
||||
|
||||
BlockData blockData = material.createBlockData();
|
||||
Set<Class<? extends BlockData>> interfaces = getInterfaces(blockData.getClass());
|
||||
interfaces.remove(BlockData.class);
|
||||
|
||||
List<Sink> sinks = interfaces.stream()
|
||||
.map(this::getSetters)
|
||||
.flatMap(Set::stream)
|
||||
.map(method -> {
|
||||
try {
|
||||
return getSink(method);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
for (int i = 1; i < sinks.size(); i++) {
|
||||
sinks.get(i - 1).next = sinks.get(i);
|
||||
}
|
||||
|
||||
if (!sinks.isEmpty()) {
|
||||
sinks.get(sinks.size() - 1).next = last;
|
||||
sinks.get(0).sink(blockData);
|
||||
} else {
|
||||
last.sink(blockData);
|
||||
}
|
||||
}
|
||||
|
||||
if (toBeCalculated.isEmpty()) {
|
||||
BauSystem.getInstance().getLogger().log(Level.INFO, () -> "Loading Bounding Boxes: " + (total - toBeCalculated.size()) + "/" + total);
|
||||
bukkitTask.cancel();
|
||||
|
||||
uniqueBoundinxBoxes.forEach((boundingBoxes, blockData) -> {
|
||||
List<Cuboid> cuboidList = boundingBoxes.stream()
|
||||
.map(boundingBox -> {
|
||||
return new Cuboid(boundingBox.getMinX(), boundingBox.getMinY(), boundingBox.getMinZ(), boundingBox.getWidthX(), boundingBox.getHeight(), boundingBox.getWidthZ());
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
Material material = blockData.getMaterial();
|
||||
if (!material.isItem()) {
|
||||
material = blockData.getPlacementMaterial();
|
||||
}
|
||||
if (material.isAir() || !material.isItem()) {
|
||||
material = Material.BARRIER;
|
||||
}
|
||||
new BlockBoundingBox(blockData, cuboidList, new SWItem(material, blockData.getMaterial().name()));
|
||||
});
|
||||
blockState.update(true, false);
|
||||
}
|
||||
}, 1, 1);
|
||||
}
|
||||
|
||||
private Set<Class<? extends BlockData>> getInterfaces(Class<?> clazz) {
|
||||
if (clazz == null) return Collections.emptySet();
|
||||
Set<Class<? extends BlockData>> interfaces = Arrays.stream(clazz.getInterfaces())
|
||||
.filter(BlockData.class::isAssignableFrom)
|
||||
.map(aClass -> (Class<? extends BlockData>) aClass)
|
||||
.collect(Collectors.toSet());
|
||||
interfaces.addAll(getInterfaces(clazz.getSuperclass()));
|
||||
interfaces.addAll(interfaces.stream()
|
||||
.map(this::getInterfaces)
|
||||
.flatMap(Set::stream)
|
||||
.collect(Collectors.toSet()));
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
private Set<Method> getSetters(Class<? extends BlockData> clazz) {
|
||||
Method[] methods = clazz.getDeclaredMethods();
|
||||
Set<Method> setters = new HashSet<>();
|
||||
for (Method method : methods) {
|
||||
if (method.getName().startsWith("set")) {
|
||||
setters.add(method);
|
||||
}
|
||||
}
|
||||
return setters;
|
||||
}
|
||||
|
||||
private abstract class Sink {
|
||||
protected Sink next = null;
|
||||
|
||||
protected abstract void sink(BlockData current);
|
||||
}
|
||||
|
||||
private Sink getSink(Method method) {
|
||||
if (method.getParameterCount() == 1) {
|
||||
Parameter parameter = method.getParameters()[0];
|
||||
Object[] values = getValues(parameter);
|
||||
return new Sink() {
|
||||
@Override
|
||||
protected void sink(BlockData current) {
|
||||
for (Object o : values) {
|
||||
BlockData cloned = current.clone();
|
||||
try {
|
||||
method.invoke(cloned, o);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
next.sink(cloned);
|
||||
}
|
||||
}
|
||||
};
|
||||
} else if (method.getParameterCount() == 2) {
|
||||
Parameter firstParameter = method.getParameters()[0];
|
||||
Parameter secondParameter = method.getParameters()[1];
|
||||
Object[] firstValues = getValues(firstParameter);
|
||||
Object[] secondValues = getValues(secondParameter);
|
||||
return new Sink() {
|
||||
|
||||
private Sink outerThis = this;
|
||||
private List<Sink> sinks = new ArrayList<>();
|
||||
|
||||
{
|
||||
for (int i = 0; i < firstValues.length; i++) {
|
||||
Object first = firstValues[i];
|
||||
boolean last = i == firstValues.length - 1;
|
||||
Sink current = new Sink() {
|
||||
@Override
|
||||
protected void sink(BlockData current) {
|
||||
for (Object second : secondValues) {
|
||||
BlockData cloned = current.clone();
|
||||
try {
|
||||
method.invoke(cloned, first, second);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (last) {
|
||||
outerThis.next.sink(cloned);
|
||||
} else {
|
||||
next.sink(cloned);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!sinks.isEmpty()) {
|
||||
sinks.get(sinks.size() - 1).next = current;
|
||||
}
|
||||
sinks.add(current);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sink(BlockData current) {
|
||||
sinks.get(0).sink(current);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
private Object[] getValues(Parameter parameter) {
|
||||
if (parameter.getType().isEnum()) {
|
||||
if (BlockFace.class.isAssignableFrom(parameter.getType())) {
|
||||
return new BlockFace[]{
|
||||
BlockFace.NORTH,
|
||||
BlockFace.SOUTH,
|
||||
BlockFace.EAST,
|
||||
BlockFace.WEST,
|
||||
BlockFace.UP,
|
||||
BlockFace.DOWN
|
||||
};
|
||||
}
|
||||
return parameter.getType().getEnumConstants();
|
||||
} else if (parameter.getType() == boolean.class || parameter.getType() == Boolean.class) {
|
||||
return new Object[]{false, true};
|
||||
} else if (parameter.getType() == int.class || parameter.getType() == Integer.class) {
|
||||
return new Object[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
} else {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
void load();
|
||||
}
|
||||
|
||||
@@ -39,10 +39,6 @@ public class LaufbauCommand extends SWCommand {
|
||||
|
||||
@Register(description = {"LAUFBAU_HELP", "LAUFBAU_PREPARE1", "LAUFBAU_PREPARE2"})
|
||||
public void laufbauSelection(@Validator Player player, @StaticValue(value = {"smallest", "blastresistant"}, allowISE = true) boolean preferingBlastResistance) {
|
||||
if (!BoundingBoxLoader.isDone()) {
|
||||
BauSystem.MESSAGE.send("LAUFBAU_NOT_LOADED", player);
|
||||
return;
|
||||
}
|
||||
Pair<Location, Location> selection = WorldEditUtils.getSelection(player);
|
||||
if (selection == null) {
|
||||
BauSystem.MESSAGE.send("LAUFBAU_NO_WORLDEDIT", player);
|
||||
@@ -78,9 +74,6 @@ public class LaufbauCommand extends SWCommand {
|
||||
|
||||
@Register(value = "settings", description = "LAUFBAU_HELP_SETTINGS")
|
||||
public void laufbauSettings(@Validator Player player) {
|
||||
if (!BoundingBoxLoader.isDone()) {
|
||||
return;
|
||||
}
|
||||
new LaufbauSettings(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,12 +115,12 @@ public class LaufbauSettings {
|
||||
} else {
|
||||
long count = blockBoundingBoxes.stream().filter(bb -> LaufbauUtils.isDeactivated(p, bb)).count();
|
||||
if (count == 0) {
|
||||
return new SWItem(material, group/*BauSystem.MESSAGE.parse(group, p)*/, Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
||||
}
|
||||
if (count == blockBoundingBoxes.size()) {
|
||||
return new SWItem(material, group/*BauSystem.MESSAGE.parse(group, p)*/, Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_INACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_INACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
||||
}
|
||||
return new SWItem(material, group/*BauSystem.MESSAGE.parse(group, p)*/, Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_MIXED", p, blockBoundingBoxes.size() - count, blockBoundingBoxes.size()), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_MIXED", p, blockBoundingBoxes.size() - count, blockBoundingBoxes.size()), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,6 @@ public class LaufbauUtils {
|
||||
}
|
||||
|
||||
public static SWItem translateItem(SWItem item, Player p) {
|
||||
if (true) return item;
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (itemMeta.getLore() != null) {
|
||||
@@ -120,7 +119,6 @@ public class LaufbauUtils {
|
||||
|
||||
@SneakyThrows
|
||||
public static boolean isDeactivated(Player p, BlockBoundingBox bb) {
|
||||
if (true) return false;
|
||||
if (bb.getSwItem() == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -130,7 +128,6 @@ public class LaufbauUtils {
|
||||
|
||||
@SneakyThrows
|
||||
public static void toggle(Player p, BlockBoundingBox bb) {
|
||||
if (true) return;
|
||||
if (bb.getSwItem() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.type.AmethystCluster;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
@MinVersion(19)
|
||||
public class AmethystBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
floorSmallAmethystBud();
|
||||
ceilingSmallAmethystBud();
|
||||
northSmallAmethystBud();
|
||||
southSmallAmethystBud();
|
||||
eastSmallAmethystBud();
|
||||
westSmallAmethystBud();
|
||||
|
||||
floorMediumAmethystBud();
|
||||
ceilingMediumAmethystBud();
|
||||
northMediumAmethystBud();
|
||||
southMediumAmethystBud();
|
||||
eastMediumAmethystBud();
|
||||
westMediumAmethystBud();
|
||||
|
||||
floorLargeAmethystBud();
|
||||
ceilingLargeAmethystBud();
|
||||
northLargeAmethystBud();
|
||||
southLargeAmethystBud();
|
||||
eastLargeAmethystBud();
|
||||
westLargeAmethystBud();
|
||||
|
||||
floorAmethystCluster();
|
||||
ceilingAmethystCluster();
|
||||
northAmethystCluster();
|
||||
southAmethystCluster();
|
||||
eastAmethystCluster();
|
||||
westAmethystCluster();
|
||||
}
|
||||
|
||||
private void floorSmallAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.UP);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 0, 4, 8, 3, 8));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_UP"));
|
||||
}
|
||||
|
||||
private void ceilingSmallAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.DOWN);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 13, 4, 8, 3, 8));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_DOWN"));
|
||||
}
|
||||
|
||||
private void northSmallAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 13, 8, 8, 3));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
private void southSmallAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 0, 8, 8, 3));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
private void eastSmallAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 4, 4, 3, 8, 8));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
private void westSmallAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(13, 4, 4, 3, 8, 8));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
private void floorMediumAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.UP);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 0, 3, 10, 4, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_UP"));
|
||||
}
|
||||
|
||||
private void ceilingMediumAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.DOWN);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 12, 3, 10, 4, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_DOWN"));
|
||||
}
|
||||
|
||||
private void northMediumAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 3, 12, 10, 10, 4));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
private void southMediumAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 4));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
private void eastMediumAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 3, 3, 4, 10, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
private void westMediumAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(12, 3, 3, 4, 10, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
private void floorLargeAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.UP);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 0, 3, 10, 5, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_UP"));
|
||||
}
|
||||
|
||||
private void ceilingLargeAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.DOWN);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 11, 3, 10, 5, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_DOWN"));
|
||||
}
|
||||
|
||||
private void northLargeAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 3, 11, 10, 10, 5));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
private void southLargeAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 5));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
private void eastLargeAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 3, 3, 5, 10, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
private void westLargeAmethystBud() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
||||
cluster.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(11, 3, 3, 5, 10, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
private void floorAmethystCluster() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
||||
cluster.setFacing(BlockFace.UP);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 0, 3, 10, 7, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_UP"));
|
||||
}
|
||||
|
||||
private void ceilingAmethystCluster() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
||||
cluster.setFacing(BlockFace.DOWN);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 9, 3, 10, 7, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_DOWN"));
|
||||
}
|
||||
|
||||
private void northAmethystCluster() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
||||
cluster.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 3, 9, 10, 10, 7));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
private void southAmethystCluster() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
||||
cluster.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 7));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
private void eastAmethystCluster() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
||||
cluster.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 3, 3, 7, 10, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
private void westAmethystCluster() {
|
||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
||||
cluster.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(9, 3, 3, 7, 10, 10));
|
||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
@MinVersion(19)
|
||||
public class AzaleaBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
BlockData blockData = Material.FLOWERING_AZALEA.createBlockData();
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(6, 0, 6, 4, 8, 4));
|
||||
new BlockBoundingBox(blockData, cuboidList, createItem("LAUFBAU_BLOCK_AZALEA", Material.FLOWERING_AZALEA));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.type.Bell;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class BellBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
ceilingBell();
|
||||
|
||||
floorNorthBell();
|
||||
floorEastBell();
|
||||
|
||||
doubleWallNorthBell();
|
||||
doubleWallEastBell();
|
||||
|
||||
singleWallNorthBell();
|
||||
singleWallSouthBell();
|
||||
singleWallEastBell();
|
||||
singleWallWestBell();
|
||||
}
|
||||
|
||||
public void ceilingBell() {
|
||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||
bell.setAttachment(Bell.Attachment.CEILING);
|
||||
bell.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||
cuboidList.add(pixelCuboid(7, 13, 7, 2, 3, 2));
|
||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_CEILING"));
|
||||
}
|
||||
|
||||
public void floorNorthBell() {
|
||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||
bell.setAttachment(Bell.Attachment.FLOOR);
|
||||
bell.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 4, 16, 16, 8));
|
||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_FLOOR", "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void floorEastBell() {
|
||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||
bell.setAttachment(Bell.Attachment.FLOOR);
|
||||
bell.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 0, 0, 8, 16, 16));
|
||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_FLOOR", "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
public void doubleWallNorthBell() {
|
||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||
bell.setAttachment(Bell.Attachment.DOUBLE_WALL);
|
||||
bell.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||
cuboidList.add(pixelCuboid(7, 13, 0, 2, 2, 16));
|
||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_DOUBLE_WALL", "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
public void doubleWallEastBell() {
|
||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||
bell.setAttachment(Bell.Attachment.DOUBLE_WALL);
|
||||
bell.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||
cuboidList.add(pixelCuboid(0, 13, 7, 16, 2, 2));
|
||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_DOUBLE_WALL", "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
public void singleWallNorthBell() {
|
||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
||||
bell.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||
cuboidList.add(pixelCuboid(7, 13, 0, 2, 2, 13));
|
||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_SINGLE_WALL", "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
public void singleWallSouthBell() {
|
||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
||||
bell.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||
cuboidList.add(pixelCuboid(7, 13, 3, 2, 2, 13));
|
||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_SINGLE_WALL", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void singleWallEastBell() {
|
||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
||||
bell.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||
cuboidList.add(pixelCuboid(3, 13, 7, 13, 2, 2));
|
||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_SINGLE_WALL", "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
public void singleWallWestBell() {
|
||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
||||
bell.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||
cuboidList.add(pixelCuboid(0, 13, 7, 13, 2, 2));
|
||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_SINGLE_WALL", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.type.BrewingStand;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class BrewingStandBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
BrewingStand brewingStand = (BrewingStand) Material.BREWING_STAND.createBlockData();
|
||||
List<Cuboid> cuboids = new ArrayList<>();
|
||||
cuboids.add(pixelCuboid(1, 0, 1, 14, 2, 14));
|
||||
cuboids.add(pixelCuboid(7, 2, 7, 2, 12, 2));
|
||||
new BlockBoundingBox(brewingStand, cuboids, createItem("LAUFBAU_BLOCK_BREWING_STAND", Material.BREWING_STAND));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.Lightable;
|
||||
import org.bukkit.block.data.type.Candle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
@MinVersion(19)
|
||||
public class CandleBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
caked();
|
||||
|
||||
single();
|
||||
}
|
||||
|
||||
private void caked() {
|
||||
Lightable candleCake = (Lightable) Material.CYAN_CANDLE_CAKE.createBlockData();
|
||||
candleCake.setLit(true);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(7, 8, 7, 2, 6, 2));
|
||||
new BlockBoundingBox(candleCake, cuboidList, createItem("LAUFBAU_BLOCK_CANDLE_CAKE", Material.CAKE));
|
||||
}
|
||||
|
||||
private void single() {
|
||||
Candle candle = (Candle) Material.CYAN_CANDLE.createBlockData();
|
||||
candle.setCandles(1);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(7, 0,7, 2, 6, 2));
|
||||
new BlockBoundingBox(candle, cuboidList, createItem("LAUFBAU_BLOCK_CANDLE", Material.CYAN_CANDLE, "LAUFBAU_COUNT_1"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.Axis;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.Orientable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
@MinVersion(19)
|
||||
public class ChainBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
bottomTopChain();
|
||||
northSouthChain();
|
||||
eastWestChain();
|
||||
}
|
||||
|
||||
private void bottomTopChain() {
|
||||
Orientable chainBottomTop = (Orientable) Material.CHAIN.createBlockData();
|
||||
chainBottomTop.setAxis(Axis.Y);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(6.5, 0, 6.5, 3, 16, 3));
|
||||
new BlockBoundingBox(chainBottomTop, cuboidList, createItem("LAUFBAU_BLOCK_CHAIN", Material.CHAIN, "LAUFBAU_FACING_UP", "LAUFBAU_FACING_DOWN"));
|
||||
}
|
||||
|
||||
private void northSouthChain() {
|
||||
Orientable chainBottomTop = (Orientable) Material.CHAIN.createBlockData();
|
||||
chainBottomTop.setAxis(Axis.Z);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(6.5, 6.5, 0, 3, 3, 16));
|
||||
new BlockBoundingBox(chainBottomTop, cuboidList, createItem("LAUFBAU_BLOCK_CHAIN", Material.CHAIN, "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
private void eastWestChain() {
|
||||
Orientable chainBottomTop = (Orientable) Material.CHAIN.createBlockData();
|
||||
chainBottomTop.setAxis(Axis.X);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 6.5, 6.5, 16, 3, 3));
|
||||
new BlockBoundingBox(chainBottomTop, cuboidList, createItem("LAUFBAU_BLOCK_CHAIN", Material.CHAIN, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class ChorusPlantBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
for (int nx = 0; nx < 2; nx++) {
|
||||
for (int ny = 0; ny < 2; ny++) {
|
||||
for (int nz = 0; nz < 2; nz++) {
|
||||
for (int px = 0; px < 2; px++) {
|
||||
for (int py = 0; py < 2; py++) {
|
||||
for (int pz = 0; pz < 2; pz++) {
|
||||
MultipleFacing chorusPlant = (MultipleFacing) Material.CHORUS_PLANT.createBlockData();
|
||||
List<String> lore = new ArrayList<>();
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(3, 3, 3, 10, 10, 10));
|
||||
if (nx == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
||||
chorusPlant.setFace(BlockFace.WEST, true);
|
||||
cuboidList.add(pixelCuboid(0, 3, 3, 3, 10, 10));
|
||||
}
|
||||
if (ny == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_DOWN");
|
||||
chorusPlant.setFace(BlockFace.DOWN, true);
|
||||
cuboidList.add(pixelCuboid(3, 0, 3, 10, 3, 10));
|
||||
}
|
||||
if (nz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
||||
chorusPlant.setFace(BlockFace.NORTH, true);
|
||||
cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 3));
|
||||
}
|
||||
if (px == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
||||
chorusPlant.setFace(BlockFace.EAST, true);
|
||||
cuboidList.add(pixelCuboid(13, 3, 3, 3, 10, 10));
|
||||
}
|
||||
if (py == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_UP");
|
||||
chorusPlant.setFace(BlockFace.UP, true);
|
||||
cuboidList.add(pixelCuboid(3, 13, 3, 10, 3, 10));
|
||||
}
|
||||
if (pz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
||||
chorusPlant.setFace(BlockFace.SOUTH, true);
|
||||
cuboidList.add(pixelCuboid(3, 3, 13, 10, 10, 3));
|
||||
}
|
||||
new BlockBoundingBox(chorusPlant, cuboidList, createItem("LAUFBAU_BLOCK_CHORUS_PLANT", Material.CHORUS_PLANT, lore.toArray(new String[0])));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
@MinVersion(19)
|
||||
public class DragonEggBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
BlockData blockData = Material.DRAGON_EGG.createBlockData();
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(1, 0, 1, 14, 16, 14));
|
||||
new BlockBoundingBox(blockData, cuboidList, createItem("LAUFBAU_BLOCK_DRAGON_EGG", Material.DRAGON_EGG));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.type.BigDripleaf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
@MinVersion(19)
|
||||
public class DripLeafBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
tiltNone();
|
||||
tiltPartial();
|
||||
}
|
||||
|
||||
private void tiltNone() {
|
||||
BigDripleaf bigDripleaf = (BigDripleaf) Material.BIG_DRIPLEAF.createBlockData();
|
||||
bigDripleaf.setTilt(BigDripleaf.Tilt.NONE);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 11, 0, 16, 4, 16));
|
||||
new BlockBoundingBox(bigDripleaf, cuboidList, createItem("LAUFBAU_BLOCK_BIG_DRIP_LEAF", Material.BIG_DRIPLEAF, "LAUFBAU_TILT_NONE"));
|
||||
}
|
||||
|
||||
private void tiltPartial() {
|
||||
BigDripleaf bigDripleaf = (BigDripleaf) Material.BIG_DRIPLEAF.createBlockData();
|
||||
bigDripleaf.setTilt(BigDripleaf.Tilt.PARTIAL);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 11, 0, 16, 2, 16));
|
||||
new BlockBoundingBox(bigDripleaf, cuboidList, createItem("LAUFBAU_BLOCK_BIG_DRIP_LEAF", Material.BIG_DRIPLEAF, "LAUFBAU_TILT_PARTIAL"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.type.Fence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class FencesBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
for (int nx = 0; nx < 2; nx++) {
|
||||
for (int nz = 0; nz < 2; nz++) {
|
||||
for (int px = 0; px < 2; px++) {
|
||||
for (int pz = 0; pz < 2; pz++) {
|
||||
Fence fence = (Fence) Material.NETHER_BRICK_FENCE.createBlockData();
|
||||
List<String> lore = new ArrayList<>();
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(6, 0, 6, 4, 24, 4));
|
||||
if (nz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
||||
fence.setFace(BlockFace.NORTH, true);
|
||||
cuboidList.add(pixelCuboid(6, 0, 0, 4, 24, 6));
|
||||
}
|
||||
if (pz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
||||
fence.setFace(BlockFace.SOUTH, true);
|
||||
cuboidList.add(pixelCuboid(6, 0, 10, 4, 24, 6));
|
||||
}
|
||||
if (nx == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
||||
fence.setFace(BlockFace.WEST, true);
|
||||
cuboidList.add(pixelCuboid(0, 0, 6, 6, 24, 4));
|
||||
}
|
||||
if (px == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
||||
fence.setFace(BlockFace.EAST, true);
|
||||
cuboidList.add(pixelCuboid(10, 0, 6, 6, 24, 4));
|
||||
}
|
||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_NETHER_BRICK_FENCE", Material.NETHER_BRICK_FENCE, lore.toArray(new String[0])));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.FaceAttachable;
|
||||
import org.bukkit.block.data.type.Grindstone;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class GrindstoneBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
floorNorthGrindstone();
|
||||
floorEastGrindstone();
|
||||
|
||||
ceilingNorthGrindstone();
|
||||
ceilingEastGrindstone();
|
||||
|
||||
wallNorthGrindstone();
|
||||
wallSouthGrindstone();
|
||||
wallEastGrindstone();
|
||||
wallWestGrindstone();
|
||||
}
|
||||
|
||||
public void floorNorthGrindstone() {
|
||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.FLOOR);
|
||||
grindstone.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 4, 2, 8, 12, 12));
|
||||
cuboidList.add(pixelCuboid(2, 0, 6, 2, 7, 4));
|
||||
cuboidList.add(pixelCuboid(12, 0, 6, 2, 7, 4));
|
||||
cuboidList.add(pixelCuboid(2, 7, 5, 2, 6, 6));
|
||||
cuboidList.add(pixelCuboid(12, 7, 5, 2, 6, 6));
|
||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_FLOOR", "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void floorEastGrindstone() {
|
||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.FLOOR);
|
||||
grindstone.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(2, 4, 4, 12, 12, 8));
|
||||
cuboidList.add(pixelCuboid(6, 0, 2, 4, 7, 2));
|
||||
cuboidList.add(pixelCuboid(6, 0, 12, 4, 7, 2));
|
||||
cuboidList.add(pixelCuboid(5, 7, 2, 6, 6, 2));
|
||||
cuboidList.add(pixelCuboid(5, 7, 12, 6, 6, 2));
|
||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_FLOOR", "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
public void ceilingNorthGrindstone() {
|
||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.CEILING);
|
||||
grindstone.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 0, 2, 8, 12, 12));
|
||||
cuboidList.add(pixelCuboid(2, 9, 6, 2, 7, 4));
|
||||
cuboidList.add(pixelCuboid(12, 9, 6, 2, 7, 4));
|
||||
cuboidList.add(pixelCuboid(2, 3, 5, 2, 6, 6));
|
||||
cuboidList.add(pixelCuboid(12, 3, 5, 2, 6, 6));
|
||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_CEILING", "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void ceilingEastGrindstone() {
|
||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.CEILING);
|
||||
grindstone.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(2, 0, 4, 12, 12, 8));
|
||||
cuboidList.add(pixelCuboid(6, 9, 2, 4, 7, 2));
|
||||
cuboidList.add(pixelCuboid(6, 9, 12, 4, 7, 2));
|
||||
cuboidList.add(pixelCuboid(5, 3, 2, 6, 6, 2));
|
||||
cuboidList.add(pixelCuboid(5, 3, 12, 6, 6, 2));
|
||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_CEILING", "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
public void wallNorthGrindstone() {
|
||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
||||
grindstone.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 2, 0, 8, 12, 12));
|
||||
cuboidList.add(pixelCuboid(2, 6, 9, 2, 4, 7));
|
||||
cuboidList.add(pixelCuboid(12, 6, 9, 2, 4, 7));
|
||||
cuboidList.add(pixelCuboid(2, 5, 3, 2, 6, 6));
|
||||
cuboidList.add(pixelCuboid(12, 5, 3, 2, 6, 6));
|
||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_WALL", "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
public void wallSouthGrindstone() {
|
||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
||||
grindstone.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 2, 4, 8, 12, 12));
|
||||
cuboidList.add(pixelCuboid(2, 6, 0, 2, 4, 7));
|
||||
cuboidList.add(pixelCuboid(12, 6, 0, 2, 4, 7));
|
||||
cuboidList.add(pixelCuboid(2, 5, 7, 2, 6, 6));
|
||||
cuboidList.add(pixelCuboid(12, 5, 7, 2, 6, 6));
|
||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_WALL", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void wallEastGrindstone() {
|
||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
||||
grindstone.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 2, 4, 12, 12, 8));
|
||||
cuboidList.add(pixelCuboid(0, 6, 2, 7, 4, 2));
|
||||
cuboidList.add(pixelCuboid(0, 6, 12, 7, 4, 2));
|
||||
cuboidList.add(pixelCuboid(7, 5, 2, 6, 6, 2));
|
||||
cuboidList.add(pixelCuboid(7, 5, 12, 6, 6, 2));
|
||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_WALL", "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
public void wallWestGrindstone() {
|
||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
||||
grindstone.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 2, 4, 12, 12, 8));
|
||||
cuboidList.add(pixelCuboid(9, 6, 2, 7, 4, 2));
|
||||
cuboidList.add(pixelCuboid(9, 6, 12, 7, 4, 2));
|
||||
cuboidList.add(pixelCuboid(3, 5, 2, 6, 6, 2));
|
||||
cuboidList.add(pixelCuboid(3, 5, 12, 6, 6, 2));
|
||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_WALL", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.type.Hopper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class HopperBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
downHopper();
|
||||
northHopper();
|
||||
southHopper();
|
||||
eastHopper();
|
||||
westHopper();
|
||||
}
|
||||
|
||||
public void downHopper() {
|
||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||
hopper.setFacing(BlockFace.DOWN);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||
cuboidList.add(pixelCuboid(6, 0, 6, 4, 4, 4));
|
||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_FLOOR"));
|
||||
}
|
||||
|
||||
public void northHopper() {
|
||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||
hopper.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||
cuboidList.add(pixelCuboid(6, 4, 0, 4, 4, 4));
|
||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_NORTH"));
|
||||
}
|
||||
|
||||
public void southHopper() {
|
||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||
hopper.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||
cuboidList.add(pixelCuboid(6, 4, 12, 4, 4, 4));
|
||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_SOUTH"));
|
||||
}
|
||||
|
||||
public void eastHopper() {
|
||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||
hopper.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||
cuboidList.add(pixelCuboid(12, 4, 6, 4, 4, 4));
|
||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_EAST"));
|
||||
}
|
||||
|
||||
public void westHopper() {
|
||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||
hopper.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||
cuboidList.add(pixelCuboid(0, 4, 6, 4, 4, 4));
|
||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_WEST"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.type.Fence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class IronBarBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
for (int nx = 0; nx < 2; nx++) {
|
||||
for (int nz = 0; nz < 2; nz++) {
|
||||
for (int px = 0; px < 2; px++) {
|
||||
for (int pz = 0; pz < 2; pz++) {
|
||||
Fence fence = (Fence) Material.IRON_BARS.createBlockData();
|
||||
List<String> lore = new ArrayList<>();
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(7, 0, 7, 2, 16, 2));
|
||||
if (nz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
||||
fence.setFace(BlockFace.NORTH, true);
|
||||
cuboidList.add(pixelCuboid(7, 0, 0, 2, 16, 7));
|
||||
}
|
||||
if (pz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
||||
fence.setFace(BlockFace.SOUTH, true);
|
||||
cuboidList.add(pixelCuboid(7, 0, 9, 2, 16, 7));
|
||||
}
|
||||
if (nx == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
||||
fence.setFace(BlockFace.WEST, true);
|
||||
cuboidList.add(pixelCuboid(0, 0, 7, 7, 16, 2));
|
||||
}
|
||||
if (px == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
||||
fence.setFace(BlockFace.EAST, true);
|
||||
cuboidList.add(pixelCuboid(9, 0, 7, 7, 16, 2));
|
||||
}
|
||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_IRON_BARS", Material.IRON_BARS, lore.toArray(new String[0])));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.type.Lantern;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class LanternBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
lantern();
|
||||
hangingLantern();
|
||||
}
|
||||
|
||||
public void lantern() {
|
||||
Lantern lantern = (Lantern) Material.LANTERN.createBlockData();
|
||||
lantern.setHanging(false);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(5, 0, 5, 6, 7, 6));
|
||||
cuboidList.add(pixelCuboid(6, 7, 6, 4, 2, 4));
|
||||
new BlockBoundingBox(lantern, cuboidList, createItem("LAUFBAU_BLOCK_LANTERN", Material.LANTERN));
|
||||
}
|
||||
|
||||
public void hangingLantern() {
|
||||
Lantern lantern = (Lantern) Material.LANTERN.createBlockData();
|
||||
lantern.setHanging(true);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(5, 1, 5, 6, 7, 6));
|
||||
cuboidList.add(pixelCuboid(6, 8, 6, 4, 2, 4));
|
||||
new BlockBoundingBox(lantern, cuboidList, createItem("LAUFBAU_BLOCK_LANTERN", Material.LANTERN, "LAUFBAU_HANGING"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class LecternBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
BlockData blockData = Material.LECTERN.createBlockData();
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 2, 16));
|
||||
cuboidList.add(pixelCuboid(4, 2, 4, 8, 12, 8));
|
||||
new BlockBoundingBox(blockData, cuboidList, createItem("LAUFBAU_BLOCK_LECTERN", Material.LECTERN));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.type.Stairs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class StairBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
straightBottomNorthStair();
|
||||
straightBottomSouthStair();
|
||||
straightBottomEastStair();
|
||||
straightBottomWestStair();
|
||||
|
||||
straightTopNorthStair();
|
||||
straightTopSouthStair();
|
||||
straightTopEastStair();
|
||||
straightTopWestStair();
|
||||
|
||||
outerLeftBottomNorthStair();
|
||||
outerLeftBottomSouthStair();
|
||||
outerLeftBottomEastStair();
|
||||
outerLeftBottomWestStair();
|
||||
|
||||
outerLeftTopNorthStair();
|
||||
outerLeftTopSouthStair();
|
||||
outerLeftTopEastStair();
|
||||
outerLeftTopWestStair();
|
||||
|
||||
innerLeftBottomNorthStair();
|
||||
innerLeftBottomSouthStair();
|
||||
innerLeftBottomEastStair();
|
||||
innerLeftBottomWestStair();
|
||||
|
||||
innerLeftTopNorthStair();
|
||||
innerLeftTopSouthStair();
|
||||
innerLeftTopEastStair();
|
||||
innerLeftTopWestStair();
|
||||
}
|
||||
|
||||
public void straightBottomNorthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
public void straightBottomSouthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 8, 8, 16, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void straightBottomEastStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(8, 8, 0, 8, 8, 16));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
public void straightBottomWestStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 8, 8, 16));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
public void straightTopNorthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
public void straightTopSouthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 0, 8, 16, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void straightTopEastStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(8, 0, 0, 8, 8, 16));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
public void straightTopWestStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 8, 8, 16));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
public void outerLeftBottomNorthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
public void outerLeftBottomSouthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(8, 8, 8, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void outerLeftBottomEastStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(8, 8, 0, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
public void outerLeftBottomWestStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 8, 8, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
public void outerLeftTopNorthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
public void outerLeftTopSouthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(8, 0, 8, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void outerLeftTopEastStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(8, 0, 0, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
public void outerLeftTopWestStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 0, 8, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
public void innerLeftBottomNorthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 8));
|
||||
cuboidList.add(pixelCuboid(0, 8, 8, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
public void innerLeftBottomSouthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 8, 8, 16, 8, 8));
|
||||
cuboidList.add(pixelCuboid(8, 8, 0, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void innerLeftBottomEastStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 8));
|
||||
cuboidList.add(pixelCuboid(8, 8, 8, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
public void innerLeftBottomWestStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||
stairs.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 8, 8, 16, 8, 8));
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
|
||||
public void innerLeftTopNorthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.NORTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 8));
|
||||
cuboidList.add(pixelCuboid(0, 0, 8, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_NORTH"));
|
||||
}
|
||||
|
||||
public void innerLeftTopSouthStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.SOUTH);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 0, 8, 16, 8, 8));
|
||||
cuboidList.add(pixelCuboid(8, 0, 0, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_SOUTH"));
|
||||
}
|
||||
|
||||
public void innerLeftTopEastStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.EAST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 8));
|
||||
cuboidList.add(pixelCuboid(8, 0, 8, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_EAST"));
|
||||
}
|
||||
|
||||
public void innerLeftTopWestStair() {
|
||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||
stairs.setHalf(Stairs.Half.TOP);
|
||||
stairs.setFacing(BlockFace.WEST);
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||
cuboidList.add(pixelCuboid(0, 0, 8, 16, 8, 8));
|
||||
cuboidList.add(pixelCuboid(0, 0, 0, 8, 8, 8));
|
||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_WEST"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.slaves.laufbau.boundingboxes;
|
||||
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.type.Fence;
|
||||
import org.bukkit.block.data.type.Wall;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||
|
||||
@Linked
|
||||
public class WallBoundingBox implements BoundingBoxLoader {
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
if (Core.getVersion() > 15) {
|
||||
v18();
|
||||
} else {
|
||||
v15();
|
||||
}
|
||||
}
|
||||
|
||||
private void v18() {
|
||||
for (int nx = 0; nx < 2; nx++) {
|
||||
for (int nz = 0; nz < 2; nz++) {
|
||||
for (int px = 0; px < 2; px++) {
|
||||
for (int pz = 0; pz < 2; pz++) {
|
||||
Wall fence = (Wall) Material.END_STONE_BRICK_WALL.createBlockData();
|
||||
List<String> lore = new ArrayList<>();
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 0, 4, 8, 24, 8));
|
||||
if (nz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
||||
fence.setHeight(BlockFace.NORTH, Wall.Height.LOW);
|
||||
cuboidList.add(pixelCuboid(5, 0, 0, 6, 24, 4));
|
||||
}
|
||||
if (pz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
||||
fence.setHeight(BlockFace.SOUTH, Wall.Height.LOW);
|
||||
cuboidList.add(pixelCuboid(5, 0, 12, 6, 24, 4));
|
||||
}
|
||||
if (nx == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
||||
fence.setHeight(BlockFace.WEST, Wall.Height.LOW);
|
||||
cuboidList.add(pixelCuboid(0, 0, 5, 4, 24, 6));
|
||||
}
|
||||
if (px == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
||||
fence.setHeight(BlockFace.EAST, Wall.Height.LOW);
|
||||
cuboidList.add(pixelCuboid(12, 0, 5, 4, 24, 6));
|
||||
}
|
||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_WALL", Material.END_STONE_BRICK_WALL, lore.toArray(new String[0])));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void v15() {
|
||||
for (int nx = 0; nx < 2; nx++) {
|
||||
for (int nz = 0; nz < 2; nz++) {
|
||||
for (int px = 0; px < 2; px++) {
|
||||
for (int pz = 0; pz < 2; pz++) {
|
||||
Fence fence = (Fence) Material.END_STONE_BRICK_WALL.createBlockData();
|
||||
List<String> lore = new ArrayList<>();
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 0, 4, 8, 24, 8));
|
||||
if (nz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
||||
fence.setFace(BlockFace.NORTH, true);
|
||||
cuboidList.add(pixelCuboid(5, 0, 0, 6, 24, 4));
|
||||
}
|
||||
if (pz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
||||
fence.setFace(BlockFace.SOUTH, true);
|
||||
cuboidList.add(pixelCuboid(5, 0, 12, 6, 24, 4));
|
||||
}
|
||||
if (nx == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
||||
fence.setFace(BlockFace.WEST, true);
|
||||
cuboidList.add(pixelCuboid(0, 0, 5, 4, 24, 6));
|
||||
}
|
||||
if (px == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
||||
fence.setFace(BlockFace.EAST, true);
|
||||
cuboidList.add(pixelCuboid(12, 0, 5, 4, 24, 6));
|
||||
}
|
||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_WALL", Material.END_STONE_BRICK_WALL, lore.toArray(new String[0])));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.testblock.blockcounter;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
@@ -34,6 +35,7 @@ public class BlockCounterListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
||||
Region region = Region.getRegion(event.getLocation());
|
||||
if (region.getType().isGlobal()) {
|
||||
return;
|
||||
|
||||
@@ -121,8 +121,8 @@ public class BauScoreboard implements Listener {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.getType().isGlobal()) return "§eSteam§8War";
|
||||
String colorCode = "§e";
|
||||
if (region.getFlags().has(Flag.COLOR).isReadable()) {
|
||||
colorCode = "§" + region.getFlags().get(Flag.COLOR).orElse(ColorMode.PINK).getColorCode();
|
||||
if (region.getRegionData().has(Flag.COLOR).isReadable()) {
|
||||
colorCode = "§" + region.getRegionData().get(Flag.COLOR).orElse(ColorMode.PINK).getColorCode();
|
||||
}
|
||||
return colorCode + "■ §eSteam§8War " + colorCode + "■"; // ■
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.world;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
@Linked
|
||||
public class OtherTNTListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onExplosion(EntityExplodeEvent e) {
|
||||
if (!(e instanceof TNTPrimed)) return;
|
||||
e.blockList().removeIf(block -> {
|
||||
if(block.getType() == Material.TNT) {
|
||||
return false;
|
||||
} else {
|
||||
block.setType(Material.AIR);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,8 @@ public class BackupScheduler implements Enable {
|
||||
@Override
|
||||
public void run() {
|
||||
Iterator<Region> regionsToBackup = RegionSystem.INSTANCE.getRegions()
|
||||
.filter(region -> region.getFlags().has(Flag.CHANGED).isReadable())
|
||||
.filter(region -> region.getFlags().get(Flag.CHANGED).getWithDefault() == ChangedMode.HAS_CHANGE)
|
||||
.filter(region -> region.getRegionData().has(Flag.CHANGED).isReadable())
|
||||
.filter(region -> region.getRegionData().get(Flag.CHANGED).isWithDefault(ChangedMode.HAS_CHANGE))
|
||||
.iterator();
|
||||
if (!regionsToBackup.hasNext()) return;
|
||||
doBackup(regionsToBackup);
|
||||
@@ -63,7 +63,7 @@ public class BackupScheduler implements Enable {
|
||||
Optional<RegionBackups.Backup> backup = region.getBackups()
|
||||
.create(RegionBackups.BackupType.AUTOMATIC);
|
||||
if (backup.isPresent()) {
|
||||
region.getFlags().set(Flag.CHANGED, ChangedMode.NO_CHANGE);
|
||||
region.getRegionData().set(Flag.CHANGED, ChangedMode.NO_CHANGE);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(BauSystem.getInstance(), 0, 20 * 60);
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.region;
|
||||
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface FlagStorage {
|
||||
|
||||
@NonNull
|
||||
<T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag);
|
||||
|
||||
/**
|
||||
* Returns true if the flag was changed and did not already contain the provided value
|
||||
*/
|
||||
<T extends Enum<T> & Flag.Value<T>> boolean set(@NonNull Flag<T> flag, @NonNull T value);
|
||||
|
||||
@NonNull
|
||||
<T extends Enum<T> & Flag.Value<T>> FlagOptional<T> get(@NonNull Flag<T> flag);
|
||||
|
||||
void clear();
|
||||
|
||||
Map<Flag<?>, Flag.Value<?>> getBackedMap();
|
||||
}
|
||||
@@ -23,7 +23,6 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.bausystem.utils.FlatteningWrapper;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -55,7 +54,7 @@ public interface Region {
|
||||
RegionType getType();
|
||||
|
||||
@NonNull
|
||||
FlagStorage getFlags();
|
||||
RegionData getRegionData();
|
||||
|
||||
@NonNull
|
||||
Area getArea();
|
||||
@@ -75,9 +74,6 @@ public interface Region {
|
||||
@NonNull
|
||||
RegionBackups getBackups();
|
||||
|
||||
@NonNull
|
||||
RegionData getRegionData();
|
||||
|
||||
interface Area {
|
||||
|
||||
Area EMPTY = new Area() {
|
||||
|
||||
@@ -49,7 +49,7 @@ public interface RegionBackups {
|
||||
private final String name;
|
||||
|
||||
@NonNull
|
||||
private final FlagStorage flags;
|
||||
private final RegionData data;
|
||||
|
||||
@CheckReturnValue
|
||||
public abstract boolean load();
|
||||
|
||||
@@ -19,75 +19,134 @@
|
||||
|
||||
package de.steamwar.bausystem.region;
|
||||
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import lombok.NonNull;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface RegionData {
|
||||
public abstract class RegionData {
|
||||
|
||||
void clear();
|
||||
private final List<Property<?, ?>> properties = new ArrayList<>();
|
||||
|
||||
SchematicNode getTestblockSchematic();
|
||||
protected final YAPIONObject data;
|
||||
protected final YAPIONObject flagData;
|
||||
protected final Runnable onChange;
|
||||
protected final Map<Flag<?>, Flag.Value<?>> flagMap = new HashMap<>();
|
||||
|
||||
void setTestblockSchematic(SchematicNode schematic);
|
||||
private final class Property<T, K> {
|
||||
private final String field;
|
||||
private final Function<K, T> loader;
|
||||
private final Function<T, K> writer;
|
||||
|
||||
RegionData EMPTY = new RegionData() {
|
||||
private T value;
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
public Property(String field, Function<K, T> loader, Function<T, K> writer) {
|
||||
this.field = field;
|
||||
this.loader = loader;
|
||||
this.writer = writer;
|
||||
properties.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchematicNode getTestblockSchematic() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTestblockSchematic(SchematicNode schematic) {
|
||||
}
|
||||
};
|
||||
|
||||
class RegionDataImpl implements RegionData {
|
||||
|
||||
private final YAPIONObject yapionObject;
|
||||
private final Runnable onChange;
|
||||
|
||||
public RegionDataImpl(YAPIONObject yapionObject, Runnable onChange) {
|
||||
this.yapionObject = yapionObject;
|
||||
this.onChange = onChange;
|
||||
|
||||
if (yapionObject.containsKey("testblockSchematic")) {
|
||||
testblockSchematic = SchematicNode.getSchematicNode(yapionObject.getInt("testblockSchematic"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
testblockSchematic = null;
|
||||
yapionObject.remove("testblockSchematic");
|
||||
onChange.run();
|
||||
}
|
||||
|
||||
private SchematicNode testblockSchematic = null;
|
||||
|
||||
@Override
|
||||
public SchematicNode getTestblockSchematic() {
|
||||
return testblockSchematic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTestblockSchematic(SchematicNode schematic) {
|
||||
if (Objects.equals(this.testblockSchematic, schematic)) {
|
||||
return;
|
||||
}
|
||||
this.testblockSchematic = schematic;
|
||||
if (schematic == null) {
|
||||
yapionObject.remove("testblockSchematic");
|
||||
public void load() {
|
||||
if (flagData.containsKey(field)) {
|
||||
value = loader.apply(flagData.getPlainValue(field));
|
||||
} else {
|
||||
yapionObject.put("testblockSchematic", testblockSchematic.getId());
|
||||
value = null;
|
||||
}
|
||||
}
|
||||
|
||||
public T get() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void set(T value) {
|
||||
this.value = value;
|
||||
if (value == null) {
|
||||
flagData.remove(field);
|
||||
} else {
|
||||
flagData.put(field, writer.apply(value));
|
||||
}
|
||||
onChange.run();
|
||||
}
|
||||
}
|
||||
|
||||
private Property<SchematicNode, Integer> testblockSchematic = new Property<>("testblockSchematic", SchematicNode::byId, SchematicNode::getId);
|
||||
|
||||
protected RegionData(YAPIONObject data, Runnable onChange) {
|
||||
this.data = data;
|
||||
this.flagData = data.getObjectOrSetDefault("flagStorage", new YAPIONObject());
|
||||
this.onChange = onChange;
|
||||
initialize();
|
||||
for (final Flag flag : Flag.getFlags()) {
|
||||
if (!has(flag).isWritable()) continue;
|
||||
try {
|
||||
String s = flagData.getPlainValue(flag.name());
|
||||
flagMap.put(flag, flag.valueOfValue(s));
|
||||
} catch (Exception e) {
|
||||
flagMap.put(flag, (Flag.Value<?>) flag.getDefaultValue());
|
||||
}
|
||||
}
|
||||
properties.forEach(Property::load);
|
||||
}
|
||||
|
||||
protected void initialize() {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public abstract <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag);
|
||||
|
||||
/**
|
||||
* Returns true if the flag was changed and did not already contain the provided value
|
||||
*/
|
||||
public final <T extends Enum<T> & Flag.Value<T>> boolean set(@NonNull Flag<T> flag, @NonNull T value) {
|
||||
if (has(flag).isWritable()) {
|
||||
if (flagMap.put(flag, value) != value) {
|
||||
flagData.put(flag.name(), value.name());
|
||||
onChange.run();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public final <T extends Enum<T> & Flag.Value<T>> FlagOptional<T> get(@NonNull Flag<T> flag) {
|
||||
return FlagOptional.of(flag, (T) flagMap.get(flag));
|
||||
}
|
||||
|
||||
public final void clear() {
|
||||
for (Flag flag : Flag.getFlags()) {
|
||||
if (has(flag).isWritable()) {
|
||||
flagMap.remove(flag);
|
||||
flagData.remove(flag.name());
|
||||
}
|
||||
}
|
||||
properties.forEach(property -> property.set(null));
|
||||
onChange.run();
|
||||
}
|
||||
|
||||
public final Map<Flag<?>, Flag.Value<?>> getBackedMap() {
|
||||
return flagMap;
|
||||
}
|
||||
|
||||
public SchematicNode getTestblockSchematic() {
|
||||
return testblockSchematic.get();
|
||||
}
|
||||
|
||||
public void setTestblockSchematic(SchematicNode schematic) {
|
||||
testblockSchematic.set(schematic);
|
||||
onChange.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
return getClass().getSimpleName() + "{" +
|
||||
"flagMap=" + flagMap +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.region.fixed;
|
||||
|
||||
import de.steamwar.bausystem.region.FlagOptional;
|
||||
import de.steamwar.bausystem.region.FlagStorage;
|
||||
import de.steamwar.bausystem.region.RegionFlagPolicy;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import de.steamwar.core.Core;
|
||||
import lombok.NonNull;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class FixedFlagStorage implements FlagStorage {
|
||||
|
||||
private Map<Flag<?>, Flag.Value<?>> flagMap = new HashMap<>();
|
||||
private YAPIONObject data;
|
||||
|
||||
public FixedFlagStorage(YAPIONObject data) {
|
||||
this.data = data;
|
||||
for (final Flag flag : Flag.getFlags()) {
|
||||
if (!has(flag).isWritable()) continue;
|
||||
try {
|
||||
String s = data.getPlainValue(flag.name());
|
||||
flagMap.put(flag, flag.valueOfValue(s));
|
||||
} catch (Exception e) {
|
||||
flagMap.put(flag, (Flag.Value<?>) flag.getDefaultValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag) {
|
||||
if (flag.oneOf(Flag.COLOR, Flag.TNT, Flag.FIRE, Flag.FREEZE, Flag.PROTECT, Flag.NO_GRAVITY, Flag.CHANGED)) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
if (flag.oneOf(Flag.ITEMS) && Core.getVersion() >= 20) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
if (flag.oneOf(Flag.TESTBLOCK)) {
|
||||
return RegionFlagPolicy.READ_ONLY;
|
||||
}
|
||||
return RegionFlagPolicy.NOT_APPLICABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Enum<T> & Flag.Value<T>> boolean set(@NonNull Flag<T> flag, @NonNull T value) {
|
||||
if (has(flag).isWritable()) {
|
||||
boolean hasChanged = flagMap.put(flag, value) != value;
|
||||
if (hasChanged) {
|
||||
data.put(flag.name(), value.name());
|
||||
WorldData.write();
|
||||
}
|
||||
return hasChanged;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull <T extends Enum<T> & Flag.Value<T>> FlagOptional<T> get(@NonNull Flag<T> flag) {
|
||||
return FlagOptional.of(flag, (T) flagMap.get(flag));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
for (Flag flag : Flag.getFlags()) {
|
||||
if (flag == Flag.TESTBLOCK) continue;
|
||||
if (flag == Flag.COLOR) continue;
|
||||
if (flag == Flag.CHANGED) continue;
|
||||
flagMap.remove(flag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Flag<?>, Flag.Value<?>> getBackedMap() {
|
||||
return flagMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FixedFlagStorage{" +
|
||||
"flagMap=" + flagMap +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.region.fixed;
|
||||
|
||||
import de.steamwar.bausystem.region.FlagOptional;
|
||||
import de.steamwar.bausystem.region.FlagStorage;
|
||||
import de.steamwar.bausystem.region.RegionFlagPolicy;
|
||||
import de.steamwar.bausystem.region.flags.ColorMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.ProtectMode;
|
||||
import de.steamwar.bausystem.region.flags.TNTMode;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import de.steamwar.core.Core;
|
||||
import lombok.NonNull;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class FixedGlobalFlagStorage implements FlagStorage {
|
||||
|
||||
private Map<Flag<?>, Flag.Value<?>> flagMap = new HashMap<>();
|
||||
private YAPIONObject data;
|
||||
|
||||
public FixedGlobalFlagStorage(YAPIONObject data) {
|
||||
flagMap.put(Flag.TNT, TNTMode.DENY);
|
||||
this.data = data;
|
||||
for (final Flag flag : Flag.getFlags()) {
|
||||
if (!has(flag).isWritable()) continue;
|
||||
try {
|
||||
String s = data.getPlainValue(flag.name());
|
||||
flagMap.put(flag, flag.valueOfValue(s));
|
||||
} catch (Exception e) {
|
||||
flagMap.put(flag, (Flag.Value<?>) flag.getDefaultValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag) {
|
||||
if (flag.oneOf(Flag.COLOR)) {
|
||||
return RegionFlagPolicy.READ_ONLY;
|
||||
}
|
||||
if (flag.oneOf(Flag.ITEMS) && Core.getVersion() >= 20) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
if (flag.oneOf(Flag.TNT, Flag.FIRE, Flag.FREEZE)) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
return RegionFlagPolicy.NOT_APPLICABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Enum<T> & Flag.Value<T>> boolean set(@NonNull Flag<T> flag, @NonNull T value) {
|
||||
if (has(flag).isWritable()) {
|
||||
data.put(flag.name(), value.name());
|
||||
WorldData.write();
|
||||
return flagMap.put(flag, value) != value;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull <T extends Enum<T> & Flag.Value<T>> FlagOptional<T> get(@NonNull Flag<T> flag) {
|
||||
if (flag.oneOf(Flag.COLOR)) {
|
||||
return FlagOptional.of((Flag) flag, ColorMode.YELLOW);
|
||||
}
|
||||
if (flag.oneOf(Flag.PROTECT)) {
|
||||
return FlagOptional.of((Flag) flag, ProtectMode.INACTIVE);
|
||||
}
|
||||
return FlagOptional.of(flag, (T) flagMap.get(flag));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
for (Flag flag : Flag.getFlags()) {
|
||||
if (flag == Flag.TESTBLOCK) continue;
|
||||
if (flag == Flag.COLOR) continue;
|
||||
if (flag == Flag.CHANGED) continue;
|
||||
flagMap.remove(flag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Flag<?>, Flag.Value<?>> getBackedMap() {
|
||||
return flagMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FixedGlobalFlagStorage{" +
|
||||
"flagMap=" + flagMap +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public final class FixedGlobalRegion implements Region {
|
||||
private static final Point MAX_POINT = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
@Setter
|
||||
private static FlagStorage FLAG_STORAGE;
|
||||
private static RegionData FLAG_STORAGE;
|
||||
|
||||
private static final UUID GLOBAL_REGION_ID = new UUID(0, 0);
|
||||
|
||||
@@ -106,7 +106,7 @@ public final class FixedGlobalRegion implements Region {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull FlagStorage getFlags() {
|
||||
public @NonNull RegionData getRegionData() {
|
||||
return FLAG_STORAGE;
|
||||
}
|
||||
|
||||
@@ -139,9 +139,4 @@ public final class FixedGlobalRegion implements Region {
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return RegionBackups.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionData getRegionData() {
|
||||
return RegionData.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.region.fixed;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionFlagPolicy;
|
||||
import de.steamwar.bausystem.region.flags.ColorMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.ProtectMode;
|
||||
import de.steamwar.bausystem.region.flags.TNTMode;
|
||||
import de.steamwar.core.Core;
|
||||
import lombok.NonNull;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
|
||||
public class FixedGlobalRegionData extends RegionData {
|
||||
|
||||
public FixedGlobalRegionData(YAPIONObject data, Runnable onChange) {
|
||||
super(data, onChange);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
flagMap.put(Flag.TNT, TNTMode.DENY);
|
||||
flagMap.put(Flag.COLOR, ColorMode.YELLOW);
|
||||
flagMap.put(Flag.PROTECT, ProtectMode.INACTIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag) {
|
||||
if (flag.oneOf(Flag.COLOR, Flag.PROTECT)) {
|
||||
return RegionFlagPolicy.READ_ONLY;
|
||||
}
|
||||
if (flag.oneOf(Flag.ITEMS) && Core.getVersion() >= 20) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
if (flag.oneOf(Flag.TNT, Flag.FIRE, Flag.FREEZE)) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
return RegionFlagPolicy.NOT_APPLICABLE;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.TestblockMode;
|
||||
import de.steamwar.bausystem.utils.FlatteningWrapper;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
@@ -50,7 +49,7 @@ public class FixedRegion implements Region {
|
||||
|
||||
private final String name;
|
||||
private final UUID uuid;
|
||||
private final FixedFlagStorage flagStorage;
|
||||
private final FixedRegionData flagStorage;
|
||||
private final Prototype prototype;
|
||||
private final String skin;
|
||||
|
||||
@@ -60,7 +59,6 @@ public class FixedRegion implements Region {
|
||||
private final int floorLevel;
|
||||
private final int waterLevel;
|
||||
private final GameModeConfig<Material, String> gameModeConfig;
|
||||
private final RegionData regionData;
|
||||
private final RegionHistory regionHistory = new RegionHistory.Impl(20);
|
||||
|
||||
private final RegionBackups regionBackups = new RegionBackups() {
|
||||
@@ -141,7 +139,7 @@ public class FixedRegion implements Region {
|
||||
}
|
||||
}
|
||||
|
||||
public FixedRegion(String name, FixedFlagStorage flagStorage, Prototype prototype, YAPIONObject regionConfig, YAPIONObject regionData) {
|
||||
public FixedRegion(String name, FixedRegionData flagStorage, Prototype prototype, YAPIONObject regionConfig, YAPIONObject regionData) {
|
||||
this.name = name;
|
||||
uuid = UUID.nameUUIDFromBytes(name.getBytes(StandardCharsets.UTF_8));
|
||||
this.flagStorage = flagStorage;
|
||||
@@ -343,7 +341,6 @@ public class FixedRegion implements Region {
|
||||
} else {
|
||||
this.gameModeConfig = GameModeConfig.getByFileName(found);
|
||||
}
|
||||
this.regionData = new RegionData.RegionDataImpl(regionData, WorldData::write);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -357,7 +354,7 @@ public class FixedRegion implements Region {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull FlagStorage getFlags() {
|
||||
public @NonNull RegionData getRegionData() {
|
||||
return flagStorage;
|
||||
}
|
||||
|
||||
@@ -390,9 +387,4 @@ public class FixedRegion implements Region {
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return regionBackups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionData getRegionData() {
|
||||
return regionData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.region.fixed;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionFlagPolicy;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.core.Core;
|
||||
import lombok.NonNull;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
|
||||
public class FixedRegionData extends RegionData {
|
||||
|
||||
public FixedRegionData(YAPIONObject data, Runnable onChange) {
|
||||
super(data, onChange);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag) {
|
||||
if (flag.oneOf(Flag.COLOR, Flag.TNT, Flag.FIRE, Flag.FREEZE, Flag.PROTECT, Flag.NO_GRAVITY, Flag.CHANGED)) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
if (flag.oneOf(Flag.ITEMS) && Core.getVersion() >= 20) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
if (flag.oneOf(Flag.TESTBLOCK)) {
|
||||
return RegionFlagPolicy.READ_ONLY;
|
||||
}
|
||||
return RegionFlagPolicy.NOT_APPLICABLE;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.region.fixed;
|
||||
|
||||
import de.steamwar.bausystem.region.FixedRegionSystem;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
@@ -216,7 +217,7 @@ public class Prototype {
|
||||
} else {
|
||||
prototype = PROTOTYPE_MAP.get(regionConfig.getPlainValue("prototype"));
|
||||
}
|
||||
FixedFlagStorage flagStorage = new FixedFlagStorage(regionData.getObjectOrSetDefault("flagStorage", new YAPIONObject()));
|
||||
FixedRegionData flagStorage = new FixedRegionData(regionData, WorldData::write);
|
||||
FixedRegionSystem.addRegion(new FixedRegion(name, flagStorage, prototype, regionConfig, regionData));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.region.fixed.loader;
|
||||
|
||||
import de.steamwar.bausystem.region.fixed.FixedGlobalFlagStorage;
|
||||
import de.steamwar.bausystem.region.fixed.FixedGlobalRegionData;
|
||||
import de.steamwar.bausystem.region.fixed.FixedGlobalRegion;
|
||||
import de.steamwar.bausystem.region.fixed.Prototype;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
@@ -80,6 +80,6 @@ public class RegionLoader {
|
||||
globalOptions = new YAPIONObject();
|
||||
optionsYapionObject.add("global", globalOptions);
|
||||
}
|
||||
FixedGlobalRegion.setFLAG_STORAGE(new FixedGlobalFlagStorage(globalOptions.getObjectOrSetDefault("flagStorage", new YAPIONObject())));
|
||||
FixedGlobalRegion.setFLAG_STORAGE(new FixedGlobalRegionData(globalOptions, WorldData::write));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,12 +148,12 @@ class EventFight(id: EntityID<Int>) : IntEntity(id), Comparable<EventFight> {
|
||||
set(value) = useDb {
|
||||
fightStat = value
|
||||
}
|
||||
val dependents by lazy { useDb { EventRelation.getFightRelations(this@EventFight) } }
|
||||
val dependents by lazy { useDb { EventRelation.getFightRelations(this@EventFight).toList() } }
|
||||
|
||||
val winner: Team?
|
||||
get() = if (ergebnis == 1) Team[teamBlue] else if (ergebnis == 2) Team[teamRed] else null
|
||||
get() = useDb { if (ergebnis == 1) Team[teamBlue] else if (ergebnis == 2) Team[teamRed] else null }
|
||||
val losser: Team?
|
||||
get() = if (ergebnis == 1) Team[teamRed] else if (ergebnis == 2) Team[teamBlue] else null
|
||||
get() = useDb { if (ergebnis == 1) Team[teamRed] else if (ergebnis == 2) Team[teamBlue] else null }
|
||||
|
||||
fun setGroup(group: Int?) = useDb { groupId = group?.let { EntityID(it, EventGroupTable) } }
|
||||
fun hasFinished() = fight != null || ergebnis != 0
|
||||
|
||||
@@ -90,7 +90,7 @@ class EventGroup(id: EntityID<Int>) : IntEntity(id) {
|
||||
set(value) {
|
||||
groupPointsPerDraw = value
|
||||
}
|
||||
val dependents by lazy { EventRelation.getGroupRelations(this) }
|
||||
val dependents by lazy { EventRelation.getGroupRelations(this).toList() }
|
||||
val lastFight by lazy { Optional.ofNullable(fights.maxByOrNull { it.startTime }) }
|
||||
|
||||
fun getId() = id.value
|
||||
|
||||
@@ -117,10 +117,10 @@ class EventRelation(id: EntityID<Int>) : IntEntity(id) {
|
||||
fromPlace = place
|
||||
}
|
||||
|
||||
fun getAdvancingTeam(): Team? = when(fromType) {
|
||||
fun getAdvancingTeam(): Team? = useDb { when(fromType) {
|
||||
FromType.FIGHT -> if (fromPlace == 0) fromFight?.winner else fromFight?.losser
|
||||
FromType.GROUP -> fromGroup?.calculatePoints()?.toList()?.sortedBy { (_, v) -> v }?.reversed()?.elementAt(fromPlace)?.first
|
||||
}
|
||||
} }
|
||||
|
||||
fun apply(): Boolean {
|
||||
val team = getAdvancingTeam() ?: return false
|
||||
|
||||
94
CommonCore/SQL/src/de/steamwar/sql/Leaderboard.kt
Normal file
94
CommonCore/SQL/src/de/steamwar/sql/Leaderboard.kt
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.sql
|
||||
|
||||
import de.steamwar.sql.internal.useDb
|
||||
import org.jetbrains.exposed.v1.core.SortOrder
|
||||
import org.jetbrains.exposed.v1.core.and
|
||||
import org.jetbrains.exposed.v1.core.count
|
||||
import org.jetbrains.exposed.v1.core.dao.id.CompositeID
|
||||
import org.jetbrains.exposed.v1.core.dao.id.CompositeIdTable
|
||||
import org.jetbrains.exposed.v1.core.dao.id.EntityID
|
||||
import org.jetbrains.exposed.v1.core.eq
|
||||
import org.jetbrains.exposed.v1.core.lessSubQuery
|
||||
import org.jetbrains.exposed.v1.dao.CompositeEntity
|
||||
import org.jetbrains.exposed.v1.dao.CompositeEntityClass
|
||||
import org.jetbrains.exposed.v1.dao.flushCache
|
||||
import org.jetbrains.exposed.v1.javatime.CurrentTimestamp
|
||||
import org.jetbrains.exposed.v1.javatime.timestamp
|
||||
import org.jetbrains.exposed.v1.jdbc.select
|
||||
import org.jetbrains.exposed.v1.jdbc.upsert
|
||||
|
||||
object LeaderboardTable : CompositeIdTable("Leaderboard") {
|
||||
val userId = reference("UserId", SteamwarUserTable)
|
||||
val name = varchar("LeaderboardName", 64).entityId()
|
||||
val time = long("Time")
|
||||
val updatedAt = timestamp("UpdatedAt").defaultExpression(CurrentTimestamp)
|
||||
val bestTime = bool("BestTime")
|
||||
|
||||
override val primaryKey = PrimaryKey(userId, name)
|
||||
|
||||
init {
|
||||
addIdColumn(userId)
|
||||
}
|
||||
}
|
||||
|
||||
class Leaderboard(id: EntityID<CompositeID>) : CompositeEntity(id) {
|
||||
companion object : CompositeEntityClass<Leaderboard>(LeaderboardTable) {
|
||||
@JvmStatic
|
||||
fun getLeaderboard(name: String) = useDb {
|
||||
find { LeaderboardTable.name eq name }.orderBy(LeaderboardTable.time to SortOrder.ASC).limit(5).toList()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getPlayerTime(user: SteamwarUser, name: String) = useDb {
|
||||
find { (LeaderboardTable.userId eq user.id.value) and (LeaderboardTable.name eq name) }.firstOrNull()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getPlayerPlacement(user: SteamwarUser, name: String) = useDb {
|
||||
LeaderboardTable.select(LeaderboardTable.time.count())
|
||||
.where {
|
||||
(LeaderboardTable.name eq name) and (LeaderboardTable.time lessSubQuery LeaderboardTable.select(
|
||||
LeaderboardTable.time
|
||||
).where { (LeaderboardTable.userId eq user.id.value) and (LeaderboardTable.name eq name) })
|
||||
}
|
||||
.firstOrNull()?.get(LeaderboardTable.time.count())?.toInt() ?: Int.MAX_VALUE
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun upsert(userId: Int, name: String, time: Long, bestTime: Boolean) = useDb {
|
||||
LeaderboardTable.upsert(
|
||||
onUpdateExclude = listOf(LeaderboardTable.updatedAt, LeaderboardTable.userId, LeaderboardTable.name)
|
||||
) {
|
||||
it[LeaderboardTable.userId] = userId
|
||||
it[LeaderboardTable.name] = name
|
||||
it[LeaderboardTable.time] = time
|
||||
it[LeaderboardTable.bestTime] = bestTime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val user by LeaderboardTable.userId.transform({ EntityID(it, SteamwarUserTable) }, { it.value })
|
||||
val name by LeaderboardTable.name
|
||||
var time by LeaderboardTable.time
|
||||
var updatedAt by LeaderboardTable.updatedAt
|
||||
var bestTime by LeaderboardTable.bestTime
|
||||
}
|
||||
@@ -55,6 +55,17 @@ class NodeMember(id: EntityID<CompositeID>) : CompositeEntity(id) {
|
||||
getNodeMember(node, member) ?: throw IllegalStateException("NodeMember not created")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun createNodeMember(node: Int, member: Int, parent: SchematicNode): NodeMember = useDb {
|
||||
if (!parent.isDir()) throw IllegalStateException("Parent must be a directory")
|
||||
NodeMemberTable.insertIgnore {
|
||||
it[this.node] = EntityID(node, SchematicNodeTable)
|
||||
it[this.userId] = EntityID(member, SteamwarUserTable)
|
||||
it[NodeMemberTable.parentNode] = parent.getId()
|
||||
}
|
||||
getNodeMember(node, member) ?: throw IllegalStateException("NodeMember not created")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun createNodeMember(node: Int, member: SteamwarUser) = createNodeMember(node, member.id.value)
|
||||
|
||||
@@ -81,6 +92,7 @@ class NodeMember(id: EntityID<CompositeID>) : CompositeEntity(id) {
|
||||
var parent by NodeMemberTable.parentNode.transform(
|
||||
{ it.map { EntityID(it, SchematicNodeTable) }.getOrNull() },
|
||||
{ Optional.ofNullable(it?.value) })
|
||||
private set
|
||||
|
||||
fun setParentId(id: Int?) {
|
||||
parent = Optional.ofNullable(id)
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.sql
|
||||
|
||||
import de.steamwar.sql.internal.useDb
|
||||
import org.jetbrains.exposed.v1.core.VarCharColumnType
|
||||
import org.jetbrains.exposed.v1.core.and
|
||||
import org.jetbrains.exposed.v1.core.dao.id.CompositeID
|
||||
import org.jetbrains.exposed.v1.core.dao.id.CompositeIdTable
|
||||
import org.jetbrains.exposed.v1.core.dao.id.EntityID
|
||||
import org.jetbrains.exposed.v1.core.eq
|
||||
import org.jetbrains.exposed.v1.dao.CompositeEntity
|
||||
import org.jetbrains.exposed.v1.dao.CompositeEntityClass
|
||||
|
||||
object PollAnswerTable: CompositeIdTable("PollAnswer") {
|
||||
val userId = reference("UserID", SteamwarUserTable)
|
||||
val question = varchar("Question", 150)
|
||||
val answer = integer("Answer")
|
||||
}
|
||||
|
||||
class PollAnswer(id: EntityID<CompositeID>): CompositeEntity(id) {
|
||||
var userId by PollAnswerTable.userId
|
||||
private set
|
||||
var question by PollAnswerTable.question
|
||||
private set
|
||||
private var answerId by PollAnswerTable.answer
|
||||
var answer: Int
|
||||
get() = answerId
|
||||
set(value) = useDb {
|
||||
answerId = value
|
||||
}
|
||||
|
||||
companion object: CompositeEntityClass<PollAnswer>(PollAnswerTable) {
|
||||
@JvmStatic
|
||||
var currentPoll: String? = null
|
||||
|
||||
@JvmStatic
|
||||
fun get(userId: Int) = useDb {
|
||||
find { (PollAnswerTable.userId eq userId) and (PollAnswerTable.question eq currentPoll!!) }.firstOrNull()
|
||||
?: new {
|
||||
this.userId = EntityID(userId, SteamwarUserTable)
|
||||
this.question = currentPoll!!
|
||||
this.answerId = 0
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getCurrentResults(): Map<Int, Int> = useDb {
|
||||
exec("SELECT Count(UserID) AS Times, Answer FROM PollAnswer WHERE Question = ? GROUP BY Answer ORDER BY Times ASC",
|
||||
args = listOf(VarCharColumnType() to currentPoll!!)) {
|
||||
val result = mutableMapOf<Int, Int>()
|
||||
while (it.next()) {
|
||||
result[it.getInt("Answer")] = it.getInt("Times")
|
||||
}
|
||||
result
|
||||
} ?: emptyMap()
|
||||
}
|
||||
}
|
||||
|
||||
fun hasAnswered() = answerId != 0
|
||||
}
|
||||
@@ -129,8 +129,8 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
|
||||
val userPerm: UserPerm,
|
||||
val multi: Boolean = false
|
||||
) {
|
||||
Ban("BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN", UserPerm.TEAM),
|
||||
Mute("MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE", UserPerm.TEAM),
|
||||
Ban("BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN", UserPerm.PUNISHMENTS),
|
||||
Mute("MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE", UserPerm.PUNISHMENTS),
|
||||
NoSchemReceiving(
|
||||
"NOSCHEMRECEIVING_TEAM",
|
||||
"NOSCHEMRECEIVING_PERMA",
|
||||
@@ -153,7 +153,7 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
|
||||
"NOSCHEMSUBMITTING_UNTIL",
|
||||
"UNNOSCHEMSUBMITTING_ERROR",
|
||||
"UNNOSCHEMSUBMITTING",
|
||||
UserPerm.TEAM
|
||||
UserPerm.CHECK
|
||||
),
|
||||
NoDevServer(
|
||||
"NODEVSERVER_TEAM",
|
||||
@@ -179,7 +179,15 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
|
||||
"UNNOTEAMSERVER",
|
||||
UserPerm.MODERATION
|
||||
),
|
||||
Note("NOTE_TEAM", null, null, null, null, UserPerm.TEAM, true);
|
||||
NoEvent(
|
||||
"NOEVENT_TEAM",
|
||||
"NOEVENT_PERMA",
|
||||
"NOEVENT_UNTIL",
|
||||
"NOEVENT_ERROR",
|
||||
"UNNOEVENT",
|
||||
UserPerm.MODERATION
|
||||
),
|
||||
Note("NOTE_TEAM", null, null, null, null, UserPerm.PUNISHMENTS, true);
|
||||
|
||||
fun isMulti() = multi
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ class SchematicNode(id: EntityID<Int>) : IntEntity(id) {
|
||||
parentNodeId = value?.let { EntityID(it, SchematicNodeTable) }
|
||||
}
|
||||
val parentNode: SchematicNode?
|
||||
get() = parent?.let { findById(it) }
|
||||
get() = useDb { parent?.let { findById(it) } }
|
||||
|
||||
val optionalParent: Optional<Int> get() = Optional.ofNullable(parent)
|
||||
var lastUpdate by SchematicNodeTable.lastUpdate.transform({ it.toInstant() }, { Timestamp.from(it) })
|
||||
|
||||
@@ -33,7 +33,7 @@ object TeamTable : IntIdTable("Team", "TeamID") {
|
||||
val name = varchar("TeamName", 16)
|
||||
val deleted = bool("TeamDeleted").default(false)
|
||||
val address = text("Address").nullable()
|
||||
val port = ushort("Port")
|
||||
val port = ushort("Port").default(25565u)
|
||||
}
|
||||
|
||||
class Team(id: EntityID<Int>) : IntEntity(id) {
|
||||
|
||||
@@ -47,6 +47,7 @@ enum class UserPerm {
|
||||
RESTRICTED_MODS,
|
||||
COLOR_CHAT,
|
||||
TEAM,
|
||||
PUNISHMENTS,
|
||||
TICKET_LOG,
|
||||
BUILD,
|
||||
CHECK,
|
||||
|
||||
@@ -27,9 +27,7 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicReader;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.*;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@@ -120,7 +118,12 @@ public class WorldeditWrapper14 implements WorldeditWrapper {
|
||||
|
||||
@Override
|
||||
public Clipboard loadChar(String charName) throws IOException {
|
||||
return new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(FightSystem.getPlugin().getDataFolder(), "text/" + charName + ".schem"))))).read();
|
||||
File file = new File(FightSystem.getPlugin().getDataFolder(), "text/" + charName + ".schem");
|
||||
Clipboard clipboard;
|
||||
try (ClipboardReader reader = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file))) {
|
||||
clipboard = reader.read();
|
||||
}
|
||||
return clipboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -203,13 +203,23 @@ public class FightSchematic extends StateDependent {
|
||||
for(int i = 0; i < chars.length; i++){
|
||||
Clipboard character;
|
||||
try {
|
||||
character = WorldeditWrapper.impl.loadChar(chars[i] == '/' ? "slash" : String.valueOf(chars[i]));
|
||||
if (Character.isLowerCase(chars[i])) {
|
||||
character = WorldeditWrapper.impl.loadChar("lower/" + chars[i]);
|
||||
} else if (Character.isUpperCase(chars[i])) {
|
||||
character = WorldeditWrapper.impl.loadChar("upper/" + chars[i]);
|
||||
} else {
|
||||
character = WorldeditWrapper.impl.loadChar(chars[i] == '/' ? "slash" : String.valueOf(chars[i]));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Could not display character {} due to missing file!", chars[i]);
|
||||
try {
|
||||
character = WorldeditWrapper.impl.loadChar("");
|
||||
}catch (IOException ex) {
|
||||
throw new SecurityException("Could not load text", ex);
|
||||
character = WorldeditWrapper.impl.loadChar(chars[i] == '/' ? "slash" : String.valueOf(chars[i]));
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Could not display character {} due to missing file!", chars[i]);
|
||||
try {
|
||||
character = WorldeditWrapper.impl.loadChar("");
|
||||
}catch (IOException exc) {
|
||||
throw new SecurityException("Could not load text", exc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,18 @@ tasks.register<FightServer>("WarGear20") {
|
||||
config = "WarGear20.yml"
|
||||
}
|
||||
|
||||
tasks.register<FightServer>("HalloweenWS") {
|
||||
group = "run"
|
||||
description = "Run a Halloween 1.21 Fight Replay Server"
|
||||
dependsOn(":SpigotCore:shadowJar")
|
||||
dependsOn(":FightSystem:shadowJar")
|
||||
template = "HalloweenWS"
|
||||
worldName = "arenas/Lucifus"
|
||||
config = "HalloweenWS.yml"
|
||||
replay = 179786
|
||||
jar = "/jars/paper-1.21.6.jar"
|
||||
}
|
||||
|
||||
tasks.register<FightServer>("WarGear21") {
|
||||
group = "run"
|
||||
description = "Run a WarGear 1.21 Fight Server"
|
||||
|
||||
@@ -22,8 +22,9 @@ package de.steamwar.lobby.boatrace;
|
||||
import de.steamwar.entity.REntity;
|
||||
import de.steamwar.entity.REntityServer;
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.lobby.util.Leaderboard;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import de.steamwar.lobby.util.LeaderboardManager;
|
||||
import de.steamwar.sql.Leaderboard;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
@@ -43,16 +44,18 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
import static de.steamwar.lobby.util.Leaderboard.renderTime;
|
||||
import static de.steamwar.lobby.util.LeaderboardManager.renderTime;
|
||||
|
||||
public class BoatRace implements EventListener, Listener {
|
||||
|
||||
private static final String CONFIG_KEY = "lobby@boatrace";
|
||||
|
||||
private static final double MIN_HEIGHT = 4.3;
|
||||
|
||||
public static final REntityServer boatNpcServer;
|
||||
|
||||
private static boolean oneNotStarted = false;
|
||||
private static final Leaderboard leaderboard;
|
||||
private static final LeaderboardManager leaderboard;
|
||||
|
||||
static {
|
||||
boatNpcServer = new REntityServer();
|
||||
@@ -65,7 +68,7 @@ public class BoatRace implements EventListener, Listener {
|
||||
new BoatRace(player);
|
||||
}
|
||||
});
|
||||
leaderboard = new Leaderboard(boatNpcServer, "lobby@boatrace", BoatRacePositions.LEADERBOARD, 5);
|
||||
leaderboard = new LeaderboardManager(boatNpcServer, CONFIG_KEY, BoatRacePositions.LEADERBOARD);
|
||||
}
|
||||
|
||||
private final Player player;
|
||||
@@ -123,12 +126,11 @@ public class BoatRace implements EventListener, Listener {
|
||||
HandlerList.unregisterAll(this);
|
||||
task.cancel();
|
||||
LobbySystem.getMessage().send("BOAT_RACE_TIME", player, renderTime(time));
|
||||
String conf = UserConfig.getConfig(player.getUniqueId(), "lobby@boatrace");
|
||||
long best = Long.parseLong(conf == null ? String.valueOf(Long.MAX_VALUE) : conf);
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
long best = leaderboard.getPlayerTime(user);
|
||||
if (time < best) {
|
||||
LobbySystem.getMessage().send("BOAT_RACE_NEW_BEST", player);
|
||||
UserConfig.updatePlayerConfig(player.getUniqueId(), "lobby@boatrace", String.valueOf(time));
|
||||
leaderboard.update();
|
||||
leaderboard.updateBestTime(user, time);
|
||||
}
|
||||
} else {
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
||||
|
||||
@@ -22,8 +22,8 @@ package de.steamwar.lobby.jumpandrun;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.lobby.listener.PlayerSpawn;
|
||||
import de.steamwar.lobby.util.Leaderboard;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import de.steamwar.lobby.util.LeaderboardManager;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@@ -45,7 +45,7 @@ import java.util.*;
|
||||
@Linked
|
||||
public class JumpAndRun implements Listener {
|
||||
|
||||
public static final String JUMP_AND_RUN_CONFIG = "jump_and_run";
|
||||
public static final String JUMP_AND_RUN_CONFIG = "jump_and_run@winter25";
|
||||
|
||||
private static final String BAR_EMPTY = "||||||||||||||||||||||||||||||";
|
||||
|
||||
@@ -58,7 +58,7 @@ public class JumpAndRun implements Listener {
|
||||
private static final Map<Player, Long> CLICKED = new HashMap<>();
|
||||
private static final Map<Player, Integer> CLICKED_COUNT = new HashMap<>();
|
||||
|
||||
private static final Leaderboard LEADERBOARD = new Leaderboard(LobbySystem.getEntityServer(false), JUMP_AND_RUN_CONFIG, new Location(Bukkit.getWorlds().get(0), 2338.5, 42.5, 1231.5), 5);
|
||||
private static final LeaderboardManager LEADERBOARD = new LeaderboardManager(LobbySystem.getEntityServer(false), JUMP_AND_RUN_CONFIG, new Location(Bukkit.getWorlds().get(0), 2338.5, 42.5, 1231.5));
|
||||
|
||||
{
|
||||
Bukkit.getScheduler().runTaskTimer(LobbySystem.getInstance(), () -> {
|
||||
@@ -161,18 +161,14 @@ public class JumpAndRun implements Listener {
|
||||
}
|
||||
|
||||
private void updateJumpAndRunTime(Player player, long time) {
|
||||
String jumpAndRunTimeConfig = UserConfig.getConfig(player.getUniqueId(), JUMP_AND_RUN_CONFIG);
|
||||
if (jumpAndRunTimeConfig == null) {
|
||||
UserConfig.updatePlayerConfig(player.getUniqueId(), JUMP_AND_RUN_CONFIG, time + "");
|
||||
} else {
|
||||
long jumpAndRunTime = Long.parseLong(jumpAndRunTimeConfig);
|
||||
if (time < jumpAndRunTime) {
|
||||
long best = LEADERBOARD.getPlayerTime(SteamwarUser.get(player.getUniqueId()));
|
||||
if (time < best) {
|
||||
if (best != Long.MAX_VALUE) {
|
||||
SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", player), Locale.ROOT);
|
||||
String parsed = format.format(new Date(jumpAndRunTime - time));
|
||||
String parsed = format.format(new Date(best - time));
|
||||
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST", player, parsed);
|
||||
UserConfig.updatePlayerConfig(player.getUniqueId(), JUMP_AND_RUN_CONFIG, time + "");
|
||||
LEADERBOARD.update();
|
||||
}
|
||||
LEADERBOARD.updateBestTime(SteamwarUser.get(player.getUniqueId()), time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,9 +97,10 @@ public class Present {
|
||||
folder = null;
|
||||
}
|
||||
}
|
||||
NodeMember nodeMember = NodeMember.createNodeMember(schematicId, user.getId());
|
||||
if (folder != null) {
|
||||
nodeMember.setParent(Optional.of(folder.getId()));
|
||||
NodeMember.createNodeMember(schematicId, user.getId(), folder);
|
||||
} else {
|
||||
NodeMember.createNodeMember(schematicId, user.getId());
|
||||
}
|
||||
LobbySystem.getMessage().send("ADVENT_CALENDAR_OPEN", player, node.getName());
|
||||
player.playSound(location, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
||||
|
||||
@@ -23,9 +23,8 @@ import de.steamwar.entity.RArmorStand;
|
||||
import de.steamwar.entity.REntity;
|
||||
import de.steamwar.entity.REntityServer;
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.sql.Leaderboard;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -39,25 +38,18 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Leaderboard implements Listener {
|
||||
|
||||
private static final Statement LEADERBOARD = new Statement("SELECT User, CAST(Value as integer) AS Time from UserConfig WHERE Config = ? ORDER BY CAST(Value as integer) ASC LIMIT ?");
|
||||
private static final Statement PLAYER_TIME = new Statement("SELECT CAST(Value as integer) AS Time FROM UserConfig WHERE Config = ? AND User = ?");
|
||||
private static final Statement PLAYER_PLACEMENT = new Statement("SELECT COUNT(*) AS Placement FROM UserConfig WHERE Config = ? AND CAST(Value as integer) < (SELECT CAST(Value as integer) AS Time FROM UserConfig WHERE Config = ? AND User = ?)");
|
||||
|
||||
public class LeaderboardManager implements Listener {
|
||||
private final REntityServer server;
|
||||
private final String configKey;
|
||||
private final Location location;
|
||||
private final int best;
|
||||
private long bestTime;
|
||||
private final List<REntity> entities = new ArrayList<>();
|
||||
private final Map<Integer, REntityServer> playerPlacements = new HashMap<>();
|
||||
|
||||
public Leaderboard(REntityServer server, String configKey, Location location, int best) {
|
||||
public LeaderboardManager(REntityServer server, String configKey, Location location) {
|
||||
this.server = server;
|
||||
this.configKey = configKey;
|
||||
this.location = location;
|
||||
this.best = best;
|
||||
Bukkit.getPluginManager().registerEvents(this, LobbySystem.getInstance());
|
||||
update();
|
||||
}
|
||||
@@ -65,20 +57,23 @@ public class Leaderboard implements Listener {
|
||||
public void update() {
|
||||
entities.forEach(REntity::die);
|
||||
entities.clear();
|
||||
List<LeaderboardEntry> leaderboard = getLeaderboard();
|
||||
if (leaderboard.isEmpty()) return;
|
||||
bestTime = leaderboard.get(0).time;
|
||||
List<Leaderboard> leaderboard = getLeaderboard();
|
||||
if (leaderboard.isEmpty()) {
|
||||
bestTime = Long.MAX_VALUE;
|
||||
return;
|
||||
}
|
||||
bestTime = leaderboard.get(0).getTime();
|
||||
for (int i = 0; i < leaderboard.size(); i++) {
|
||||
LeaderboardEntry entry = leaderboard.get(i);
|
||||
Leaderboard entry = leaderboard.get(i);
|
||||
RArmorStand entity = new RArmorStand(server, location.clone().add(0, (leaderboard.size() - i - 1) * 0.32, 0), RArmorStand.Size.MARKER);
|
||||
SteamwarUser user = SteamwarUser.byId(entry.user);
|
||||
SteamwarUser user = SteamwarUser.byId(entry.getUser());
|
||||
String color = "§7";
|
||||
if (i == 0) {
|
||||
color = "§6§l";
|
||||
} else if (i < 3) {
|
||||
color = "§e";
|
||||
}
|
||||
entity.setDisplayName(calcName(user, color, i + 1, entry.time));
|
||||
entity.setDisplayName(calcName(user, color, i + 1, entry.getTime()));
|
||||
entity.setInvisible(true);
|
||||
entities.add(entity);
|
||||
}
|
||||
@@ -135,32 +130,27 @@ public class Leaderboard implements Listener {
|
||||
return st.toString();
|
||||
}
|
||||
|
||||
private List<LeaderboardEntry> getLeaderboard() {
|
||||
return LEADERBOARD.select(resultSet -> {
|
||||
List<LeaderboardEntry> leaderboard = new ArrayList<>();
|
||||
while (resultSet.next()) {
|
||||
leaderboard.add(new LeaderboardEntry(resultSet.getInt("User"), resultSet.getLong("Time")));
|
||||
}
|
||||
return leaderboard;
|
||||
}, configKey, best);
|
||||
private boolean isNewBestTime(long time) {
|
||||
return time < bestTime;
|
||||
}
|
||||
|
||||
private long getPlayerTime(SteamwarUser user) {
|
||||
return PLAYER_TIME.select(resultSet -> {
|
||||
if (!resultSet.next()) {
|
||||
return Long.MAX_VALUE;
|
||||
}
|
||||
return resultSet.getLong("Time");
|
||||
}, configKey, user.getId());
|
||||
public void updateBestTime(SteamwarUser user, long time) {
|
||||
Leaderboard.upsert(user.getId(), configKey, time, isNewBestTime(time));
|
||||
update();
|
||||
}
|
||||
|
||||
private List<Leaderboard> getLeaderboard() {
|
||||
return Leaderboard.getLeaderboard(configKey);
|
||||
}
|
||||
|
||||
public long getPlayerTime(SteamwarUser user) {
|
||||
Leaderboard lb = Leaderboard.getPlayerTime(user, configKey);
|
||||
if(lb != null) return lb.getTime();
|
||||
return Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
private int getPlayerPlacement(SteamwarUser user) {
|
||||
return PLAYER_PLACEMENT.select(resultSet -> {
|
||||
if (!resultSet.next()) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return resultSet.getInt("Placement");
|
||||
}, configKey, configKey, user.getId());
|
||||
return Leaderboard.getPlayerPlacement(user, configKey);
|
||||
}
|
||||
|
||||
public static String renderTime(long time) {
|
||||
@@ -178,13 +168,6 @@ public class Leaderboard implements Listener {
|
||||
time % 1000);
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
private class LeaderboardEntry {
|
||||
|
||||
private final int user;
|
||||
private final long time;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
SteamwarUser steamwarUser = SteamwarUser.get(event.getPlayer().getUniqueId());
|
||||
@@ -300,10 +300,10 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
|
||||
return head;
|
||||
}
|
||||
|
||||
private static final Class<?> entityPose = Reflection.getClass("net.minecraft.world.entity.Pose");
|
||||
private static final Object standing = entityPose.getEnumConstants()[0];
|
||||
private static final Object swimming = entityPose.getEnumConstants()[3];
|
||||
private static final Object sneaking = entityPose.getEnumConstants()[5];
|
||||
protected static final Class<?> entityPose = Reflection.getClass("net.minecraft.world.entity.Pose");
|
||||
protected static final Object standing = entityPose.getEnumConstants()[0];
|
||||
protected static final Object swimming = entityPose.getEnumConstants()[3];
|
||||
protected static final Object sneaking = entityPose.getEnumConstants()[5];
|
||||
@Override
|
||||
public Object getPose(FlatteningWrapper.EntityPose pose) {
|
||||
switch (pose) {
|
||||
|
||||
@@ -37,6 +37,7 @@ dependencies {
|
||||
|
||||
compileOnly(libs.paperapi21)
|
||||
compileOnly(libs.nms21)
|
||||
compileOnly(libs.authlib2)
|
||||
compileOnly(libs.datafixer)
|
||||
compileOnly(libs.netty)
|
||||
compileOnly(libs.authlib)
|
||||
|
||||
@@ -43,4 +43,11 @@ public class FlatteningWrapper21 extends FlatteningWrapper14 implements Flatteni
|
||||
});
|
||||
return head;
|
||||
}
|
||||
|
||||
protected static final Object shooting = entityPose.getEnumConstants()[16];
|
||||
@Override
|
||||
public Object getPose(FlatteningWrapper.EntityPose pose) {
|
||||
if (pose == FlatteningWrapper.EntityPose.SHOOTING) return shooting;
|
||||
return super.getPose(pose);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,46 +21,31 @@ package de.steamwar.core;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import de.steamwar.Reflection;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import org.bukkit.GameMode;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
public class ProtocolWrapper21 implements ProtocolWrapper {
|
||||
|
||||
private static final Reflection.Field<List> equipmentStack = Reflection.getField(equipmentPacket, List.class, 0);
|
||||
@Override
|
||||
public void setEquipmentPacketStack(Object packet, Object slot, Object stack) {
|
||||
equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack)));
|
||||
ClientboundSetEquipmentPacket setEquipmentPacket = (ClientboundSetEquipmentPacket) packet;
|
||||
setEquipmentPacket.getSlots().add(Pair.of((EquipmentSlot) slot, (ItemStack) stack));
|
||||
}
|
||||
|
||||
private static final Reflection.Constructor removePacketConstructor = Reflection.getConstructor(ClientboundPlayerInfoRemovePacket.class, List.class);
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Object playerInfoPacketConstructor(PlayerInfoAction action, GameProfile profile, GameMode mode) {
|
||||
if(action == PlayerInfoAction.REMOVE)
|
||||
return removePacketConstructor.invoke(Collections.singletonList(profile.getId()));
|
||||
return switch (action) {
|
||||
case ADD -> new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE), new ClientboundPlayerInfoUpdatePacket.Entry(
|
||||
profile.getId(), profile, true, 0, GameType.byId(mode.getValue()), null, true, 0, null
|
||||
));
|
||||
case GAMEMODE -> new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE), new ClientboundPlayerInfoUpdatePacket.Entry(
|
||||
profile.getId(), profile, true, 0, GameType.byId(mode.getValue()), null, true, 0, null
|
||||
));
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
return new ClientboundPlayerInfoRemovePacket(Collections.singletonList(profile.getId()));
|
||||
|
||||
@Override
|
||||
public void initTPSWarp(LongSupplier longSupplier) {
|
||||
Util.timeSource = () -> System.nanoTime() + longSupplier.getAsLong();
|
||||
return new ClientboundPlayerInfoUpdatePacket(action == PlayerInfoAction.ADD ?
|
||||
EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE) : EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE),
|
||||
Collections.singletonList(new ClientboundPlayerInfoUpdatePacket.Entry(profile.getId(), profile, false, 0, GameType.byId(mode.getValue()), null, false, 0, null)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@@ -40,4 +41,9 @@ public class TrickyTrialsWrapper21 implements TrickyTrialsWrapper {
|
||||
public Material getTurtleScute() {
|
||||
return Material.TURTLE_SCUTE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(Property property) {
|
||||
return property.value();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReaderV2;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
@@ -37,7 +36,11 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.enginehub.linbus.stream.LinBinaryIO;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WorldEditWrapper21 implements WorldEditWrapper {
|
||||
|
||||
@@ -68,12 +71,58 @@ public class WorldEditWrapper21 implements WorldEditWrapper {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public Clipboard getClipboard(InputStream is, NodeData.SchematicFormat schemFormat) throws IOException {
|
||||
return switch (schemFormat) {
|
||||
case MCEDIT -> new MCEditSchematicReader(new NBTInputStream(is)).read();
|
||||
case SPONGE_V2 -> new SpongeSchematicV2Reader(LinBinaryIO.read(new DataInputStream(is))).read();
|
||||
case SPONGE_V3 -> new SpongeSchematicV3Reader(LinBinaryIO.read(new DataInputStream(is))).read();
|
||||
};
|
||||
public Clipboard getClipboard(InputStream is, NodeData.SchematicFormat ignored) throws IOException {
|
||||
ResetableInputStream ris = new ResetableInputStream(is);
|
||||
for (NodeData.SchematicFormat schemFormat : NodeData.SchematicFormat.values()) {
|
||||
try {
|
||||
Clipboard clipboard = switch (schemFormat) {
|
||||
case MCEDIT -> new MCEditSchematicReader(new NBTInputStream(ris)).read();
|
||||
case SPONGE_V2 -> new SpongeSchematicV2Reader(LinBinaryIO.read(new DataInputStream(ris))).read();
|
||||
case SPONGE_V3 -> new SpongeSchematicV3Reader(LinBinaryIO.read(new DataInputStream(ris))).read();
|
||||
};
|
||||
ris.close();
|
||||
return clipboard;
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
ris.reset();
|
||||
}
|
||||
throw new IOException("No clipboard found");
|
||||
}
|
||||
|
||||
private class ResetableInputStream extends InputStream {
|
||||
|
||||
private InputStream inputStream;
|
||||
private int pointer = 0;
|
||||
private List<Integer> list = new ArrayList<>();
|
||||
|
||||
public ResetableInputStream(InputStream in) {
|
||||
this.inputStream = in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
if (pointer >= list.size()) {
|
||||
int data = inputStream.read();
|
||||
list.add(data);
|
||||
pointer++;
|
||||
return data;
|
||||
}
|
||||
int data = list.get(pointer);
|
||||
pointer++;
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() throws IOException {
|
||||
pointer = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
list.clear();
|
||||
pointer = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.core.authlib;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.GameProfileRepository;
|
||||
import com.mojang.authlib.ProfileLookupCallback;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.Services;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class SteamwarGameProfileRepository21 extends SteamwarGameProfileRepository {
|
||||
private static final GameProfileRepository fallback;
|
||||
private static final Reflection.Field<Services> field;
|
||||
private static final Services current;
|
||||
|
||||
static {
|
||||
Class<?> clazz = MinecraftServer.getServer().getClass();
|
||||
field = Reflection.getField(clazz, Services.class, 0);
|
||||
current = field.get(MinecraftServer.getServer());
|
||||
fallback = current.profileRepository();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findProfilesByNames(String[] strings, ProfileLookupCallback profileLookupCallback) {
|
||||
List<String> unknownNames = new ArrayList<>();
|
||||
for (String name:strings) {
|
||||
SteamwarUser user = SteamwarUser.get(name);
|
||||
if(user == null) {
|
||||
unknownNames.add(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
profileLookupCallback.onProfileLookupSucceeded(new GameProfile(user.getUUID(), user.getUserName()));
|
||||
}
|
||||
if(!unknownNames.isEmpty()) {
|
||||
fallback.findProfilesByNames(unknownNames.toArray(new String[0]), profileLookupCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<GameProfile> findProfileByName(String s) {
|
||||
return fallback.findProfileByName(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inject() {
|
||||
Services newServices = new Services(current.sessionService(), current.servicesKeySet(), this, current.profileCache(), current.paperConfigurations());
|
||||
field.set(MinecraftServer.getServer(), newServices);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,9 @@
|
||||
|
||||
package de.steamwar.entity;
|
||||
|
||||
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.PositionMoveRotation;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
@@ -31,4 +33,21 @@ public class PacketConstructor21 implements PacketConstructor{
|
||||
PositionMoveRotation rot = new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, pitch, yaw);
|
||||
return new ClientboundTeleportEntityPacket(entityId, rot, Collections.emptySet(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createRPlayerSpawn(RPlayer player) {
|
||||
return new ClientboundAddEntityPacket(
|
||||
player.entityId,
|
||||
player.uuid,
|
||||
player.x,
|
||||
player.y,
|
||||
player.z,
|
||||
player.yaw,
|
||||
player.pitch,
|
||||
EntityType.PLAYER,
|
||||
0,
|
||||
Vec3.ZERO,
|
||||
player.headYaw
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,8 @@ public class ChunkHider21 implements ChunkHider {
|
||||
int value = ProtocolUtils.readVarInt(section.getIn());
|
||||
ProtocolUtils.writeVarInt(section.getOut(), !section.isSkipSection() && section.getObfuscate().contains(value) ? section.getTarget() : value);
|
||||
return;
|
||||
} else {
|
||||
} else if (section.getBitsPerBlock() < 9) {
|
||||
// Indirect (paletted) storage – only present when bitsPerBlock < 9 in 1.21+
|
||||
section.processPalette();
|
||||
}
|
||||
|
||||
@@ -152,6 +153,9 @@ public class ChunkHider21 implements ChunkHider {
|
||||
} else if(section.getBitsPerBlock() < 6) {
|
||||
section.skipPalette();
|
||||
section.skipNewDataArray(64);
|
||||
} else {
|
||||
// Direct (global) biome IDs – no palette present
|
||||
section.skipNewDataArray(64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@@ -40,4 +41,9 @@ public class TrickyTrialsWrapper8 implements TrickyTrialsWrapper {
|
||||
public Material getTurtleScute() {
|
||||
return Material.STONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(Property property) {
|
||||
return property.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.core.authlib;
|
||||
|
||||
import com.mojang.authlib.Agent;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.GameProfileRepository;
|
||||
import com.mojang.authlib.ProfileLookupCallback;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SteamwarGameProfileRepository8 extends SteamwarGameProfileRepository {
|
||||
|
||||
private static final GameProfileRepository fallback;
|
||||
|
||||
private static final Object minecraftServer;
|
||||
private static final Reflection.Field<?> gameProfile;
|
||||
|
||||
static {
|
||||
Class<?> minecraftServerClass = Reflection.getClass("net.minecraft.server.MinecraftServer");
|
||||
Class<?> gpr = Reflection.getClass("com.mojang.authlib.GameProfileRepository");
|
||||
gameProfile = Reflection.getField(minecraftServerClass, gpr, 0);
|
||||
minecraftServer = Reflection.getTypedMethod(minecraftServerClass, "getServer", minecraftServerClass).invoke(null);
|
||||
fallback = (GameProfileRepository) gameProfile.get(minecraftServer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inject() {
|
||||
gameProfile.set(minecraftServer, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findProfilesByNames(String[] strings, Agent agent, ProfileLookupCallback profileLookupCallback) {
|
||||
if(agent == Agent.SCROLLS) {
|
||||
fallback.findProfilesByNames(strings, agent, profileLookupCallback);
|
||||
} else {
|
||||
List<String> unknownNames = new ArrayList<>();
|
||||
for (String name:strings) {
|
||||
SteamwarUser user = SteamwarUser.get(name);
|
||||
if(user == null) {
|
||||
unknownNames.add(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
profileLookupCallback.onProfileLookupSucceeded(new GameProfile(user.getUUID(), user.getUserName()));
|
||||
}
|
||||
if(!unknownNames.isEmpty()) {
|
||||
fallback.findProfilesByNames(unknownNames.toArray(new String[0]), agent, profileLookupCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user