Skip to content

Commit 385e839

Browse files
authored
Merge branch 'v1.21' into fix/improve-pipeline
2 parents 42ff9c2 + 1ff8b18 commit 385e839

5 files changed

Lines changed: 133 additions & 3 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.mockbukkit.mockbukkit.entity;
2+
3+
import org.bukkit.entity.CamelHusk;
4+
import org.bukkit.entity.EntityType;
5+
import org.jspecify.annotations.NullMarked;
6+
import org.mockbukkit.mockbukkit.ServerMock;
7+
8+
import java.util.UUID;
9+
10+
/**
11+
* Mock implementation of an {@link CamelHusk}.
12+
*
13+
* @see CamelMock
14+
*/
15+
@NullMarked
16+
public class CamelHuskMock extends CamelMock implements CamelHusk
17+
{
18+
19+
/**
20+
* Constructs a new {@link CamelHusk} on the provided {@link ServerMock} with a specified {@link UUID}.
21+
*
22+
* @param server The server to create the entity on.
23+
* @param uuid The UUID of the entity.
24+
*/
25+
public CamelHuskMock(ServerMock server, UUID uuid)
26+
{
27+
super(server, uuid);
28+
}
29+
30+
@Override
31+
public EntityType getType()
32+
{
33+
return EntityType.CAMEL_HUSK;
34+
}
35+
36+
}

src/main/java/org/mockbukkit/mockbukkit/entity/CamelMock.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
import java.util.UUID;
1010

11+
/**
12+
* Mock implementation of an {@link Camel}.
13+
*
14+
* @see AbstractHorseMock
15+
*/
1116
public class CamelMock extends AbstractHorseMock implements Camel
1217
{
1318

src/main/java/org/mockbukkit/mockbukkit/entity/EntityTypesMock.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.bukkit.entity.Breeze;
1818
import org.bukkit.entity.BreezeWindCharge;
1919
import org.bukkit.entity.Camel;
20+
import org.bukkit.entity.CamelHusk;
2021
import org.bukkit.entity.Cat;
2122
import org.bukkit.entity.CaveSpider;
2223
import org.bukkit.entity.ChestBoat;
@@ -76,10 +77,12 @@
7677
import org.bukkit.entity.Minecart;
7778
import org.bukkit.entity.Mule;
7879
import org.bukkit.entity.MushroomCow;
80+
import org.bukkit.entity.Nautilus;
7981
import org.bukkit.entity.Ocelot;
8082
import org.bukkit.entity.OminousItemSpawner;
8183
import org.bukkit.entity.Painting;
8284
import org.bukkit.entity.Panda;
85+
import org.bukkit.entity.Parched;
8386
import org.bukkit.entity.Parrot;
8487
import org.bukkit.entity.Phantom;
8588
import org.bukkit.entity.Pig;
@@ -236,6 +239,7 @@ public static Builder withDefaults()
236239
.register(Breeze.class, BreezeMock.class, BreezeMock::new)
237240
.register(BreezeWindCharge.class, BreezeWindChargeMock.class, BreezeWindChargeMock::new)
238241
.register(Camel.class, CamelMock.class, CamelMock::new)
242+
.register(CamelHusk.class, CamelHuskMock.class, CamelHuskMock::new)
239243
.register(Cat.class, CatMock.class, CatMock::new)
240244
.register(CaveSpider.class, CaveSpiderMock.class, CaveSpiderMock::new)
241245
.register(CherryBoat.class, CherryBoatMock.class, CherryBoatMock::new)
@@ -304,6 +308,7 @@ public static Builder withDefaults()
304308
.register(Minecart.class, RideableMinecartMock.class, RideableMinecartMock::new)
305309
.register(Mule.class, MuleMock.class, MuleMock::new)
306310
.register(MushroomCow.class, MushroomCowMock.class, MushroomCowMock::new)
311+
.register(Nautilus.class, NautilusMock.class, NautilusMock::new)
307312
.register(OakBoat.class, OakBoatMock.class, OakBoatMock::new)
308313
.register(OakChestBoat.class, OakChestBoatMock.class, OakChestBoatMock::new)
309314
.register(Ocelot.class, OcelotMock.class, OcelotMock::new)
@@ -312,6 +317,7 @@ public static Builder withDefaults()
312317
.register(PaleOakBoat.class, PaleOakBoatMock.class, PaleOakBoatMock::new)
313318
.register(PaleOakChestBoat.class, PaleOakChestBoatMock.class, PaleOakChestBoatMock::new)
314319
.register(Panda.class, PandaMock.class, PandaMock::new)
320+
.register(Parched.class, ParchedMock.class, ParchedMock::new)
315321
.register(Parrot.class, ParrotMock.class, ParrotMock::new)
316322
.register(Phantom.class, PhantomMock.class, PhantomMock::new)
317323
.register(Pig.class, PigMock.class, PigMock::new)
@@ -412,10 +418,13 @@ else if (bukkitClazz == Player.class)
412418
var myConstructor = bukkitClazz.getDeclaredConstructor(ServerMock.class, UUID.class);
413419
return (EntityMock) myConstructor.newInstance(server, entityUUID);
414420
}
415-
catch (NoSuchMethodException | InstantiationException | IllegalAccessException |
416-
InvocationTargetException e)
421+
catch (NoSuchMethodException e)
417422
{
418-
log.warn("Couldn't find: " + e.getMessage() + " for " + bukkitClazz.getName() + ". Falling back to reflection.", e);
423+
log.debug("Method with signature '{}' does not exist in '{}', falling back to reflection.", e.getMessage(), bukkitClazz.getName());
424+
}
425+
catch (InstantiationException | IllegalAccessException | InvocationTargetException e)
426+
{
427+
log.warn("Couldn't find: {} for {}. Falling back to reflection.", e.getMessage(), bukkitClazz.getName(), e);
419428
}
420429

421430
EntityData<? extends Entity, ? extends EntityMock> data = bukkitToMockData.get(bukkitClazz);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.mockbukkit.mockbukkit.entity;
2+
3+
import org.bukkit.entity.EntityType;
4+
import org.bukkit.entity.Nautilus;
5+
import org.jspecify.annotations.NullMarked;
6+
import org.mockbukkit.mockbukkit.ServerMock;
7+
8+
import java.util.UUID;
9+
10+
/**
11+
* Mock implementation of an {@link Nautilus}.
12+
*
13+
* @see AbstractNautilusMock
14+
*/
15+
@NullMarked
16+
public class NautilusMock extends AbstractNautilusMock implements Nautilus
17+
{
18+
19+
/**
20+
* Constructs a new {@link Nautilus} on the provided {@link ServerMock} with a specified {@link UUID}.
21+
*
22+
* @param server The server to create the entity on.
23+
* @param uuid The UUID of the entity.
24+
*/
25+
public NautilusMock(ServerMock server, UUID uuid)
26+
{
27+
super(server, uuid);
28+
}
29+
30+
@Override
31+
public EntityType getType()
32+
{
33+
return EntityType.NAUTILUS;
34+
}
35+
36+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package org.mockbukkit.mockbukkit.entity;
2+
3+
import org.bukkit.entity.EntityType;
4+
import org.bukkit.entity.Parched;
5+
import org.bukkit.entity.Skeleton;
6+
import org.jspecify.annotations.NullMarked;
7+
import org.mockbukkit.mockbukkit.ServerMock;
8+
9+
import java.util.UUID;
10+
11+
/**
12+
* Mock implementation of an {@link Parched}.
13+
*
14+
* @see AbstractSkeletonMock
15+
*/
16+
@NullMarked
17+
public class ParchedMock extends AbstractSkeletonMock implements Parched
18+
{
19+
20+
/**
21+
* Constructs a new {@link Parched} on the provided {@link ServerMock} with a specified {@link UUID}.
22+
*
23+
* @param server The server to create the entity on.
24+
* @param uuid The UUID of the entity.
25+
*/
26+
public ParchedMock(ServerMock server, UUID uuid)
27+
{
28+
super(server, uuid);
29+
}
30+
31+
@Override
32+
@Deprecated(since = "1.17", forRemoval = true)
33+
public Skeleton.SkeletonType getSkeletonType()
34+
{
35+
return Skeleton.SkeletonType.PARCHED;
36+
}
37+
38+
@Override
39+
public EntityType getType()
40+
{
41+
return EntityType.PARCHED;
42+
}
43+
44+
}

0 commit comments

Comments
 (0)