Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ building can start!
* Powerful navigator which allows for an overview of all worlds. Extra GUIs for:
- **_Not Started_**, **_In Progress_**, **_Almost Finished_** and **_Finished_** maps
- Maps that have been put to the **_Archive_**
- **_Private_** player maps: Each player can create their own map, if a map with their name
doesn't exist
- **_Private_** player maps: Each player can create their own map, if a map with their name
doesn't exist
* **Create worlds with ease**: When creating a world, choose from:
- **_Predefined worlds_** _or_
- **_Custom generators_** provided by 3rd party plugins _or_
Expand Down
6 changes: 1 addition & 5 deletions buildSrc/src/main/kotlin/CommonConfig.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.compile.JavaCompile
Expand All @@ -12,7 +11,6 @@ fun Project.applyCommonConfiguration() {
version = rootProject.version

repositories {
mavenLocal()
mavenCentral()
maven {
name = "Spigot"
Expand All @@ -26,13 +24,11 @@ fun Project.applyCommonConfiguration() {
name = "OSS Sonatype Snapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
}
mavenLocal()
}

plugins.withId("java") {
the<JavaPluginExtension>().apply {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Furnace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Lightable;
import org.bukkit.block.data.MultipleFacing;
Expand All @@ -37,7 +36,6 @@
import org.bukkit.block.data.type.HangingSign;
import org.bukkit.block.data.type.Sign;
import org.bukkit.block.data.type.Slab;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -182,17 +180,20 @@ public void setBlock(BlockPlaceEvent event, String key) {

@EventHandler
public void onInvisibleItemFramePlacement(HangingPlaceEvent event) {
if (event.getEntity().getType() != EntityType.ITEM_FRAME) {
if (!(event.getEntity() instanceof ItemFrame itemFrame)) {
return;
}

ItemStack itemStack = event.getItemStack();
if (itemStack == null) {
return;
}

ItemMeta itemMeta = itemStack.getItemMeta();
if (!itemMeta.getPersistentDataContainer().has(this.invisibleFrameKey, PersistentDataType.BYTE)) {
if (itemMeta == null || !itemMeta.getPersistentDataContainer().has(this.invisibleFrameKey, PersistentDataType.BYTE)) {
return;
}

ItemFrame itemFrame = (ItemFrame) event.getEntity();
itemFrame.setVisible(false);
}

Expand All @@ -217,8 +218,7 @@ public void setPlant(PlayerInteractEvent event) {
}
adjacent.setType(material);
MultipleFacing multipleFacing = (MultipleFacing) adjacent.getBlockData();
Arrays.stream(DirectionUtil.BLOCK_SIDES)
.forEach(blockFace -> multipleFacing.setFace(blockFace, blockFace == toPlace));
Arrays.stream(DirectionUtil.BLOCK_SIDES).forEach(blockFace -> multipleFacing.setFace(blockFace, blockFace == toPlace));
adjacent.setBlockData(multipleFacing);
break;
default:
Expand All @@ -230,11 +230,10 @@ public void setPlant(PlayerInteractEvent event) {
@Override
public void modifySlab(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (block == null || !(block.getBlockData() instanceof Slab)) {
if (block == null || !(block.getBlockData() instanceof Slab slab)) {
return;
}

Slab slab = (Slab) block.getBlockData();
if (slab.getType() != Slab.Type.DOUBLE) {
return;
}
Expand Down Expand Up @@ -283,38 +282,30 @@ private void open(Block block) {

@Override
public void rotateBlock(Block block, Player player, BlockFace direction) {
BlockData blockData = block.getBlockData();

if (blockData instanceof Directional) {
Directional directional = (Directional) blockData;
directional.setFacing(direction);
block.setBlockData(directional);
} else if (blockData instanceof Orientable) {
Orientable orientable = (Orientable) blockData;
Axis axis;
switch (direction) {
case UP:
case DOWN:
axis = Axis.Y;
break;
case EAST:
case WEST:
axis = Axis.X;
break;
default:
axis = Axis.Z;
break;
switch (block.getBlockData()) {
case Directional directional -> {
directional.setFacing(direction);
block.setBlockData(directional);
}
case Orientable orientable -> {
Axis axis = switch (direction) {
case UP, DOWN -> Axis.Y;
case EAST, WEST -> Axis.X;
default -> Axis.Z;
};
orientable.setAxis(axis);
block.setBlockData(orientable);
}
case Sign sign -> {
sign.setRotation(direction);
block.setBlockData(sign);
}
case HangingSign hangingSign -> {
hangingSign.setRotation(direction);
block.setBlockData(hangingSign);
}
default -> {
}
orientable.setAxis(axis);
block.setBlockData(orientable);
} else if (blockData instanceof Sign) {
Sign sign = (Sign) blockData;
sign.setRotation(direction);
block.setBlockData(sign);
} else if (blockData instanceof HangingSign) {
HangingSign hangingSign = (HangingSign) blockData;
hangingSign.setRotation(direction);
block.setBlockData(hangingSign);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,24 @@ public static BlockFace getPlayerDirection(Player player) {

yaw %= 360;
int i = (int) ((yaw + 8) / 22.5);
switch (i) {
case 1:
return BlockFace.SOUTH_SOUTH_WEST;
case 2:
return BlockFace.SOUTH_WEST;
case 3:
return BlockFace.WEST_SOUTH_WEST;
case 4:
return BlockFace.WEST;
case 5:
return BlockFace.WEST_NORTH_WEST;
case 6:
return BlockFace.NORTH_WEST;
case 7:
return BlockFace.NORTH_NORTH_WEST;
case 8:
return BlockFace.NORTH;
case 9:
return BlockFace.NORTH_NORTH_EAST;
case 10:
return BlockFace.NORTH_EAST;
case 11:
return BlockFace.EAST_NORTH_EAST;
case 12:
return BlockFace.EAST;
case 13:
return BlockFace.EAST_SOUTH_EAST;
case 14:
return BlockFace.SOUTH_EAST;
case 15:
return BlockFace.SOUTH_SOUTH_EAST;
default:
return BlockFace.SOUTH;
}
return switch (i) {
case 1 -> BlockFace.SOUTH_SOUTH_WEST;
case 2 -> BlockFace.SOUTH_WEST;
case 3 -> BlockFace.WEST_SOUTH_WEST;
case 4 -> BlockFace.WEST;
case 5 -> BlockFace.WEST_NORTH_WEST;
case 6 -> BlockFace.NORTH_WEST;
case 7 -> BlockFace.NORTH_NORTH_WEST;
case 8 -> BlockFace.NORTH;
case 9 -> BlockFace.NORTH_NORTH_EAST;
case 10 -> BlockFace.NORTH_EAST;
case 11 -> BlockFace.EAST_NORTH_EAST;
case 12 -> BlockFace.EAST;
case 13 -> BlockFace.EAST_SOUTH_EAST;
case 14 -> BlockFace.SOUTH_EAST;
case 15 -> BlockFace.SOUTH_SOUTH_EAST;
default -> BlockFace.SOUTH;
};
}

/**
Expand Down Expand Up @@ -100,29 +84,12 @@ public static BlockFace getCardinalDirection(Player player) {
yaw %= 360;

int i = (int) ((yaw + 8) / 22.5);
switch (i) {
case 15:
case 0:
case 1:
case 2:
return BlockFace.NORTH;
case 3:
case 4:
case 5:
case 6:
return BlockFace.EAST;
case 7:
case 8:
case 9:
case 10:
return BlockFace.SOUTH;
case 11:
case 12:
case 13:
case 14:
return BlockFace.WEST;
}
return switch (i) {
case 3, 4, 5, 6 -> BlockFace.EAST;
case 7, 8, 9, 10 -> BlockFace.SOUTH;
case 11, 12, 13, 14 -> BlockFace.WEST;
default -> BlockFace.NORTH;
};

return BlockFace.NORTH;
}
}
2 changes: 1 addition & 1 deletion buildsystem-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tasks {
opt.overview("javadoc/overview.html")
opt.encoding("UTF-8")
opt.charSet("UTF-8")
opt.links("https://docs.oracle.com/javase/8/docs/api/")
opt.links("https://docs.oracle.com/javase/21/docs/api/")
opt.links("https://hub.spigotmc.org/javadocs/spigot/")
opt.links("https://javadoc.io/static/org.jetbrains/annotations/24.1.0/")
opt.isLinkSource = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import de.eintosti.buildsystem.api.world.BuildWorld;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.ApiStatus.Internal;
import org.jetbrains.annotations.NotNull;

/**
Expand All @@ -34,7 +34,7 @@ public class BuildWorldEvent extends Event {

private final BuildWorld buildWorld;

@ApiStatus.Internal
@Internal
public BuildWorldEvent(BuildWorld buildWorld) {
this.buildWorld = buildWorld;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import de.eintosti.buildsystem.api.world.BuildWorld;
import org.bukkit.event.Cancellable;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.ApiStatus.Internal;

/**
* Called when a {@link BuildWorld} is loaded.
Expand All @@ -30,7 +30,7 @@ public class BuildWorldLoadEvent extends BuildWorldEvent implements Cancellable

private boolean cancelled = false;

@ApiStatus.Internal
@Internal
public BuildWorldLoadEvent(BuildWorld buildWorld) {
super(buildWorld);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package de.eintosti.buildsystem.api.event.world;

import de.eintosti.buildsystem.api.world.BuildWorld;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.ApiStatus.Internal;

/**
* Called after a {@link BuildWorld} has loaded.
Expand All @@ -27,7 +27,7 @@
*/
public class BuildWorldPostLoadEvent extends BuildWorldEvent {

@ApiStatus.Internal
@Internal
public BuildWorldPostLoadEvent(BuildWorld buildWorld) {
super(buildWorld);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package de.eintosti.buildsystem.api.event.world;

import de.eintosti.buildsystem.api.world.BuildWorld;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.ApiStatus.Internal;

/**
* Called after a {@link BuildWorld} has unloaded.
Expand All @@ -27,7 +27,7 @@
*/
public class BuildWorldPostUnloadEvent extends BuildWorldEvent {

@ApiStatus.Internal
@Internal
public BuildWorldPostUnloadEvent(BuildWorld buildWorld) {
super(buildWorld);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import de.eintosti.buildsystem.api.world.BuildWorld;
import org.bukkit.event.Cancellable;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.ApiStatus.Internal;

/**
* Called when a {@link BuildWorld} is unloaded.
Expand All @@ -30,7 +30,7 @@ public class BuildWorldUnloadEvent extends BuildWorldEvent implements Cancellabl

private boolean cancelled = false;

@ApiStatus.Internal
@Internal
public BuildWorldUnloadEvent(BuildWorld buildWorld) {
super(buildWorld);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
*/
public enum NavigatorType {
OLD,
NEW;
NEW
}
Loading
Loading