public Construct exec(Target t, Env env, Construct... args) throws CancelCommandException, ConfigRuntimeException { double x = 0; double y = 0; double z = 0; float size = 3; MCWorld w = null; MCPlayer m = null; if (args.length == 2 && args[1] instanceof CInt) { CInt temp = (CInt) args[1]; size = temp.getInt(); } if (size > 100) { throw new ConfigRuntimeException( "A bit excessive, don't you think? Let's scale that back some, huh?", ExceptionType.RangeException, t); } if (!(args[0] instanceof CArray)) { throw new ConfigRuntimeException( "Expecting an array at parameter 1 of explosion", ExceptionType.CastException, t); } MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], w, t); w = loc.getWorld(); x = loc.getX(); z = loc.getZ(); y = loc.getY(); if (w == null) { if (!(env.GetCommandSender() instanceof MCPlayer)) { throw new ConfigRuntimeException( this.getName() + " needs a world in the location array, or a player so it can take the current world of that player.", ExceptionType.PlayerOfflineException, t); } m = env.GetPlayer(); w = m.getWorld(); } w.explosion(x, y, z, size); return new CVoid(t); }
public Construct exec(Target t, Env environment, Construct... args) throws ConfigRuntimeException { MCLocation l; MCPlayer p; p = environment.GetPlayer(); MCWorld w = (p != null ? p.getWorld() : null); l = ObjectGenerator.GetGenerator().location(args[0], w, t); if (l.getWorld() instanceof CraftWorld) { CraftWorld cw = (CraftWorld) l.getWorld(); net.minecraft.server.Block.byId[l.getBlock().getTypeId()].dropNaturally( cw.getHandle(), l.getBlockX(), l.getBlockY(), l.getBlockZ(), l.getBlock().getData(), 1.0f, 0); } l.getBlock().setTypeId(0); CraftServer cs = (CraftServer) ((BukkitMCServer) Static.getServer()).__Server(); cs.getHandle().a(new Packet0KeepAlive(), 0); return new CVoid(t); }