Skip to content

Commit 919d497

Browse files
committed
Merge branch 'api-8' into api-9
2 parents 9f90f08 + a7d1ce8 commit 919d497

File tree

6 files changed

+69
-25
lines changed

6 files changed

+69
-25
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
release:
1111
types: [released]
1212

13+
env:
14+
PROJECT_NAME: spongeapi
15+
1316
jobs:
1417
build:
1518
# Only run on PRs if the source branch is on someone else's repo
@@ -23,6 +26,8 @@ jobs:
2326
# Setup
2427
- name: Check out
2528
uses: actions/checkout@v2
29+
with:
30+
ssh-key: ${{ secrets.SPONGE_JD_DEPLOY_KEY }}
2631
- name: Setup JDK 16
2732
uses: actions/setup-java@v2
2833
with:
@@ -60,13 +65,15 @@ jobs:
6065
- name: Determine status
6166
if: "${{ runner.os == 'Linux' }}"
6267
run: |
63-
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
68+
VERSION=$(./gradlew :properties | awk '/^version:/ { print $2; }')
69+
if [ "$(echo $VERSION | grep '\-SNAPSHOT')" ]; then
6470
echo "STATUS=snapshot" >> $GITHUB_ENV
6571
else
6672
echo "STATUS=release" >> $GITHUB_ENV
6773
fi
68-
- name: Publish with Gradle (snapshot)
69-
if: "${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/heads/api-') }}"
74+
echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV
75+
- name: Publish with Gradle
76+
if: "${{ runner.os == 'Linux' && ((env.STATUS != 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/heads/api-')) || (env.STATUS == 'release' && github.event_name == 'release')) }}"
7077
run: ./gradlew -PforceSign=true publish
7178
env:
7279
ORG_GRADLE_PROJECT_githubPackagesUsername: "${{ github.actor }}"
@@ -79,17 +86,17 @@ jobs:
7986
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SPONGE_MAVEN_OSSRH_PASSWORD }}"
8087
ORG_GRADLE_PROJECT_spongeSigningKey: "${{ secrets.SPONGE_SIGNING_KEY }}"
8188
ORG_GRADLE_PROJECT_spongeSigningPassword: "${{ secrets.SPONGE_SIGNING_PASSWORD }}"
82-
- name: Publish with Gradle (release)
83-
if: "${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'release' }}"
84-
run: ./gradlew publish
85-
env:
86-
ORG_GRADLE_PROJECT_githubPackagesUsername: "${{ github.actor }}"
87-
ORG_GRADLE_PROJECT_githubPackagesPassword: "${{ secrets.GITHUB_TOKEN }}"
88-
ORG_GRADLE_PROJECT_spongeSnapshotRepo: "${{ secrets.SPONGE_MAVEN_SNAPSHOT_REPO_URL }}"
89-
ORG_GRADLE_PROJECT_spongeReleaseRepo: "${{ secrets.SPONGE_MAVEN_RELEASE_REPO_URL }}"
90-
ORG_GRADLE_PROJECT_spongeUsername: "${{ secrets.SPONGE_MAVEN_REPO_USER }}"
91-
ORG_GRADLE_PROJECT_spongePassword: "${{ secrets.SPONGE_MAVEN_REPO_PASSWORD }}"
92-
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SPONGE_MAVEN_OSSRH_USER }}"
93-
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SPONGE_MAVEN_OSSRH_PASSWORD }}"
94-
ORG_GRADLE_PROJECT_spongeSigningKey: "${{ secrets.SPONGE_SIGNING_KEY }}"
95-
ORG_GRADLE_PROJECT_spongeSigningPassword: "${{ secrets.SPONGE_SIGNING_PASSWORD }}"
89+
- name: Publish Javadoc
90+
if: "${{ runner.os == 'Linux' && ((env.STATUS != 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/heads/api-')) || (env.STATUS == 'release' && github.event_name == 'release')) }}"
91+
run: |
92+
git clone [email protected]:SpongePowered/APIJavadocs.git publish-jd -b data -c core.sshCommand="$(git config --local --get core.sshCommand)" -c user.name=Spongie -c user.email="[email protected]"
93+
cd publish-jd
94+
DESTDIR="$PROJECT_NAME/$PROJECT_VERSION"
95+
rm -rf $DESTDIR
96+
mkdir -p $DESTDIR
97+
cp -R ../build/docs/javadoc/* $DESTDIR
98+
git add .
99+
git commit -m "Publishing javadoc for $PROJECT_NAME $PROJECT_VERSION"
100+
git push origin
101+
cd ..
102+
rm -rf publish-jd

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ projectDescription=A plugin API for Minecraft: Java Edition
66

77
org.gradle.parallel=true
88

9-
adventureVersion=4.8.0
9+
adventureVersion=4.8.1
1010
caffeineVersion=3.0.2
1111
configurateVersion=4.1.1
1212
errorproneVersion=2.7.1

src/main/java/org/spongepowered/api/data/Keys.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
import org.spongepowered.api.item.ItemType;
201201
import org.spongepowered.api.item.ItemTypes;
202202
import org.spongepowered.api.item.enchantment.Enchantment;
203+
import org.spongepowered.api.item.enchantment.EnchantmentTypes;
203204
import org.spongepowered.api.item.inventory.Inventory;
204205
import org.spongepowered.api.item.inventory.ItemStack;
205206
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
@@ -342,6 +343,12 @@ public final class Keys {
342343
*/
343344
public static final Key<Value<Ticks>> ATTACK_TIME = Keys.key(ResourceKey.sponge("attack_time"), Ticks.class);
344345

346+
/**
347+
* Remaining ticks of the auto spin attack a {@link Living} is doing.
348+
* @see #IS_AUTO_SPIN_ATTACK
349+
*/
350+
public static final Key<Value<Ticks>> AUTO_SPIN_ATTACK_TICKS = Keys.key(ResourceKey.sponge("auto_spin_attack_ticks"), Ticks.class);
351+
345352
/**
346353
* The author of a {@link ItemTypes#WRITTEN_BOOK} {@link ItemStack}.
347354
*/
@@ -1176,6 +1183,12 @@ public final class Keys {
11761183
*/
11771184
public static final Key<Value<Boolean>> IS_ATTACHED = Keys.key(ResourceKey.sponge("is_attached"), Boolean.class);
11781185

1186+
/**
1187+
* Whether a {@link Living} is doing an auto spin attack (doable with the {@link EnchantmentTypes#RIPTIDE} enchantment.)
1188+
* @see #AUTO_SPIN_ATTACK_TICKS
1189+
*/
1190+
public static final Key<Value<Boolean>> IS_AUTO_SPIN_ATTACK = Keys.key(ResourceKey.sponge("is_auto_spin_attack"), Boolean.class);
1191+
11791192
/**
11801193
* Whether an entity is begging for food.
11811194
* e.g. {@link Cat cats} or tamed {@link Wolf wolves}

src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public interface AttackEntityEvent extends Event, Cancellable {
281281
*
282282
* @return The list of damage modifier functions
283283
*/
284-
List<? extends ModifierFunction<DamageModifier>> originalFunctions();
284+
List<DamageFunction> originalFunctions();
285285

286286
/**
287287
* Gets the "base" damage to deal to the targeted {@link Entity}. The

src/main/java/org/spongepowered/api/world/World.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ default Optional<? extends Player> closestPlayer(final int x, final int y, final
123123
* This gets a guaranteed {@link Chunk} at the desired block position; however,
124124
* the {@link Chunk} instance may be {@link Chunk#isEmpty() empty}, and
125125
* likewise, may not be generated, valid, pre-existing. It is important to
126-
* check for these cases prior to attmepting to modify the chunk.
126+
* check for these cases prior to attempting to modify the chunk.
127127
*
128128
* <p>Note that this is still different from {@link #chunk(Vector3i)}
129129
* due to it being a relative block position which can vary depending on
@@ -140,7 +140,7 @@ default Optional<? extends Player> closestPlayer(final int x, final int y, final
140140
* This gets a guaranteed {@link Chunk} at the desired block position; however,
141141
* the {@link Chunk} instance may be {@link Chunk#isEmpty() empty}, and
142142
* likewise, may not be generated, valid, pre-existing. It is important to
143-
* check for these cases prior to attmepting to modify the chunk.
143+
* check for these cases prior to attempting to modify the chunk.
144144
*
145145
* <p>Note that this is still different from {@link #chunk(Vector3i)}
146146
* due to the relative block position dictated by {@link Server#chunkLayout()},
@@ -156,10 +156,10 @@ default Optional<? extends Player> closestPlayer(final int x, final int y, final
156156

157157
/**
158158
* {@inheritDoc}
159-
* This gets a guaranteed {@link Chunk} at the desired block position; however,
159+
* This gets a guaranteed {@link Chunk} at the desired chunk position; however,
160160
* the {@link Chunk} instance may be {@link Chunk#isEmpty() empty}, and
161161
* likewise, may not be generated, valid, pre-existing. It is important to
162-
* check for these cases prior to attmepting to modify the chunk.
162+
* check for these cases prior to attempting to modify the chunk.
163163
*
164164
* @param chunkPos The chunk position relative to the {@link Server#chunkLayout() chunk layout}
165165
* @return The available chunk at that position
@@ -172,10 +172,10 @@ default Chunk chunk(final Vector3i chunkPos) {
172172

173173
/**
174174
* {@inheritDoc}
175-
* This gets a guaranteed {@link Chunk} at the desired block position; however,
175+
* This gets a guaranteed {@link Chunk} at the desired chunk position; however,
176176
* the {@link Chunk} instance may be {@link Chunk#isEmpty() empty}, and
177177
* likewise, may not be generated, valid, pre-existing. It is important to
178-
* check for these cases prior to attmepting to modify the chunk.
178+
* check for these cases prior to attempting to modify the chunk.
179179
*
180180
* @param cx The x chunk coordinate
181181
* @param cy The y coordinate

src/main/java/org/spongepowered/api/world/volume/Volume.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
package org.spongepowered.api.world.volume;
2626

27+
import org.spongepowered.api.world.chunk.Chunk;
28+
import org.spongepowered.api.world.server.ServerWorld;
2729
import org.spongepowered.math.vector.Vector3i;
2830

2931
import java.util.Objects;
@@ -62,11 +64,33 @@ default boolean containsBlock(final Vector3i position) {
6264
*/
6365
boolean containsBlock(int x, int y, int z);
6466

67+
/**
68+
* Returns true if {@link #containsBlock(Vector3i)} is true and the
69+
* backing data is actually loaded - e.g. for a {@link ServerWorld}, this
70+
* will only return true if the {@link Chunk} that contains this co-ordinate
71+
* is fully loaded.
72+
*
73+
* @param position The position to check
74+
* @return Whether or not the position has a block in this volume
75+
* <strong>and</strong> the location is loaded.
76+
*/
6577
default boolean isAreaAvailable(final Vector3i position) {
6678
Objects.requireNonNull(position, "position");
6779

6880
return this.isAreaAvailable(position.x(), position.y(), position.z());
6981
}
7082

83+
/**
84+
* Returns true if {@link #containsBlock(int, int, int)} is true and the
85+
* backing data is actually loaded - e.g. for a {@link ServerWorld}, this
86+
* will only return true if the {@link Chunk} that contains this co-ordinate
87+
* is fully loaded.
88+
*
89+
* @param x The X coordinate to check
90+
* @param y The Y coordinate to check
91+
* @param z The Z coordinate to check
92+
* @return Whether or not the position has a block in this volume
93+
* <strong>and</strong> the location is loaded.
94+
*/
7195
boolean isAreaAvailable(int x, int y, int z);
7296
}

0 commit comments

Comments
 (0)