Added debug
This commit is contained in:
parent
4045bc5839
commit
d6858c293d
@ -36,10 +36,10 @@ public class Plugin extends PluginBase {
|
|||||||
// Register Blocks
|
// Register Blocks
|
||||||
Reflections blockReflections = new Reflections("com.cimeyclust.addonreader.resources.custom_blocks");
|
Reflections blockReflections = new Reflections("com.cimeyclust.addonreader.resources.custom_blocks");
|
||||||
// Log super classes of each class in the package
|
// Log super classes of each class in the package
|
||||||
blockReflections.getSubTypesOf(Object.class).forEach(clazz -> getLogger().info(clazz + " extends " + clazz.getSuperclass()));
|
blockReflections.getSubTypesOf(Object.class).forEach(clazz -> System.out.println(clazz + " extends " + clazz.getSuperclass()));
|
||||||
|
|
||||||
// Log block classes
|
// Log block classes
|
||||||
blockReflections.getSubTypesOf(Object.class).forEach(clazz -> getLogger().info(clazz + " is a block class"));
|
blockReflections.getSubTypesOf(Object.class).forEach(clazz -> System.out.println(clazz + " is a block class"));
|
||||||
|
|
||||||
Set<Class<? extends CustomBlock>> blocks = blockReflections.getSubTypesOf(Object.class).stream()
|
Set<Class<? extends CustomBlock>> blocks = blockReflections.getSubTypesOf(Object.class).stream()
|
||||||
.filter(clazz -> clazz.getSuperclass() == CustomBlock.class)
|
.filter(clazz -> clazz.getSuperclass() == CustomBlock.class)
|
||||||
@ -47,7 +47,7 @@ public class Plugin extends PluginBase {
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
for (Class<? extends CustomBlock> clazz : blocks) {
|
for (Class<? extends CustomBlock> clazz : blocks) {
|
||||||
getLogger().info("§aLoading custom block " + clazz + "...");
|
System.out.println("§aLoading custom block " + clazz + "...");
|
||||||
try {
|
try {
|
||||||
Block.registerCustomBlock(Collections.singletonList(clazz)).assertOK();
|
Block.registerCustomBlock(Collections.singletonList(clazz)).assertOK();
|
||||||
} catch (AssertionError e) {
|
} catch (AssertionError e) {
|
||||||
@ -58,7 +58,7 @@ public class Plugin extends PluginBase {
|
|||||||
// Register Items
|
// Register Items
|
||||||
Reflections itemReflections = new Reflections("com.cimeyclust.addonreader.resources.custom_items");
|
Reflections itemReflections = new Reflections("com.cimeyclust.addonreader.resources.custom_items");
|
||||||
// Log super classes of each class in the package
|
// Log super classes of each class in the package
|
||||||
itemReflections.getSubTypesOf(Object.class).forEach(clazz -> getLogger().info(clazz + " extends " + clazz.getSuperclass()));
|
itemReflections.getSubTypesOf(Object.class).forEach(clazz -> System.out.println(clazz + " extends " + clazz.getSuperclass()));
|
||||||
|
|
||||||
Set<Class<? extends CustomItem>> items = itemReflections.getSubTypesOf(Object.class).stream()
|
Set<Class<? extends CustomItem>> items = itemReflections.getSubTypesOf(Object.class).stream()
|
||||||
.filter(clazz -> clazz.getSuperclass() == CustomItem.class)
|
.filter(clazz -> clazz.getSuperclass() == CustomItem.class)
|
||||||
@ -66,7 +66,7 @@ public class Plugin extends PluginBase {
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
for (Class<? extends CustomItem> clazz : items) {
|
for (Class<? extends CustomItem> clazz : items) {
|
||||||
getLogger().info("§aLoading custom item " + clazz + "...");
|
System.out.println("§aLoading custom item " + clazz + "...");
|
||||||
try {
|
try {
|
||||||
Item.registerCustomItem(clazz).assertOK();
|
Item.registerCustomItem(clazz).assertOK();
|
||||||
} catch (AssertionError e) {
|
} catch (AssertionError e) {
|
||||||
@ -77,7 +77,7 @@ public class Plugin extends PluginBase {
|
|||||||
// Register Entities
|
// Register Entities
|
||||||
Reflections entityReflections = new Reflections("com.cimeyclust.addonreader.resources.custom_entities");
|
Reflections entityReflections = new Reflections("com.cimeyclust.addonreader.resources.custom_entities");
|
||||||
// Log super classes of each class in the package
|
// Log super classes of each class in the package
|
||||||
entityReflections.getSubTypesOf(Object.class).forEach(clazz -> getLogger().info(clazz + " extends " + clazz.getSuperclass()));
|
entityReflections.getSubTypesOf(Object.class).forEach(clazz -> System.out.println(clazz + " extends " + clazz.getSuperclass()));
|
||||||
|
|
||||||
Set<Class<? extends Entity>> entities = itemReflections.getSubTypesOf(Object.class).stream()
|
Set<Class<? extends Entity>> entities = itemReflections.getSubTypesOf(Object.class).stream()
|
||||||
.filter(clazz -> clazz.getSuperclass() == Entity.class)
|
.filter(clazz -> clazz.getSuperclass() == Entity.class)
|
||||||
@ -85,7 +85,7 @@ public class Plugin extends PluginBase {
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
for (Class<? extends Entity> clazz : entities) {
|
for (Class<? extends Entity> clazz : entities) {
|
||||||
getLogger().info("§aLoading custom entity " + clazz + "...");
|
System.out.println("§aLoading custom entity " + clazz + "...");
|
||||||
try {
|
try {
|
||||||
Entity.registerCustomEntity(new CustomClassEntityProvider(clazz)).assertOK();
|
Entity.registerCustomEntity(new CustomClassEntityProvider(clazz)).assertOK();
|
||||||
entities.add(clazz);
|
entities.add(clazz);
|
||||||
@ -94,12 +94,12 @@ public class Plugin extends PluginBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getLogger().info("§aCustomResources has been enabled!");
|
System.out.println("§aCustomResources has been enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tickComponents(Entity entity) {
|
public static void tickComponents(Entity entity) {
|
||||||
if (!(entity instanceof EntityIntelligent)) return;
|
if (!(entity instanceof EntityIntelligent)) return;
|
||||||
getInstance().getServer().getPluginManager().getPlugin("NukkitAddonReader").getLogger().info("Ticking components for entity: " + entity.getName());
|
System.out.println("Ticking components for entity: " + entity.getName());
|
||||||
if (getInstance().getServer().getPluginManager().getPlugin("NukkitAddonReader") instanceof com.cimeyclust.addonreader.Plugin pl) {
|
if (getInstance().getServer().getPluginManager().getPlugin("NukkitAddonReader") instanceof com.cimeyclust.addonreader.Plugin pl) {
|
||||||
pl.tickComponents((EntityIntelligent) entity);
|
pl.tickComponents((EntityIntelligent) entity);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user