9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-19 15:09:27 +00:00

Update to Paper 1.21.4 (post hard fork™️ edition)

This commit is contained in:
MrPowerGamerBR
2025-01-14 00:52:12 -03:00
parent 3e8eff82ea
commit 8e7b51f5d7
98 changed files with 3947 additions and 5536 deletions

View File

@@ -0,0 +1,44 @@
--- a/paper-api/build.gradle.kts
+++ b/paper-api/build.gradle.kts
@@ -103,6 +_,18 @@
main {
java {
srcDir(generatedApiPath)
+ srcDir(file("../paper-api/src/main/java"))
+ }
+ resources {
+ srcDir(file("../paper-api/src/main/resources"))
+ }
+ }
+ test {
+ java {
+ srcDir(file("../paper-api/src/test/java"))
+ }
+ resources {
+ srcDir(file("../paper-api/src/test/resources"))
}
}
}
@@ -169,7 +_,7 @@
tasks.withType<Javadoc> {
val options = options as StandardJavadocDocletOptions
- options.overview = "src/main/javadoc/overview.html"
+ options.overview = "../paper-api/src/main/javadoc/overview.html"
options.use()
options.isDocFilesSubDirs = true
options.links(
@@ -202,11 +_,11 @@
}
// workaround for https://github.com/gradle/gradle/issues/4046
- inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset")
+ inputs.dir("../paper-api/src/main/javadoc").withPropertyName("javadoc-sourceset")
val fsOps = services.fileSystemOperations
doLast {
fsOps.copy {
- from("src/main/javadoc") {
+ from("../paper-api/src/main/javadoc") {
include("**/doc-files/**")
}
into("build/docs/javadoc")

View File

@@ -0,0 +1,61 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrPowerGamerBR <git@mrpowergamerbr.com>
Date: Wed, 12 Jun 2024 11:53:27 -0300
Subject: [PATCH] SPARKLYPOWER Add custom blocks
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
index 679f78e07a3a2de745fa237165d0a8db5e086f29..a083aac89cbe397545f34f0e9312fc8fb66dec85 100644
--- a/src/main/java/com/destroystokyo/paper/MaterialTags.java
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
@@ -83,6 +83,7 @@ public class MaterialTags {
*/
public static final MaterialSetTag CONCRETES = new MaterialSetTag(keyFor("concretes"))
.endsWith("_CONCRETE")
+ .notStartsWith("SPARKLYPOWER_") // SparklyPaper - custom blocks
.ensureSize("CONCRETES", 16).lock();
/**
@@ -161,6 +162,7 @@ public class MaterialTags {
.endsWith("TERRACOTTA")
.not(Material.TERRACOTTA)
.notEndsWith("GLAZED_TERRACOTTA")
+ .notStartsWith("SPARKLYPOWER_") // SparklyPaper - custom blocks
.ensureSize("STAINED_TERRACOTTA", 16).lock();
/**
@@ -168,6 +170,7 @@ public class MaterialTags {
*/
public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta"))
.endsWith("TERRACOTTA")
+ .notStartsWith("SPARKLYPOWER_") // SparklyPaper - custom blocks
.ensureSize("TERRACOTTA", 33).lock();
/**
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 9afafc00e457c721a1b20b05c6a5d330caa40dfb..34049b57f5e481e3e8a3eb22cc73dcfda39c6116 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -3814,6 +3814,22 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
POTTED_FLOWERING_AZALEA_BUSH(10609),
POTTED_OPEN_EYEBLOSSOM(24999),
POTTED_CLOSED_EYEBLOSSOM(16694),
+ // SparklyPaper start - SparklyPower Survival custom blocks
+ // The IDs themselves doesn't have any correlation with anything, Spigot invented that for backwards compatibility
+ SPARKLYPOWER_RAINBOW_WOOL(13003),
+ SPARKLYPOWER_RAINBOW_CONCRETE(13004),
+ SPARKLYPOWER_RAINBOW_TERRACOTTA(13005),
+ SPARKLYPOWER_ASPHALT_SERVER(13006),
+ /**
+ * BlockData: {@link Slab}
+ */
+ SPARKLYPOWER_ASPHALT_SERVER_SLAB(13007, Slab.class),
+ SPARKLYPOWER_ASPHALT_PLAYER(13008),
+ /**
+ * BlockData: {@link Slab}
+ */
+ SPARKLYPOWER_ASPHALT_PLAYER_SLAB(13009, Slab.class),
+ // SparklyPaper end
// ----- Legacy Separator -----
@Deprecated(since = "1.13")
LEGACY_AIR(0, 0),

View File

@@ -0,0 +1,11 @@
--- a/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java
+++ b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java
@@ -27,7 +_,7 @@
*
* @return the frame type
*/
- Frame frame();
+ Frame frame(); // patch
/**
* Gets the advancement title.

View File

@@ -0,0 +1,2 @@
public class ForkFile {
}

View File

@@ -0,0 +1,82 @@
package net.sparklypower.sparklypaper.event.entity;
import org.bukkit.entity.HumanEntity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Called when a entity releases a bow, before the projectile is spawned
* <p>
* Compared to EntityShootBowEvent, this event is called before the projectile is spawned, before the force check is done, and before the bow release sound is played.
* <p>
* Currently this event is only called for players! To be more specific, it is only called for HumanEntity!!
*/
public class PreEntityShootBowEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final ItemStack bow;
private final EquipmentSlot hand;
private final float force;
private boolean cancelled;
public PreEntityShootBowEvent(@NotNull final HumanEntity shooter, @Nullable final ItemStack bow, @NotNull final EquipmentSlot hand, final float force) {
super(shooter);
this.bow = bow;
this.hand = hand;
this.force = force;
}
/**
* Gets the bow ItemStack used to fire the arrow.
*
* @return the bow involved in this event
*/
@Nullable
public ItemStack getBow() {
return bow;
}
/**
* Get the hand from which the bow was shot.
*
* @return the hand
*/
@NotNull
public EquipmentSlot getHand() {
return hand;
}
/**
* Gets the force the arrow was launched with
*
* @return bow shooting force, up to 1.0
*/
public float getForce() {
return force;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -0,0 +1,70 @@
package net.sparklypower.sparklypaper.event.inventory;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Called when the recipe of an Item is completed inside a crafting matrix.
*
* This is an alternate version of [org.bukkit.event.inventory.CraftItemEvent], where this one is called for player crafting items and crafters.
*/
public class CraftItemRecipeEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Recipe recipe;
private final ItemStack @Nullable [] matrix;
private ItemStack result;
private boolean isCancelled = false;
public CraftItemRecipeEvent(@NotNull ItemStack @Nullable [] matrix, @NotNull Recipe recipe, @Nullable ItemStack result) {
this.matrix = matrix;
this.recipe = recipe;
this.result = result;
}
public void setResult(@Nullable ItemStack result) {
this.result = result;
}
@Nullable
public ItemStack getResult() {
return result;
}
/**
* @return A copy of the current recipe on the crafting matrix.
*/
@NotNull
public Recipe getRecipe() {
return recipe;
}
public @Nullable ItemStack[] getCraftingMatrix() {
return matrix;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancel) {
this.isCancelled = cancel;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -0,0 +1,129 @@
package net.sparklypower.sparklypaper.event.player;
import com.google.common.base.Preconditions;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;
/**
* Raised when a player moves a controllable vehicle. Controllable vehicles are vehicles that the client can control, such as boats, horses, striders, pigs, etc.
* <p>
* Minecarts are NOT affected by this event!
*/
public class PlayerMoveControllableVehicleEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false;
private final Vehicle vehicle;
private Location from;
private Location to;
public PlayerMoveControllableVehicleEvent(@NotNull final Player player, @NotNull final Vehicle vehicle, @NotNull final Location from, @NotNull final Location to) {
super(player);
this.vehicle = vehicle;
this.from = from;
this.to = to;
}
/**
* Get the previous position.
*
* @return Old position.
*/
@NotNull
public Location getFrom() {
return from.clone(); // Paper - clone to avoid changes
}
/**
* Sets the location to mark as where the player moved from
*
* @param from New location to mark as the players previous location
*/
public void setFrom(@NotNull Location from) {
validateLocation(from, this.from);
this.from = from;
}
/**
* Get the next position.
*
* @return New position.
*/
@NotNull
public Location getTo() {
return to.clone(); // Paper - clone to avoid changes
}
/**
* Sets the location that this player will move to
*
* @param to New Location this player will move to
*/
public void setTo(@NotNull Location to) {
validateLocation(to, this.to);
this.to = to;
}
/**
* Get the vehicle.
*
* @return the vehicle
*/
@NotNull
public final Entity getVehicle() {
return vehicle;
}
/**
* Gets the cancellation state of this event. A cancelled event will not
* be executed in the server, but will still pass to other plugins
* <p>
* If a move or teleport event is cancelled, the vehicle and player will be moved or
* teleported back to the Location as defined by getFrom(). This will not
* fire an event
*
* @return true if this event is cancelled
*/
@Override
public boolean isCancelled() {
return cancel;
}
/**
* Sets the cancellation state of this event. A cancelled event will not
* be executed in the server, but will still pass to other plugins
* <p>
* If a move or teleport event is cancelled, the vehicle and player will be moved or
* teleported back to the Location as defined by getFrom(). This will not
* fire an event
*
* @param cancel true if you wish to cancel this event
*/
@Override
public void setCancelled(boolean cancel) {
this.cancel = cancel;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
private void validateLocation(@NotNull Location loc, @NotNull Location originalLoc) {
Preconditions.checkArgument(loc != null, "Cannot use null location!");
Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!");
Preconditions.checkArgument(loc.getWorld() != originalLoc, "New location should be in the original world!");
}
}

View File

@@ -0,0 +1,167 @@
package net.sparklypower.sparklypaper.event.player;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Called after the server attempts to move the player, but before the PlayerMoveEvent is called.
* <p>
* In contrast to PlayerMoveEvent, this event happens on every movement instead of being throttled like PlayerMoveEvent,
* and this event exposes the player's onGround/horizontalCollision status, allowing plugins to manipulate it.
*/
public class PlayerPreMoveEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final Location from;
private final Location to;
private boolean onGround;
private boolean horizontalCollision;
private boolean resetFallDistance;
public PlayerPreMoveEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, boolean onGround, boolean horizontalCollision, boolean resetFallDistance) {
super(player);
this.from = from;
this.to = to;
this.onGround = onGround;
this.horizontalCollision = horizontalCollision;
this.resetFallDistance = resetFallDistance;
}
/**
* Gets the location this player moved from
*
* @return Location the player moved from
*/
@NotNull
public Location getFrom() {
return from;
}
/**
* Gets the location this player moved to
*
* @return Location the player moved to
*/
@NotNull // Paper
public Location getTo() {
return to;
}
// Paper start - PlayerMoveEvent improvements
/**
* Check if the player has changed position (even within the same block) in the event
*
* @return whether the player has changed position or not
*/
public boolean hasChangedPosition() {
return hasExplicitlyChangedPosition() || !from.getWorld().equals(to.getWorld());
}
/**
* Check if the player has changed position (even within the same block) in the event, disregarding a possible world change
*
* @return whether the player has changed position or not
*/
public boolean hasExplicitlyChangedPosition() {
return from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ();
}
/**
* Check if the player has moved to a new block in the event
*
* @return whether the player has moved to a new block or not
*/
public boolean hasChangedBlock() {
return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld());
}
/**
* Check if the player has moved to a new block in the event, disregarding a possible world change
*
* @return whether the player has moved to a new block or not
*/
public boolean hasExplicitlyChangedBlock() {
return from.getBlockX() != to.getBlockX() || from.getBlockY() != to.getBlockY() || from.getBlockZ() != to.getBlockZ();
}
/**
* Check if the player has changed orientation in the event
*
* @return whether the player has changed orientation or not
*/
public boolean hasChangedOrientation() {
return from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw();
}
// Paper end
/**
* Gets if the client said that they are on ground, keep in mind that this value is controlled by the client, so it can
* be spoofed by malicious clients or be out of sync.
*
* @return if the client said that the is on ground
*/
public boolean isOnGround() {
return onGround;
}
/**
* Sets if the player should be on ground.
*
* @param onGround true if the player should be on ground
*/
public void setOnGround(boolean onGround) {
this.onGround = onGround;
}
/**
* Gets if the client said that they are horizontally colliding, keep in mind that this value is controlled by the client, so it can
* be spoofed by malicious clients or be out of sync.
*
* @return if the player is horizontally colliding on a block
*/
public boolean isHorizontalCollision() {
return horizontalCollision;
}
/**
* Sets if the player should be horizontally colliding on a block.
*
* @param horizontalCollision true if the player should be colliding horizontally be on ground
*/
public void setHorizontalCollision(boolean horizontalCollision) {
this.horizontalCollision = horizontalCollision;
}
/**
* Gets if the player's fall distance should be reset. By default, the fall distance is reset every time the player moves upwards on the y axis.
*
* @return if the fall distance should be reset
*/
public boolean isResetFallDistance() {
return resetFallDistance;
}
/**
* Sets if the player's fall distance should be reset.
*
* @param resetFallDistance true if the player fall distance should be reset
*/
public void setResetFallDistance(boolean resetFallDistance) {
this.resetFallDistance = resetFallDistance;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}