diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 496cc6e7bd..a35d4822c7 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -49,6 +49,10 @@ public final class CraftServer implements Server { } } + public void disablePlugins() { + pluginManager.disablePlugins(); + } + private void loadPlugin(Plugin plugin) { List<Command> pluginCommands = PluginCommandYamlParser.parse(plugin); if (!pluginCommands.isEmpty()) { @@ -168,5 +172,9 @@ public final class CraftServer implements Server { console.e.k = monsters ? 1 : 0; console.e.a(monsters, animals); + + pluginManager.clearPlugins(); + commandMap.clearCommands(); + loadPlugins(); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index e4989c4e8a..cdeffc3a7a 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -3,8 +3,11 @@ package org.bukkit.craftbukkit; import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.entity.*; import org.bukkit.entity.*; +import org.bukkit.entity.Entity; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Random; import net.minecraft.server.*; @@ -316,4 +319,44 @@ public class CraftWorld implements World { return hash; } } + + public List<Entity> getEntities() { + List<Entity> list = new ArrayList<Entity>(); + + for (Object o : world.b) { + if (o instanceof net.minecraft.server.Entity) { + net.minecraft.server.Entity mcEnt + = (net.minecraft.server.Entity)o; + + Entity bukkitEntity = mcEnt.getBukkitEntity(); + + // Assuming that bukkitEntity isn't null + if (bukkitEntity != null) { + list.add(bukkitEntity); + } + } + } + + return list; + } + + public List<LivingEntity> getLivingEntities() { + List<LivingEntity> list = new ArrayList<LivingEntity>(); + + for (Object o : world.b) { + if (o instanceof net.minecraft.server.Entity) { + net.minecraft.server.Entity mcEnt + = (net.minecraft.server.Entity)o; + + Entity bukkitEntity = mcEnt.getBukkitEntity(); + + // Assuming that bukkitEntity isn't null + if (bukkitEntity != null && bukkitEntity instanceof LivingEntity) { + list.add((LivingEntity)bukkitEntity); + } + } + } + + return list; + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 4c00089685..4d19e34b6b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -337,6 +337,14 @@ public class CraftBlock implements Block { return null; } + public boolean isBlockPowered() { + return world.getHandle().o(x, y, z); + } + + public boolean isBlockIndirectlyPowered() { + return world.getHandle().p(x, y, z); + } + public void update() { type = world.getHandle().a(x, y, z); data = (byte)world.getHandle().b(x, y, z); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 95982b6546..2c32a63129 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -110,4 +110,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { entity.a.b(((Packet) (new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())))); } + public boolean performCommand(String command) { + return server.dispatchCommand(this, command); + } }