9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-28 11:29:17 +00:00

improve api

This commit is contained in:
XiaoMoMi
2025-03-31 05:27:52 +08:00
parent 40c4065859
commit 70d853f671
9 changed files with 20 additions and 9 deletions

View File

@@ -64,7 +64,7 @@ public class CustomBlockAttemptPlaceEvent extends PlayerEvent implements Cancell
@NotNull
public Location location() {
return this.location;
return this.location.clone();
}
@NotNull

View File

@@ -56,7 +56,7 @@ public class CustomBlockBreakEvent extends PlayerEvent implements Cancellable {
@NotNull
public Location location() {
return this.location;
return this.location.clone();
}
@NotNull

View File

@@ -81,7 +81,7 @@ public class CustomBlockInteractEvent extends PlayerEvent implements Cancellable
@NotNull
public Location location() {
return this.location;
return this.location.clone();
}
@NotNull

View File

@@ -50,7 +50,7 @@ public class CustomBlockPlaceEvent extends PlayerEvent implements Cancellable {
@NotNull
public Location location() {
return this.location;
return this.location.clone();
}
@NotNull

View File

@@ -65,7 +65,7 @@ public class FurnitureAttemptPlaceEvent extends PlayerEvent implements Cancellab
@NotNull
public Location location() {
return location;
return location.clone();
}
@NotNull

View File

@@ -1,6 +1,7 @@
package net.momirealms.craftengine.bukkit.api.event;
import net.momirealms.craftengine.bukkit.entity.furniture.LoadedFurniture;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@@ -28,6 +29,11 @@ public class FurnitureBreakEvent extends PlayerEvent implements Cancellable {
return this.furniture;
}
@NotNull
public Location location() {
return this.furniture.location();
}
@NotNull
public static HandlerList getHandlerList() {
return HANDLER_LIST;

View File

@@ -28,7 +28,7 @@ public class FurnitureInteractEvent extends PlayerEvent implements Cancellable {
@NotNull
public Location interactionPoint() {
return interactionPoint;
return this.interactionPoint.clone();
}
@NotNull
@@ -46,6 +46,11 @@ public class FurnitureInteractEvent extends PlayerEvent implements Cancellable {
return this.furniture;
}
@NotNull
public Location location() {
return this.furniture.location();
}
@NotNull
public static HandlerList getHandlerList() {
return HANDLER_LIST;

View File

@@ -38,7 +38,7 @@ public class FurniturePlaceEvent extends PlayerEvent implements Cancellable {
@NotNull
public Location location() {
return this.location;
return this.location.clone();
}
@NotNull

View File

@@ -27,7 +27,7 @@ public class LoadedFurniture {
private final CustomFurniture furniture;
private final AnchorType anchorType;
// location
private Location location;
private final Location location;
// base entity
private final WeakReference<Entity> baseEntity;
private final int baseEntityId;
@@ -86,7 +86,7 @@ public class LoadedFurniture {
@NotNull
public Location location() {
return this.location;
return this.location.clone();
}
@NotNull