geforkt von Mirrors/Paper
Add API to send game events (#6444)
Dieser Commit ist enthalten in:
Ursprung
ebb3c9b96a
Commit
b3c84b4e7d
@ -109,6 +109,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Collection<Material> getInfiniburn();
|
||||
+
|
||||
+ /**
|
||||
+ * Posts a specified game event at a location
|
||||
+ *
|
||||
+ * @param sourceEntity optional source entity
|
||||
+ * @param gameEvent the game event to post
|
||||
+ * @param position the position in the world where to post the event to listeners
|
||||
+ */
|
||||
+ void sendGameEvent(@Nullable Entity sourceEntity, @NotNull GameEvent gameEvent, @NotNull Vector position);
|
||||
+ // Paper end
|
||||
+
|
||||
// Spigot start
|
||||
|
@ -64,8 +64,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public Collection<org.bukkit.Material> getInfiniburn() {
|
||||
+ return com.google.common.collect.Sets.newHashSet(com.google.common.collect.Iterators.transform(getHandle().dimensionType().infiniburn().getValues().iterator(), CraftMagicNumbers::getMaterial));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
|
||||
+ getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.Registry.GAME_EVENT.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public Raid locateNearestRaid(Location location, int radius) {
|
||||
Validate.notNull(location, "Location cannot be null");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftVector {
|
||||
public static net.minecraft.world.phys.Vec3 toNMS(org.bukkit.util.Vector bukkit) {
|
||||
return new net.minecraft.world.phys.Vec3(bukkit.getX(), bukkit.getY(), bukkit.getZ());
|
||||
}
|
||||
+ // Paper start
|
||||
+ public static org.bukkit.util.Vector toBukkit(net.minecraft.core.BlockPos blockPosition) {
|
||||
+ return new org.bukkit.util.Vector(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraft.core.BlockPos toBlockPos(org.bukkit.util.Vector bukkit) {
|
||||
+ return new net.minecraft.core.BlockPos(bukkit.getX(), bukkit.getY(), bukkit.getZ());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren