mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-02-23 15:01:21 +01:00
Replace EntityUtils with new NmsEntity implementation and deprecate it
This commit is contained in:
parent
a11c6aa691
commit
c43bc093cc
@ -2,6 +2,7 @@ package com.craftaro.core.utils;
|
|||||||
|
|
||||||
import com.craftaro.core.compatibility.ClassMapping;
|
import com.craftaro.core.compatibility.ClassMapping;
|
||||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
import com.craftaro.core.compatibility.CompatibleMaterial;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
@ -13,6 +14,10 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link com.craftaro.core.nms.entity.NmsEntity} instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public class EntityUtils {
|
public class EntityUtils {
|
||||||
private static Class<?> clazzEntityInsentient, clazzEntity, clazzCraftEntity;
|
private static Class<?> clazzEntityInsentient, clazzEntity, clazzCraftEntity;
|
||||||
|
|
||||||
@ -41,6 +46,10 @@ public class EntityUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link com.craftaro.core.nms.entity.NmsEntity#setMobAware(Entity, boolean)} instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void setUnaware(LivingEntity entity) {
|
public static void setUnaware(LivingEntity entity) {
|
||||||
try {
|
try {
|
||||||
setUnaware(methodGetHandle.invoke(clazzCraftEntity.cast(entity)));
|
setUnaware(methodGetHandle.invoke(clazzCraftEntity.cast(entity)));
|
||||||
@ -49,6 +58,10 @@ public class EntityUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link com.craftaro.core.nms.entity.NmsEntity#setMobAware(Entity, boolean)} instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void setUnaware(Object entity) {
|
public static void setUnaware(Object entity) {
|
||||||
try {
|
try {
|
||||||
if (aware != null) {
|
if (aware != null) {
|
||||||
@ -61,6 +74,10 @@ public class EntityUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link com.craftaro.core.nms.entity.NmsEntity#isAware(Entity)} instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static boolean isAware(LivingEntity entity) {
|
public static boolean isAware(LivingEntity entity) {
|
||||||
try {
|
try {
|
||||||
return isAware(methodGetHandle.invoke(clazzCraftEntity.cast(entity)));
|
return isAware(methodGetHandle.invoke(clazzCraftEntity.cast(entity)));
|
||||||
@ -71,6 +88,10 @@ public class EntityUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link com.craftaro.core.nms.entity.NmsEntity#isAware(Entity)} instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static boolean isAware(Object entity) {
|
public static boolean isAware(Object entity) {
|
||||||
try {
|
try {
|
||||||
if (aware != null) {
|
if (aware != null) {
|
||||||
|
@ -2,12 +2,15 @@ package com.craftaro.core.nms;
|
|||||||
|
|
||||||
import com.craftaro.core.nms.anvil.AnvilCore;
|
import com.craftaro.core.nms.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public interface NmsImplementations {
|
public interface NmsImplementations {
|
||||||
|
@NotNull NmsEntity getEntity();
|
||||||
|
|
||||||
@NotNull NMSPlayer getPlayer();
|
@NotNull NMSPlayer getPlayer();
|
||||||
|
|
||||||
@NotNull WorldCore getWorld();
|
@NotNull WorldCore getWorld();
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.craftaro.core.nms.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public interface NmsEntity {
|
||||||
|
boolean isMob(Entity entity);
|
||||||
|
|
||||||
|
void setMobAware(Entity entity, boolean aware);
|
||||||
|
|
||||||
|
boolean isAware(Entity entity);
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_10_R1;
|
package com.craftaro.core.nms.v1_10_R1;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_10_R1.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_10_R1.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_10_R1.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_10_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_10_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_10_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_10_R1.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_10_R1.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_10_R1.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_10_R1.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_10_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_10_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_10_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_10_R1.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_11_R1;
|
package com.craftaro.core.nms.v1_11_R1;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_11_R1.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_11_R1.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_11_R1.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_11_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_11_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_11_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_11_R1.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_11_R1.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_11_R1.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_11_R1.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_11_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_11_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_11_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_11_R1.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_12_R1;
|
package com.craftaro.core.nms.v1_12_R1;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_12_R1.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_12_R1.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.v1_12_R1.world.NmsWorldBorderImpl;
|
|
||||||
import com.craftaro.core.nms.v1_12_R1.world.WorldCoreImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_12_R1.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_12_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_12_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_12_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_12_R1.nbt.NBTCoreImpl;
|
||||||
|
import com.craftaro.core.nms.v1_12_R1.world.NmsWorldBorderImpl;
|
||||||
|
import com.craftaro.core.nms.v1_12_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_12_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_12_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_12_R1.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_13_R1;
|
package com.craftaro.core.nms.v1_13_R1;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_13_R1.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_13_R1.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_13_R1.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_13_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_13_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_13_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_13_R1.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_13_R1.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_13_R1.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_13_R1.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_13_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_13_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_13_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_13_R1.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_13_R2;
|
package com.craftaro.core.nms.v1_13_R2;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_13_R2.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_13_R2.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_13_R2.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_13_R2.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_13_R2.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_13_R2.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_13_R2.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_13_R2.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_13_R2.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_13_R2.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_13_R2.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_13_R2.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_13_R2.Entity;
|
||||||
|
import net.minecraft.server.v1_13_R2.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_14_R1;
|
package com.craftaro.core.nms.v1_14_R1;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_14_R1.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_14_R1.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.v1_14_R1.world.NmsWorldBorderImpl;
|
|
||||||
import com.craftaro.core.nms.v1_14_R1.world.WorldCoreImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_14_R1.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_14_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_14_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_14_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_14_R1.nbt.NBTCoreImpl;
|
||||||
|
import com.craftaro.core.nms.v1_14_R1.world.NmsWorldBorderImpl;
|
||||||
|
import com.craftaro.core.nms.v1_14_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_14_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_14_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_14_R1.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_15_R1;
|
package com.craftaro.core.nms.v1_15_R1;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_15_R1.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_15_R1.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.v1_15_R1.world.NmsWorldBorderImpl;
|
|
||||||
import com.craftaro.core.nms.v1_15_R1.world.WorldCoreImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_15_R1.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_15_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_15_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_15_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_15_R1.nbt.NBTCoreImpl;
|
||||||
|
import com.craftaro.core.nms.v1_15_R1.world.NmsWorldBorderImpl;
|
||||||
|
import com.craftaro.core.nms.v1_15_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_15_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_15_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_15_R1.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_16_R1;
|
package com.craftaro.core.nms.v1_16_R1;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_16_R1.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_16_R1.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_16_R1.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_16_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_16_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_16_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_16_R1.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_16_R1.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_16_R1.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_16_R1.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_16_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_16_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_16_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_16_R1.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_16_R1.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((EntityInsentient) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return ((EntityInsentient) nmsEntity).aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_16_R2;
|
package com.craftaro.core.nms.v1_16_R2;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_16_R2.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_16_R2.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_16_R2.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_16_R2.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_16_R2.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_16_R2.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_16_R2.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_16_R2.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_16_R2.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_16_R2.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_16_R2.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_16_R2.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_16_R2.Entity;
|
||||||
|
import net.minecraft.server.v1_16_R2.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((EntityInsentient) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return ((EntityInsentient) nmsEntity).aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_16_R3;
|
package com.craftaro.core.nms.v1_16_R3;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_16_R3.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_16_R3.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_16_R3.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_16_R3.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_16_R3.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_16_R3.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_16_R3.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_16_R3.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_16_R3.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_16_R3.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_16_R3.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_16_R3.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_16_R3.Entity;
|
||||||
|
import net.minecraft.server.v1_16_R3.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((EntityInsentient) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return ((EntityInsentient) nmsEntity).aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
package com.craftaro.core.nms.v1_17_R1;
|
package com.craftaro.core.nms.v1_17_R1;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.v1_17_R1.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_17_R1.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_17_R1.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_17_R1.entity.NMSPlayerImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_17_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_17_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_17_R1.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_17_R1.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_17_R1.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_17_R1.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_17_R1.world.WorldCoreImpl;
|
||||||
@ -14,6 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_17_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.world.entity.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((EntityInsentient) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(Entity entity) {
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient nmsMob) {
|
||||||
|
return nmsMob.aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_18_R1;
|
package com.craftaro.core.nms.v1_18_R1;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_18_R1.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_18_R1.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.v1_18_R1.world.NmsWorldBorderImpl;
|
|
||||||
import com.craftaro.core.nms.v1_18_R1.world.WorldCoreImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_18_R1.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_18_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_18_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_18_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_18_R1.nbt.NBTCoreImpl;
|
||||||
|
import com.craftaro.core.nms.v1_18_R1.world.NmsWorldBorderImpl;
|
||||||
|
import com.craftaro.core.nms.v1_18_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_18_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof Mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((Mob) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(Entity entity) {
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof Mob nmsMob) {
|
||||||
|
return nmsMob.aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_18_R2;
|
package com.craftaro.core.nms.v1_18_R2;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_18_R2.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_18_R2.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.v1_18_R2.world.NmsWorldBorderImpl;
|
|
||||||
import com.craftaro.core.nms.v1_18_R2.world.WorldCoreImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_18_R2.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_18_R2.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_18_R2.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_18_R2.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_18_R2.nbt.NBTCoreImpl;
|
||||||
|
import com.craftaro.core.nms.v1_18_R2.world.NmsWorldBorderImpl;
|
||||||
|
import com.craftaro.core.nms.v1_18_R2.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_18_R2.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof Mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((Mob) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(Entity entity) {
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof Mob nmsMob) {
|
||||||
|
return nmsMob.aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_19_0;
|
package com.craftaro.core.nms.v1_19_0;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_19_0.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_19_0.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_19_0.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_19_0.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_19_0.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_19_0.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_19_0.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_19_0.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_19_0.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_19_0.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_19_0.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_19_0.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof Mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((Mob) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(Entity entity) {
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof Mob nmsMob) {
|
||||||
|
return nmsMob.aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
package com.craftaro.core.nms.v1_19_R1;
|
package com.craftaro.core.nms.v1_19_R1;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_19_R1.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_19_R1.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_19_R1.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_19_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_19_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_19_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_19_R1.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_19_R1.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_19_R1.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_19_R1.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_19_R1.world.WorldCoreImpl;
|
||||||
@ -15,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -25,6 +28,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
if (((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion().equals("7b9de0da1357e5b251eddde9aa762916")) {
|
if (((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion().equals("7b9de0da1357e5b251eddde9aa762916")) {
|
||||||
var nmsMc1_19_0 = new com.craftaro.core.nms.v1_19_0.NmsImplementationsImpl();
|
var nmsMc1_19_0 = new com.craftaro.core.nms.v1_19_0.NmsImplementationsImpl();
|
||||||
|
|
||||||
|
this.entity = nmsMc1_19_0.getEntity();
|
||||||
this.player = nmsMc1_19_0.getPlayer();
|
this.player = nmsMc1_19_0.getPlayer();
|
||||||
this.world = nmsMc1_19_0.getWorld();
|
this.world = nmsMc1_19_0.getWorld();
|
||||||
this.worldBorder = nmsMc1_19_0.getWorldBorder();
|
this.worldBorder = nmsMc1_19_0.getWorldBorder();
|
||||||
@ -34,6 +38,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -41,6 +46,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_19_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof Mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((Mob) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(Entity entity) {
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof Mob nmsMob) {
|
||||||
|
return nmsMob.aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,21 @@
|
|||||||
package com.craftaro.core.nms.v1_19_R2;
|
package com.craftaro.core.nms.v1_19_R2;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_19_R2.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_19_R2.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_19_R2.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_19_R2.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_19_R2.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_19_R2.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_19_R2.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_19_R2.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_19_R2.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_19_R2.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_19_R2.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -20,6 +23,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -27,6 +31,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_19_R2.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof Mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((Mob) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(Entity entity) {
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof Mob nmsMob) {
|
||||||
|
return nmsMob.aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,21 @@
|
|||||||
package com.craftaro.core.nms.v1_19_R3;
|
package com.craftaro.core.nms.v1_19_R3;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_19_R3.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_19_R3.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.v1_19_R3.world.NmsWorldBorderImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_19_R3.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_19_R3.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_19_R3.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_19_R3.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_19_R3.nbt.NBTCoreImpl;
|
||||||
|
import com.craftaro.core.nms.v1_19_R3.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_19_R3.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_19_R3.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -20,6 +23,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -27,6 +31,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_19_R3.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof Mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((Mob) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(Entity entity) {
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof Mob nmsMob) {
|
||||||
|
return nmsMob.aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,21 @@
|
|||||||
package com.craftaro.core.nms.v1_20_R1;
|
package com.craftaro.core.nms.v1_20_R1;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_20_R1.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_20_R1.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_20_R1.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_20_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_20_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_20_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_20_R1.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_20_R1.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_20_R1.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_20_R1.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_20_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -20,6 +23,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -27,6 +31,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_20_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof Mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
((Mob) nmsEntity).aware = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(Entity entity) {
|
||||||
|
var nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof Mob nmsMob) {
|
||||||
|
return nmsMob.aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_8_R1;
|
package com.craftaro.core.nms.v1_8_R1;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_8_R1.anvil.AnvilCore;
|
import com.craftaro.core.nms.v1_8_R1.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.v1_8_R1.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_8_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_8_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_8_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_8_R1.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_8_R1.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_8_R1.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_8_R1.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_8_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_8_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_8_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_8_R1.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_8_R2;
|
package com.craftaro.core.nms.v1_8_R2;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_8_R2.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_8_R2.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.v1_8_R2.world.NmsWorldBorderImpl;
|
|
||||||
import com.craftaro.core.nms.v1_8_R2.world.WorldCoreImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_8_R2.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_8_R2.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_8_R2.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_8_R2.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_8_R2.nbt.NBTCoreImpl;
|
||||||
|
import com.craftaro.core.nms.v1_8_R2.world.NmsWorldBorderImpl;
|
||||||
|
import com.craftaro.core.nms.v1_8_R2.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_8_R2.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_8_R2.Entity;
|
||||||
|
import net.minecraft.server.v1_8_R2.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_8_R3;
|
package com.craftaro.core.nms.v1_8_R3;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.anvil.AnvilCore;
|
import com.craftaro.core.nms.anvil.AnvilCore;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
import com.craftaro.core.nms.v1_8_R3.entity.NMSPlayerImpl;
|
import com.craftaro.core.nms.v1_8_R3.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_8_R3.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_8_R3.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_8_R3.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_8_R3.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_8_R3.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_8_R3.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_8_R3.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_8_R3.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_8_R3.Entity;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,22 @@
|
|||||||
package com.craftaro.core.nms.v1_9_R1;
|
package com.craftaro.core.nms.v1_9_R1;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_9_R1.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_9_R1.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.v1_9_R1.world.NmsWorldBorderImpl;
|
|
||||||
import com.craftaro.core.nms.v1_9_R1.world.WorldCoreImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_9_R1.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_9_R1.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_9_R1.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_9_R1.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_9_R1.nbt.NBTCoreImpl;
|
||||||
|
import com.craftaro.core.nms.v1_9_R1.world.NmsWorldBorderImpl;
|
||||||
|
import com.craftaro.core.nms.v1_9_R1.world.WorldCoreImpl;
|
||||||
import com.craftaro.core.nms.world.NmsWorldBorder;
|
import com.craftaro.core.nms.world.NmsWorldBorder;
|
||||||
import com.craftaro.core.nms.world.WorldCore;
|
import com.craftaro.core.nms.world.WorldCore;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_9_R1.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_9_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_9_R1.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
package com.craftaro.core.nms.v1_9_R2;
|
package com.craftaro.core.nms.v1_9_R2;
|
||||||
|
|
||||||
import com.craftaro.core.nms.v1_9_R2.anvil.AnvilCore;
|
|
||||||
import com.craftaro.core.nms.v1_9_R2.entity.NMSPlayerImpl;
|
|
||||||
import com.craftaro.core.nms.NmsImplementations;
|
import com.craftaro.core.nms.NmsImplementations;
|
||||||
import com.craftaro.core.nms.entity.NMSPlayer;
|
import com.craftaro.core.nms.entity.NMSPlayer;
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
import com.craftaro.core.nms.nbt.NBTCore;
|
import com.craftaro.core.nms.nbt.NBTCore;
|
||||||
|
import com.craftaro.core.nms.v1_9_R2.anvil.AnvilCore;
|
||||||
|
import com.craftaro.core.nms.v1_9_R2.entity.NMSPlayerImpl;
|
||||||
|
import com.craftaro.core.nms.v1_9_R2.entity.NmsEntityImpl;
|
||||||
import com.craftaro.core.nms.v1_9_R2.nbt.NBTCoreImpl;
|
import com.craftaro.core.nms.v1_9_R2.nbt.NBTCoreImpl;
|
||||||
import com.craftaro.core.nms.v1_9_R2.world.NmsWorldBorderImpl;
|
import com.craftaro.core.nms.v1_9_R2.world.NmsWorldBorderImpl;
|
||||||
import com.craftaro.core.nms.v1_9_R2.world.WorldCoreImpl;
|
import com.craftaro.core.nms.v1_9_R2.world.WorldCoreImpl;
|
||||||
@ -14,6 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NmsImplementationsImpl implements NmsImplementations {
|
public class NmsImplementationsImpl implements NmsImplementations {
|
||||||
|
private final NmsEntity entity;
|
||||||
private final NMSPlayer player;
|
private final NMSPlayer player;
|
||||||
private final WorldCore world;
|
private final WorldCore world;
|
||||||
private final NmsWorldBorder worldBorder;
|
private final NmsWorldBorder worldBorder;
|
||||||
@ -21,6 +24,7 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
private final NBTCore nbt;
|
private final NBTCore nbt;
|
||||||
|
|
||||||
public NmsImplementationsImpl() {
|
public NmsImplementationsImpl() {
|
||||||
|
this.entity = new NmsEntityImpl();
|
||||||
this.player = new NMSPlayerImpl();
|
this.player = new NMSPlayerImpl();
|
||||||
this.world = new WorldCoreImpl();
|
this.world = new WorldCoreImpl();
|
||||||
this.worldBorder = new NmsWorldBorderImpl();
|
this.worldBorder = new NmsWorldBorderImpl();
|
||||||
@ -28,6 +32,11 @@ public class NmsImplementationsImpl implements NmsImplementations {
|
|||||||
this.nbt = new NBTCoreImpl();
|
this.nbt = new NBTCoreImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull NmsEntity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull NMSPlayer getPlayer() {
|
public @NotNull NMSPlayer getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.craftaro.core.nms.v1_9_R2.entity;
|
||||||
|
|
||||||
|
import com.craftaro.core.nms.entity.NmsEntity;
|
||||||
|
import net.minecraft.server.v1_9_R2.Entity;
|
||||||
|
import net.minecraft.server.v1_9_R2.EntityInsentient;
|
||||||
|
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity;
|
||||||
|
|
||||||
|
public class NmsEntityImpl implements NmsEntity {
|
||||||
|
@Override
|
||||||
|
public boolean isMob(org.bukkit.entity.Entity entity) {
|
||||||
|
return ((CraftEntity) entity).getHandle() instanceof EntityInsentient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobAware(org.bukkit.entity.Entity entity, boolean aware) {
|
||||||
|
if (!isMob(entity)) {
|
||||||
|
throw new IllegalArgumentException("Entity is not a mob and cannot be set aware");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.fromMobSpawner = aware;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAware(org.bukkit.entity.Entity entity) {
|
||||||
|
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
if (nmsEntity instanceof EntityInsentient) {
|
||||||
|
return nmsEntity.fromMobSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user